예제 #1
0
    def doSmartCut(self, row, *obj):
        # Doesn't apply to eemm
        if obj[0][0] != obj[2][0]:
            return True

        altObj = [list(obj), list(obj)]

        # Find the proper alternate Z pairings. 
        ssInd = 0 # index of Z1 same-sign lepton
        if nObjVar(row, 'SS', obj[1], obj[2]):
            ssInd += 1
        for i in range(2):
            altObj[i][ssInd] = obj[i+2]
            altObj[i][i+2] = obj[ssInd]

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

        zACompatibility = []
        zBMass = []
        for i in range(len(altZMass)):
            if altZCompatibility[i][0] < altZCompatibility[i][1]:  # Za is first
                zACompatibility.append(altZCompatibility[i][0])
                zBMass.append(altZMass[i][1])
            else:
                zACompatibility.append(altZCompatibility[i][1])
                zBMass.append(altZMass[i][0])

        return not any((zACompatibility[i] < z1Compatibility and zBMass[i] < 12) for i in range(2))
예제 #2
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
예제 #3
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)
예제 #4
0
def getCandInfo3l(row, *objects):
    numbers = {}
    numbers["run"] = row.run
    numbers["lumi"] = row.lumi
    numbers["event"] = row.evt
    numbers["m3l"] = evVar(row, "Mass")
    numbers["mZ"] = nObjVar(row, "Mass", objects[0], objects[1])
    numbers["ptL3"] = objVar(row, "Pt", objects[2])
    numbers["l3Tight"] = 1 if objVar(row, "ZZTightID", objects[2]) and objVar(row, "ZZIsoPass", objects[2]) else 0

    return numbers
예제 #5
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)