Dear ROOTers,
Using ROOT version 5.34.10, I load a TFile which contains many trees, as listed in the macro below:
root -l treefile.root
I execute the following macro (.x macro.c) after loading the file as shown above:
{
TCanvas c1;
TH1D test1("test1","test",5,50.,200.);
test1.Sumw2();
TH1D test2("test2","test",5,50.,200.);
test2.Sumw2();
tt_nom->Draw("mbb>>test1","mct>160 && met>100 && mbb>50 && mt>40 && nbj==0 && mt>100");
tt_powhegjimmy->Draw("mbb>>test2","mct>160 && met>100 && mbb>50 && mt>40 && nbj==0 && mt>100");
c1.Clear();
c1.SetLogy();
test1.Draw("e");
test2.SetLineColor(kRed);
test2.Draw("esame");
}
It works fine, but it vomits all sort of crap when I exit CINT after execution. If I convert this macro into a c function (shown below), it works better (no error message) but the canvas doesn’t appear.
void macro() {
TCanvas c1;
TH1D test1("test1","test",5,50.,200.);
test1.Sumw2();
TH1D test2("test2","test",5,50.,200.);
test2.Sumw2();
tt_nom->Draw("mbb>>test1","mct>160 && met>100 && mbb>50 && mt>40 && nbj==0 && mt>100");
tt_powhegjimmy->Draw("mbb>>test2","mct>160 && met>100 && mbb>50 && mt>40 && nbj==0 && mt>100");
c1.Clear();
c1.SetLogy();
test1.Draw("e");
test2.SetLineColor(kRed);
test2.Draw("esame");
}
I feel this is simple, but is there a way I can execute this code without a massive seg fault and a canvas?
Thanks in advance,
Andrée