コード例 #1
0
ファイル: closureTest.py プロジェクト: fzeiser/Unfolder
bkg_noerr = H1D(bkg)
for k in range(0, len(bkg_noerr.err)):
    bkg_noerr.err[k] = 0

# generate fake data
data = recoWithFakes

# Create unfolding class
m = Unfolder(bkg, mig, eff, truth)
m.setUniformPrior()
#m.setGaussianPrior()
#m.setCurvaturePrior()
#m.setFirstDerivativePrior()

m.run(data)
m.setAlpha(1.0)
m.sample(50000)

# plot marginal distributions
m.plotMarginal("plotMarginal.%s" % extension)

# plot correlations
#m.plotPairs("pairPlot.%s" % extension) # takes forever
m.plotCov("covPlot.%s" % extension)
m.plotCorr("corrPlot.%s" % extension)
m.plotCorrWithNP("corrPlotWithNP.%s" % extension)
m.plotSkewness("skewPlot.%s" % extension)
m.plotKurtosis("kurtosisPlot.%s" % extension)

m.plotNP("plotNP.%s" % extension)
コード例 #2
0
ファイル: unfoldBias.py プロジェクト: fzeiser/Unfolder
    m.addUncertainty(k, sbkg, smig.project('y'))

# add migration uncertainty
uncUnfList = []  #["me", "ps"]
for k in uncUnfList:
    m.addUnfoldingUncertainty(k, mig[k], eff[k])

# try a curvature-based prior
# first choose alpha using only a MAP estimate
#m.setEntropyPrior()
#m.setCurvaturePrior(1.0)
m.setFirstDerivativePrior(1.0)
#m.setGaussianPrior()

#m.setConstrainArea(True)
m.run(data)
# does the same for the pseudo-data

alpha = {}
alphaChi2 = {}
bestAlphaBias = {}
bestAlphaBiasStd = {}
bestAlphaNormBias = {}
bestAlphaNormBiasStd = {}

for i in ["", "me", "ps"]:
    print "Checking bias due to configuration '%s'" % i

    alpha[i] = -1
    alphaChi2[i] = -1
    bestAlphaBias[i] = -1