Exemplo n.º 1
0
 def event_weight(self, row):
     if row.run > 2:  #FIXME! add tight ID correction
         return 1.
     return self.pucorrector(row.nTruePU) * \
             mcCorrectors.get_electron_corrections(row,'e2') *\
             mcCorrectors.electron_tight_corrections(row.e1Pt, row.e1AbsEta) *\
             mcCorrectors.double_electron_trigger(row)
Exemplo n.º 2
0
        def fill_histos(dirname, row, weight):
            mass = frfits.default_scaler(row.e1_e2_Mass) if "charge_weight" in dirname else row.e1_e2_Mass
            mass_up = frfits.default_scaler_up(row.e1_e2_Mass) if "charge_weight" in dirname else row.e1_e2_Mass
            mass_dw = frfits.default_scaler_down(row.e1_e2_Mass) if "charge_weight" in dirname else row.e1_e2_Mass

            histos[dirname]['ePt'     ].Fill(row.e1Pt,weight)
            histos[dirname]['eAbsEta' ].Fill(row.e1AbsEta,weight)
            histos[dirname]['SCEnergy'].Fill(row.e1SCEnergy,weight)
            histos[dirname]['ePt'     ].Fill(row.e2Pt,weight)
            histos[dirname]['eAbsEta' ].Fill(row.e2AbsEta,weight)
            histos[dirname]['SCEnergy'].Fill(row.e2SCEnergy,weight)
            histos[dirname]['TrkMass' ].Fill(mass, weight)
            histos[dirname]['TrkMass_low' ].Fill(mass_dw, weight)
            histos[dirname]['TrkMass_high' ].Fill(mass_up, weight)
            #histos[dirname]['SCMass'  ].Fill(sc_inv_mass(row),weight)
            histos[dirname]["e1Pt"    ].Fill(row.e1Pt,weight)
            histos[dirname]["e2Pt"    ].Fill(row.e2Pt,weight)
            histos[dirname]["e1AbsEta"].Fill(row.e1AbsEta,weight)
            histos[dirname]["e2AbsEta"].Fill(row.e2AbsEta,weight)
            histos[dirname]['TrkMass_NOSCALE'].Fill(row.e1_e2_Mass, weight)
            histos[dirname]['TrkMass_NoWeight'].Fill(row.e1_e2_Mass)
            histos[dirname]['type1_pfMetEt'].Fill(row.type1_pfMetEt, weight)
            histos[dirname]['mva_metEt'].Fill(row.mva_metEt, weight)
            if row.run < 2:
                histos[dirname]["trig_weight" ].Fill( self.pucorrector(row.nTruePU) )
                histos[dirname]["PU_weight"   ].Fill( mcCorrectors.get_electron_corrections(row,'e1','e2') )
                histos[dirname]["idIso_weight"].Fill( mcCorrectors.double_electron_trigger(row) )
Exemplo n.º 3
0
 def event_weight(self, row):
     if row.run > 2: #FIXME! add tight ID correction
         return 1.
     return self.pucorrector(row.nTruePU) * \
             mcCorrectors.get_electron_corrections(row,'e2') *\
             mcCorrectors.electron_tight_corrections(row.e1Pt, row.e1AbsEta) *\
             mcCorrectors.double_electron_trigger(row)
Exemplo n.º 4
0
 def mc_weight(self, row):
     if row.run > 2:
         return 1.
     else:
         return self.pucorrector(row.nTruePU) * \
             mcCorrectors.get_electron_corrections(row,'e2') *\
             mcCorrectors.electron_tight_corrections(row.e1Pt, row.e1AbsEta) *\
             mcCorrectors.double_electron_trigger(row)
Exemplo n.º 5
0
 def mc_weight(self, row):
     if row.run > 2:
         return 1.
     else:
         return self.pucorrector(row.nTruePU) * \
             mcCorrectors.get_electron_corrections(row,'e2') *\
             mcCorrectors.electron_tight_corrections(row.e1Pt, row.e1AbsEta) *\
             mcCorrectors.double_electron_trigger(row)
Exemplo n.º 6
0
    def process(self):

        def preselection(row):
            if not row.doubleEPass:  return False
            if not (row.e1MatchesDoubleEPath > 0 and \
                    row.e2MatchesDoubleEPath > 0): return False 
            if row.e1Pt < 20:        return False
            if not selections.eSelection(row, 'e1'): return False
            if not selections.eSelection(row, 'e2'): return False
            if any([ row.muVetoPt5,
                      row.tauVetoPt20,
                      row.eVetoCicTightIso]):        return False
            if not (row.jetVeto40 >= 1):             return False
            if row.e1_e2_Mass < 40: return False
            return True

        histos = self.histograms
        pucorrector = self.pucorrector
        for row in self.tree:
            if not preselection(row):
                continue

            evt_weight = pucorrector(row.nTruePU) * \
                mcCorrectors.get_electron_corrections(row,'e1','e2') *\
                mcCorrectors.double_electron_trigger(row)
            for iso_label in lep_id:
                if not selections.lepton_id_iso(row, 'e1', iso_label):
                    continue
                if not selections.lepton_id_iso(row, 'e2', iso_label):
                    continue
                folder = '%s' % iso_label
                
                if row.e1GenPdgId != -999 and row.e2GenPdgId != -999:
                    if row.e1_e2_SS:
                        histos['%s/ss_trkMass' % folder].Fill(row.e1_e2_Mass, evt_weight)
                    else:
                        histos['%s/os_trkMass' % folder].Fill(row.e1_e2_Mass, evt_weight)
                        
                for el in ['e1','e2']:
                    pdgid = getattr(row, name_mapping(el,'GenPdgId'))
                    if pdgid != -999:
                        eta    = getattr(row, name_mapping(el,'AbsEta') )
                        pt     = getattr(row, name_mapping(el,'Pt') )
                        charge = getattr(row, name_mapping(el,'Charge') )
                        if eta < barrelThr:
                            histos['%s/pt_in_barrel' % folder].Fill(pt, evt_weight)
                        elif eta < accThr:
                            histos['%s/pt_in_endcap' % folder].Fill(pt, evt_weight)
                        histos['%s/matched_electrons' % folder].Fill( eta, pt, evt_weight)
                        single_hist = '%s/matched_%s'  % (folder, el)
                        histos[single_hist].Fill( eta, pt, evt_weight)
                        if charge*(11) == pdgid: ##e- --> -11; e+ --> 11 MISMEASURED ELECTRON
                            single_hist = '%s/flipped_%s' % (folder, el)
                            histos[single_hist].Fill( eta, pt, evt_weight)
                            histos['%s/flipped_electrons' % folder].Fill( eta, pt, evt_weight )
Exemplo n.º 7
0
        def fill_histos(dirname, row, weight):
            mass = frfits.default_scaler(
                row.e1_e2_Mass
            ) if "charge_weight" in dirname else row.e1_e2_Mass
            mass_up = frfits.default_scaler_up(
                row.e1_e2_Mass
            ) if "charge_weight" in dirname else row.e1_e2_Mass
            mass_dw = frfits.default_scaler_down(
                row.e1_e2_Mass
            ) if "charge_weight" in dirname else row.e1_e2_Mass

            histos[dirname]['ePt'].Fill(row.e1Pt, weight)
            histos[dirname]['eAbsEta'].Fill(row.e1AbsEta, weight)
            histos[dirname]['SCEnergy'].Fill(row.e1SCEnergy, weight)
            histos[dirname]['ePt'].Fill(row.e2Pt, weight)
            histos[dirname]['eAbsEta'].Fill(row.e2AbsEta, weight)
            histos[dirname]['SCEnergy'].Fill(row.e2SCEnergy, weight)
            histos[dirname]['TrkMass'].Fill(mass, weight)
            histos[dirname]['TrkMass_low'].Fill(mass_dw, weight)
            histos[dirname]['TrkMass_high'].Fill(mass_up, weight)
            #histos[dirname]['SCMass'  ].Fill(sc_inv_mass(row),weight)
            histos[dirname]["e1Pt"].Fill(row.e1Pt, weight)
            histos[dirname]["e2Pt"].Fill(row.e2Pt, weight)
            histos[dirname]["e1AbsEta"].Fill(row.e1AbsEta, weight)
            histos[dirname]["e2AbsEta"].Fill(row.e2AbsEta, weight)
            histos[dirname]['TrkMass_NOSCALE'].Fill(row.e1_e2_Mass, weight)
            histos[dirname]['TrkMass_NoWeight'].Fill(row.e1_e2_Mass)
            histos[dirname]['type1_pfMetEt'].Fill(row.type1_pfMetEt, weight)
            histos[dirname]['mva_metEt'].Fill(row.mva_metEt, weight)
            if row.run < 2:
                histos[dirname]["trig_weight"].Fill(
                    self.pucorrector(row.nTruePU))
                histos[dirname]["PU_weight"].Fill(
                    mcCorrectors.get_electron_corrections(row, 'e1', 'e2'))
                histos[dirname]["idIso_weight"].Fill(
                    mcCorrectors.double_electron_trigger(row))