Exemple #1
0
def getCandInfo(row, *objects):
    numbers = {}
    numbers["run"] = row.run
    numbers["lumi"] = row.lumi
    numbers["event"] = row.evt
    numbers["m4l"] = evVar(row, "Mass")
    numbers["mZ1"] = nObjVar(row, "Mass", objects[0], objects[1])
    numbers["mZ2"] = nObjVar(row, "Mass", objects[2], objects[3])

    # eemm channel may have masses swapped
    if zMassDist(numbers["mZ1"]) > zMassDist(numbers["mZ2"]):
        temp = numbers["mZ2"]
        numbers["mZ2"] = numbers["mZ1"]
        numbers["mZ1"] = temp

    numbers["nJets"] = evVar(row, "nJets")
    if numbers["nJets"] > 0:
        numbers["jet1pt"] = evVar(row, "jetPt").at(0)
        if numbers["nJets"] > 1:
            numbers["jet2pt"] = evVar(row, "jetPt").at(1)
        else:
            numbers["jet2pt"] = 0
    else:
        numbers["jet1pt"] = 0
        numbers["jet2pt"] = 0

    numbers["mjj"] = max(0, evVar(row, "mjj"))

    return numbers
Exemple #2
0
def getCandInfo(zMassVar, row, *objects):
    numbers = {}
    numbers['run'] = row.run
    numbers['lumi'] = row.lumi
    numbers['event'] = row.evt
    numbers['mass4l'] = evVar(row, 'MassFSR')
    numbers['mZ1'] = nObjVar(row, zMassVar, objects[0], objects[1])
    numbers['mZ2'] = nObjVar(row, zMassVar, objects[2], objects[3])

    # eemm channel may have masses swapped
    if zMassDist(numbers['mZ1']) > zMassDist(numbers['mZ2']):
        temp = numbers['mZ2']
        numbers['mZ2'] = numbers['mZ1']
        numbers['mZ1'] = temp

    numbers['D_bkg^kin'] = evVar(row, 'D_bkg_kin')
    numbers['D_bkg'] = evVar(row, 'D_bkg')
    numbers['D_gg'] = evVar(row, 'D_gg')
    numbers['Dkin_HJJ^VBF'] = evVar(row, 'D_VBF2j')
    numbers['D_0-'] = evVar(row, 'D_g4')
    numbers['Dkin_HJ^VBF-1'] = evVar(row, 'D_VBF1j')
    numbers['Dkin_HJJ^WH-h'] = evVar(row, 'D_WHh')
    numbers['Dkin_HJJ^ZH-h'] = evVar(row, 'D_ZHh')
    numbers['njets30'] = evVar(row, 'nJets')
    numbers['jet1pt'] = max(-1.,evVar(row, 'jet1Pt'))
    numbers['jet2pt'] = max(-1.,evVar(row, 'jet2Pt'))
    numbers['jet1qgl'] = evVar(row, 'jet1QGLikelihood')
    numbers['jet2qgl'] = evVar(row, 'jet2QGLikelihood')
    numbers['Dfull_HJJ^VBF'] = evVar(row, 'D_VBF2j_QG')
    numbers['Dfull_HJ^VBF-1'] = evVar(row, 'D_VBF1j_QG')
    numbers['Dfull_HJJ^WH-h'] = evVar(row, 'D_WHh_QG')
    numbers['Dfull_HJJ^ZH-h'] = evVar(row, 'D_ZHh_QG')
    numbers['category'] = evVar(row, "ZZCategory")
    # numbers['m4lRefit'] = evVar(row, 'MassRefit')
    # numbers['m4lRefitError'] = evVar(row, 'MassRefitError')

    if not args.data:
        numbers['weight'] = evVar(row, 'genWeight')
        numbers['weight'] /= abs(numbers['weight'])

        for ob in objects:
            numbers['weight'] *= objVar(row, 'EffScaleFactor', ob)

    outTemp = ('{run}:{lumi}:{event}:{mass4l:.2f}:{mZ1:.2f}:{mZ2:.2f}:{D_bkg^kin:'
               '.3f}:{D_bkg:.3f}:{D_gg:.3f}:{Dkin_HJJ^VBF:.3f}:{D_0-:.3f}:'
               '{Dkin_HJ^VBF-1:.3f}:{Dkin_HJJ^WH-h:.3f}:{Dkin_HJJ^ZH-h:.3f}:'
               '{njets30:d}:{jet1pt:.2f}:{jet2pt:.2f}:{jet1qgl:.3f}:{jet2qgl:.3f}:'
               '{Dfull_HJJ^VBF:.3f}:{Dfull_HJ^VBF-1:.3f}:{Dfull_HJJ^WH-h:.3f}:'
               '{Dfull_HJJ^ZH-h:.3f}:{category}') #:{m4lRefit:.2f}:{m4lRefitError:.2f}:'
    if not args.data:
        outTemp += ':{weight:.3f}'

    return outTemp.format(**numbers)
Exemple #3
0
    def doSmartCut(self, row, *obj):
        # Doesn't apply to eemm
        if obj[0][0] != obj[2][0]:
            return True

        # Find the proper alternate Z pairing. We already checked that we have 2 OS pairs
        if nObjVar(row, 'SS', *sorted([obj[0], obj[2]])): # l1 matches l4
            altObj = [obj[0], obj[3], obj[1], obj[2]]
        else: # l1 matches l3
            altObj = [obj[0], obj[2], obj[1], obj[3]]

        altZMass = [nObjVar(row, "Mass"+self.fsrVar, *sorted(altObj[:2])), nObjVar(row, "Mass"+self.fsrVar, *sorted(altObj[2:]))]
        altZCompatibility = [zMassDist(m) for m in altZMass]
        z1Compatibility = zCompatibility(row, obj[0], obj[1], self.fsrVar)

        if altZCompatibility[0] < altZCompatibility[1]:  # Za is first
            zACompatibility = altZCompatibility[0]
            zBMass = altZMass[1]
        else:
            zACompatibility = altZCompatibility[1]
            zBMass = altZMass[0]

        return not (zACompatibility < z1Compatibility and zBMass < 12)
Exemple #4
0
 def storeVars(self, row, objects, cuts):
     '''
     Need Z1 distance from nominal mass.
     '''
     self.dZ = zMassDist(getattr(row, 'Mass'+cuts.fsrVar))