Hi, I’ve a root file. In this file are saved histograms about particle densities in function of distance. In the root file there are 4 histograms (one about photons, one about electrons, one about muons and one about hadrons), but the distance values are the same in the 4 histograms.
I use this code tog get the histograms, for example about muons:
TH1F *hmuolatg = (TH1F *)g->Get("hmuolat");
if (hmuolatg == 0) {
printf("Error getting an histogram from the file!\n");
return;
}
I need to make a histogram about all particle densities (i.e. a histogram having the sum of densities about muons, hadrons, electrons and photons)
I tried
TH1F *hmuolatg = (TH1F *)g->Get("hmuolat","helelat","hhadlat", "hgamlat");
if (hmuolatg == 0) {
printf("Error getting an histogram from the file!\n");
return;
}
but it doesn’t work.
Is there a way?
ROOT Version ( 5.34/36):
Platform, compiler ( Devc++):
Yes but that’s the way to get object from a file. Now you have the four histograms you can combine them . For instance you can put them in a THStack and draw them in one go.
But in this plot there are 4 histograms (one for each particle)
I wanna make only one histogram that is the sum of the four histograms. For example at d=0 densities are about 2 * 10^(-5), 5,5 * 10^(-6), 6 * 10^(-7), 2 * 10^(-7), then I wanna make a histogram having at d=0 density 2 * 10^(-5) + 5,5 * 10^(-6)+ 6 * 10^(-7)+ 2 * 10^(-7) = . 0,0000263 and same thing for each distance. Is it possible?