Created
December 8, 2011 16:05
-
-
Save brynmathias/1447434 to your computer and use it in GitHub Desktop.
How to calculate the errors for combinations of eff histograms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
asymErrorCumu = r.TGraphAsymmErrors() | |
asymErrorCumu.Divide(cumuNomTotal,cumuDenomTotal) | |
for bin in range(CumuNomList[0].GetNbinsX()): | |
binLumi = 0 | |
BinEff = 0. | |
point = bin + 1 | |
errPlus = 0. | |
errMinus = 0. | |
yval = 0. | |
xvalAtPoint = r.Double(0) | |
yvalAtPoint = r.Double(0) | |
pointEff = r.Double(0) | |
xOfPoint = r.Double(0) | |
asymErrorCumu.GetPoint(point,xOfPoint,r.Double(0)) | |
for numerator,denominator,weight,TEff in zip(CumuNomList,CumuDenomList,values[1],collectionCumu): | |
if int(denominator.GetBinContent(bin)) is not 0: | |
binLumi += weight | |
TEff.GetPoint(point,xvalAtPoint,pointEff) | |
BinEff += (pointEff*weight) | |
errPlus += (TEff.GetErrorYhigh(point)**2 * weight**2) | |
errMinus += (TEff.GetErrorYlow(point)**2 * weight**2) | |
# This is our efficiency for the bin. | |
if int(binLumi) == 0: binLumi = 1. | |
BinEff /= binLumi | |
errPlus = math.sqrt(errPlus/ (binLumi**2)) | |
errMinus = math.sqrt(errMinus/ (binLumi**2)) | |
print "Point = %f,%f, + %f, -%f"%(xOfPoint,BinEff,errPlus,errMinus) | |
# Now we need to set the errors and points of our histogram!!! | |
# if int(xvalAtPoint) is not 0: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment