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 skipObjectsNotPassingQualityBits = cms.bool(
True),
36 qualityBits = cms.string(
37 "filter('*CaloIdLTrackIdLIsoVL*TrackIso*Filter') + " \
38 "2*filter('hltEle*WPTight*TrackIsoFilter*') + " \
39 "4*filter('hltEle*WPLoose*TrackIsoFilter') + " \
40 "8*filter('*OverlapFilter*IsoEle*PFTau*') + " \
41 "16*filter('hltEle*Ele*CaloIdLTrackIdLIsoVL*Filter') + " \
42 "32*filter('hltMu*TrkIsoVVL*Ele*CaloIdLTrackIdLIsoVL*Filter*') + " \
43 "64*filter('hltOverlapFilterIsoEle*PFTau*') + " \
44 "128*filter('hltEle*Ele*Ele*CaloIdLTrackIdLDphiLeg*Filter') + " \
45 "256*max(filter('hltL3fL1Mu*DoubleEG*Filtered*'),filter('hltMu*DiEle*CaloIdLTrackIdLElectronleg*Filter')) + " \
46 "512*max(filter('hltL3fL1DoubleMu*EG*Filter*'),filter('hltDiMu*Ele*CaloIdLTrackIdLElectronleg*Filter')) + " \
47 "1024*min(filter('hltEle32L1DoubleEGWPTightGsfTrackIsoFilter'),filter('hltEGL1SingleEGOrFilter')) + " \
48 "2048*filter('hltEle*CaloIdVTGsfTrkIdTGsfDphiFilter') + " \
49 "4096*path('HLT_Ele*PFJet*') + " \
50 "8192*max(filter('hltEG175HEFilter'),filter('hltEG200HEFilter'))"),
51 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), 2048 = 1e (CaloIdVT_GsfTrkIdT), 4096 = 1e (PFJet), 8192 = 1e (Photon175_OR_Photon200)"),
54 name = cms.string(
"Photon (PixelMatch-vetoed e/gamma)"),
56 sel = cms.string(
"type(92) && pt > 20 && coll('hltEgammaCandidates') && !filter('*PixelMatchFilter')"),
57 l1seed = cms.string(
"type(-98)"), l1deltaR = cms.double(0.3),
59 skipObjectsNotPassingQualityBits = cms.bool(
True),
60 qualityBits = cms.string(
"0"), qualityBitsDoc = cms.string(
""),
63 name = cms.string(
"Muon"),
65 sel = cms.string(
"type(83) && pt > 5 && (coll('hltIterL3MuonCandidates') || (pt > 45 && coll('hltHighPtTkMuonCands')) || (pt > 95 && coll('hltOldL3MuonCandidates')))"),
66 l1seed = cms.string(
"type(-81)"), l1deltaR = cms.double(0.5),
67 l2seed = cms.string(
"type(83) && coll('hltL2MuonCandidates')"), l2deltaR = cms.double(0.3),
68 skipObjectsNotPassingQualityBits = cms.bool(
True),
69 qualityBits = cms.string(
70 "filter('*RelTrkIsoVVLFiltered0p4') + " \
71 "2*filter('hltL3crIso*Filtered0p07') + " \
72 "4*filter('*OverlapFilterIsoMu*PFTau*') + " \
73 "8*max(filter('hltL3crIsoL1*SingleMu*Filtered0p07'),filter('hltL3crIsoL1sMu*Filtered0p07')) + " \
74 "16*filter('hltDiMuon*Filtered*') + " \
75 "32*filter('hltMu*TrkIsoVVL*Ele*CaloIdLTrackIdLIsoVL*Filter*') + " \
76 "64*filter('hltOverlapFilterIsoMu*PFTau*') + " \
77 "128*filter('hltL3fL1TripleMu*') + " \
78 "256*max(filter('hltL3fL1DoubleMu*EG*Filtered*'),filter('hltDiMu*Ele*CaloIdLTrackIdLElectronleg*Filter')) + " \
79 "512*max(filter('hltL3fL1Mu*DoubleEG*Filtered*'),filter('hltMu*DiEle*CaloIdLTrackIdLElectronleg*Filter')) + " \
80 "1024*max(filter('hltL3fL1sMu*L3Filtered50*'),filter('hltL3fL1sMu*TkFiltered50*')) + " \
81 "2048*max(filter('hltL3fL1sMu*L3Filtered100*'),filter('hltL3fL1sMu*TkFiltered100*'))"),
82 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, 1024 = 1mu (Mu50), 2048 = 1mu (Mu100)"),
85 name = cms.string(
"Tau"),
87 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*') )"),
88 l1seed = cms.string(
"type(-100)"), l1deltaR = cms.double(0.3),
89 l2seed = cms.string(
"type(84) && coll('hltL2TauJetsL1IsoTauSeeded')"), l2deltaR = cms.double(0.3),
90 skipObjectsNotPassingQualityBits = cms.bool(
True),
91 qualityBits = cms.string(
92 "filter('*LooseChargedIso*') + " \
93 "2*filter('*MediumChargedIso*') + " \
94 "4*filter('*TightChargedIso*') + " \
95 "8*filter('*TightOOSCPhotons*') + " \
96 "16*filter('*Hps*') + " \
97 "32*filter('hltSelectedPFTau*MediumChargedIsolationL1HLTMatched*') + " \
98 "64*filter('hltDoublePFTau*TrackPt1*ChargedIsolation*Dz02Reg') + " \
99 "128*filter('hltOverlapFilterIsoEle*PFTau*') + " \
100 "256*filter('hltOverlapFilterIsoMu*PFTau*') + " \
101 "512*filter('hltDoublePFTau*TrackPt1*ChargedIsolation*')"),
102 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"),
105 name = cms.string(
"Jet"),
107 sel = cms.string(
"( type(0) || type(85) || type(86) || type(-99) )"),
108 l1seed = cms.string(
"type(-99)"), l1deltaR = cms.double(0.3),
109 l2seed = cms.string(
"type(85) || type(86) || type(-99)"), l2deltaR = cms.double(0.3),
110 skipObjectsNotPassingQualityBits = cms.bool(
True),
111 qualityBits = cms.string(
112 "1 * filter('*CrossCleaned*LooseChargedIsoPFTau*') + " \
113 "2 * filter('hltBTagCaloCSVp087Triple') + " \
114 "4 * filter('hltDoubleCentralJet90') + " \
115 "8 * filter('hltDoublePFCentralJetLooseID90') + " \
116 "16 * filter('hltL1sTripleJetVBFIorHTTIorDoubleJetCIorSingleJet') + " \
117 "32 * filter('hltQuadCentralJet30') + " \
118 "64 * filter('hltQuadPFCentralJetLooseID30') + " \
119 "128 * max(filter('hltL1sQuadJetC50IorQuadJetC60IorHTT280IorHTT300IorHTT320IorTripleJet846848VBFIorTripleJet887256VBFIorTripleJet927664VBF'), filter('hltL1sQuadJetCIorTripleJetVBFIorHTT')) + " \
120 "256 * filter('hltQuadCentralJet45') + " \
121 "512 * filter('hltQuadPFCentralJetLooseID45') + " \
122 "1024 * max(filter('hltL1sQuadJetC60IorHTT380IorHTT280QuadJetIorHTT300QuadJet'), filter('hltL1sQuadJetC50to60IorHTT280to500IorHTT250to340QuadJet')) + " \
123 "2048 * max(filter('hltBTagCaloCSVp05Double'), filter('hltBTagCaloDeepCSVp17Double')) + " \
124 "4096 * filter('hltPFCentralJetLooseIDQuad30') + " \
125 "8192 * filter('hlt1PFCentralJetLooseID75') + " \
126 "16384 * filter('hlt2PFCentralJetLooseID60') + " \
127 "32768 * filter('hlt3PFCentralJetLooseID45') + " \
128 "65536 * filter('hlt4PFCentralJetLooseID40') + " \
129 "131072 * max(filter('hltBTagPFCSVp070Triple'), max(filter('hltBTagPFDeepCSVp24Triple'), filter('hltBTagPFDeepCSV4p5Triple')) )" 131 qualityBitsDoc = cms.string(
132 "Jet bits: bit 0 for VBF cross-cleaned from loose iso PFTau, bit 1 for hltBTagCaloCSVp087Triple, bit 2 for hltDoubleCentralJet90, bit 3 for hltDoublePFCentralJetLooseID90," \
133 " bit 4 for hltL1sTripleJetVBFIorHTTIorDoubleJetCIorSingleJet, bit 5 for hltQuadCentralJet30, bit 6 for hltQuadPFCentralJetLooseID30," \
134 " bit 7 for hltL1sQuadJetC50IorQuadJetC60IorHTT280IorHTT300IorHTT320IorTripleJet846848VBFIorTripleJet887256VBFIorTripleJet927664VBF or hltL1sQuadJetCIorTripleJetVBFIorHTT," \
135 " bit 8 for hltQuadCentralJet45, bit 9 for hltQuadPFCentralJetLooseID45," \
136 " bit 10 for hltL1sQuadJetC60IorHTT380IorHTT280QuadJetIorHTT300QuadJet or hltL1sQuadJetC50to60IorHTT280to500IorHTT250to340QuadJet" \
137 " bit 11 for hltBTagCaloCSVp05Double or hltBTagCaloDeepCSVp17Double, bit 12 for hltPFCentralJetLooseIDQuad30, bit 13 for hlt1PFCentralJetLooseID75," \
138 " bit 14 for hlt2PFCentralJetLooseID60, bit 15 for hlt3PFCentralJetLooseID45, bit 16 for hlt4PFCentralJetLooseID40," \
139 " bit 17 for hltBTagPFCSVp070Triple or hltBTagPFDeepCSVp24Triple or hltBTagPFDeepCSV4p5Triple "),
142 name = cms.string(
"FatJet"),
144 sel = cms.string(
"type(85) && pt > 120 && coll('hltAK8PFJetsCorrected')"),
145 l1seed = cms.string(
"type(-99)"), l1deltaR = cms.double(0.3),
146 l2seed = cms.string(
"type(85) && coll('hltAK8CaloJetsCorrectedIDPassed')"), l2deltaR = cms.double(0.3),
147 skipObjectsNotPassingQualityBits = cms.bool(
True),
148 qualityBits = cms.string(
"0"), qualityBitsDoc = cms.string(
""),
151 name = cms.string(
"MET"),
153 sel = cms.string(
"type(87) && pt > 30 && coll('hltPFMETProducer')"),
154 l1seed = cms.string(
"type(-87) && coll('L1ETM')"), l1deltaR = cms.double(9999),
155 l1seed_2 = cms.string(
"type(-87) && coll('L1ETMHF')"), l1deltaR_2 = cms.double(9999),
156 l2seed = cms.string(
"type( 87) && coll('hltMetClean')"), l2deltaR = cms.double(9999),
157 skipObjectsNotPassingQualityBits = cms.bool(
True),
158 qualityBits = cms.string(
"0"), qualityBitsDoc = cms.string(
""),
161 name = cms.string(
"HT"),
163 sel = cms.string(
"type(89) || type(-89)"),
164 l1seed = cms.string(
"type(-89) && coll('L1HTT')"), l1deltaR = cms.double(9999),
165 l1seed_2 = cms.string(
"type(-89) && coll('L1HTTHF')"), l1deltaR_2 = cms.double(9999),
166 l2seed = cms.string(
"type(89) && coll('hltHtMhtJet30')"), l2deltaR = cms.double(9999),
167 skipObjectsNotPassingQualityBits = cms.bool(
True),
168 qualityBits = cms.string(
169 "1 * filter('hltL1sTripleJetVBFIorHTTIorDoubleJetCIorSingleJet') + " \
170 "2 * max(filter('hltL1sQuadJetC50IorQuadJetC60IorHTT280IorHTT300IorHTT320IorTripleJet846848VBFIorTripleJet887256VBFIorTripleJet927664VBF'), filter('hltL1sQuadJetCIorTripleJetVBFIorHTT')) + " \
171 "4 * max(filter('hltL1sQuadJetC60IorHTT380IorHTT280QuadJetIorHTT300QuadJet'), filter('hltL1sQuadJetC50to60IorHTT280to500IorHTT250to340QuadJet')) + " \
172 "8 * max(filter('hltCaloQuadJet30HT300'), filter('hltCaloQuadJet30HT320')) + " \
173 "16 * max(filter('hltPFCentralJetsLooseIDQuad30HT300'), filter('hltPFCentralJetsLooseIDQuad30HT330'))" 175 qualityBitsDoc = cms.string(
176 "HT bits: bit 0 for hltL1sTripleJetVBFIorHTTIorDoubleJetCIorSingleJet, bit 1 for hltL1sQuadJetC50IorQuadJetC60IorHTT280IorHTT300IorHTT320IorTripleJet846848VBFIorTripleJet887256VBFIorTripleJet927664VBF or hltL1sQuadJetCIorTripleJetVBFIorHTT, " \
177 "bit 2 for hltL1sQuadJetC60IorHTT380IorHTT280QuadJetIorHTT300QuadJet or hltL1sQuadJetC50to60IorHTT280to500IorHTT250to340QuadJet, " \
178 "bit 3 for hltCaloQuadJet30HT300 or hltCaloQuadJet30HT320, bit 4 for hltPFCentralJetsLooseIDQuad30HT300 or hltPFCentralJetsLooseIDQuad30HT330" 182 name = cms.string(
"MHT"),
184 sel = cms.string(
"type(90)"),
185 l1seed = cms.string(
"type(-90) && coll('L1HTM')"), l1deltaR = cms.double(9999),
186 l1seed_2 = cms.string(
"type(-90) && coll('L1HTMHF')"), l1deltaR_2 = cms.double(9999),
187 l2seed = cms.string(
"type(90) && coll('hltHtMhtJet30')"), l2deltaR = cms.double(9999),
188 skipObjectsNotPassingQualityBits = cms.bool(
True),
189 qualityBits = cms.string(
190 "1 * max(filter('hltCaloQuadJet30HT300'), filter('hltCaloQuadJet30HT320')) + " \
191 "2 * max(filter('hltPFCentralJetsLooseIDQuad30HT300'), filter('hltPFCentralJetsLooseIDQuad30HT330'))" 193 qualityBitsDoc = cms.string
195 "MHT bits: bit 0 for hltCaloQuadJet30HT300 or hltCaloQuadJet30HT320, bit 1 for hltPFCentralJetsLooseIDQuad30HT300 or hltPFCentralJetsLooseIDQuad30HT330" 205 selections2016 = copy.deepcopy(triggerObjectTable.selections)
206 for sel
in selections2016:
208 sel.sel = cms.string(
"type(83) && pt > 5 && (coll('hlt*L3MuonCandidates') || coll('hlt*TkMuonCands') || coll('hlt*TrkMuonCands'))")
209 sel.qualityBits = cms.string(
"filter('*RelTrkIso*Filtered0p4') + 2*filter('hltL3cr*IsoFiltered0p09') + 4*filter('*OverlapFilter*IsoMu*PFTau*') + 8*filter('hltL3f*IsoFiltered0p09') + 1024*max(filter('hltL3fL1sMu*L3Filtered50*'),filter('hltL3fL1sMu*TkFiltered50*'))")
210 sel.qualityBitsDoc = cms.string(
"1 = TrkIsoVVL, 2 = Iso, 4 = OverlapFilter PFTau, 8 = IsoTkMu, 1024 = 1mu (Mu50)")
211 elif sel.name==
'Tau':
212 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*') )")
213 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*')")
214 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")
216 run2_HLTconditions_2016.toModify(
218 selections = selections2016
221 from PhysicsTools.PatUtils.L1ECALPrefiringWeightProducer_cff
import prefiringweight
222 run2_HLTconditions_2016.toModify(prefiringweight, DataEra = cms.string(
"2016BtoH"))
224 l1PreFiringEventWeightTable = cms.EDProducer(
"GlobalVariablesTableProducer",
225 variables = cms.PSet(
226 L1PreFiringWeight_Nom =
ExtVar(cms.InputTag(
"prefiringweight:nonPrefiringProb"),
"double", doc =
"L1 pre-firing event correction weight (1-probability)", precision=8),
227 L1PreFiringWeight_Up =
ExtVar(cms.InputTag(
"prefiringweight:nonPrefiringProbUp"),
"double", doc =
"L1 pre-firing event correction weight (1-probability), up var.", precision=8),
228 L1PreFiringWeight_Dn =
ExtVar(cms.InputTag(
"prefiringweight:nonPrefiringProbDown"),
"double", doc =
"L1 pre-firing event correction weight (1-probability), down var.", precision=8),
232 triggerObjectTables = cms.Sequence( unpackedPatTrigger + triggerObjectTable )
234 _triggerObjectTables_withL1PreFiring = triggerObjectTables.copy()
235 _triggerObjectTables_withL1PreFiring.replace(triggerObjectTable, prefiringweight + l1PreFiringEventWeightTable + triggerObjectTable)
236 (run2_HLTconditions_2016 | run2_HLTconditions_2017).toReplaceWith(triggerObjectTables, _triggerObjectTables_withL1PreFiring)
def ExtVar(tag, valtype, compression=None, doc=None, mcOnly=False, precision=-1)