Example #1
0
    def __init__(self,
                 data,
                 loose_id,
                 tight_id,
                 trigger_bits = (
                     "HLT_Ele10_LW_L1R", # run < 140041
                     "HLT_Ele15_SW_L1R", # run <= 143962
                     "HLT_Ele15_SW_CaloEleId_L1R", # run <= 146427
                     "HLT_Ele17_SW_CaloEleId_L1R", # run <= 147116
                     "HLT_Ele17_SW_TightEleId_L1R", # run <= 148818
                     "HLT_Ele22_SW_TighterEleId_L1R_v2", # run <= 149180
                     "HLT_Ele22_SW_TighterEleId_L1R_v3" # run >= 149181
                     ),
                 pf_mht = True,
                 mht_cuts = [50, 75, 100 ],
                 met_cuts = [10, 20, 30, 40],
                 mt_cuts = [30, 50, 70],
                 lepton_type = "Electron",
                 ele_jet_dr = 0.3,
                 lep_ptcut = 25.,
                 name = "eWPol",
		 ignore_gen = False,
                 event_no_dump = True
                 ):
        self.name = name
        self.jet_dr = wpol.EleJetDRFilter(ele_jet_dr)
        self.loose_ele_id = wpol.CustomEleId(loose_id.ps())
        self.tight_ele_id = wpol.CustomEleId(tight_id.ps())
        self.lep_pt_cut = lep_ptcut
        self.pol_plots_cfg = PSet(
            DoGen = not (data or ignore_gen),
            LeptonType = lepton_type,
            METThreshold = 40.,
            NLeptons = 1
            )
        self.ops = []
        # Basic event selection
        triggers = PSet(Triggers=trigger_bits)
        self.ops.append(("basic_plots_pretrig",
                         wpol.eWPolBasicPlots("eWPolBasicPlots_PreTrigger",
                                              self.pol_plots_cfg.ps())))
        self.ops.append(("trigger", fwk.OP_MultiTrigger(
            triggers.ps()
            )))
        self.ops.append(("basic_plots_posttrig",
                         wpol.eWPolBasicPlots("eWPolBasicPlots_PostTrigger",
                                              self.pol_plots_cfg.ps())))
        self.ops.append(("good_events", fwk.OP_GoodEventSelection()))
        # Basic object cuts
        self.ops.append(("datamc_one_ele", wpol.DataMCPlots("RECO_DataMCPlots_OneEle")))
        self.ops.append(("one_ele", fwk.OP_NumComElectrons("==", 1)))
        self.ops.append(("basic_plots_gteqoneele",
                         wpol.eWPolBasicPlots("eWPolBasicPlots_GTEQOneEle",
                                              self.pol_plots_cfg.ps())))
        self.ops.append(("good_ele", wpol.ApplyLeptonCut(lepton_type,
                                            lep_ptcut,
                                            self.tight_ele_id,
                                            1,
                                            True)))
        self.ops.append(("datamc_one_wp70_ele", wpol.DataMCPlots("RECO_DataMCPlots_OneWP70Ele")))
        self.ops.append(("three_charge", wpol.ChargeAgreement()))
        self.ops.append(("basic_plots_oneele",
                         wpol.eWPolBasicPlots("eWPolBasicPlots_OneEle",
                                              self.pol_plots_cfg.ps())))
        # self.ops.append(("z_mass", wpol.MassWindowCut(lepton_type,
        #                                     PSet( MassLower = 76.,
        #                                           MassUpper = 106.,
        #                                           MatchCharge = True,
        #                                           NetCharge = 0).ps() )))
        self.ops.append(("zero_mu", fwk.OP_NumComMuons("==", 0)))
        self.ops.append(("lt4_jets", fwk.OP_NumComJets("<", 4)))
        self.ops.append(("pol_plots_premht", wpol.RECO_ElPolPlots(
            "RECO_ElPolPlots_PreMHT",
            self.pol_plots_cfg.ps())))

# Pre MHT Cut

        self.ops.append(("basic_plots_premht",
                         wpol.eWPolBasicPlots("eWPolBasicPlots_PreMHT",
                                              self.pol_plots_cfg.ps())))

        # self.ops.append(("datamc_plots_premht", wpol.DataMCPlots(
        #     "RECO_DataMCPlots_PreMHT2")))

        # MHT Cuts and plots
        self.mht_cuts = {}
        self.pol_plots = {}
        self.datamc_plots = {}
        for mht in mht_cuts:
            if pf_mht:
                self.mht_cuts[mht] = wpol.OP_PFMHTCut(mht)
            else:
                self.mht_cuts[mht] = fwk.RECO_CommonMHTCut(mht)
            self.pol_plots["mht%d" % mht] = wpol.RECO_ElPolPlots(
                "RECO_ElPolPlots_PostMHT%d" % mht,
                self.pol_plots_cfg.ps())
            self.datamc_plots["mht%d" % mht] = wpol.DataMCPlots(
                "RECO_DataMCPlots_PostMHT%d" % mht)

        # MET Cuts and plots

        self.met_cuts = {}
        for mht in mht_cuts:
            for met in met_cuts:
                self.met_cuts[(mht, met)] = fwk.OP_PFMETCut(met)
                self.pol_plots["mht%d_met%d" % (mht, met)] = wpol.RECO_ElPolPlots(
                    "RECO_ElPolPlots_PostMHT%dMET%d" % (mht, met),
                    self.pol_plots_cfg.ps())

        # MT Cuts and plots
        self.mt_cuts = {}
        for mht in mht_cuts:
            for mt in mt_cuts:
                self.mt_cuts[(mht, mt)] = wpol.ePFMTCut(lepton_type, mt)
                self.pol_plots["mht%d_mt%d" % (mht, mt)] = wpol.RECO_ElPolPlots(
                    "RECO_ElPolPlots_PostMHT%dMT%d" % (mht, mt),
                    self.pol_plots_cfg.ps())
		self.datamc_plots["mht%d_mt%d" % (mht, mt)] = wpol.DataMCPlots(
		    "RECO_DataMCPlots_PostMHT%dMT%d" % (mht, mt))
        self.cuts = {}
        self.tree = fwk.Tree(self.name)
        if event_no_dump:
            self.event_no_dump = wpol.EventNoDump("EventNoDump_MT50", "event_no")
                "HLT_Ele15_SW_CaloEleId_L1R",
                "HLT_Ele17_SW_CaloEleId_L1R",
                "HLT_Ele17_SW_TightEleId_L1R",
                "HLT_Ele22_SW_TighterEleId_L1R_v2",
                "HLT_Ele22_SW_TighterEleId_L1R_v3"
                )
triggers = PSet(Triggers=trigger_bits)

trig = fwk.OP_MultiTrigger(triggers.ps())
goodevents = fwk.OP_GoodEventSelection()
oneeli = fwk.OP_NumComElectrons("==", 1)
onetighteli = wpol.ApplyLeptonCut("Electron", 25., tight_ele_id, 1, True)
threecharge = wpol.ChargeAgreement()
nomuons = fwk.OP_NumComMuons("==",0)
numjets = fwk.OP_NumComJets("<", 4)
mtcut = wpol.ePFMTCut("Electron", 50)
ptwcut = wpol.OP_PFMHTCut(50)

isolationID = wpol.DebugElectronID(0, tight_id.ps())
hoeID = wpol.DebugElectronID(1, tight_id.ps())
deltaetaID = wpol.DebugElectronID(2, tight_id.ps())
deltaphiID = wpol.DebugElectronID(3, tight_id.ps())
sigmaietaietaID = wpol.DebugElectronID(4, tight_id.ps())
conversionID = wpol.DebugElectronID(5, tight_id.ps())

t.Attach(myEventNoDump01)
t.TAttach(myEventNoDump01, trig)
t.TAttach(trig, myEventNoDump02)
t.TAttach(myEventNoDump02, goodevents)
t.TAttach(goodevents, myEventNoDump03)
t.TAttach(myEventNoDump03, oneeli)