_ROOT Version:6.14 but also tried it in 5.3x
_Platform: x86_64bit with Linux slc6
_Compiler:gcc8 - I think
_Environment: Connected to Linux machine through putty terminal and using Xming as an X-terminal emulator. Viewing platform is MSWindows 10 OS, x86_64
I have a *.root file where I have stored a set of 1D and 2D histograms. Three of the 1D histograms are efficiencies and I would like to display them on top of each other and also have a Legend that identifies the three.
Here is the script I have tried in cint. <the *.root file and the histograms have already been loaded into the session, individually the histograms appear fine.>
TCanvas *c2 = new TCanvas("c2","Canvas name is c2"); c2->Clear(); c2->cd(); hist1bF->Draw("e"); hist1cF->Draw("eSAME"); hist1lF->Draw("eSAME"); TLegend *effLeg = new TLegend(4000.0,0.75,5000.0,1.0); effLeg->SetHeader("Jet Flavour (Truth)","C"); effLeg->AddEntry(hist1bF, "b Jets","l"); effLeg->AddEntry(hist1cF, "c Jets","l"); effLeg->AddEntry(hist1lF, "uds Jets","l"); effLeg->Draw("SAME"); c2->SaveAs("moneyPlots/Canvas2.png");
The result of this code is the following plot…notice that there is no legend to be seen.
Also, the code runs and produces no errors, the plot that is stored in the *.png file is identical to the one below.
In addition to trying this interactively within cint I have also written a python script that performs the entire operation, it opens the *.root file, and attempts the same things. Again, I get no errors and I get the same plot I just displayed. No Legend.
Has anyone encountered this before? What I am doing looks identical to some of the ROOT tutorials I’ve seen on this topic… .I’m stumped.