예제 #1
0
 def passedFilter(self, cutter):
     if not self.initEvent(cutter): return False
     applyConeCorrection(self.chain, self.new_chain)
     if self.new_chain.l_flavor.count(1) == 0: return False
     if not cutter.cut(self.hasCorrectNumberOfFakes(),
                       'correct number of fakes'):
         return False
     return True
예제 #2
0
    def passedFilter(self,
                     cutter,
                     only_muons=False,
                     only_electrons=False,
                     require_jets=False):
        if not cutter.cut(self.chain._passMETFilters, 'pass met filters'):
            return False

        #Select exactly one lepton and veto a second loose lepton
        if not self.initEvent(cutter): return False
        if not cutter.cut(
                isGoodLightLepton(self.chain, self.chain.l_indices[0], 'FO'),
                'is FO lepton'):
            return False

        #Select correct lepton flavor
        if only_muons and only_electrons:
            raise RuntimeError(
                "passedFilter in LightLeptonFakeRateMeasurementRegion can not have both only muons and only electrons at the same time"
            )
        if only_muons and not cutter.cut(self.chain.l_flavor[0] == 1,
                                         'is muon'):
            return False
        if only_electrons and not cutter.cut(self.chain.l_flavor[0] == 0,
                                             'is electron'):
            return False

        #Require the presence of at least one good jet if option is set to True
        if require_jets:
            jet_indices = selectJets(self.chain, cleaned='loose')
            if len(jet_indices) < 1: return False

            max_delta_r = 0
            for jet in jet_indices:
                delta_r = deltaR(self.chain._jetEta[jet], self.chain.l_eta[0],
                                 self.chain._jetPhi[jet], self.chain.l_phi[0])
                if delta_r > max_delta_r:
                    max_delta_r = delta_r
            if not cutter.cut(max_delta_r > 0.7, 'contains jet'): return False

        applyConeCorrection(self.chain, self.new_chain)

        return True
예제 #3
0
    def passedFilter(self, cutter, region):
        if not self.initEvent(cutter): return False
        applyConeCorrection(self.chain, self.new_chain)
        if 'tau' in self.flavors_of_interest:
            if region != 'Mix':
                if not cutter.cut(self.chain._met < 50, 'MET>50'): return False
                if not cutter.cut(containsOSSF(self.chain), 'OSSF present'):
                    return False
                if not cutter.cut(not bVeto(self.chain), 'b-veto'):
                    return False
            else:
                if not passedFilterTauMixCT(self.chain, self.new_chain,
                                            self.is_reco_level, cutter):
                    return False

        if not cutter.cut(self.hasCorrectNumberOfFakes(),
                          'correct number of fakes'):
            return False
        # if not cutter.cut(self.chain._passMETFilters, 'pass met filters'): return False

        return True
예제 #4
0
    def passedFilter(self, cutter, only_muons=False, only_electrons=False):
        if not self.initEvent(cutter): return False
        applyConeCorrection(self.chain, self.new_chain)

        nprompt = 0
        nnonprompt = 0
        for i, l in enumerate(self.new_chain.l_indices):
            if self.chain.l_isfake[i]:
                if only_muons and self.new_chain.l_flavor[i] != 1: return False
                if only_electrons and self.new_chain.l_flavor[i] != 0:
                    return False
                nnonprompt += 1
            else:
                nprompt += 1

        if nnonprompt < 1: return False
        if nprompt + nnonprompt != 3: return False

        self.loose_leptons_of_interest = []
        for l in xrange(len(self.new_chain.l_indices)):
            if self.new_chain.l_isFO[l] and not self.new_chain.l_istight[l]:
                self.loose_leptons_of_interest.append(l)
        return True