def setSequences(process, options): process.init_sequence = cms.Sequence() if options['UseCalibEn']: process.enCalib_sequence = cms.Sequence( process.regressionApplication * process.calibratedPatElectrons * process.calibratedPatPhotons * process.selectElectronsBase * process.selectPhotonsBase) process.init_sequence += process.enCalib_sequence process.sc_sequence = cms.Sequence() if options['useAOD']: process.sc_sequence += process.sc_sequenceAOD else: process.sc_sequence += process.sc_sequenceMiniAOD process.sc_sequence += process.probeSC process.sc_sequence += process.probeSCEle import EgammaAnalysis.TnPTreeProducer.egmElectronIDModules_cff as egmEleID process.ele_sequence = egmEleID.setIDs(process, options) process.ele_sequence += cms.Sequence(process.probeEle) if options['ApplyL1Matching']: process.ele_sequence += process.goodElectronProbesL1 process.ele_sequence += process.probeEleL1matched process.tag_sequence = cms.Sequence( process.goodElectrons + process.tagEleCutBasedTight + # note: this one also gets introduced by the egmEleID.setIDs function process.tagEle) import EgammaAnalysis.TnPTreeProducer.egmPhotonIDModules_cff as egmPhoID process.pho_sequence = cms.Sequence(process.goodPhotons) process.pho_sequence += egmPhoID.setIDs(process, options) process.pho_sequence += cms.Sequence(process.probePho) process.hlt_sequence = cms.Sequence(process.hltFilter) for flag in options['HLTFILTERSTOMEASURE']: process.hlt_sequence += getattr(process, flag) if options['isMC']: process.tag_sequence += process.genEle + process.genTagEle process.ele_sequence += process.genProbeEle process.pho_sequence += process.genProbePho process.sc_sequence += process.genProbeSC process.init_sequence += process.egmGsfElectronIDSequence process.init_sequence += process.egmPhotonIDSequence process.init_sequence += process.eleVarHelper if options['addSUSY']: process.init_sequence += process.susy_sequence if options['addSUSY']: process.init_sequence += process.susy_sequence_requiresVID
def setTagsProbes(process, options): eleHLTProducer = 'PatElectronTriggerCandProducer' gamHLTProducer = 'PatPhotonTriggerCandProducer' hltObjects = 'slimmedPatTrigger' # 'selectedPatTrigger' FOR 2016 genParticles = 'prunedGenParticles' SCEleMatcher = 'PatElectronMatchedCandidateProducer' if (options['useAOD']): eleHLTProducer = 'GsfElectronTriggerCandProducer' gamHLTProducer = 'PhotonTriggerCandProducer' hltObjects = 'hltTriggerSummaryAOD' genParticles = 'genParticles' SCEleMatcher = 'GsfElectronMatchedCandidateProducer' goodPartDef.setGoodParticlesAOD( process, options ) else: goodPartDef.setGoodParticlesMiniAOD( process, options ) ####################### TAG ELECTRON ############################ process.tagEle = cms.EDProducer(eleHLTProducer, filterNames = cms.vstring(options['TnPHLTTagFilters']), inputs = cms.InputTag("tagEleCutBasedTight"), bits = cms.InputTag('TriggerResults::' + options['HLTProcessName']), objects = cms.InputTag(hltObjects), dR = cms.double(0.3), isAND = cms.bool(True) ) ##################### PROBE ELECTRONs ########################### process.probeEle = process.tagEle.clone() process.probeEle.filterNames = cms.vstring(options['TnPHLTProbeFilters']) process.probeEle.inputs = cms.InputTag("goodElectrons") ################# PROBE ELECTRONs passHLT ####################### process.probeElePassHLT = process.tagEle.clone() process.probeElePassHLT.inputs = cms.InputTag("probeEle") process.probeElePassHLT.filterNames = cms.vstring(options['HLTFILTERTOMEASURE']) process.probeElePassHLT.isAND = cms.bool(False) ###################### PROBE PHOTONs ############################ process.probePho = cms.EDProducer( gamHLTProducer, filterNames = options['TnPHLTProbeFilters'], inputs = cms.InputTag("goodPhotons"), bits = cms.InputTag('TriggerResults::' + options['HLTProcessName'] ), objects = cms.InputTag(hltObjects), dR = cms.double(0.3), isAND = cms.bool(True) ) if options['useAOD'] : process.probePho = process.goodPhotons.clone() ######################### PROBE SCs ############################# process.probeSC = cms.EDProducer("RecoEcalCandidateTriggerCandProducer", filterNames = cms.vstring(options['TnPHLTProbeFilters']), inputs = cms.InputTag("goodSuperClusters"), bits = cms.InputTag('TriggerResults::' + options['HLTProcessName']), objects = cms.InputTag(hltObjects), dR = cms.double(0.3), isAND = cms.bool(True) ) process.probeSCEle = cms.EDProducer( SCEleMatcher, src = cms.InputTag("superClusterCands"), ReferenceElectronCollection = cms.untracked.InputTag("goodElectrons"), cut = cms.string(options['SUPERCLUSTER_CUTS']) ) ########################## gen tag & probes ###################### if options['isMC'] : cut_gen_standard = 'abs(pdgId) == 11 && pt > 3 && abs(eta) < 2.7 && isPromptFinalState' cut_gen_flashgg = 'abs(pdgId) == 11 && pt > 3 && abs(eta) < 2.7 && ( isPromptFinalState || status == 23)' cut_gen_tau = 'abs(pdgId) == 11 && pt > 3 && abs(eta) < 2.7 && ( isPromptFinalState || isDirectPromptTauDecayProductFinalState) ' process.genEle = cms.EDFilter( "GenParticleSelector", src = cms.InputTag(genParticles), cut = cms.string(cut_gen_standard), ) process.genTagEle = cms.EDProducer("MCMatcher", src = cms.InputTag("tagEle"), matched = cms.InputTag("genEle"), mcStatus = cms.vint32(), mcPdgId = cms.vint32(), checkCharge = cms.bool(False), maxDeltaR = cms.double(0.20), # Minimum deltaR for the match maxDPtRel = cms.double(50.0), # Minimum deltaPt/Pt for the match resolveAmbiguities = cms.bool(False), # Forbid two RECO objects to match to the same GEN objec resolveByMatchQuality = cms.bool(True), # False = just match input in order; True = pick lowest deltaR pair first ) process.genProbeEle = process.genTagEle.clone( src = cms.InputTag("probeEle") ) process.genProbePho = process.genTagEle.clone( src = cms.InputTag("probePho") ) process.genProbeSC = process.genTagEle.clone( src = cms.InputTag("probeSC") ) ########################### TnP pairs ############################ masscut = cms.string("60<mass<120") process.tnpPairingEleHLT = cms.EDProducer("CandViewShallowCloneCombiner", decay = cms.string("tagEle@+ probeEle@-"), checkCharge = cms.bool(True), cut = masscut, ) process.tnpPairingEleRec = process.tnpPairingEleHLT.clone() process.tnpPairingEleRec.decay = cms.string("tagEle probeSC" ) process.tnpPairingEleRec.checkCharge = cms.bool(False) process.tnpPairingEleIDs = process.tnpPairingEleHLT.clone() process.tnpPairingEleIDs.decay = cms.string("tagEle probeEle") process.tnpPairingEleIDs.checkCharge = cms.bool(False) process.tnpPairingPhoIDs = process.tnpPairingEleHLT.clone() process.tnpPairingPhoIDs.decay = cms.string("tagEle probePho") process.tnpPairingPhoIDs.checkCharge = cms.bool(False) ######################## probe passing ID ########################## import EgammaAnalysis.TnPTreeProducer.egmElectronIDModules_cff as egmEleID import EgammaAnalysis.TnPTreeProducer.egmPhotonIDModules_cff as egmPhoID egmEleID.setIDs(process, options) egmPhoID.setIDs(process, options)
def setTagsProbes(process, options): eleHLTProducer = 'PatElectronTriggerCandProducer' #eleHLTProducer = 'PatElectronhltTriggerCandProducer' # for rerun with minoaod gamHLTProducer = 'PatPhotonTriggerCandProducer' hltObjects = 'slimmedPatTrigger' #hltObjects = 'hltTriggerSummaryAOD' # for rerun with miniaod genParticles = 'prunedGenParticles' SCEleMatcher = 'PatElectronMatchedCandidateProducer' if (options['useAOD']): eleHLTProducer = 'GsfElectronTriggerCandProducer' gamHLTProducer = 'PhotonTriggerCandProducer' hltObjects = 'hltTriggerSummaryAOD' genParticles = 'genParticles' SCEleMatcher = 'GsfElectronMatchedCandidateProducer' goodPartDef.setGoodParticlesAOD( process, options ) else: goodPartDef.setGoodParticlesMiniAOD( process, options ) ####################### TAG ELECTRON ############################ process.tagEle = cms.EDProducer(eleHLTProducer, filterNames = cms.vstring(options['TnPHLTTagFilters']), inputs = cms.InputTag("tagEleCutBasedTight"), bits = cms.InputTag('TriggerResults::' + options['HLTProcessName']), objects = cms.InputTag(hltObjects), dR = cms.double(0.1), isAND = cms.bool(True) ) ##################### PROBE ELECTRONs ########################### process.probeEle = process.tagEle.clone() process.probeEle.inputs = cms.InputTag("probeEleCutBasedTight94X") process.probeEle.filterNames = cms.vstring(options['TnPHLTProbeFilters']) ################# PROBE ELECTRONs passHLT ####################### process.probeElePassHLT = process.tagEle.clone() process.probeElePassHLT.inputs = cms.InputTag("probeEle") process.probeElePassHLT.isAND = cms.bool(False) #### Ele32WPTight l1tFilt_Ele32WPTight = "hltEGL1SingleEGOrFilter" l1tEtFilt_Ele32WPTight = "hltEG32L1SingleEGOrEtFilter" FilterPre_Ele32WPTight = "hltEle32WPTight" process.probeElePassL1TEle32WPTight = process.probeElePassHLT.clone() process.probeElePassL1TEle32WPTight.filterNames = cms.vstring(l1tFilt_Ele32WPTight) process.probeElePassL1TEtEle32WPTight = process.probeElePassHLT.clone() process.probeElePassL1TEtEle32WPTight.filterNames = cms.vstring(l1tEtFilt_Ele32WPTight) process.probeElePassHcalIsoEle32WPTight = process.probeElePassHLT.clone() process.probeElePassHcalIsoEle32WPTight.filterNames = cms.vstring(FilterPre_Ele32WPTight+"HcalIsoFilter") process.probeElePassPixelMatchEle32WPTight = process.probeElePassHLT.clone() process.probeElePassPixelMatchEle32WPTight.filterNames = cms.vstring(FilterPre_Ele32WPTight+"PixelMatchFilter") process.probeElePassPMS2Ele32WPTight = process.probeElePassHLT.clone() process.probeElePassPMS2Ele32WPTight.filterNames = cms.vstring(FilterPre_Ele32WPTight+"PMS2Filter") process.probeElePassGsfTrackIsoEle32WPTight = process.probeElePassHLT.clone() process.probeElePassGsfTrackIsoEle32WPTight.filterNames = cms.vstring(FilterPre_Ele32WPTight+"GsfTrackIsoFilter") #process.probeElePass_Ele32WPTight = process.probeElePassHLT.clone() #process.probeElePass_Ele32WPTight.filterNames = cms.vstring(FilterPre_Ele32WPTight+"") #### Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_v16 or v17 l1tFilt = "hltEGL1SingleAndDoubleEGOrPairFilter" #### Leg1 FilterPre = "hltEle23Ele12CaloIdLTrackIdLIsoVL" Leg1Post = "Leg1Filter" EtLeg1Filter = FilterPre + "Et" + Leg1Post ClusterShapeLeg1Filter = FilterPre + "ClusterShape" + Leg1Post HELeg1Filter = FilterPre + "HE" + Leg1Post EcalIsoLeg1Filter = FilterPre + "EcalIso" + Leg1Post HcalIsoLeg1Filter = FilterPre + "HcalIso" + Leg1Post PixelMatchLeg1Filter = FilterPre + "PixelMatch" + Leg1Post OneOEMinusOneOPLeg1Filter = FilterPre + "OneOEMinusOneOP" + Leg1Post DetaLeg1Filter = FilterPre + "Deta" + Leg1Post DphiLeg1Filter = FilterPre + "Dphi" + Leg1Post TrackIsoLeg1Filter = FilterPre + "TrackIso" + Leg1Post process.probeElePassL1T = process.probeElePassHLT.clone() process.probeElePassL1T.filterNames = cms.vstring(l1tFilt) process.probeElePassEtLeg1 = process.probeElePassHLT.clone() process.probeElePassEtLeg1.filterNames = cms.vstring(EtLeg1Filter) process.probeElePassClusterShapeLeg1 = process.probeElePassHLT.clone() process.probeElePassClusterShapeLeg1.filterNames = cms.vstring(ClusterShapeLeg1Filter) process.probeElePassHELeg1 = process.probeElePassHLT.clone() process.probeElePassHELeg1.filterNames = cms.vstring(HELeg1Filter) process.probeElePassEcalIsoLeg1 = process.probeElePassHLT.clone() process.probeElePassEcalIsoLeg1.filterNames = cms.vstring(EcalIsoLeg1Filter) process.probeElePassHcalIsoLeg1 = process.probeElePassHLT.clone() process.probeElePassHcalIsoLeg1.filterNames = cms.vstring(HcalIsoLeg1Filter) process.probeElePassPixelMatchLeg1 = process.probeElePassHLT.clone() process.probeElePassPixelMatchLeg1.filterNames = cms.vstring(PixelMatchLeg1Filter) process.probeElePassOneOEMinusOneOPLeg1 = process.probeElePassHLT.clone() process.probeElePassOneOEMinusOneOPLeg1.filterNames = cms.vstring(OneOEMinusOneOPLeg1Filter) process.probeElePassDetaLeg1 = process.probeElePassHLT.clone() process.probeElePassDetaLeg1.filterNames = cms.vstring(DetaLeg1Filter) process.probeElePassDphiLeg1 = process.probeElePassHLT.clone() process.probeElePassDphiLeg1.filterNames = cms.vstring(DphiLeg1Filter) process.probeElePassTrackIsoLeg1 = process.probeElePassHLT.clone() process.probeElePassTrackIsoLeg1.filterNames = cms.vstring(TrackIsoLeg1Filter) Leg2Post = "Leg2Filter" EtLeg2Filter = FilterPre + "Et" + Leg2Post ClusterShapeLeg2Filter = FilterPre + "ClusterShape" + Leg2Post HELeg2Filter = FilterPre + "HE" + Leg2Post EcalIsoLeg2Filter = FilterPre + "EcalIso" + Leg2Post HcalIsoLeg2Filter = FilterPre + "HcalIso" + Leg2Post PixelMatchLeg2Filter = FilterPre + "PixelMatch" + Leg2Post OneOEMinusOneOPLeg2Filter = FilterPre + "OneOEMinusOneOP" + Leg2Post DetaLeg2Filter = FilterPre + "Deta" + Leg2Post DphiLeg2Filter = FilterPre + "Dphi" + Leg2Post TrackIsoLeg2Filter = FilterPre + "TrackIso" + Leg2Post process.probeElePassEtLeg2 = process.probeElePassHLT.clone() process.probeElePassEtLeg2.filterNames = cms.vstring(EtLeg2Filter) process.probeElePassClusterShapeLeg2 = process.probeElePassHLT.clone() process.probeElePassClusterShapeLeg2.filterNames = cms.vstring(ClusterShapeLeg2Filter) process.probeElePassHELeg2 = process.probeElePassHLT.clone() process.probeElePassHELeg2.filterNames = cms.vstring(HELeg2Filter) process.probeElePassEcalIsoLeg2 = process.probeElePassHLT.clone() process.probeElePassEcalIsoLeg2.filterNames = cms.vstring(EcalIsoLeg2Filter) process.probeElePassHcalIsoLeg2 = process.probeElePassHLT.clone() process.probeElePassHcalIsoLeg2.filterNames = cms.vstring(HcalIsoLeg2Filter) process.probeElePassPixelMatchLeg2 = process.probeElePassHLT.clone() process.probeElePassPixelMatchLeg2.filterNames = cms.vstring(PixelMatchLeg2Filter) process.probeElePassOneOEMinusOneOPLeg2 = process.probeElePassHLT.clone() process.probeElePassOneOEMinusOneOPLeg2.filterNames = cms.vstring(OneOEMinusOneOPLeg2Filter) process.probeElePassDetaLeg2 = process.probeElePassHLT.clone() process.probeElePassDetaLeg2.filterNames = cms.vstring(DetaLeg2Filter) process.probeElePassDphiLeg2 = process.probeElePassHLT.clone() process.probeElePassDphiLeg2.filterNames = cms.vstring(DphiLeg2Filter) process.probeElePassTrackIsoLeg2 = process.probeElePassHLT.clone() process.probeElePassTrackIsoLeg2.filterNames = cms.vstring(TrackIsoLeg2Filter) #### DoubleEle33 process.probeElePassPMS2UnseededFilterDouble33 = process.probeElePassHLT.clone() process.probeElePassPMS2UnseededFilterDouble33.filterNames = cms.vstring("hltDiEle33CaloIdLMWPMS2UnseededFilter") process.probeElePassPMS2SeededFilterDouble33 = process.probeElePassHLT.clone() process.probeElePassPMS2SeededFilterDouble33.filterNames = cms.vstring("hltEle33CaloIdLMWPMS2Filter") ### To be adapted for AOD too #process.ele27erObj = cms.EDFilter('PATTriggerObjectStandAloneSelector', # src = cms.InputTag('selectedPatTrigger'), # cut = cms.string('abs(eta) < 2.17') # ) ###################### PROBE PHOTONs ############################ process.probePho = cms.EDProducer( gamHLTProducer, filterNames = options['TnPHLTProbeFilters'], inputs = cms.InputTag("goodPhotons"), bits = cms.InputTag('TriggerResults::' + options['HLTProcessName'] ), objects = cms.InputTag(hltObjects), dR = cms.double(0.3), isAND = cms.bool(True) ) if options['useAOD'] : process.probePho = process.goodPhotons.clone() ######################### PROBE SCs ############################# process.probeSC = cms.EDProducer("RecoEcalCandidateTriggerCandProducer", filterNames = cms.vstring(options['TnPHLTProbeFilters']), inputs = cms.InputTag("goodSuperClusters"), bits = cms.InputTag('TriggerResults::' + options['HLTProcessName']), objects = cms.InputTag(hltObjects), dR = cms.double(0.3), isAND = cms.bool(True) ) process.probeSCEle = cms.EDProducer( SCEleMatcher, src = cms.InputTag("superClusterCands"), ReferenceElectronCollection = cms.untracked.InputTag("goodElectrons"), cut = cms.string(options['SUPERCLUSTER_CUTS']) ) ########################## gen tag & probes ###################### if options['isMC'] : cut_gen_standard = 'abs(pdgId) == 11 && pt > 3 && abs(eta) < 2.7 && isPromptFinalState' cut_gen_flashgg = 'abs(pdgId) == 11 && pt > 3 && abs(eta) < 2.7 && ( isPromptFinalState || status == 23)' cut_gen_tau = 'abs(pdgId) == 11 && pt > 3 && abs(eta) < 2.7 && ( isPromptFinalState || isDirectPromptTauDecayProductFinalState) ' process.genEle = cms.EDFilter( "GenParticleSelector", src = cms.InputTag(genParticles), cut = cms.string(cut_gen_standard), ) process.genTagEle = cms.EDProducer("MCMatcher", src = cms.InputTag("tagEle"), matched = cms.InputTag("genEle"), mcStatus = cms.vint32(), mcPdgId = cms.vint32(), checkCharge = cms.bool(False), maxDeltaR = cms.double(0.20), # Minimum deltaR for the match maxDPtRel = cms.double(50.0), # Minimum deltaPt/Pt for the match resolveAmbiguities = cms.bool(False), # Forbid two RECO objects to match to the same GEN objec resolveByMatchQuality = cms.bool(True), # False = just match input in order; True = pick lowest deltaR pair first ) process.genProbeEle = process.genTagEle.clone( src = cms.InputTag("probeEle") ) process.genProbePho = process.genTagEle.clone( src = cms.InputTag("probePho") ) process.genProbeSC = process.genTagEle.clone( src = cms.InputTag("probeSC") ) ########################### TnP pairs ############################ masscut = cms.string("50<mass<130") process.tnpPairingEleHLT = cms.EDProducer("CandViewShallowCloneCombiner", decay = cms.string("tagEle@+ probeEle@-"), checkCharge = cms.bool(True), cut = masscut, ) process.tnpPairingEleRec = process.tnpPairingEleHLT.clone() process.tnpPairingEleRec.decay = cms.string("tagEle probeSC" ) process.tnpPairingEleRec.checkCharge = cms.bool(False) process.tnpPairingEleIDs = process.tnpPairingEleHLT.clone() process.tnpPairingEleIDs.decay = cms.string("tagEle probeEle") process.tnpPairingEleIDs.checkCharge = cms.bool(False) process.tnpPairingPhoIDs = process.tnpPairingEleHLT.clone() process.tnpPairingPhoIDs.decay = cms.string("tagEle probePho") process.tnpPairingPhoIDs.checkCharge = cms.bool(False) ######################## probe passing ID ########################## import EgammaAnalysis.TnPTreeProducer.egmElectronIDModules_cff as egmEleID import EgammaAnalysis.TnPTreeProducer.egmPhotonIDModules_cff as egmPhoID egmEleID.setIDs(process, options) egmPhoID.setIDs(process, options)