No histogram show up

Hi,

I wrote a simple macro that loads histograms from file and divides them. I’d like to show the resulting histo in a canvas, but there is no way to do it. It only can be printed on file. Is there a reason for it? What am I missing?

Thanks a lot

Sara
patTau_test.C (1.27 KB)

I see you are drawing the histogram using the option P so you should see it drawn with points.
Simply do Draw() without option to see it better.

PS: I cannot run you macro because the data file is missing.

Hi,

I’ve tried to remove the “p” option but no histogram is shown again…
I’m attaching the root file to run the macro.
Thanks!
Sara
patTau_Histograms_100GeV_scaled_gen.root (16.7 KB)

Hi,

The histograms are owned by the file, and are deleted when the file is closed. Adding:

TH1::AddDirectory(kFALSE); in your function should solve the problem.

Cheers, Bertrand.

Thanks! it works, indeed!

Sara :slight_smile: