Please read tips for efficient and successful posting and posting code
ROOT Version: 6.18/04
Platform: Debian 10.4
Compiler: gcc (Debian 8.3.0-6) 8.3.0
Hi, I’m trying to Add two TH1D histograms to each other. As far as I have understood, the syntax
hist1.Add(hist1, hist2)
should do the job using PYROOT as long as the bin number and the Xaxis limits are the same and I have the method working in one of my scripts.
In another script, however, I get the error message << Info in TH1D::Add: Attempt to add histograms with different axis limits - trying to use TH1::Merge>>.
Unfortunately, I can’t post a minimal script here, but I will outline what I’ve done to try and get the histograms to add without error message:
-
Checked the type of histo and it’s <class ‘ROOT.TH1D’> for both histos.
-
Checked the number of bins via the Methods histo.GetXaxis().GetFirst() and histo.GetXaxis().GetLast(). For both histos, I get a bin number N= 1027298 .
-
Checked the Xaxis values for the first and the last bins, and they agree for both histograms hist1 and hist2 to
t_begin_histo: 0.00022629975367420164
t_end_histo: 256.8239702002463t_begin_histo = histo.GetBinCenter(first_bin_histo) t_end_histo = histo.GetBinCenter(last_bin_histo)
Do you have any other suggestions of what I could check to eliminate the error?
Thanks for your help.