21 auto hpe =
new TH1F(
"hpe",
"Use left and right side for Y scale drawing", 100, 0, 10);
22 hpe->GetYaxis()->SetTitle(
"Expo");
24 auto hpg =
new TH1F(
"hpg",
"Gaus distribution", 100, 0, 10);
25 hpg->GetYaxis()->SetTitle(
"#color[2]{Gaus1} / #color[3]{Gaus2}");
26 hpg->GetYaxis()->SetAxisColor(
kRed);
29 auto hpg2 =
new TH1F(
"hpg2",
"Narrow gaus distribution", 100, 0, 10);
32 for (
int i = 0; i < 25000; i++) {
41 for (
int i = 0; i < 10000; i++) {
42 auto x = 20. + i / 100.;
43 if ((i >= 2000) && (i < 3000))
50 gr1->SetTitle(
"Tow graphs sharing same Y scale, but using different X scales");
51 gr1->GetXaxis()->SetTitle(
"Graph1");
54 gr2->GetXaxis()->SetAxisColor(
kBlue);
55 gr2->GetXaxis()->SetTitle(
"Graph2");
56 gr2->GetXaxis()->SetTitleColor(
kBlue);
60 auto c1 =
new TCanvas(
"c1",
"Twoscales example", 1200, 800);
62 if (!
gROOT->IsBatch() && !
c1->IsWeb())
63 ::Warning(
"twoscales.cxx",
"macro may not work without enabling web-based canvas");
67 c1->GetPad(1)->Add(
hpe);
68 c1->GetPad(1)->Add(
hpg,
"Y+");
69 c1->GetPad(1)->Add(
hpg2,
"same,Y+");
71 c1->GetPad(2)->SetTopMargin(0.2);
72 c1->GetPad(2)->Add(
gr1,
"AL");
73 c1->GetPad(2)->Add(
gr2,
"AL,X+");
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
R__EXTERN TRandom * gRandom
R__EXTERN TStyle * gStyle
A TGraph is an object made of two arrays X and Y with npoints each.
1-D histogram with a float per channel (see TH1 documentation)
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
virtual Double_t Exp(Double_t tau)
Returns an exponential deviate.
void SetStatX(Float_t x=0)
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.