Logo ROOT  
Reference Guide
candledecay.C File Reference

Detailed Description

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

void candledecay()
{
auto c1 = new TCanvas("c1","Candle Decay",800,600);
c1->Divide(2,1);
auto rng = new TRandom();
auto h1 = new TH2I("h1","Decay",1000,0,1000,20,0,20);
float myRand;
for (int i = 0; i < 19; i++) {
for (int j = 0; j < 1000000; j++) {
myRand = rng->Gaus(350+i*8,20+2*i);
h1->Fill(myRand,i);
}
}
h1->SetFillStyle(0);
h1->SetFillColor(kGray);
h1->SetLineColor(kBlue);
h1->GetYaxis()->SetTitle("time");
h1->GetXaxis()->SetTitle("probability density");
c1->cd(1);
h1->Draw("violiny(112000000)");
c1->cd(2);
auto h2 = (TH2I*)h1->Clone("h2");
h2->SetBarWidth(0.8);
h2->DrawCopy("candley2");
}
Author
Georg Troska

Definition in file candledecay.C.

TH1::DrawCopy
virtual TH1 * DrawCopy(Option_t *option="", const char *name_postfix="_copy") const
Copy this histogram and Draw in the current pad.
Definition: TH1.cxx:3044
h1
TH1F * h1
Definition: legend1.C:5
TH1::Clone
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
Definition: TH1.cxx:2664
TRandom
Definition: TRandom.h:27
TH2I
2-D histogram with an int per channel (see TH1 documentation)}
Definition: TH2.h:212
TH1::GetYaxis
TAxis * GetYaxis()
Definition: TH1.h:318
TH1::Fill
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Definition: TH1.cxx:3274
TNamed::SetTitle
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
TCanvas
Definition: TCanvas.h:23
kBlue
@ kBlue
Definition: Rtypes.h:66
kGray
@ kGray
Definition: Rtypes.h:65
TH1::GetXaxis
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
Definition: TH1.h:317
TH1::SetBarWidth
virtual void SetBarWidth(Float_t width=0.5)
Definition: TH1.h:357
TH1::Draw
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition: TH1.cxx:2997
c1
return c1
Definition: legend1.C:41