Plotting histograms with "+" at the end of the nam

Hi,

I have a root file containing histograms that have a “+” at the end of the name. I am having trouble plotting these histograms using a macro. I have tried variations on:

TFile f(“signal.root”);
f->GetDirectory(“jPsi.DaughtersPlots”).cd();
histo = (TH1D*)f->Get(“pT_mu+”);
histo->Draw();

but I’m not having any luck. What would be the correct way to plot the “pT_mu+” histogram?

Many thanks,

Lisa

Hopefully you’ll get a response on how to plot these. My suggestion in the future is don’t use any strange characters (e.g., ‘+’) in the name of histograms :smiley:

Cheers,
Charles

Hi,

You need to call ‘Get’ on the directory that contains the histograms. So use TFile f("signal.root"); f->GetDirectory("jPsi.DaughtersPlots").cd(); histo = (TH1D*)gDirectory->Get("pT_mu+"); histo->Draw();

Cheers,
Philippe.