Hello,
drawing a THStack usually gives no Stats-box. Is there an easy way to draw the statistics for the sum of all drawn histograms?
At the moment I’m doing something like this (using v4.03/02)
THStack* hists=new THStack("res1","Residuals long side");
TH1S* eca1=new TH1S("eca1","residuals endcapA inner layer",100,-.5,.5);eca1->SetFillColor(kRed);
TH1S* eca2=new TH1S("eca2","residuals endcapA outer layer",100,-.5,.5);eca2->SetFillColor(kMagenta);
TH1S* ecc1=new TH1S("ecc1","residuals endcapC inner layer",100,-.5,.5);ecc1->SetFillColor(kYellow);
TH1S* ecc2=new TH1S("ecc2","residuals endcapC outer layer",100,-.5,.5);ecc2->SetFillColor(kGreen);
TH1S* bar1=new TH1S("bar1","residuals barrel inner layer",100,-.5,.5);bar1->SetFillColor(kBlue);
TH1S* bar2=new TH1S("bar2","residuals barrel outer layer",100,-.5,.5);bar2->SetFillColor(kCyan);
//t is a TTree
t->Project("eca1","res1","PixelSCT==1 && BarrelEC==-2 && LayerDisc==0");
t->Project("eca2","res1","PixelSCT==1 && BarrelEC==-2 && LayerDisc==2");
t->Project("ecc1","res1","PixelSCT==1 && BarrelEC==2 && LayerDisc==0");
t->Project("ecc2","res1","PixelSCT==1 && BarrelEC==2 && LayerDisc==2");
t->Project("bar1","res1","PixelSCT==1 && BarrelEC==0 && LayerDisc==0");
t->Project("bar2","res1","PixelSCT==1 && BarrelEC==0 && LayerDisc==2");
hists->Add(eca1);
hists->Add(eca2);
hists->Add(ecc1);
hists->Add(ecc2);
hists->Add(bar1);
hists->Add(bar2,"sameshist");
canv->cd(1);
hists->Draw();
where I add the last histogram with the “sameshist” option. This works somehow, although I don’t know why. It computes the sum of all entries in the THStack, but it draws the histograms with error bars, although I gave the option “hist”.
I’m puzzled…
Cheers,
Tobias