Example #1
0
#m.setEntropyPrior()
#m.setFirstDerivativePrior()

# add uncertainties
uncList = [
]  #'sjcalib1030', 'eup', 'ecup'] + ['lup'+str(x) for x in range(0, 10+1)] + ['cup'+str(x) for x in range(0, 3+1)] + ['bup'+str(x) for x in range(0, 3+1)] + ['ewkup']
for k in uncList:
    print "Getting histograms for syst. ", k
    struth, srecoWithFakes, sbkg, smig, seff, snrt = getHistograms(
        "out_ttallhad_psrw_Syst.root", k, "mttAsymm")
    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 = {}
Example #2
0
unf_orig_mode = m.hunf_mode

del m
n = None
m = Unfolder(bkg["A"], mig["A"], eff["A"], truth["A"])
m.setUniformPrior()
#m.setGaussianPrior()
#m.setCurvaturePrior()
#if fb > 0:
#  m.setFirstDerivativePrior(fb)

for k in uncUnfList:
    # use uncertainty at reconstruction level, by using the nominal truth folded with the alternative response matrix
    #m.addUncertainty(k, bkg["A"], np.dot(truth["A"].val, response[k].val))
    # one can also use a non-linear term in the unfolding
    m.addUnfoldingUncertainty(k, bkg["A"], mig[k], eff[k])

print("Response")
print(m.response.val)
print(m.response_unfsyst["B"].val)

m.run(data)
#m.graph("modelWithSysts.png")
#m.setAlpha(0)
m.sample(50000)

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

for i in uncUnfList:
    #m.plotNPMarginal(i, "plotNPMarginal_%s.%s" % (i, extension))