1 import FWCore.ParameterSet.Config
as cms
2 from Configuration.Eras.Modifier_run2_HLTconditions_2016_cff
import run2_HLTconditions_2016
3 from Configuration.Eras.Modifier_run2_HLTconditions_2017_cff
import run2_HLTconditions_2017
4 from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff
import run2_miniAOD_80XLegacy
8 unpackedPatTrigger = cms.EDProducer(
"PATTriggerObjectStandAloneUnpacker",
9 patTriggerObjectsStandAlone = cms.InputTag(
'slimmedPatTrigger'),
10 triggerResults = cms.InputTag(
'TriggerResults::HLT'),
11 unpackFilterLabels = cms.bool(
True)
14 run2_miniAOD_80XLegacy.toModify(
16 patTriggerObjectsStandAlone =
"selectedPatTrigger",
17 unpackFilterLabels =
False 20 triggerObjectTable = cms.EDProducer(
"TriggerObjectTableProducer",
21 name= cms.string(
"TrigObj"),
22 src = cms.InputTag(
"unpackedPatTrigger"),
23 l1EG = cms.InputTag(
"caloStage2Digis",
"EGamma"),
24 l1Sum = cms.InputTag(
"caloStage2Digis",
"EtSum"),
25 l1Jet = cms.InputTag(
"caloStage2Digis",
"Jet"),
26 l1Muon = cms.InputTag(
"gmtStage2Digis",
"Muon"),
27 l1Tau = cms.InputTag(
"caloStage2Digis",
"Tau"),
28 selections = cms.VPSet(
30 name = cms.string(
"Electron (PixelMatched e/gamma)"),
32 sel = cms.string(
"type(92) && pt > 7 && coll('hltEgammaCandidates') && filter('*PixelMatchFilter')"),
33 l1seed = cms.string(
"type(-98)"), l1deltaR = cms.double(0.3),
35 qualityBits = cms.string(
36 "filter('*CaloIdLTrackIdLIsoVL*TrackIso*Filter') + " \
37 "2*filter('hltEle*WPTight*TrackIsoFilter*') + " \
38 "4*filter('hltEle*WPLoose*TrackIsoFilter') + " \
39 "8*filter('*OverlapFilterIsoEle*PFTau*') + " \
40 "16*filter('hltEle*Ele*CaloIdLTrackIdLIsoVL*Filter') + " \
41 "32*filter('hltMu*TrkIsoVVL*Ele*CaloIdLTrackIdLIsoVL*Filter*') + " \
42 "64*filter('hltOverlapFilterIsoEle*PFTau*') + " \
43 "128*filter('hltEle*Ele*Ele*CaloIdLTrackIdLDphiLeg*Filter') + " \
44 "256*max(filter('hltL3fL1Mu*DoubleEG*Filtered*'),filter('hltMu*DiEle*CaloIdLTrackIdLElectronleg*Filter')) + " \
45 "512*max(filter('hltL3fL1DoubleMu*EG*Filter*'),filter('hltDiMu*Ele*CaloIdLTrackIdLElectronleg*Filter')) + " \
46 "1024*min(filter('hltEle32L1DoubleEGWPTightGsfTrackIsoFilter'),filter('hltEGL1SingleEGOrFilter'))"),
47 qualityBitsDoc = cms.string(
"1 = CaloIdL_TrackIdL_IsoVL, 2 = 1e (WPTight), 4 = 1e (WPLoose), 8 = OverlapFilter PFTau, 16 = 2e, 32 = 1e-1mu, 64 = 1e-1tau, 128 = 3e, 256 = 2e-1mu, 512 = 1e-2mu, 1024 = 1e (32_L1DoubleEG_AND_L1SingleEGOr)"),
50 name = cms.string(
"Photon (PixelMatch-vetoed e/gamma)"),
52 sel = cms.string(
"type(92) && pt > 20 && coll('hltEgammaCandidates') && !filter('*PixelMatchFilter')"),
53 l1seed = cms.string(
"type(-98)"), l1deltaR = cms.double(0.3),
55 qualityBits = cms.string(
"0"), qualityBitsDoc = cms.string(
""),
58 name = cms.string(
"Muon"),
60 sel = cms.string(
"type(83) && pt > 5 && coll('hltIterL3MuonCandidates')"),
61 l1seed = cms.string(
"type(-81)"), l1deltaR = cms.double(0.5),
62 l2seed = cms.string(
"type(83) && coll('hltL2MuonCandidates')"), l2deltaR = cms.double(0.3),
63 qualityBits = cms.string(
64 "filter('*RelTrkIsoVVLFiltered0p4') + " \
65 "2*filter('hltL3crIso*Filtered0p07') + " \
66 "4*filter('*OverlapFilterIsoMu*PFTau*') + " \
67 "8*max(filter('hltL3crIsoL1*SingleMu*Filtered0p07'),filter('hltL3crIsoL1sMu*Filtered0p07')) + " \
68 "16*filter('hltDiMuon*Filtered*') + " \
69 "32*filter('hltMu*TrkIsoVVL*Ele*CaloIdLTrackIdLIsoVL*Filter*') + " \
70 "64*filter('hltOverlapFilterIsoMu*PFTau*') + " \
71 "128*filter('hltL3fL1TripleMu*') + " \
72 "256*max(filter('hltL3fL1DoubleMu*EG*Filtered*'),filter('hltDiMu*Ele*CaloIdLTrackIdLElectronleg*Filter')) + " \
73 "512*max(filter('hltL3fL1Mu*DoubleEG*Filtered*'),filter('hltMu*DiEle*CaloIdLTrackIdLElectronleg*Filter'))"),
74 qualityBitsDoc = cms.string(
"1 = TrkIsoVVL, 2 = Iso, 4 = OverlapFilter PFTau, 8 = 1mu, 16 = 2mu, 32 = 1mu-1e, 64 = 1mu-1tau, 128 = 3mu, 256 = 2mu-1e, 512 =1mu-2e"),
77 name = cms.string(
"Tau"),
79 sel = cms.string(
"type(84) && pt > 5 && coll('*Tau*') && ( filter('*LooseChargedIso*') || filter('*MediumChargedIso*') || filter('*TightChargedIso*') || filter('*TightOOSCPhotons*') || filter('hltL2TauIsoFilter') || filter('*OverlapFilterIsoMu*') || filter('*OverlapFilterIsoEle*') || filter('*L1HLTMatched*') || filter('*Dz02*') )"),
80 l1seed = cms.string(
"type(-100)"), l1deltaR = cms.double(0.3),
81 l2seed = cms.string(
"type(84) && coll('hltL2TauJetsL1IsoTauSeeded')"), l2deltaR = cms.double(0.3),
82 qualityBits = cms.string(
83 "filter('*LooseChargedIso*') + " \
84 "2*filter('*MediumChargedIso*') + " \
85 "4*filter('*TightChargedIso*') + " \
86 "8*filter('*TightOOSCPhotons*') + " \
87 "16*filter('*Hps*') + " \
88 "32*filter('hltSelectedPFTau*MediumChargedIsolationL1HLTMatched*') + " \
89 "64*filter('hltDoublePFTau*TrackPt1*ChargedIsolation*Dz02Reg') + " \
90 "128*filter('hltOverlapFilterIsoEle*PFTau*') + " \
91 "256*filter('hltOverlapFilterIsoMu*PFTau*') + " \
92 "512*filter('hltDoublePFTau*TrackPt1*ChargedIsolation*')"),
93 qualityBitsDoc = cms.string(
"1 = LooseChargedIso, 2 = MediumChargedIso, 4 = TightChargedIso, 8 = TightID OOSC photons, 16 = HPS, 32 = single-tau + tau+MET, 64 = di-tau, 128 = e-tau, 256 = mu-tau, 512 = VBF+di-tau"),
96 name = cms.string(
"Jet"),
98 sel = cms.string(
"type(85) && pt > 30 && (coll('hltAK4PFJetsCorrected') || coll('hltMatchedVBF*PFJets*PFTau*OverlapRemoval'))"),
99 l1seed = cms.string(
"type(-99)"), l1deltaR = cms.double(0.3),
100 l2seed = cms.string(
"type(85) && coll('hltAK4CaloJetsCorrectedIDPassed')"), l2deltaR = cms.double(0.3),
101 qualityBits = cms.string(
"filter('*CrossCleaned*LooseChargedIsoPFTau*')"), qualityBitsDoc = cms.string(
"1 = VBF cross-cleaned from loose iso PFTau"),
104 name = cms.string(
"FatJet"),
106 sel = cms.string(
"type(85) && pt > 120 && coll('hltAK8PFJetsCorrected')"),
107 l1seed = cms.string(
"type(-99)"), l1deltaR = cms.double(0.3),
108 l2seed = cms.string(
"type(85) && coll('hltAK8CaloJetsCorrectedIDPassed')"), l2deltaR = cms.double(0.3),
109 qualityBits = cms.string(
"0"), qualityBitsDoc = cms.string(
""),
112 name = cms.string(
"MET"),
114 sel = cms.string(
"type(87) && pt > 30 && coll('hltPFMETProducer')"),
115 l1seed = cms.string(
"type(-87) && coll('L1ETM')"), l1deltaR = cms.double(9999),
116 l1seed_2 = cms.string(
"type(-87) && coll('L1ETMHF')"), l1deltaR_2 = cms.double(9999),
117 l2seed = cms.string(
"type( 87) && coll('hltMetClean')"), l2deltaR = cms.double(9999),
118 qualityBits = cms.string(
"0"), qualityBitsDoc = cms.string(
""),
121 name = cms.string(
"HT"),
123 sel = cms.string(
"type(89) && pt > 100 && coll('hltPFHTJet30')"),
124 l1seed = cms.string(
"type(-89) && coll('L1HTT')"), l1deltaR = cms.double(9999),
125 l1seed_2 = cms.string(
"type(-89) && coll('L1HTTHF')"), l1deltaR_2 = cms.double(9999),
127 qualityBits = cms.string(
"0"), qualityBitsDoc = cms.string(
""),
130 name = cms.string(
"MHT"),
132 sel = cms.string(
"type(90) && pt > 30 && coll('hltPFMHTTightID')"),
133 l1seed = cms.string(
"type(-90) && coll('L1HTM')"), l1deltaR = cms.double(9999),
134 l1seed_2 = cms.string(
"type(-90) && coll('L1HTMHF')"), l1deltaR_2 = cms.double(9999),
136 qualityBits = cms.string(
"0"), qualityBitsDoc = cms.string(
""),
145 selections2016 = copy.deepcopy(triggerObjectTable.selections)
146 for sel
in selections2016:
148 sel.sel = cms.string(
"type(83) && pt > 5 && (coll('hlt*L3MuonCandidates') || coll('hlt*TkMuonCands') || coll('hlt*TrkMuonCands'))")
149 sel.qualityBits = cms.string(
"filter('*RelTrkIso*Filtered0p4') + 2*filter('hltL3cr*IsoFiltered0p09') + 4*filter('*OverlapFilter*IsoMu*PFTau*') + 8*filter('hltL3f*IsoFiltered0p09')")
150 sel.qualityBitsDoc = cms.string(
"1 = TrkIsoVVL, 2 = Iso, 4 = OverlapFilter PFTau, 8 = IsoTkMu")
151 elif sel.name==
'Tau':
152 sel.sel = cms.string(
"type(84) && pt > 5 && coll('*Tau*') && ( filter('*LooseIso*') || filter('*MediumIso*') || filter('*MediumComb*Iso*') || filter('hltL2TauIsoFilter') || filter('*OverlapFilter*IsoMu*') || filter('*OverlapFilter*IsoEle*') || filter('*L1HLTMatched*') || filter('*Dz02*') )")
153 sel.qualityBits = cms.string(
"(filter('*LooseIso*')-filter('*VLooseIso*'))+2*filter('*Medium*Iso*')+4*filter('*VLooseIso*')+8*0+16*filter('hltL2TauIsoFilter')+32*filter('*OverlapFilter*IsoMu*')+64*filter('*OverlapFilter*IsoEle*')+128*filter('*L1HLTMatched*')+256*filter('*Dz02*')")
154 sel.qualityBitsDoc = cms.string(
"1 = LooseIso, 2 = Medium(Comb)Iso, 4 = VLooseIso, 8 = None, 16 = L2p5 pixel iso, 32 = OverlapFilter IsoMu, 64 = OverlapFilter IsoEle, 128 = L1-HLT matched, 256 = Dz")
155 elif sel.name==
'Electron (PixelMatched e/gamma)':
157 sel.qualityBits = cms.string(
"filter('*CaloIdLTrackIdLIsoVL*TrackIso*Filter') + 2*filter('hltEle*WPTight*TrackIsoFilter*') + 4*filter('hltEle*WPLoose*TrackIsoFilter') + 8*filter('*OverlapFilter*IsoEle*PFTau*')")
160 run2_HLTconditions_2016.toModify(
162 selections = selections2016
165 from PhysicsTools.PatUtils.L1ECALPrefiringWeightProducer_cff
import prefiringweight
166 run2_HLTconditions_2016.toModify(prefiringweight, DataEra = cms.string(
"2016BtoH"))
168 l1PreFiringEventWeightTable = cms.EDProducer(
"GlobalVariablesTableProducer",
169 variables = cms.PSet(
170 L1PreFiringWeight_Nom =
ExtVar(cms.InputTag(
"prefiringweight:nonPrefiringProb"),
"double", doc =
"L1 pre-firing event correction weight (1-probability)", precision=8),
171 L1PreFiringWeight_Up =
ExtVar(cms.InputTag(
"prefiringweight:nonPrefiringProbUp"),
"double", doc =
"L1 pre-firing event correction weight (1-probability), up var.", precision=8),
172 L1PreFiringWeight_Dn =
ExtVar(cms.InputTag(
"prefiringweight:nonPrefiringProbDown"),
"double", doc =
"L1 pre-firing event correction weight (1-probability), down var.", precision=8),
176 triggerObjectTables = cms.Sequence( unpackedPatTrigger + triggerObjectTable )
178 _triggerObjectTables_withL1PreFiring = triggerObjectTables.copy()
179 _triggerObjectTables_withL1PreFiring.replace(triggerObjectTable, prefiringweight + l1PreFiringEventWeightTable + triggerObjectTable)
180 (run2_HLTconditions_2016 | run2_HLTconditions_2017).toReplaceWith(triggerObjectTables, _triggerObjectTables_withL1PreFiring)
def ExtVar(tag, valtype, compression=None, doc=None, mcOnly=False, precision=-1)