Home | News | Documentation | Download

How to merge histograms which are in root files and are provided by pythia8?

I have written a code which is written in pythia8 and the export files are root-files that create histograms.how can i merge histograms from different root files?

hadd

Looks like Wile E Coyote beat me to the answer!

Just to elaborate a bit, you can run hadd like this:
hadd result.root file0.root file1.root file2.root ...

This will work if your histograms (in file0.root, file1.root etc.) have the same names, binning etc. (Otherwise you can write a macro to combine histograms using TH1::Add()).

This executable should be located at $ROOTSYS/bin/hadd (it should already be set up if you have your $PATH set up for ROOT via $ROOTSYS/bin/thisroot.sh).

Thank you very much .I think i got it