160 for aHisto
in histos[1:]:
161 if aHisto.GetNbinsX() != histos[0].GetNbinsX():
162 print "Input histograms have different number of x bins - can't do quadrature sum safely"
164 elif aHisto.GetNbinsY() != histos[0].GetNbinsY():
165 print "Input histograms have different number of y bins - can't do quadrature sum safely"
167 for xBin
in range(1,histos[0].GetNbinsX()+2):
169 for aHisto
in histos:
171 edge = aHisto.GetXaxis().GetBinLowEdge(xBin)
172 elif fabs(edge-aHisto.GetXaxis().GetBinLowEdge(xBin)) > tolerance:
173 print "Input histograms have different x binning - can't do quadrature sum safely"
175 for yBin
in range(1,histos[0].GetNbinsY()+2):
177 for aHisto
in histos:
179 edge = aHisto.GetYaxis().GetBinLowEdge(yBin)
180 elif fabs(edge-aHisto.GetYaxis().GetBinLowEdge(yBin)) > tolerance:
181 print "Input histograms have different y binning - can't do quadrature sum safely"
186 quadSumHisto = histos[0].Clone()
187 for xBin
in range(1,quadSumHisto.GetNbinsX()+1):
188 for yBin
in range(1,quadSumHisto.GetNbinsY()+1):
190 for aHisto
in histos:
191 quadSum +=
pow(aHisto.GetBinContent(xBin,yBin),2)
192 quadSumHisto.SetBinContent(xBin,yBin,sqrt(quadSum))