Logo ROOT   6.10/09
Reference Guide
candledecay.C File Reference

Detailed Description

View in nbviewer Open in SWAN Candle Decay, illustrate a time development of a certain value.

pict1_candledecay.C.png
void candledecay()
{
TCanvas *c1 = new TCanvas("c1","Candle Decay",800,600);
c1->Divide(2,1);
TRandom *rand = new TRandom();
TH2I *h1 = new TH2I("h1","Decay",1000,0,1000,20,0,20);
float myRand;
for (int i = 0; i < 17; i++) {
for (int j = 0; j < 1000000; j++) {
myRand = rand->Gaus(350+i*5,5+5*i);
h1->Fill(myRand,i);
}
}
h1->SetBarWidth(4);
h1->SetFillStyle(0);
h1->SetLineColor(kBlue);
h1->GetYaxis()->SetTitle("time");
h1->GetXaxis()->SetTitle("probability density");
c1->cd(1);
h1->Draw("violiny(12000000)");
c1->cd(2);
TH2I *h2 = (TH2I*)h1->Clone("h2");
h2->SetBarWidth(0.8);
h2->DrawCopy("candley2");
}
Author
Georg Troska

Definition in file candledecay.C.