Ejemplo n.º 1
0
    def preselection(self, row, cut_flow_trk = None, LT_threshold = 80.):
        ''' Preselection applied to events.

        Excludes FR object IDs and sign cut.
        '''
        double_mu_pass = row.doubleMuPass #and \
            ## row.m1MatchesDoubleMu2011Paths > 0 and \
            ## row.m2MatchesDoubleMu2011Paths > 0
        if not ( double_mu_pass ): return False
        cut_flow_trk.Fill('trigger')

        if row.m1Pt < row.m2Pt:                   return False
        if row.m1Pt < 20:                         return False
        if not selections.muSelection(row, 'm1'): return False #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
        cut_flow_trk.Fill('obj1 Presel')

        if not selections.muSelection(row, 'm2'): return False #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
        cut_flow_trk.Fill('obj2 Presel')

        if not selections.tauSelection(row, 't'): return False #applies basic selection (eta, pt > 20, DZ)
        if not row.tAntiElectronMVA3Loose:        return False
        cut_flow_trk.Fill('obj3 Presel')

        if row.LT < LT_threshold: return False
        cut_flow_trk.Fill('LT')

        if row.m1_m2_SS and row.m1_t_SS: return False #remove three SS leptons
        if row.m1_m2_Mass < 20:          return False
        if not selections.vetos(row):    return False #applies mu bjet e additional tau vetoes
        cut_flow_trk.Fill('vetos')
        cut_flow_trk.Fill('charge_fakes') #no charge fakes here

        return True
Ejemplo n.º 2
0
    def process(self):
        old = None
        for row in self.tree:
#            print "charge", row.evt, row.m1Charge, row.m2Charge, row.singleIsoMu27Pass, row.bjetCISVVeto30Medium, row.m1PFIDLoose, row.m2PFIDLoose, row.m1RelPFIsoDBDefaultR04, row.m2RelPFIsoDBDefaultR04, selections.muSelection(row, 'm1'), selections.muSelection(row, 'm2')  
            if int(row.m1Charge*row.m2Charge)==1:                                                                                                                                                                                                       
                continue
            if row.singleIsoMu27Pass == 0:# and row.singleMu27Pass == 0:
                continue
            dirnames = ['mm']
            if row.bjetCISVVeto30Medium!=0 : continue
            if not selections.muSelection(row, 'm1') or not selections.muSelection(row, 'm2'): continue
            if not row.m1PFIDLoose == 1 or not row.m2PFIDLoose == 1: continue
            if row.m1RelPFIsoDBDefaultR04 < 1 and row.m2RelPFIsoDBDefaultR04 < 1:
                dirnames.append('Iso1')
            if row.m1RelPFIsoDBDefaultR04 < 0.5 and row.m2RelPFIsoDBDefaultR04 < 0.5:
                dirnames.append('Iso0p5')
            if row.m1RelPFIsoDBDefaultR04 < 0.25 and row.m2RelPFIsoDBDefaultR04 < 0.25:
                dirnames.append('Iso0p25')
            if row.m1RelPFIsoDBDefaultR04 < 0.15 and row.m2RelPFIsoDBDefaultR04 < 0.15:
                dirnames.append('Iso0p15')
            if row.m1RelPFIsoDBDefaultR04 < 0.1 and row.m2RelPFIsoDBDefaultR04 < 0.1:
                dirnames.append('Iso0p1')
            #print "after", row.evt, row.m1Charge, row.m2Charge, row.singleIsoMu27Pass, row.bjetCISVVeto30Medium, row.m1PFIDLoose, row.m2PFIDLoose, row.m1RelPFIsoDBDefaultR04, row.m2RelPFIsoDBDefaultR04, selections.muSelection(row, 'm1'), selections.muSelection(row, 'm2')  
#            if old is not None:
#                if old.evt == row.evt:
#                    if abs(row.m1_m2_Mass-91.1) < abs(old.m1_m2_Mass-91.1):
#                        old = row
#                else:
#                    print "saving"
            for dirname in dirnames:    
                self.fill_histos(dirname, row, 1.0)
Ejemplo n.º 3
0
    def preselection(self, row, cut_flow_trk = None, LT_threshold = 80., taupt_thr = 0.):
        ''' Preselection applied to events.

        Excludes FR object IDs and sign cut.
        '''
        double_mu_pass =  row.doubleMuPass and \
            row.m1MatchesDoubleMuPaths > 0 and \
            row.m2MatchesDoubleMuPaths > 0
        double_muTrk_pass = row.doubleMuTrkPass and \
             row.m1MatchesDoubleMuTrkPaths > 0 and \
             row.m2MatchesDoubleMuTrkPaths > 0
        if not ( double_mu_pass or double_muTrk_pass ): return False
        cut_flow_trk.Fill('trigger')

        if row.m1Pt < row.m2Pt:                   return False
        if row.m1Pt < 20:                         return False
        if not selections.muSelection(row, 'm1'): return False #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
        cut_flow_trk.Fill('obj1 Presel')
        #cut_flow_trk.Fill('pt requirements 1', 'eta requirements 1', 'MissingHits 1', 'HasConversion 1', 'JetBtag 1', 'DZ 1',)


        if not selections.muSelection(row, 'm2'): return False #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
        cut_flow_trk.Fill('obj2 Presel')
        #cut_flow_trk.Fill('pt requirements 2', 'eta requirements 2', 'MissingHits 2', 'HasConversion 2', 'JetBtag 2', 'DZ 2',)

        if not selections.tauSelection(row, 't'): return False #applies basic selection (eta, pt > 20, DZ)
        if not row.tAntiElectronMVA3Loose:        return False
        if row.tPt < taupt_thr: return False
        cut_flow_trk.Fill('obj3 Presel')

        if row.LT < LT_threshold: return False
        cut_flow_trk.Fill('LT')

        if row.m1_m2_SS and row.m1_t_SS: return False #remove three SS leptons
        if row.m1_m2_Mass < 20:          return False
        if not selections.vetos(row):    return False #applies mu bjet e additional tau vetoes
        cut_flow_trk.Fill('vetos')
        #cut_flow_trk.Fill('ChargeIdTight')
        cut_flow_trk.Fill('charge_fakes') #no charge fakes here
        
        #FIXME: ONLY FOR CUT-FLOW PRODUCTION
        #if not row.m1PFIDTight: return False
        #cut_flow_trk.Fill('obj1 ID')
        #if not selections.lepton_id_iso(row, 'm1', 'h2taucuts'): return False
        #cut_flow_trk.Fill('obj1 Iso')
        #if not row.m2PFIDTight: return False
        #cut_flow_trk.Fill('obj2 ID')
        #if not selections.lepton_id_iso(row, 'm2', 'h2taucuts'): return False
        #cut_flow_trk.Fill('obj2 Iso')
        #if not row.tLooseIso3Hits: return False
        #cut_flow_trk.Fill('obj3 IDIso')
        
        return True
Ejemplo n.º 4
0
    def preselection( self, row, cut_flow_trk = None, LT_threshold = 80.):
        ''' Preselection applied to events.

        Excludes FR object IDs and sign cut.
        '''
        mu17e8 = (row.mu17ele8isoPass and row.mPt >= 20) if use_iso_trigger else (row.mu17ele8Pass and row.mPt >= 20)
        mu8e17 = (row.mu8ele17isoPass and row.ePt >= 20) #if use_iso_trigger else (row.mu17ele8Pass and row.mPt < 20)
        if not (mu17e8 or mu8e17):                return False
        cut_flow_trk.Fill('trigger')

        if not selections.muSelection(row, 'm'):  return False #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
        cut_flow_trk.Fill('obj1 Presel')

        if not selections.eSelection(row, 'e'):   return False #applies basic selection (eta, pt > 10, DZ, missingHits, jetBTag, HasConversion and chargedIdTight)
        cut_flow_trk.Fill('obj2 Presel')

        if not selections.tauSelection(row, 't'): return False #applies basic selection (eta, pt > 20, DZ)
        if row.tMuOverlap:         return False
        if not row.tAntiMuonTight: return False
        cut_flow_trk.Fill('obj3 Presel')

        if row.LT < LT_threshold:            return False
        cut_flow_trk.Fill('LT')

        if row.e_m_SS and row.e_t_SS: return False #remove three SS leptons
        if not selections.vetos(row): return False #applies mu bjet e additional tau vetoes
        cut_flow_trk.Fill('vetos')
        cut_flow_trk.Fill('charge_fakes') #no charge fakes here

        return True
    def preselection(self, row):
        ''' Preselection applied to events.

        Excludes FR object IDs and sign cut.
        '''
        if not row.isoMu24eta2p1Pass                : return False
        if not selections.muSelection(row, 'm1', 10): return False
        if not selections.muSelection(row, 'm2', 10): return False
        m1matches = row.m1MatchesIsoMu24eta2p1 and \
                    (row.m1Pt > 25) and (row.m1AbsEta < 2.1) 
        m2matches = row.m2MatchesIsoMu24eta2p1 and \
                    (row.m2Pt > 25) and (row.m2AbsEta < 2.1) 
        if not (m1matches or m2matches):       return False
        if not selections.mu_idIso(row, 'm1'): return False    
        if not selections.vetos(row):          return False
        return True
Ejemplo n.º 6
0
    def preselection(self, row, cut_flow_trk = None, LT_threshold = 80., taupt_thr = 0.):
        ''' Preselection applied to events.

        Excludes FR object IDs and sign cut.
        '''

        #
        # NEW EXPLICIT CUT, BEFORE IT WAS IMPLICIT AND MADE WHILE PLOTTING!
        #
        if row.m1_t_DR < 0.5 or row.m2_t_DR < 0.5 or row.m1_m2_DR < 0.5: return False
        cut_flow_trk.Fill('DR separation')

        if row.m2_t_Mass < 20: return False
        cut_flow_trk.Fill('sub mass cut')

        double_mu_pass =  row.doubleMuPass and \
            row.m1MatchesDoubleMuPaths > 0 and \
            row.m2MatchesDoubleMuPaths > 0
        double_muTrk_pass = row.doubleMuTrkPass and \
             row.m1MatchesMu17TrkMu8Path  > 0 and \
             row.m2MatchesMu17TrkMu8Path  > 0
        if not ( double_mu_pass or double_muTrk_pass ): return False
        cut_flow_trk.Fill('trigger')

        if row.m1Pt < row.m2Pt:                   return False
        if row.m1Pt < 20:                         return False
        if not selections.muSelection(row, 'm1'): return False #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
        cut_flow_trk.Fill('obj1 Presel')

        if not selections.muSelection(row, 'm2'): return False #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
        cut_flow_trk.Fill('obj2 Presel')

        if not selections.tauSelection(row, 't'): return False #applies basic selection (eta, pt > 20, DZ)
        if not row.tAntiElectronMVA3Loose:        return False
        if row.tPt < taupt_thr: return False
        cut_flow_trk.Fill('obj3 Presel')

        if row.LT < LT_threshold: return False
        cut_flow_trk.Fill('LT')

        if row.m1_m2_Mass < 20:          return False
        cut_flow_trk.Fill('dilepton mass cut')

        if not selections.vetos(row, cut_flow_trk):    return False #applies mu bjet e additional tau vetoes
        
        return True
Ejemplo n.º 7
0
 def preselection(row):
     if not row.e_m_SS: return False
     if not selections.muSelection(row, 'm'):  return False #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
     if not selections.eSelection(row, 'e'):   return False #applies basic selection (eta, pt > 10, DZ, missingHits, jetBTag, HasConversion and chargedIdTight)
     if not row.eChargeIdTight:                return False
     if not (row.jetVeto40_DR05 >= 1):         return False
     if not selections.vetos(row):             return False #applies mu bjet e additional tau vetoes
     return True
Ejemplo n.º 8
0
    def preselection(self, row):
        ''' Preselection applied to events.

        Excludes FR object IDs and sign cut.
        '''
        double_mu_pass =  row.doubleMuPass and \
            row.m1MatchesDoubleMuPaths > 0 and \
            row.m2MatchesDoubleMuPaths > 0
        double_muTrk_pass = row.doubleMuTrkPass and \
             row.m1MatchesDoubleMuTrkPaths > 0 and \
             row.m2MatchesDoubleMuTrkPaths > 0
        if not ( double_mu_pass or double_muTrk_pass ): return False
        if row.m1_m2_SS:         return False
        if row.m1Pt < row.m2Pt:  return False
        if row.m1_m2_Mass < 60:  return False
        if row.m1_m2_Mass > 120: return False
        if not selections.muSelection(row, 'm1'): return False #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
        if not selections.muSelection(row, 'm2'): return False #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
        return True
Ejemplo n.º 9
0
    def preselection( self, row, cut_flow_trk = None, LT_threshold = 80., taupt_thr = 0.):
        ''' Preselection applied to events.

        Excludes FR object IDs and sign cut.
        '''
        if row.e_t_DR < 0.5 or row.m_t_DR < 0.5 or row.e_m_DR < 0.5: return False
        cut_flow_trk.Fill('DR separation')

        if self.hfunc['subMass'](row, 1)[0] < 20: return False
        cut_flow_trk.Fill('sub mass cut')

        mu17e8, mu8e17 = False, False
        if use_iso_trigger:
            mu17e8 = row.mu17ele8isoPass and \
                row.mMatchesMu17Ele8IsoPath > 0 and \
                row.eMatchesMu17Ele8IsoPath > 0 and \
                row.mPt >= 20
            mu8e17 = row.mu8ele17isoPass and \
                row.mMatchesMu8Ele17IsoPath > 0 and \
                row.eMatchesMu8Ele17IsoPath > 0 and \
                row.ePt >= 20
        else:
            mu17e8 = row.mu17ele8Pass and \
                row.mMatchesMu17Ele8Path > 0 and \
                row.eMatchesMu17Ele8Path > 0 and \
                row.mPt >= 20
            mu8e17 = row.mu8ele17Pass and \
                row.mMatchesMu8Ele17Path > 0 and \
                row.eMatchesMu8Ele17Path > 0 and \
                row.ePt >= 20
            
        if not (mu17e8 or mu8e17):                return False
        cut_flow_trk.Fill('trigger')

        if not selections.muSelection(row, 'm'):  return False #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
        cut_flow_trk.Fill('obj1 Presel')

        if not selections.eSelection(row, 'e'):   return False #applies basic selection (eta, pt > 10, DZ, missingHits, jetBTag, HasConversion and chargedIdTight)
        cut_flow_trk.Fill('obj2 Presel')

        if not selections.tauSelection(row, 't'): return False #applies basic selection (eta, pt > 20, DZ)
        if row.tPt < taupt_thr: return False
        cut_flow_trk.Fill('obj3 Presel')

        if row.LT < LT_threshold:            return False
        cut_flow_trk.Fill('LT')

        if row.e_m_Mass < 20:          return False
        cut_flow_trk.Fill('dilepton mass cut')

        if not selections.vetos(row, cut_flow_trk): return False #applies mu bjet e additional tau vetoes

        cut_flow_trk.Fill('charge_fakes') #no charge fakes here

        return True
Ejemplo n.º 10
0
 def preselection(row):
     if not row.e_m_SS: return False
     if not selections.muSelection(row, 'm'):
         return False  #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
     if not selections.eSelection(row, 'e'):
         return False  #applies basic selection (eta, pt > 10, DZ, missingHits, jetBTag, HasConversion and chargedIdTight)
     if not row.eChargeIdTight: return False
     if not (row.jetVeto40_DR05 >= 1): return False
     if not selections.vetos(row):
         return False  #applies mu bjet e additional tau vetoes
     return True
Ejemplo n.º 11
0
        def preselection(row):
            double_mu_pass =  row.doubleMuPass and \
                row.m1MatchesDoubleMuPaths > 0 and \
                row.m2MatchesDoubleMuPaths > 0
            double_muTrk_pass = row.doubleMuTrkPass and \
                 row.m1MatchesDoubleMuTrkPaths > 0 and \
                 row.m2MatchesDoubleMuTrkPaths > 0
            if not (double_mu_pass or double_muTrk_pass): return False

            if not row.m1_m2_SS: return False
            if row.m2Pt > row.m1Pt: return False
            if row.m1_m2_Mass < 20: return False
            if not row.m1Pt > 20: return False
            if not row.m1PFIDTight: return False
            if not selections.muSelection(row, 'm1'): return False
            if not selections.muSelection(row, 'm2'): return False
            if not selections.vetos(row):
                return False  #applies mu bjet e additional tau vetoes
            if not (row.jetVeto40_DR05 >= 1): return False
            return True
Ejemplo n.º 12
0
    def preselection(self, row):
        ''' Preselection applied to events.

        Excludes FR object IDs and sign cut.
        '''
        mu17e8 = (row.mu17ele8isoPass and row.mPt >= 20) if use_iso_trigger else (row.mu17ele8Pass and row.mPt >= 20)
        mu8e17 = (row.mu8ele17isoPass and row.ePt >= 20) #if use_iso_trigger else (row.mu17ele8Pass and row.mPt < 20)
        if not (mu17e8 or mu8e17):                return False
        if not selections.muSelection(row, 'm'):  return False #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
        if not selections.eSelection(row, 'e'):   return False #applies basic selection (eta, pt > 10, DZ, missingHits, jetBTag, HasConversion and chargedIdTight)
        if not selections.vetos(row):             return False #applies mu bjet e additional tau vetoes
        return True
Ejemplo n.º 13
0
 def process(self):
      for row in self.tree:
          if row.singleIsoMu27Pass == 0:# and row.singleMu27Pass == 0:
              continue
          dirnames = ['mm']
          weight_to_use = row.GenWeight #it should be changed when using corrections
          if row.bjetCISVVeto30Medium!=0 : continue
          if not selections.muSelection(row, 'm1') or not selections.muSelection(row, 'm2'): continue
          if not row.m1PFIDLoose == 1 or not row.m2PFIDLoose == 1: continue
          if row.m1RelPFIsoDBDefaultR04 < 1 and row.m2RelPFIsoDBDefaultR04 < 1:
              dirnames.append('Iso1')
          if row.m1RelPFIsoDBDefaultR04 < 0.5 and row.m2RelPFIsoDBDefaultR04 < 0.5:
              dirnames.append('Iso0p5')
          if row.m1RelPFIsoDBDefaultR04 < 0.25 and row.m2RelPFIsoDBDefaultR04 < 0.25:
              dirnames.append('Iso0p25')
          if row.m1RelPFIsoDBDefaultR04 < 0.15 and row.m2RelPFIsoDBDefaultR04 < 0.15:
              dirnames.append('Iso0p15')
          if row.m1RelPFIsoDBDefaultR04 < 0.1 and row.m2RelPFIsoDBDefaultR04 < 0.1:
              dirnames.append('Iso0p1')
          for dirname in dirnames:
              self.fill_histos(dirname, row, weight_to_use)
Ejemplo n.º 14
0
    def preselection(self, row):
        ''' Preselection applied to events.

        Excludes FR object IDs and sign cut.
        '''
        double_mu_pass =  row.doubleMuPass and \
            row.m1MatchesDoubleMuPaths > 0 and \
            row.m2MatchesDoubleMuPaths > 0
        double_muTrk_pass = row.doubleMuTrkPass and \
             row.m1MatchesDoubleMuTrkPaths > 0 and \
             row.m2MatchesDoubleMuTrkPaths > 0
        if not (double_mu_pass or double_muTrk_pass): return False
        if row.m1_m2_SS: return False
        if row.m1Pt < row.m2Pt: return False
        if row.m1_m2_Mass < 60: return False
        if row.m1_m2_Mass > 120: return False
        if not selections.muSelection(row, 'm1'):
            return False  #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
        if not selections.muSelection(row, 'm2'):
            return False  #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
        return True
Ejemplo n.º 15
0
    def process(self):
        sys_shifts = []
        for row in self.tree:
            if int(row.m1Charge * row.m2Charge) == 1:
                continue

            if row.singleIsoMu27Pass == 0:  # and row.singleMu27Pass == 0:
                continue

            if row.bjetCISVVeto30Medium != 0: continue
            if not selections.muSelection(
                    row, 'm1') or not selections.muSelection(row, 'm2'):
                continue
            if abs(91.19 - row.m1_m2_Mass) > 30: continue
            if not row.m1PFIDLoose == 1 or not row.m2PFIDLoose == 1: continue

            dirnames = ['mm']
            weight_to_use = row.GenWeight  #it should be changed when using corrections
            weight_map = self.event_weight(row, sys_shifts, weight_to_use)
            if weight_map[''] == 0: continue
            weight_to_use = weight_map['']

            if row.m1RelPFIsoDBDefaultR04 < 1 and row.m2RelPFIsoDBDefaultR04 < 1:
                dirnames.append('Iso1')
            if row.m1RelPFIsoDBDefaultR04 < 0.5 and row.m2RelPFIsoDBDefaultR04 < 0.5:
                dirnames.append('Iso0p5')
            if row.m1RelPFIsoDBDefaultR04 < 0.25 and row.m2RelPFIsoDBDefaultR04 < 0.25:
                dirnames.append('Iso0p25')
            if row.m1RelPFIsoDBDefaultR04 < 0.15 and row.m2RelPFIsoDBDefaultR04 < 0.15:
                dirnames.append('Iso0p15')
                #if oldevent[0] == row.evt: print "eventID", row.evt, "m1Pt", row.m1Pt, "m2Pt", row.m2Pt, "row.m1Phi", row.m1Phi, "row.m2Phi", row.m2Phi, "row.m1Eta", row.m1Eta, "row.m2Eta", row.m2Eta, "deltaR", row.m1_m2_DR, "oldevent deltaR", oldevent[8], "m1_m2_Mass", row.m1_m2_Mass, "Mass", oldevent[7]
                #oldevent = (row.evt,row.m1Pt,row.m2Pt,row.m1Phi,row.m2Phi,row.m1Eta,row.m2Eta,row.m1_m2_Mass,row.m1_m2_DR)
            if row.m1RelPFIsoDBDefaultR04 < 0.1 and row.m2RelPFIsoDBDefaultR04 < 0.1:
                dirnames.append('Iso0p1')
            for dirname in dirnames:
                self.fill_histos(dirname, row, 1.0)
Ejemplo n.º 16
0
        def preselection(row, cut_flow_trk):
            double_mu_pass =  row.doubleMuPass and \
                row.m1MatchesDoubleMuPaths > 0 and \
                row.m2MatchesDoubleMuPaths > 0
            double_muTrk_pass = row.doubleMuTrkPass and \
                 row.m1MatchesMu17TrkMu8Path > 0 and \
                 row.m2MatchesMu17TrkMu8Path > 0
            if not ( double_mu_pass or double_muTrk_pass ): return False
            cut_flow_trk.Fill('trigger')

            if not row.m1_m2_SS: return False
            cut_flow_trk.Fill('m1_m2_SS')

            if row.m1_m2_DR < 0.5: return False
            cut_flow_trk.Fill('m1_m2_DR')

            if row.m2Pt > row.m1Pt: return False
            if row.m1_m2_Mass < 20: return False
            cut_flow_trk.Fill('m1_m2_Mass')

            if not selections.muSelection(row, 'm1', cut_flow_trk):  return False
            if not row.m1Pt > 20: return False
            cut_flow_trk.Fill('lead mu pt')
            if not row.m1PFIDTight: return False
            cut_flow_trk.Fill('m1PFIDTight')
            #cut_flow_trk.Fill('lead mu preselection')

            if not selections.muSelection(row, 'm2'):  return False
            cut_flow_trk.Fill('sublead mu preselection')

            if not selections.vetos(row, cut_flow_trk):  return False #applies mu bjet e additional tau vetoes
            #if not (row.jetVeto40_DR05 >= 1): return False
            if row.jetVeto20 == 0: return False
            cut_flow_trk.Fill('Jet presence')

            return True
Ejemplo n.º 17
0
    def preselection(self, row):
        ''' Preselection applied to events.

        Excludes FR object IDs and sign cut.
        '''
        mu17e8 = (row.mu17ele8isoPass
                  and row.mPt >= 20) if use_iso_trigger else (
                      row.mu17ele8Pass and row.mPt >= 20)
        mu8e17 = (
            row.mu8ele17isoPass and row.ePt >= 20
        )  #if use_iso_trigger else (row.mu17ele8Pass and row.mPt < 20)
        if not (mu17e8 or mu8e17): return False
        if not selections.muSelection(row, 'm'):
            return False  #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
        if not selections.eSelection(row, 'e'):
            return False  #applies basic selection (eta, pt > 10, DZ, missingHits, jetBTag, HasConversion and chargedIdTight)
        if not selections.vetos(row):
            return False  #applies mu bjet e additional tau vetoes
        return True
Ejemplo n.º 18
0
        def preselection(row):
            if not row.e_m_SS: return False
            cut_flow_trk.Fill('e_m_SS')

            if row.e_m_DR < 0.5:                      return False
            cut_flow_trk.Fill('e_m_DR')

            if not selections.muSelection(row, 'm'):  return False #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
            cut_flow_trk.Fill('mu presel')

            if not selections.eSelection(row, 'e'):   return False #applies basic selection (eta, pt > 10, DZ, missingHits, jetBTag, HasConversion and chargedIdTight)
            if not row.eChargeIdTight:                return False
            cut_flow_trk.Fill('e presel')

            #if not (row.jetVeto40_DR05 >= 1):         return False
            if row.jetVeto20 == 0: return False
            cut_flow_trk.Fill('jet presence')

            if not selections.vetos(row, cut_flow_trk, False):  return False #applies mu bjet e additional tau vetoes
            #DO NOT APPLY BJet veto. It is used for ttbar CR
            return True
Ejemplo n.º 19
0
        def preselection(row):
            if not row.e_m_SS: return False
            cut_flow_trk.Fill('e_m_SS')

            if row.e_m_DR < 0.5: return False
            cut_flow_trk.Fill('e_m_DR')

            if not selections.muSelection(row, 'm'):
                return False  #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
            cut_flow_trk.Fill('mu presel')

            if not selections.eSelection(row, 'e'):
                return False  #applies basic selection (eta, pt > 10, DZ, missingHits, jetBTag, HasConversion and chargedIdTight)
            if not row.eChargeIdTight: return False
            cut_flow_trk.Fill('e presel')

            #if not (row.jetVeto40_DR05 >= 1):         return False
            if row.jetVeto20 == 0: return False
            cut_flow_trk.Fill('jet presence')

            if not selections.vetos(row, cut_flow_trk, False):
                return False  #applies mu bjet e additional tau vetoes
            #DO NOT APPLY BJet veto. It is used for ttbar CR
            return True
Ejemplo n.º 20
0
    def preselection( self, row, cut_flow_trk = None, LT_threshold = 80., taupt_thr = 0.):
        ''' Preselection applied to events.

        Excludes FR object IDs and sign cut.
        '''
        mu17e8, mu8e17 = False, False
        if use_iso_trigger:
            mu17e8 = row.mu17ele8isoPass and \
                row.mMatchesMu17Ele8IsoPath > 0 and \
                row.eMatchesMu17Ele8IsoPath > 0 and \
                row.mPt >= 20
            mu8e17 = row.mu8ele17isoPass and \
                row.mMatchesMu8Ele17IsoPath > 0 and \
                row.eMatchesMu8Ele17IsoPath > 0 and \
                row.ePt >= 20
        else:
            mu17e8 = row.mu17ele8Pass and \
                row.mMatchesMu17Ele8Path > 0 and \
                row.eMatchesMu17Ele8Path > 0 and \
                row.mPt >= 20
            mu8e17 = row.mu8ele17Pass and \
                row.mMatchesMu8Ele17Path > 0 and \
                row.eMatchesMu8Ele17Path > 0 and \
                row.ePt >= 20
            
        if not (mu17e8 or mu8e17):                return False
        cut_flow_trk.Fill('trigger')

        if not selections.muSelection(row, 'm'):  return False #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
        #cut_flow_trk.Fill('pt requirements 1', 'eta requirements 1', 'MissingHits 1', 'HasConversion 1', 'JetBtag 1', 'DZ 1',)
        cut_flow_trk.Fill('obj1 Presel')

        if not selections.eSelection(row, 'e'):   return False #applies basic selection (eta, pt > 10, DZ, missingHits, jetBTag, HasConversion and chargedIdTight)
        cut_flow_trk.Fill('obj2 Presel')
        #FIXME
        #if row.ePt < 10:           return False
	#cut_flow_trk.Fill('pt requirements 2')
    	#if row.eAbsEta > 2.5:      return False
	#cut_flow_trk.Fill('eta requirements 2')
    	#if row.eMissingHits:       return False
	#cut_flow_trk.Fill('MissingHits 2')
    	#if row.eHasConversion:     return False
	#cut_flow_trk.Fill('HasConversion 2')
    	#if row.eJetBtag > 3.3:     return False
	#cut_flow_trk.Fill('JetBtag 2')
    	#if abs(row.eDZ) > 0.2:     return False
	#cut_flow_trk.Fill('DZ 2')


        if not selections.tauSelection(row, 't'): return False #applies basic selection (eta, pt > 20, DZ)
        if row.tPt < taupt_thr: return False
        if row.tMuOverlap:         return False
        if not row.tAntiMuonTight: return False
        cut_flow_trk.Fill('obj3 Presel')

        if row.LT < LT_threshold:            return False
        cut_flow_trk.Fill('LT')

        if row.e_m_SS and row.e_t_SS: return False #remove three SS leptons
        if not selections.vetos(row): return False #applies mu bjet e additional tau vetoes
        cut_flow_trk.Fill('vetos')
        #FIXME
    	if not row.eChargeIdTight: return False
        #cut_flow_trk.Fill('ChargeIdTight')
       
        if e_m_Mass < 20:          return False
        cut_flow_trk.Fill('charge_fakes') #no charge fakes here

        #FIXME: ONLY FOR CUT-FLOW PRODUCTION
        #if not row.mPFIDTight: return False
        #cut_flow_trk.Fill('obj1 ID')
        #if not selections.lepton_id_iso(row, 'm', 'h2taucuts'): return False
        #cut_flow_trk.Fill('obj1 Iso')
        #if not selections.summer_2013_eid(row, 'e'): return False
        #cut_flow_trk.Fill('obj2 ID')
        #if not selections.lepton_id_iso(row, 'e', 'h2taucuts'): return False
        #cut_flow_trk.Fill('obj2 Iso')
        #if not row.tLooseIso3Hits: return False
        #cut_flow_trk.Fill('obj3 IDIso')

        return True
Ejemplo n.º 21
0
    def preselection(self,
                     row,
                     cut_flow_trk=None,
                     LT_threshold=80.,
                     taupt_thr=0.):
        ''' Preselection applied to events.

        Excludes FR object IDs and sign cut.
        '''
        mu17e8, mu8e17 = False, False
        if use_iso_trigger:
            mu17e8 = row.mu17ele8isoPass and \
                row.mMatchesMu17Ele8IsoPath > 0 and \
                row.eMatchesMu17Ele8IsoPath > 0 and \
                row.mPt >= 20
            mu8e17 = row.mu8ele17isoPass and \
                row.mMatchesMu8Ele17IsoPath > 0 and \
                row.eMatchesMu8Ele17IsoPath > 0 and \
                row.ePt >= 20
        else:
            mu17e8 = row.mu17ele8Pass and \
                row.mMatchesMu17Ele8Path > 0 and \
                row.eMatchesMu17Ele8Path > 0 and \
                row.mPt >= 20
            mu8e17 = row.mu8ele17Pass and \
                row.mMatchesMu8Ele17Path > 0 and \
                row.eMatchesMu8Ele17Path > 0 and \
                row.ePt >= 20

        if not (mu17e8 or mu8e17): return False
        cut_flow_trk.Fill('trigger')

        if not selections.muSelection(row, 'm'):
            return False  #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
        #cut_flow_trk.Fill('pt requirements 1', 'eta requirements 1', 'MissingHits 1', 'HasConversion 1', 'JetBtag 1', 'DZ 1',)
        cut_flow_trk.Fill('obj1 Presel')

        if not selections.eSelection(row, 'e'):
            return False  #applies basic selection (eta, pt > 10, DZ, missingHits, jetBTag, HasConversion and chargedIdTight)
        cut_flow_trk.Fill('obj2 Presel')
        #FIXME
        #if row.ePt < 10:           return False
        #cut_flow_trk.Fill('pt requirements 2')
        #if row.eAbsEta > 2.5:      return False
        #cut_flow_trk.Fill('eta requirements 2')
        #if row.eMissingHits:       return False
        #cut_flow_trk.Fill('MissingHits 2')
        #if row.eHasConversion:     return False
        #cut_flow_trk.Fill('HasConversion 2')
        #if row.eJetBtag > 3.3:     return False
        #cut_flow_trk.Fill('JetBtag 2')
        #if abs(row.eDZ) > 0.2:     return False
        #cut_flow_trk.Fill('DZ 2')

        if not selections.tauSelection(row, 't'):
            return False  #applies basic selection (eta, pt > 20, DZ)
        if row.tPt < taupt_thr: return False
        if row.tMuOverlap: return False
        if not row.tAntiMuonTight: return False
        cut_flow_trk.Fill('obj3 Presel')

        if row.LT < LT_threshold: return False
        cut_flow_trk.Fill('LT')

        if row.e_m_SS and row.e_t_SS: return False  #remove three SS leptons
        if not selections.vetos(row):
            return False  #applies mu bjet e additional tau vetoes
        cut_flow_trk.Fill('vetos')
        #FIXME
        if not row.eChargeIdTight: return False
        #cut_flow_trk.Fill('ChargeIdTight')

        if e_m_Mass < 20: return False
        cut_flow_trk.Fill('charge_fakes')  #no charge fakes here

        #FIXME: ONLY FOR CUT-FLOW PRODUCTION
        #if not row.mPFIDTight: return False
        #cut_flow_trk.Fill('obj1 ID')
        #if not selections.lepton_id_iso(row, 'm', 'h2taucuts'): return False
        #cut_flow_trk.Fill('obj1 Iso')
        #if not selections.summer_2013_eid(row, 'e'): return False
        #cut_flow_trk.Fill('obj2 ID')
        #if not selections.lepton_id_iso(row, 'e', 'h2taucuts'): return False
        #cut_flow_trk.Fill('obj2 Iso')
        #if not row.tLooseIso3Hits: return False
        #cut_flow_trk.Fill('obj3 IDIso')

        return True
Ejemplo n.º 22
0
    def preselection(self,
                     row,
                     cut_flow_trk=None,
                     LT_threshold=80.,
                     taupt_thr=0.):
        ''' Preselection applied to events.

        Excludes FR object IDs and sign cut.
        '''
        if row.e_t_DR < 0.5 or row.m_t_DR < 0.5 or row.e_m_DR < 0.5:
            return False
        cut_flow_trk.Fill('DR separation')

        if self.hfunc['subMass'](row, 1)[0] < 20: return False
        cut_flow_trk.Fill('sub mass cut')

        mu17e8, mu8e17 = False, False
        if use_iso_trigger:
            mu17e8 = row.mu17ele8isoPass and \
                row.mMatchesMu17Ele8IsoPath > 0 and \
                row.eMatchesMu17Ele8IsoPath > 0 and \
                row.mPt >= 20
            mu8e17 = row.mu8ele17isoPass and \
                row.mMatchesMu8Ele17IsoPath > 0 and \
                row.eMatchesMu8Ele17IsoPath > 0 and \
                row.ePt >= 20
        else:
            mu17e8 = row.mu17ele8Pass and \
                row.mMatchesMu17Ele8Path > 0 and \
                row.eMatchesMu17Ele8Path > 0 and \
                row.mPt >= 20
            mu8e17 = row.mu8ele17Pass and \
                row.mMatchesMu8Ele17Path > 0 and \
                row.eMatchesMu8Ele17Path > 0 and \
                row.ePt >= 20

        if not (mu17e8 or mu8e17): return False
        cut_flow_trk.Fill('trigger')

        if not selections.muSelection(row, 'm'):
            return False  #applies basic selection (eta, pt > 10, DZ, pixHits, jetBTag)
        cut_flow_trk.Fill('obj1 Presel')

        if not selections.eSelection(row, 'e'):
            return False  #applies basic selection (eta, pt > 10, DZ, missingHits, jetBTag, HasConversion and chargedIdTight)
        cut_flow_trk.Fill('obj2 Presel')

        if not selections.tauSelection(row, 't'):
            return False  #applies basic selection (eta, pt > 20, DZ)
        if row.tPt < taupt_thr: return False
        cut_flow_trk.Fill('obj3 Presel')

        if row.LT < LT_threshold: return False
        cut_flow_trk.Fill('LT')

        if row.e_m_Mass < 20: return False
        cut_flow_trk.Fill('dilepton mass cut')

        if not selections.vetos(row, cut_flow_trk):
            return False  #applies mu bjet e additional tau vetoes

        cut_flow_trk.Fill('charge_fakes')  #no charge fakes here

        return True