12void candleplotwhiskers() {
13 auto c1 =
new TCanvas(
"c1",
"Candle Presets",700,800);
17 auto h1 =
new TH2I(
"h1",
"Gaus",100,-5,5,1,0,1);
18 auto h2 =
new TH1I(
"h2",
"Gaus",100,-5,5);
21 h2->GetXaxis()->SetTitle(
"Standard deviation #sigma");
22 h2->GetYaxis()->SetTitle(
"dN/d#sigma");
25 for (
int i = 0; i < 100000; i++) {
26 myRand = rng->Gaus(0,1);
33 q[0] = 0.;
q[1] = 0.;
q[2] = 0.;
34 p[0] = 0.25; p[1] = 0.5; p[2] = 0.75;
36 h2->GetQuantiles(3,
q,p);
37 cout <<
"Q1 (-25%): " <<
q[0] <<
" Median: " <<
q[1] <<
" Q3 (+25%): " <<
q[2] << endl;
38 double iqr =
q[2]-
q[0];
39 auto mygaus_1_middle =
new TF1(
"mygaus_1_middle",
"gaus",
q[0],
q[2]);
40 auto mygaus_1_left =
new TF1(
"mygaus_1_left",
"gaus",
q[0]-1.5*iqr,
q[0]);
41 mygaus_1_left->SetLineColor(
kGreen);
42 auto mygaus_1_right =
new TF1(
"mygaus_1_right",
"gaus",
q[2],
q[2]+1.5*iqr);
43 mygaus_1_right->SetLineColor(
kGreen);
51 h2->Fit(
"mygaus_1_left",
"R");
52 mygaus_1_left->Draw(
"same");
53 auto l3 =
new TLine(
q[0]-1.5*iqr,0,
q[0]-1.5*iqr,mygaus_1_left->Eval(
q[0]-1.5*iqr));
54 l3->SetLineColor(
kGreen); l3->SetLineWidth(2); l3->Draw(
"");
55 auto l1 =
new TLine(
q[0] ,0,
q[0] ,mygaus_1_left->Eval(
q[0]));
56 l1->SetLineWidth(2); l1->SetLineColor(
kGreen); l1->Draw(
"");
58 h2->Fit(
"mygaus_1_right",
"R",
"");
59 mygaus_1_right->Draw(
"same");
60 auto l4 =
new TLine(
q[2]+1.5*iqr,0,
q[2]+1.5*iqr,mygaus_1_left->Eval(
q[2]+1.5*iqr));
61 l4->SetLineColor(
kGreen); l4->SetLineWidth(2); l4->Draw(
"");
62 auto l5 =
new TLine(
q[2] ,0,
q[2] ,mygaus_1_right->Eval(
q[2]));
63 l5->SetLineWidth(2); l5->SetLineColor(
kGreen); l5->Draw(
"");
65 h2->Fit(
"mygaus_1_middle",
"R");
66 mygaus_1_middle->Draw(
"same");
69 auto t =
new TText(); t->SetTextFont(42);
70 t->DrawText(0,mygaus_1_middle->Eval(0)/2,
"50%");
71 t->DrawText(-1.5,mygaus_1_middle->Eval(-1.5)/2,
"24.65%");
72 t->DrawText(+1,mygaus_1_middle->Eval(+1.5)/2,
"24.65%");
73 t->DrawText(
q[0]-1.5*iqr,1000,
Form(
"%.3f",
q[0]-1.5*iqr))->SetTextAngle(90);
74 t->DrawText(
q[2]+1.5*iqr,1000,
Form(
"%.3f",
q[2]+1.5*iqr))->SetTextAngle(90);
75 t->DrawText(
q[0],1000,
Form(
"%.3f",
q[0]))->SetTextAngle(90);
76 t->DrawText(
q[2],1000,
Form(
"%.3f",
q[2]))->SetTextAngle(90);
char * Form(const char *fmt,...)
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
1-D histogram with an int per channel (see TH1 documentation)}
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
2-D histogram with an int per channel (see TH1 documentation)}
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
This is the base class for the ROOT Random number generators.
Base class for several text objects.