Example #1
0
        print "CCLA: Unfolding ", Reco2d, "using matix ", response

        if DAgostini == True:
            unfold2d = RooUnfoldBayes(response, Reco2d, NITER)
        else:
            unfold2d = RooUnfoldInvert(response, Reco2d)

        unfold2d.Print()

        new_hists.append(unfold2d)

        unfold2d.SetNToys(30000)

        hUnf2d = unfold2d.Hreco(2)

        hErr2d = unfold2d.Ereco(2)

        #chi2 = RooUnfold.Chi2 (unfold2d,2)
        chi2comp = Proj2D_Y(Gen2d, minMass, maxMass, Gen2d.GetName(), True)
        hraw = Proj2D_Y(Reco2d, minMass, maxMass, Gen2d.GetName(), True)
        hUnf1d = Proj2D_Y(hUnf2d, minMass, maxMass, Gen2d.GetName(), True)
        print "------", hraw.Integral(), hUnf1d.Integral(), hUnf2d.Integral(
        ), chi2comp.Integral()
        chi2comp.Scale(hUnf1d.Integral() / chi2comp.Integral())
        #chi2 = unfold2d.Chi2 (hUnf1d,2)
        chi2 = hUnf2d.Chi2(hUnf1d, 2)
        print "---chi square:", chi2

        covMatrix.append(hErr2d)

        print "XXX: ", hUnf2d
Example #2
0
reco_unfoldedSD = unfoldSD.Hreco()
sdspan = reco_unfoldedSD.ProjectionX()
sdspan.SetName('pyth8_spanmassSD')

reco_unfolded.Draw()

c2 = TCanvas()
c2.cd()

reco_unfoldedSD.Draw()
truth.SetLineColor(4)

truth.Draw('SAME')

################### New Correlation matrix stuff
cov = unfold.Ereco()
covSD = unfoldSD.Ereco()

nb = cov.GetNrows()
import math
cor = ROOT.TH2F("cor", "", nb, 0, nb, nb, 0, nb)
corSD = ROOT.TH2F("corSD", "", nb, 0, nb, nb, 0, nb)

for i in xrange(0, nb):
    for j in xrange(0, nb):
        Viijj = cov[i][i] * cov[j][j]
        if Viijj > 0.0:
            cor.SetBinContent(i + 1, j + 1, cov[i][j] / math.sqrt(Viijj))

for i in xrange(0, nb):
    for j in xrange(0, nb):