Exemplo n.º 1
0
    def makeMETV(self, event):
        output = []

        # loop on the leptons
        leptons = filter(
            lambda x: (abs(x.pdgId()) == 11 and x.heepID) or
            (abs(x.pdgId()) == 13 and x.highPtIDIso), event.selectedLeptons)
        fatJets = self.selectJets(
            event.jetsAK8, lambda x: x.pt() > 200.0 and abs(x.eta()) < 2.4 and
            x.jetID('POG_PFID_Tight'), leptons, 1.0)

        if len(fatJets) < 1:
            return output

        self.substructure(fatJets[0])
        VV = Pair(event.met, fatJets[0])

        # kinematics
        if VV.deltaPhi() < 2.0 or VV.leg1.pt() < 200:
            return output

        if self.cfg_comp.isMC:
            self.softDropGen(fatJets[0], event)
            VVGEN = Pair(event.met, Singlet(VV.leg2.genJet().p4()))
            VV.genPartialMass = VVGEN.mt()
        else:
            VV.genPartialMass = -1

        # topology
        satteliteJets = self.selectJets(
            event.jets, lambda x: x.pt() > 30.0 and x.jetID('POG_PFID_Tight'),
            leptons, 0.3, [VV.leg2], 0.8)
        self.topology(VV, satteliteJets, leptons)
        output.append(VV)
        return output
Exemplo n.º 2
0
    def makeMETV(self,event):
        output=[]

        #loop on the leptons
        leptons= filter(lambda x: (abs(x.pdgId())==11 and x.heepID) or (abs(x.pdgId())==13 and x.highPtIDIso ),event.selectedLeptons)
        fatJets=self.selectJets(event.jetsAK8,lambda x: x.pt()>200.0 and abs(x.eta())<2.4 and x.jetID('POG_PFID_Loose')  ,leptons,1.0)

        if len(fatJets)<1:
            return output

        VV=Pair(event.met,fatJets[0])
        
        #kinematics
        if VV.deltaPhi()<2.0 or VV.leg1.pt()<200:
            return output

        self.substructure(VV.leg2,event)

        if not hasattr(VV.leg2,"substructure"):
            return output


        #check if there are subjets

#        if len(VV.leg2.substructure.prunedSubjets)<2:
#            print 'No substructure'
#            return output
        

        #topology                
        satteliteJets = self.selectJets(event.jets,lambda x: x.pt()>30.0  and x.jetID('POG_PFID_Loose')  ,leptons,0.3,[VV.leg2],0.8)
        self.topology(VV,satteliteJets,leptons)       
        output.append(VV)
        return output
Exemplo n.º 3
0
    def makeWV(self, event):
        output = []

        #loop on the leptons
        looseLeptonsForW = filter(
            lambda x: (abs(x.pdgId()) == 11 and x.heepID) or
            (abs(x.pdgId()) == 13 and x.highPtIDIso), event.selectedLeptons)
        tightLeptonsForW = filter(
            lambda x: (abs(x.pdgId()) == 11 and x.heepID and x.pt() > 120) or
            (abs(x.pdgId()) == 13 and x.highPtIDIso and x.pt() > 53 and abs(
                x.eta()) < 2.1), event.selectedLeptons)

        if len(tightLeptonsForW) == 0:
            return output

        #make leptonic W
        W = self.vbTool.makeW(tightLeptonsForW, event.met)
        if len(W) == 0:
            return output

        bestW = max(W, key=lambda x: x.leg1.pt())
        #now the jets
        fatJets = self.selectJets(
            event.jetsAK8, lambda x: x.pt() > 200.0 and abs(x.eta()) < 2.4 and
            x.jetID('POG_PFID_Loose'), tightLeptonsForW, 1.0)
        if len(fatJets) == 0:
            return output
        bestJet = max(fatJets, key=lambda x: x.pt())

        VV = Pair(bestW, bestJet)
        if deltaR(bestW.leg1.eta(), bestW.leg1.phi(), bestJet.eta(),
                  bestJet.phi()) < ROOT.TMath.Pi() / 2.0:
            return output
        if VV.deltaPhi() < 2.0:
            return output
        if abs(deltaPhi(bestW.leg2.phi(), bestJet.phi())) < 2.0:
            return output

        #substructure
        self.substructure(VV.leg2, event)
        if not hasattr(VV.leg2, 'substructure'):
            return output

        #check if there are subjets

#        if len(VV.leg2.substructure.prunedSubjets)<2:
#            print 'No substructure',len(VV.leg2.substructure.prunedSubjets)
#            return output

#topology
        satteliteJets = self.selectJets(
            event.jets, lambda x: x.pt() > 30.0 and x.jetID('POG_PFID_Loose'),
            tightLeptonsForW, 0.3, [bestJet], 0.8)
        otherLeptons = self.cleanOverlap(looseLeptonsForW, [bestW.leg1])
        self.topology(VV, satteliteJets, otherLeptons)

        output.append(VV)
        return output
Exemplo n.º 4
0
    def makeWV(self, event):
        output = []

        # loop on the leptons
        looseLeptonsForW = filter(lambda x: (abs(x.pdgId()) == 11 and x.heepID) or (
            abs(x.pdgId()) == 13 and x.highPtIDIso), event.selectedLeptons)
        tightLeptonsForW = filter(lambda x: (abs(x.pdgId()) == 11 and x.heepID and x.pt() > 55) or (
            abs(x.pdgId()) == 13 and x.highPtIDIso and x.pt() > 55), event.selectedLeptons)

        if len(tightLeptonsForW) == 0:
            return output

        # make leptonic W
        W = self.vbTool.makeW(tightLeptonsForW, event.met)
        if len(W) == 0:
            return output

        bestW = max(W, key=lambda x: x.leg1.pt())
        # now the jets, use lower pT cut since we'll recluster
        fatJets = self.selectJets(event.jetsAK8, lambda x: x.pt() > 200.0 and abs(
            x.eta()) < 2.4 and x.jetID('POG_PFID_Tight'), tightLeptonsForW, 1.0)
        if len(fatJets) == 0:
            return output
        bestJet = max(fatJets, key=lambda x: x.pt())
        self.substructure(bestJet)
        self.softDropRECO(bestJet,event)
        VV = Pair(bestW, bestJet)
        if deltaR(bestW.leg1.eta(), bestW.leg1.phi(), bestJet.eta(), bestJet.phi()) < ROOT.TMath.Pi() / 2.0:
            return output
        if VV.deltaPhi() < 2.0:
            return output
        if abs(deltaPhi(bestW.leg2.phi(), bestJet.phi())) < 2.0:
            return output


        if self.cfg_comp.isMC:
            self.softDropGen(bestJet,event)

            if not hasattr(bestJet,'genJetP4'):
                VV.genPartialMass = -1
            else:
                newMET = event.met.p4() + VV.leg2.p4() - VV.leg2.genJetP4
                newMET.SetPz(0.0)
                newW = Pair(VV.leg1.leg1, Singlet(newMET))
                self.vbTool.defaultWKinematicFit(newW)
                VV.genPartialMass = ( VV.leg1.p4() + VV.leg2.genJetP4 ).M()
        else:
            VV.genPartialMass = -1

        # topology
        satteliteJets = self.selectJets(event.jets, lambda x: x.pt() > 30.0 and x.jetID(
            'POG_PFID_Tight'), tightLeptonsForW, 0.4, [bestJet], 0.8)
        otherLeptons = self.cleanOverlap(looseLeptonsForW, [bestW.leg1])
        self.topology(VV, satteliteJets, otherLeptons)

        output.append(VV)
        return output
Exemplo n.º 5
0
    def makeMETV(self, event):
        output = []

        # loop on the leptons
        leptons = filter(
            lambda x: (abs(x.pdgId()) == 11 and x.heepID) or
            (abs(x.pdgId()) == 13 and x.highPtIDIso), event.selectedLeptons)
        fatJets = self.selectJets(
            event.jetsAK8, lambda x: x.pt() > 200.0 and abs(x.eta()) < 2.4 and
            x.jetID('POG_PFID_Tight'), leptons, 1.0)

        if len(fatJets) < 1:
            return output

        VV = Pair(event.met, fatJets[0])

        # kinematics
        if VV.deltaPhi() < 2.0 or VV.leg1.pt() < 200:
            return output

        self.substructure(VV.leg2, event)

        if not hasattr(VV.leg2, "substructure"):
            return output

        # substructure changes jet, so we need to recalculate the resonance
        # mass
        VV = Pair(event.met, fatJets[0])

        # check if there are subjets

        # if len(VV.leg2.substructure.prunedSubjets)<2:
        #     print 'No substructure'
        #     return output
        if self.cfg_comp.isMC:
            self.substructureGEN(VV.leg2, event)
            if hasattr(VV.leg2, 'substructureGEN'):
                VVGEN = Pair(event.met, Singlet(VV.leg2.substructureGEN.jet))
                VV.genPartialMass = VVGEN.mt()

        # topology
        satteliteJets = self.selectJets(
            event.jets, lambda x: x.pt() > 30.0 and x.jetID('POG_PFID_Tight'),
            leptons, 0.3, [VV.leg2], 0.8)
        self.topology(VV, satteliteJets, leptons)
        output.append(VV)
        return output
Exemplo n.º 6
0
    def makeWV(self, event):
        output = []

        # loop on the leptons
        looseLeptonsForW = filter(lambda x: (abs(x.pdgId()) == 11 and x.heepID) or (
            abs(x.pdgId()) == 13 and x.highPtIDIso), event.selectedLeptons)
        tightLeptonsForW = filter(lambda x: (abs(x.pdgId()) == 11 and x.heepID and x.pt() > 55) or (
            abs(x.pdgId()) == 13 and x.highPtIDIso and x.pt() > 55), event.selectedLeptons)

        if len(tightLeptonsForW) == 0:
            return output

        # make leptonic W
        W = self.vbTool.makeW(tightLeptonsForW, event.met)
        if len(W) == 0:
            return output

        bestW = max(W, key=lambda x: x.leg1.pt())
        # now the jets, use lower pT cut since we'll recluster
        fatJets = self.selectJets(event.jetsAK8, lambda x: x.pt() > 150.0 and abs(
            x.eta()) < 2.4 and x.jetID('POG_PFID_Loose'), tightLeptonsForW, 1.0)
        if len(fatJets) == 0:
            return output
        bestJet = max(fatJets, key=lambda x: x.pt())

        VV = Pair(bestW, bestJet)
        if deltaR(bestW.leg1.eta(), bestW.leg1.phi(), bestJet.eta(), bestJet.phi()) < ROOT.TMath.Pi() / 2.0:
            return output
        if VV.deltaPhi() < 2.0:
            return output
        if abs(deltaPhi(bestW.leg2.phi(), bestJet.phi())) < 2.0:
            return output

        # substructure
        self.substructure(VV.leg2, event)
        if not hasattr(VV.leg2, 'substructure'):
            return output

        # substructure function has reclustered jet, so we need to check the pT
        # again
        if not VV.leg2.pt() > 200.:
            return output
        # also recalculate the resonance mass four vector
        VV = Pair(bestW, bestJet)

        # substructure truth
        if self.cfg_comp.isMC:
            self.substructureGEN(VV.leg2, event)
            if hasattr(VV.leg2, 'substructureGEN'):
                newMET = event.met.p4() + VV.leg2.p4() - VV.leg2.substructureGEN.jet
                newMET.SetPz(0.0)
                newW = Pair(VV.leg1.leg1, Singlet(newMET))
                self.vbTool.defaultWKinematicFit(newW)
                VV.genPartialMass = (
                    VV.leg1.p4() + VV.leg2.substructureGEN.jet).M()

        # topology
        satteliteJets = self.selectJets(event.jets, lambda x: x.pt() > 30.0 and x.jetID(
            'POG_PFID_Loose'), tightLeptonsForW, 0.4, [bestJet], 0.8)
        otherLeptons = self.cleanOverlap(looseLeptonsForW, [bestW.leg1])
        self.topology(VV, satteliteJets, otherLeptons)

        output.append(VV)
        return output