I have a macro to run over a few root files and produce a plot. I set the line width, color and style and then draw the histogram, but when I pass each histogram to the TLegend with AddEntry, it draws the default black line. I’m using Root 5.24. Please see attached Macro.
I’ve been whacking my head against this for far too long. Any help would be much appreciated!
IsoDistrib2.C (7.96 KB)
Your macro looks fine. You have the"l" option in AddEntry. Unfortunately I cannot run it to see what is wrong because some data files are missing. Can you send me a running macro showing the problem ?
I don’t really know what you mean by a running macro, but if I send you the two root files that it reads in then you can surely run it.
Thank you for the quick reply
PythiaQCD.root (428 KB)
PythiaWenu.root (1.38 MB)
IsoDistrib2.C (7.88 KB)
I don’t really know what you mean by a running macro, but if I send you the two root files that it reads in then you can surely run it. [/quote]
That’s a way to make your macro run-able… thanks. looking at it now.
I guess because you do some transformations on the histograms (rebin, scale …) the pointers are change (to be checked). To bypass this problem use the other version of AddEntry. The one “by name”:
root.cern.ch/root/html/TLegend.h … d:AddEntry
In your case it is enough to put between double quote the first parameter of al the AddEntry calls you have.
Wow… That is truly amazing.
Thank you very much for that.