In general, you could create as many ROOT files with histograms as you have ROOT files with trees and then “combine” your histograms using hadd
(run hadd -?
for help).
You can also use a TChain to analyse all your ROOT files with trees (and create a single ROOT file with histograms).
gen_MatGG.cxx (3.2 KB)
Note that the “his2D” histogram is filled two times with every pair of “Eclab” values. So, maybe after the loops you should execute his2D->Scale(0.5);
or you could simply use his2D->Fill(x, y, 0.5);
instead.
BTW. See also: