I am trying to subtract two histograms that exist as leaves of a TTree. I am having trouble with the binning.
TH1F genMEThist = (TH1F)gPad->GetPrimitive(“genMET”);
TH1F patMEThist = (TH1F)gPad->GetPrimitive(“patMET”);
TH1F diff = (*genMEThist)-(*patMEThist);
Warning in TH1F::Add Attempt to add histograms with different axis limits
The Warning is valid because both plots have 100 bins, but genMEThist max input is 110 and patMEThist max is 138. So it is just subtracting by bin number, not by actual input, and the bin size of each histogram is different.
I thought to just rebin one to the bins of the other and then define a new TH1F from the rebin.
TH1F diff2 = (*genMEThist)-(*patMEThistRebin)
still gives same error.
I realize that the binning is not the only problem here, the actual axis limits also need to line up. But I am stuck here. Any help or a simpler method would be very much appreciated.
Thanks in advance!
p.s. I am using
ROOT 5.22/00a (branches/v5-22-00-patches@27437, Jul 21 2009, 01:05:00 on linux)
CINT/ROOT C/C++ Interpreter version 5.16.29,