Exemplo n.º 1
0
    def getMT2Hemi(self, event, TMPobjects40jc, met, postFix):

        if len(TMPobjects40jc)>=2:

            pxvec  = ROOT.std.vector(float)()
            pyvec  = ROOT.std.vector(float)()
            pzvec  = ROOT.std.vector(float)()
            Evec  = ROOT.std.vector(float)()
            grouping  = ROOT.std.vector(int)()
            
            for jet in TMPobjects40jc:
                pxvec.push_back(jet.px())
                pyvec.push_back(jet.py())
                pzvec.push_back(jet.pz())
                Evec.push_back(jet.energy())

            hemisphere = Hemisphere(pxvec, pyvec, pzvec, Evec, 2, 3)
            grouping=hemisphere.getGrouping()

            pseudoJet1px = 0 
            pseudoJet1py = 0 
            pseudoJet1pz = 0
            pseudoJet1energy = 0 
            multPSJ1 = 0

            pseudoJet2px = 0 
            pseudoJet2py = 0 
            pseudoJet2pz = 0
            pseudoJet2energy = 0 
            multPSJ2 = 0
                
            for index in range(0, len(pxvec)):
                if(grouping[index]==1):
                    pseudoJet1px += pxvec[index]
                    pseudoJet1py += pyvec[index]
                    pseudoJet1pz += pzvec[index]
                    pseudoJet1energy += Evec[index]
                    multPSJ1 += 1
                if(grouping[index]==2):
                    pseudoJet2px += pxvec[index]
                    pseudoJet2py += pyvec[index]
                    pseudoJet2pz += pzvec[index]
                    pseudoJet2energy += Evec[index]                    
                    multPSJ2 += 1

            pseudoJet1pt2 = pseudoJet1px*pseudoJet1px + pseudoJet1py*pseudoJet1py
            pseudoJet2pt2 = pseudoJet2px*pseudoJet2px + pseudoJet2py*pseudoJet2py

            if pseudoJet1pt2 >= pseudoJet2pt2:
                setattr(event, "pseudoJet1"+postFix, ROOT.reco.Particle.LorentzVector( pseudoJet1px, pseudoJet1py, pseudoJet1pz, pseudoJet1energy ))
                setattr(event, "pseudoJet2"+postFix, ROOT.reco.Particle.LorentzVector( pseudoJet2px, pseudoJet2py, pseudoJet2pz, pseudoJet2energy ))
                setattr(event, "multPseudoJet1"+postFix, multPSJ1 )
                setattr(event, "multPseudoJet2"+postFix, multPSJ2 )
            else:
                setattr(event, "pseudoJet2"+postFix, ROOT.reco.Particle.LorentzVector( pseudoJet1px, pseudoJet1py, pseudoJet1pz, pseudoJet1energy ))
                setattr(event, "pseudoJet1"+postFix, ROOT.reco.Particle.LorentzVector( pseudoJet2px, pseudoJet2py, pseudoJet2pz, pseudoJet2energy ))
                setattr(event, "multPseudoJet1"+postFix, multPSJ2 )
                setattr(event, "multPseudoJet2"+postFix, multPSJ1 )

            return self.computeMT2(getattr(event,'pseudoJet1'+postFix), getattr(event,'pseudoJet2'+postFix), met)
Exemplo n.º 2
0
def getMT2(objects, met):
    # objects - list of Objects
    # met - ROOT.TLorentzVector()
    # creates auxiliary arrays for objects and met
    # calls Hemisphere method

    if len(objects) >= 2:
        pxvec = ROOT.std.vector(float)()
        pyvec = ROOT.std.vector(float)()
        pzvec = ROOT.std.vector(float)()
        Evec = ROOT.std.vector(float)()
        grouping = ROOT.std.vector(int)()

        for jet in objects:
            pxvec.push_back(jet.p4().Px())
            pyvec.push_back(jet.p4().Py())
            pzvec.push_back(jet.p4().Pz())
            Evec.push_back(jet.p4().Energy())

        # this magical object groups together the 4 vectors into two hemispheres
        hemisphere = Hemisphere(pxvec, pyvec, pzvec, Evec, 2, 3)
        grouping = hemisphere.getGrouping()

        pseudoJet1px = 0
        pseudoJet1py = 0
        pseudoJet1pz = 0
        pseudoJet1energy = 0
        multPSJ1 = 0

        pseudoJet2px = 0
        pseudoJet2py = 0
        pseudoJet2pz = 0
        pseudoJet2energy = 0
        multPSJ2 = 0

        # we build two "pseudo-jets", i.e. two four-vectors that are the sum of the 4-vectors of each hemisphere
        for index in range(0, len(pxvec)):
            if (grouping[index] == 1):
                pseudoJet1px += pxvec[index]
                pseudoJet1py += pyvec[index]
                pseudoJet1pz += pzvec[index]
                pseudoJet1energy += Evec[index]
                multPSJ1 += 1
            if (grouping[index] == 2):
                pseudoJet2px += pxvec[index]
                pseudoJet2py += pyvec[index]
                pseudoJet2pz += pzvec[index]
                pseudoJet2energy += Evec[index]
                multPSJ2 += 1

        pseudoJet1pt2 = pseudoJet1px * pseudoJet1px + pseudoJet1py * pseudoJet1py
        pseudoJet2pt2 = pseudoJet2px * pseudoJet2px + pseudoJet2py * pseudoJet2py

        # pt^2 ordering
        if pseudoJet1pt2 >= pseudoJet2pt2:
            pseudoJet1p4 = ROOT.TLorentzVector(pseudoJet1px, pseudoJet1py,
                                               pseudoJet1pz, pseudoJet1energy)
            pseudoJet2p4 = ROOT.TLorentzVector(pseudoJet2px, pseudoJet2py,
                                               pseudoJet2pz, pseudoJet2energy)
        else:
            pseudoJet1p4 = ROOT.TLorentzVector(pseudoJet2px, pseudoJet2py,
                                               pseudoJet2pz, pseudoJet2energy)
            pseudoJet2p4 = ROOT.TLorentzVector(pseudoJet1px, pseudoJet1py,
                                               pseudoJet1pz, pseudoJet1energy)

        # TODO: here I could choose to save the information on these pseudojets
        # for the moment only use the information to compute the mt2 variable

        mt2 = computeMT2(visApx=pseudoJet1p4.Px(),
                         visApy=pseudoJet1p4.Py(),
                         visBpx=pseudoJet2p4.Px(),
                         visBpy=pseudoJet2p4.Py(),
                         invispx=met.Px(),
                         invispy=met.Py())
        return mt2

    #else: raise RuntimeError("Something's wrong with MT2 calculation, expect at least two objects")
    else:
        #print 'cannot compute mt2 variable for this event'
        return -999
Exemplo n.º 3
0
    def getMT2Hemi(self, event, TMPobjects40jc, met, collectionPostFix,
                   postFix):

        if len(TMPobjects40jc) >= 2:

            pxvec = ROOT.std.vector(float)()
            pyvec = ROOT.std.vector(float)()
            pzvec = ROOT.std.vector(float)()
            Evec = ROOT.std.vector(float)()
            grouping = ROOT.std.vector(int)()

            for jet in TMPobjects40jc:
                pxvec.push_back(jet.px())
                pyvec.push_back(jet.py())
                pzvec.push_back(jet.pz())
                Evec.push_back(jet.energy())

            hemisphere = Hemisphere(pxvec, pyvec, pzvec, Evec, 2, 3)
            grouping = hemisphere.getGrouping()

            pseudoJet1px = 0
            pseudoJet1py = 0
            pseudoJet1pz = 0
            pseudoJet1energy = 0
            multPSJ1 = 0

            pseudoJet2px = 0
            pseudoJet2py = 0
            pseudoJet2pz = 0
            pseudoJet2energy = 0
            multPSJ2 = 0

            for index in range(0, len(pxvec)):
                if (grouping[index] == 1):
                    pseudoJet1px += pxvec[index]
                    pseudoJet1py += pyvec[index]
                    pseudoJet1pz += pzvec[index]
                    pseudoJet1energy += Evec[index]
                    multPSJ1 += 1
                if (grouping[index] == 2):
                    pseudoJet2px += pxvec[index]
                    pseudoJet2py += pyvec[index]
                    pseudoJet2pz += pzvec[index]
                    pseudoJet2energy += Evec[index]
                    multPSJ2 += 1

            pseudoJet1pt2 = pseudoJet1px * pseudoJet1px + pseudoJet1py * pseudoJet1py
            pseudoJet2pt2 = pseudoJet2px * pseudoJet2px + pseudoJet2py * pseudoJet2py

            if pseudoJet1pt2 >= pseudoJet2pt2:
                setattr(
                    event, "pseudoJet1" + collectionPostFix + postFix,
                    ROOT.reco.Particle.LorentzVector(pseudoJet1px,
                                                     pseudoJet1py,
                                                     pseudoJet1pz,
                                                     pseudoJet1energy))
                setattr(
                    event, "pseudoJet2" + collectionPostFix + postFix,
                    ROOT.reco.Particle.LorentzVector(pseudoJet2px,
                                                     pseudoJet2py,
                                                     pseudoJet2pz,
                                                     pseudoJet2energy))
                setattr(event, "multPseudoJet1" + collectionPostFix + postFix,
                        multPSJ1)
                setattr(event, "multPseudoJet2" + collectionPostFix + postFix,
                        multPSJ2)
            else:
                setattr(
                    event, "pseudoJet2" + collectionPostFix + postFix,
                    ROOT.reco.Particle.LorentzVector(pseudoJet1px,
                                                     pseudoJet1py,
                                                     pseudoJet1pz,
                                                     pseudoJet1energy))
                setattr(
                    event, "pseudoJet1" + collectionPostFix + postFix,
                    ROOT.reco.Particle.LorentzVector(pseudoJet2px,
                                                     pseudoJet2py,
                                                     pseudoJet2pz,
                                                     pseudoJet2energy))
                setattr(event, "multPseudoJet1" + collectionPostFix + postFix,
                        multPSJ2)
                setattr(event, "multPseudoJet2" + collectionPostFix + postFix,
                        multPSJ1)

            setattr(
                event, "mt2" + collectionPostFix + postFix,
                self.computeMT2(
                    getattr(event, 'pseudoJet1' + collectionPostFix + postFix),
                    getattr(event, 'pseudoJet2' + collectionPostFix + postFix),
                    met))
            return self.computeMT2(
                getattr(event, 'pseudoJet1' + collectionPostFix + postFix),
                getattr(event, 'pseudoJet2' + collectionPostFix + postFix),
                met)
Exemplo n.º 4
0
    def makeMT2(self, event):
        #        print '==> INSIDE THE PRINT MT2'
        #        print 'MET=',event.met.pt()

        import array
        import numpy

        ## ===> hadronic MT2 (as used in the SUS-13-019)

        objects40jc = [
            j for j in event.cleanJets if j.pt() > 40 and abs(j.eta()) < 2.5
        ]

        #### get hemispheres via AntiKT -1 antikt, 1 kt, 0 CA
        if len(objects40jc) >= 2:

            objects = ROOT.std.vector(ROOT.reco.Particle.LorentzVector)()
            for jet in objects40jc:
                objects.push_back(jet.p4())

            hemisphereViaKt = ReclusterJets(objects, 1., 50.0)
            groupingViaKt = hemisphereViaKt.getGroupingExclusive(2)

            if len(groupingViaKt) >= 2:
                event.pseudoViaKtJet1_had = ROOT.reco.Particle.LorentzVector(
                    groupingViaKt[0])
                event.pseudoViaKtJet2_had = ROOT.reco.Particle.LorentzVector(
                    groupingViaKt[1])
                event.mt2ViaKt_had = self.computeMT2(event.pseudoViaKtJet1_had,
                                                     event.pseudoViaKtJet2_had,
                                                     event.met)

            if not self.cfg_ana.doOnlyDefault:
                hemisphereViaAKt = ReclusterJets(objects, -1., 50.0)
                groupingViaAKt = hemisphereViaAKt.getGroupingExclusive(2)

                if len(groupingViaAKt) >= 2:
                    event.pseudoViaKtJet1_had = ROOT.reco.Particle.LorentzVector(
                        groupingViaAKt[0])
                    event.pseudoViaKtJet2_had = ROOT.reco.Particle.LorentzVector(
                        groupingViaAKt[1])
                    event.mt2ViaAKt_had = self.computeMT2(
                        event.pseudoViaAKtJet1_had, event.pseudoViaAKtJet2_had,
                        event.met)

#### get hemispheres (seed 2: max inv mass, association method: default 3 = minimal lund distance)

        if len(objects40jc) >= 2:

            pxvec = ROOT.std.vector(float)()
            pyvec = ROOT.std.vector(float)()
            pzvec = ROOT.std.vector(float)()
            Evec = ROOT.std.vector(float)()
            grouping = ROOT.std.vector(int)()

            for jet in objects40jc:
                pxvec.push_back(jet.px())
                pyvec.push_back(jet.py())
                pzvec.push_back(jet.pz())
                Evec.push_back(jet.energy())

            hemisphere = Hemisphere(pxvec, pyvec, pzvec, Evec, 2, 3)
            grouping = hemisphere.getGrouping()
            ##            print 'grouping ',len(grouping)

            pseudoJet1px = 0
            pseudoJet1py = 0
            pseudoJet1pz = 0
            pseudoJet1energy = 0
            multPSJ1 = 0

            pseudoJet2px = 0
            pseudoJet2py = 0
            pseudoJet2pz = 0
            pseudoJet2energy = 0
            multPSJ2 = 0

            for index in range(0, len(pxvec)):
                if (grouping[index] == 1):
                    pseudoJet1px += pxvec[index]
                    pseudoJet1py += pyvec[index]
                    pseudoJet1pz += pzvec[index]
                    pseudoJet1energy += Evec[index]
                    multPSJ1 += 1
                if (grouping[index] == 2):
                    pseudoJet2px += pxvec[index]
                    pseudoJet2py += pyvec[index]
                    pseudoJet2pz += pzvec[index]
                    pseudoJet2energy += Evec[index]
                    multPSJ2 += 1

            pseudoJet1pt2 = pseudoJet1px * pseudoJet1px + pseudoJet1py * pseudoJet1py
            pseudoJet2pt2 = pseudoJet2px * pseudoJet2px + pseudoJet2py * pseudoJet2py

            if pseudoJet1pt2 >= pseudoJet2pt2:
                event.pseudoJet1_had = ROOT.reco.Particle.LorentzVector(
                    pseudoJet1px, pseudoJet1py, pseudoJet1pz, pseudoJet1energy)
                event.pseudoJet2_had = ROOT.reco.Particle.LorentzVector(
                    pseudoJet2px, pseudoJet2py, pseudoJet2pz, pseudoJet2energy)
                event.multPseudoJet1_had = multPSJ1
                event.multPseudoJet2_had = multPSJ2
            else:
                event.pseudoJet2_had = ROOT.reco.Particle.LorentzVector(
                    pseudoJet1px, pseudoJet1py, pseudoJet1pz, pseudoJet1energy)
                event.pseudoJet1_had = ROOT.reco.Particle.LorentzVector(
                    pseudoJet2px, pseudoJet2py, pseudoJet2pz, pseudoJet2energy)
                event.multPseudoJet1_had = multPSJ2
                event.multPseudoJet2_had = multPSJ1

            event.mt2_had = self.computeMT2(event.pseudoJet1_had,
                                            event.pseudoJet2_had, event.met)

#### do same things for GEN

        allGenJets = [x for x in self.handles['genJets'].product()]
        objects40jc_Gen = [
            j for j in allGenJets if j.pt() > 40 and abs(j.eta()) < 2.5
        ]

        if len(objects40jc_Gen) >= 2:

            pxvec = ROOT.std.vector(float)()
            pyvec = ROOT.std.vector(float)()
            pzvec = ROOT.std.vector(float)()
            Evec = ROOT.std.vector(float)()
            grouping = ROOT.std.vector(int)()

            for jet in objects40jc_Gen:
                pxvec.push_back(jet.px())
                pyvec.push_back(jet.py())
                pzvec.push_back(jet.pz())
                Evec.push_back(jet.energy())

            #### get hemispheres (seed 2: max inv mass, association method: default 3 = minimal lund distance)
            hemisphere = Hemisphere(pxvec, pyvec, pzvec, Evec, 2, 3)
            grouping = hemisphere.getGrouping()
            ##            print 'grouping ',len(grouping)

            pseudoJet1px = 0
            pseudoJet1py = 0
            pseudoJet1pz = 0
            pseudoJet1energy = 0

            pseudoJet2px = 0
            pseudoJet2py = 0
            pseudoJet2pz = 0
            pseudoJet2energy = 0

            for index in range(0, len(pxvec)):
                if (grouping[index] == 1):
                    pseudoJet1px += pxvec[index]
                    pseudoJet1py += pyvec[index]
                    pseudoJet1pz += pzvec[index]
                    pseudoJet1energy += Evec[index]
                if (grouping[index] == 2):
                    pseudoJet2px += pxvec[index]
                    pseudoJet2py += pyvec[index]
                    pseudoJet2pz += pzvec[index]
                    pseudoJet2energy += Evec[index]

            pseudoGenJet1 = ROOT.reco.Particle.LorentzVector(
                pseudoJet1px, pseudoJet1py, pseudoJet1pz, pseudoJet1energy)
            pseudoGenJet2 = ROOT.reco.Particle.LorentzVector(
                pseudoJet2px, pseudoJet2py, pseudoJet2pz, pseudoJet2energy)

            event.mt2_gen = self.computeMT2(pseudoGenJet1, pseudoGenJet2,
                                            event.met.genMET())

## ===> full MT2 (jets + leptons)
        objects10lc = [
            l for l in event.selectedLeptons
            if l.pt() > 10 and abs(l.eta()) < 2.5
        ]
        if hasattr(event, 'selectedIsoCleanTrack'):
            objects10lc = [
                l for l in event.selectedLeptons
                if l.pt() > 10 and abs(l.eta()) < 2.5
            ] + [t for t in event.selectedIsoCleanTrack]

        objects40j10lc = objects40jc + objects10lc

        objects40j10lc.sort(key=lambda obj: obj.pt(), reverse=True)

        if len(objects40j10lc) >= 2:

            pxvec = ROOT.std.vector(float)()
            pyvec = ROOT.std.vector(float)()
            pzvec = ROOT.std.vector(float)()
            Evec = ROOT.std.vector(float)()
            grouping = ROOT.std.vector(int)()

            for obj in objects40j10lc:
                pxvec.push_back(obj.px())
                pyvec.push_back(obj.py())
                pzvec.push_back(obj.pz())
                Evec.push_back(obj.energy())

            #for obj in objects_fullmt2:
            #    print "pt: ", obj.pt(), ", eta: ", obj.eta(), ", phi: ", obj.phi(), ", mass: ", obj.mass()

            #### get hemispheres (seed 2: max inv mass, association method: default 3 = minimal lund distance)

            hemisphere = Hemisphere(pxvec, pyvec, pzvec, Evec, 2, 3)
            grouping = hemisphere.getGrouping()
            ##            print 'grouping ',len(grouping)

            pseudoJet1px = 0
            pseudoJet1py = 0
            pseudoJet1pz = 0
            pseudoJet1energy = 0

            pseudoJet2px = 0
            pseudoJet2py = 0
            pseudoJet2pz = 0
            pseudoJet2energy = 0

            for index in range(0, len(pxvec)):
                if (grouping[index] == 1):
                    pseudoJet1px += pxvec[index]
                    pseudoJet1py += pyvec[index]
                    pseudoJet1pz += pzvec[index]
                    pseudoJet1energy += Evec[index]
                if (grouping[index] == 2):
                    pseudoJet2px += pxvec[index]
                    pseudoJet2py += pyvec[index]
                    pseudoJet2pz += pzvec[index]
                    pseudoJet2energy += Evec[index]

            pseudoJet1pt2 = pseudoJet1px * pseudoJet1px + pseudoJet1py * pseudoJet1py
            pseudoJet2pt2 = pseudoJet2px * pseudoJet2px + pseudoJet2py * pseudoJet2py

            if pseudoJet1pt2 >= pseudoJet2pt2:
                event.pseudoJet1 = ROOT.reco.Particle.LorentzVector(
                    pseudoJet1px, pseudoJet1py, pseudoJet1pz, pseudoJet1energy)
                event.pseudoJet2 = ROOT.reco.Particle.LorentzVector(
                    pseudoJet2px, pseudoJet2py, pseudoJet2pz, pseudoJet2energy)
            else:
                event.pseudoJet2 = ROOT.reco.Particle.LorentzVector(
                    pseudoJet1px, pseudoJet1py, pseudoJet1pz, pseudoJet1energy)
                event.pseudoJet1 = ROOT.reco.Particle.LorentzVector(
                    pseudoJet2px, pseudoJet2py, pseudoJet2pz, pseudoJet2energy)

            ###

            event.mt2 = self.computeMT2(event.pseudoJet1, event.pseudoJet2,
                                        event.met)

## ===> full gamma_MT2

        gamma_objects40jc = [
            j for j in event.gamma_cleanJets
            if j.pt() > 40 and abs(j.eta()) < 2.5
        ]

        gamma_objects40j10lc = gamma_objects40jc + objects10lc

        gamma_objects40j10lc.sort(key=lambda obj: obj.pt(), reverse=True)

        ##        if len(gamma_objects40j10lc)>=2:
        if len(gamma_objects40jc) >= 2:

            pxvec = ROOT.std.vector(float)()
            pyvec = ROOT.std.vector(float)()
            pzvec = ROOT.std.vector(float)()
            Evec = ROOT.std.vector(float)()
            grouping = ROOT.std.vector(int)()

            ##            for obj in objects40j10lc:
            for obj in gamma_objects40jc:
                pxvec.push_back(obj.px())
                pyvec.push_back(obj.py())
                pzvec.push_back(obj.pz())
                Evec.push_back(obj.energy())

            #### get hemispheres (seed 2: max inv mass, association method: default 3 = minimal lund distance)

            hemisphere = Hemisphere(pxvec, pyvec, pzvec, Evec, 2, 3)
            grouping = hemisphere.getGrouping()
            ##            print 'grouping ',len(grouping)

            pseudoJet1px = 0
            pseudoJet1py = 0
            pseudoJet1pz = 0
            pseudoJet1energy = 0

            pseudoJet2px = 0
            pseudoJet2py = 0
            pseudoJet2pz = 0
            pseudoJet2energy = 0

            for index in range(0, len(pxvec)):
                if (grouping[index] == 1):
                    pseudoJet1px += pxvec[index]
                    pseudoJet1py += pyvec[index]
                    pseudoJet1pz += pzvec[index]
                    pseudoJet1energy += Evec[index]
                if (grouping[index] == 2):
                    pseudoJet2px += pxvec[index]
                    pseudoJet2py += pyvec[index]
                    pseudoJet2pz += pzvec[index]
                    pseudoJet2energy += Evec[index]

            event.gamma_pseudoJet1 = ROOT.reco.Particle.LorentzVector(
                pseudoJet1px, pseudoJet1py, pseudoJet1pz, pseudoJet1energy)
            event.gamma_pseudoJet2 = ROOT.reco.Particle.LorentzVector(
                pseudoJet2px, pseudoJet2py, pseudoJet2pz, pseudoJet2energy)

            event.gamma_mt2 = self.computeMT2(event.gamma_pseudoJet1,
                                              event.gamma_pseudoJet2,
                                              event.gamma_met)

## ===> zll_MT2

        csLeptons = [
            l for l in event.selectedLeptons
            if l.pt() > 10 and abs(l.eta()) < 2.5
        ]

        if len(csLeptons) == 2 and len(objects40jc) >= 2:

            pxvec = ROOT.std.vector(float)()
            pyvec = ROOT.std.vector(float)()
            pzvec = ROOT.std.vector(float)()
            Evec = ROOT.std.vector(float)()
            grouping = ROOT.std.vector(int)()

            for obj in objects40jc:
                pxvec.push_back(obj.px())
                pyvec.push_back(obj.py())
                pzvec.push_back(obj.pz())
                Evec.push_back(obj.energy())

            #### get hemispheres (seed 2: max inv mass, association method: default 3 = minimal lund distance)

            hemisphere = Hemisphere(pxvec, pyvec, pzvec, Evec, 2, 3)
            grouping = hemisphere.getGrouping()
            ##            print 'grouping ',len(grouping)

            pseudoJet1px = 0
            pseudoJet1py = 0
            pseudoJet1pz = 0
            pseudoJet1energy = 0

            pseudoJet2px = 0
            pseudoJet2py = 0
            pseudoJet2pz = 0
            pseudoJet2energy = 0

            for index in range(0, len(pxvec)):
                if (grouping[index] == 1):
                    pseudoJet1px += pxvec[index]
                    pseudoJet1py += pyvec[index]
                    pseudoJet1pz += pzvec[index]
                    pseudoJet1energy += Evec[index]
                if (grouping[index] == 2):
                    pseudoJet2px += pxvec[index]
                    pseudoJet2py += pyvec[index]
                    pseudoJet2pz += pzvec[index]
                    pseudoJet2energy += Evec[index]

            zll_pseudoJet1 = ROOT.reco.Particle.LorentzVector(
                pseudoJet1px, pseudoJet1py, pseudoJet1pz, pseudoJet1energy)
            zll_pseudoJet2 = ROOT.reco.Particle.LorentzVector(
                pseudoJet2px, pseudoJet2py, pseudoJet2pz, pseudoJet2energy)

            event.zll_mt2 = self.computeMT2(zll_pseudoJet1, zll_pseudoJet2,
                                            event.zll_met)

#### do the mt2 with one or two b jets (medium CSV)
        if len(event.bjetsMedium) >= 2:

            event.mt2bb = self.computeMT2(event.bjetsMedium[0],
                                          event.bjetsMedium[1], event.met)
#            print 'MT2bb(2b)',event.mt2bb
        if len(event.bjetsMedium) == 1:

            objects40jcCSV = [
                j for j in event.cleanJets if j.pt() > 40
                and abs(j.eta()) < 2.5 and j.p4() != event.bjetsMedium[0].p4()
            ]
            objects40jcCSV.sort(key=lambda l: l.btag(
                'combinedInclusiveSecondaryVertexV2BJetTags'),
                                reverse=True)

            if len(objects40jcCSV) > 0:
                event.mt2bb = self.computeMT2(event.bjetsMedium[0],
                                              objects40jcCSV[0], event.met)
##                print 'MT2bb(1b)',event.mt2bb

## ===> leptonic MT2 (as used in the SUS-13-025 )
        if not self.cfg_ana.doOnlyDefault:
            if len(event.selectedLeptons) >= 2:
                event.mt2lep = self.computeMT2(event.selectedLeptons[0],
                                               event.selectedLeptons[1],
                                               event.met)

## ===> hadronic MT2w (as used in the SUS-13-011) below just a placeHolder to be coded properly

        if not self.cfg_ana.doOnlyDefault:
            if len(event.selectedLeptons) >= 1:

                metVector = TVectorD(
                    3, array.array('d',
                                   [0., event.met.px(),
                                    event.met.py()]))
                lVector = TVectorD(
                    3,
                    array.array('d', [
                        0., event.selectedLeptons[0].px(),
                        event.selectedLeptons[0].py()
                    ]))
                #placeholder for visaVector and visbVector  need to get the jets
                visaVector = TVectorD(
                    3,
                    array.array('d', [
                        0., event.selectedLeptons[0].px(),
                        event.selectedLeptons[0].py()
                    ]))
                visbVector = TVectorD(
                    3,
                    array.array('d', [
                        0., event.selectedLeptons[0].px(),
                        event.selectedLeptons[0].py()
                    ]))

                metVector = numpy.asarray(metVector, dtype='double')
                lVector = numpy.asarray(lVector, dtype='double')
                visaVector = numpy.asarray(visaVector, dtype='double')
                visbVector = numpy.asarray(visbVector, dtype='double')

                mt2wSNT.set_momenta(lVector, visaVector, visbVector, metVector)
                event.mt2w = mt2wSNT.get_mt2w()