Example #1
0
    event.getByLabel(label, handle)
    genParts = handle.product()

    if (eventN % 100 == 0):
        print "Record:", eventN,
        print "Run:", event.object().id().run(),
        print "event:", event.object().id().event()
    for particle in genParts:
        if (abs(particle.pdgId()) == 25) and (particle.status() == 3):
            dauMode = abs(particle.daughter(0).pdgId())
            if not (dauMode in decayCnts):
                decayCnts[dauMode] = 0
            decayCnts[dauMode] += 1
            # printParticleDecayTree(particle, statusCutoff = 3)
            Higgs_mass[0] = particle.mass()
            Event_wgt[0] = HWWSignalShapes.HiggsCPWeight(
                opts.mH, particle.mass())
            sumWgts += Event_wgt[0]

            # Running_wgt[0] = HWWSignalShapes.runningWidthWeight(350,
            #                                                     particle.mass())
            # sumRunning += Running_wgt[0]
            break

    outTree.Fill()
    if eventN >= 10000:
        break

print decayCnts
#print "n events:",eventN
print "avg CP weight:", sumWgts / (eventN + 1)
# print "avg running width weight:", sumRunning/(eventN+1)