Hello,
I have two histograms named h0 and h1, which were created like this:
TreeS->Draw("var1>>h0");
TreeS->Draw("var2>>h1");
I also wrote this method to plot them:
void PlotHists(TH1F* h1, TH1F* h2, TString title, TString name1 = "Uncut", TString name2 = "Cut")
{
h1->SetName(name1); h2->SetName(name2);
h1->SetNormFactor(1); h2->SetNormFactor(1);
h1->SetLineColor(kRed); h2->SetLineColor(kBlue);
h1->SetTitle(title); h1->Draw(); gPad->Update();
TPaveStats* s = (TPaveStats*)h1->GetListOfFunctions()->FindObject("stats");
s->SetY1NDC(0.65); s->SetY2NDC(0.40); s->SetX1NDC(0.98); s->SetX2NDC(0.65);
s->SetLineColor(kRed); s->SetTextSize(.05);
h2->Draw("sames"); gPad->Update();
TPaveStats* s = (TPaveStats*)h2->GetListOfFunctions()->FindObject("stats");
s->SetY1NDC(0.92); s->SetY2NDC(0.67); s->SetX1NDC(0.98); s->SetX2NDC(0.65);
s->SetLineColor(kBlue); s->SetTextSize(.05);
h2->Draw("sames");
}
This method works great.
However, when I now try to rewrite these histograms
TreeS->Draw("var3>>h1");
TreeS->Draw("var4>>h2");
and plot them using the same module, I notice that the plots does not change.
Help!
Thank you!