Avoiding accumulation out-of-range entries in the histogram's first and last bins


In the following piece of code, I’m converting Gaussians (TF1’s) to histograms (TH1D) in order to add them up in an eventloop. Adding up TF1’s failed since there is a limit on the number of iteration. With histograms, it works, however on the edges peaks are appearing that should be there, so I guess that out-of-range events are being added there. Is there a way to avoid that?

Gaus_tot = ROOT.TF1(“Gaus_tot”,“gaus”,100, 200)
Hist_tot = Gaus_tot.GetHistogram()
Gaus_i = ROOT.TF1(“Gaus_i”,“gaus”,100, 200)
for iev in chain1:
Gaus_i = ROOT.TF1(“Gaus_i”,“gaus”,100, 200)
Gaus_i.SetParameters(1., iev.mean, iev.sigma)
Hist_i = Gaus_i.GetHistogram()
Hist_tot.Add(Hist_i, iev.weight)


Can you please post a running script so we can understand where the problem is coming from ?
I already answer in this related post

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.