ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/DGele/PhysicsTools/PatAlgos/python/tools/jetTools.py
Revision: 1.1.1.1 (vendor branch)
Committed: Tue Oct 20 17:15:14 2009 UTC (15 years, 6 months ago) by dgele
Content type: text/x-python
Branch: ANA
CVS Tags: start
Changes since 1.1: +0 -0 lines
Log Message:
version CMSSW_2_2_10

File Contents

# Content
1 import FWCore.ParameterSet.Config as cms
2
3 from PhysicsTools.PatAlgos.tools.helpers import *
4
5
6 def switchJECSet(process,
7 newName,
8 oldName
9 ):
10 """
11 ------------------------------------------------------------------
12 replace tags in the JetCorrFactorsProducer for end-users:
13
14 process : process
15 newName : new name of JEC module
16 oldName : old name of JEC module
17 ------------------------------------------------------------------
18 """
19 switchJECSet_(process.jetCorrFactors, newName, oldName)
20
21
22 def switchJECSet_(jetCorrFactors,
23 newName,
24 oldName,
25 steps=['L1Offset', 'L2Relative', 'L3Absolute', 'L4EMF', 'L5Flavor', 'L6UE', 'L7Parton']
26 ):
27 """
28 ------------------------------------------------------------------
29 replace tags in the JetCorrFactorsProducer (inner implementation)
30
31 jetCorrFactors : jetCorrFactors module
32 newName : new name of JEC module
33 oldName : old name of JEC module
34 steps : correction steps in the module
35 ------------------------------------------------------------------
36 """
37 found = False
38 for k in steps:
39 ## loop jet correction steps
40 vv = getattr(jetCorrFactors, k).value();
41 if (vv.find(oldName) != -1):
42 found = True
43 if (vv != "none"):
44 ## replace if the correction steps is not 'none'
45 setattr(jetCorrFactors, k, vv.replace(oldName,newName))
46 if not found:
47 raise RuntimeError,"""
48 Can't replace jet energy correction step %s with %s.
49 The full configuration is %s""" % (oldName, newName, jetCorrFactors.dumpPython())
50
51
52 def switchJECParameters(jetCorrFactors,
53 newAlgo,
54 newType="Calo",
55 oldAlgo="IC5",
56 oldType="Calo"
57 ):
58 """
59 ------------------------------------------------------------------
60 replace tags in the JetCorrFactorsProducer
61
62 jetCorrFactors : jetCorrFactors module
63 newAlgo : label of new jet algo [IC5, SC5, KT6, ...]
64 newType : label of new jet type [Calo, Pflow, Jpt, ...]
65 oldAlgo : label of old jet alog [IC5, SC5, KT6, ...]
66 oldType : label of old jet type [Calo, Pflow, Jpt, ...]
67 ------------------------------------------------------------------
68 """
69 for k in ['L1Offset', 'L2Relative', 'L3Absolute', 'L4EMF', 'L6UE', 'L7Parton']:
70 ## loop jet correction steps; the L5Flavor step
71 ## is not in the list as as it is said not to
72 ## dependend on the specific jet algorithm
73 vv = getattr(jetCorrFactors, k).value();
74 if (vv != "none"):
75 ## the first replace is for '*_IC5Calo'
76 ## types, the second for '*_IC5' types
77 setattr(jetCorrFactors, k, vv.replace(oldAlgo+oldType, newAlgo+newType).replace(oldAlgo, newAlgo) )
78
79
80 def runBTagging(process,
81 jetCollection,
82 label
83 ):
84 """
85 ------------------------------------------------------------------
86 define sequence to run b tagging on AOD input for a given jet
87 collection including a JetTracksAssociatorAtVertex with name
88 'jetTracksAssociatorAtVertex' + 'label'
89
90 process : process
91 jetCollection : input jet collection
92 label : postfix label to identify new sequence/modules
93
94 the sequence is added to the process but not to any path; return
95 value is a pair of (sequence, labels) where 'sequence' is the
96 cms.Sequence, and 'labels' is a vector with the following entries:
97
98 * labels['jta'] = the name of the JetTrackAssociator module
99 * labels['tagInfos'] = a list of names of the TagInfo modules
100 * labels['jetTags '] = a list of names of the JetTag modules
101 ------------------------------------------------------------------
102 """
103 if (label == ''):
104 ## label is not allowed to be empty
105 raise ValueError, "label for re-running b tagging is not allowedc to be empty"
106
107 ## import track associator & b tag configuration
108 process.load("RecoJets.JetAssociationProducers.ic5JetTracksAssociatorAtVertex_cfi")
109 from RecoJets.JetAssociationProducers.ic5JetTracksAssociatorAtVertex_cfi import ic5JetTracksAssociatorAtVertex
110 process.load("RecoBTag.Configuration.RecoBTag_cff")
111 import RecoBTag.Configuration.RecoBTag_cff as btag
112
113 ## define tag info labels (compare with jetProducer_cfi.py)
114 jtaLabel = 'jetTracksAssociatorAtVertex' + label
115 ipTILabel = 'impactParameterTagInfos' + label
116 svTILabel = 'secondaryVertexTagInfos' + label
117 seTILabel = 'softElectronTagInfos' + label
118 smTILabel = 'softMuonTagInfos' + label
119
120 ## produce tag infos
121 setattr( process, jtaLabel, ic5JetTracksAssociatorAtVertex.clone(jets = jetCollection))
122 setattr( process, ipTILabel, btag.impactParameterTagInfos.clone(jetTracks = cms.InputTag(jtaLabel)) )
123 setattr( process, svTILabel, btag.secondaryVertexTagInfos.clone(trackIPTagInfos = cms.InputTag(ipTILabel)) )
124 setattr( process, seTILabel, btag.softElectronTagInfos.clone(jets = jetCollection) )
125 setattr( process, smTILabel, btag.softMuonTagInfos.clone(jets = jetCollection) )
126
127 ## make VInputTag from strings
128 def vit(*args) : return cms.VInputTag( *[ cms.InputTag(x) for x in args ] )
129
130 ## produce btags
131 setattr( process, 'jetBProbabilityBJetTags'+label, btag.jetBProbabilityBJetTags.clone(tagInfos = vit(ipTILabel)) )
132 setattr( process, 'jetProbabilityBJetTags' +label, btag.jetProbabilityBJetTags.clone (tagInfos = vit(ipTILabel)) )
133 setattr( process, 'trackCountingHighPurBJetTags'+label, btag.trackCountingHighPurBJetTags.clone(tagInfos = vit(ipTILabel)) )
134 setattr( process, 'trackCountingHighEffBJetTags'+label, btag.trackCountingHighEffBJetTags.clone(tagInfos = vit(ipTILabel)) )
135 setattr( process, 'impactParameterMVABJetTags'+label, btag.impactParameterMVABJetTags.clone(tagInfos = vit(ipTILabel)) )
136 setattr( process, 'simpleSecondaryVertexBJetTags'+label, btag.simpleSecondaryVertexBJetTags.clone(tagInfos = vit(svTILabel)) )
137 setattr( process, 'combinedSecondaryVertexBJetTags'+label, btag.combinedSecondaryVertexBJetTags.clone(tagInfos = vit(ipTILabel, svTILabel)) )
138 setattr( process, 'combinedSecondaryVertexMVABJetTags'+label, btag.combinedSecondaryVertexMVABJetTags.clone(tagInfos = vit(ipTILabel, svTILabel)) )
139 setattr( process, 'softElectronBJetTags'+label, btag.softElectronBJetTags.clone(tagInfos = vit(seTILabel)) )
140 setattr( process, 'softMuonBJetTags'+label, btag.softMuonBJetTags.clone(tagInfos = vit(smTILabel)) )
141 setattr( process, 'softMuonNoIPBJetTags'+label, btag.softMuonNoIPBJetTags.clone(tagInfos = vit(smTILabel)) )
142
143 ## define vector of (output) labels
144 labels = { 'jta' : jtaLabel,
145 'tagInfos' : (ipTILabel,svTILabel,seTILabel,smTILabel),
146 'jetTags' : [ (x + label) for x in ('jetBProbabilityBJetTags',
147 'jetProbabilityBJetTags',
148 'trackCountingHighPurBJetTags',
149 'trackCountingHighEffBJetTags',
150 'impactParameterMVABJetTags',
151 'simpleSecondaryVertexBJetTags',
152 'combinedSecondaryVertexBJetTags',
153 'combinedSecondaryVertexMVABJetTags',
154 'softElectronBJetTags',
155 'softMuonBJetTags',
156 'softMuonNoIPBJetTags'
157 )
158 ]
159 }
160
161 ## extend an existing sequence by otherLabels
162 def mkseq(process, firstlabel, *otherlabels):
163 seq = getattr(process, firstlabel)
164 for x in otherlabels: seq += getattr(process, x)
165 return cms.Sequence(seq)
166
167 ## add tag infos to the process
168 setattr( process, 'btaggingTagInfos'+label, mkseq(process, *(labels['tagInfos']) ) )
169 ## add b tags to the process
170 setattr( process, 'btaggingJetTags'+label, mkseq(process, *(labels['jetTags']) ) )
171 ## add a combined sequence to the process
172 seq = mkseq(process, jtaLabel, 'btaggingTagInfos'+label, 'btaggingJetTags' + label)
173 setattr( process, 'btagging'+label, seq )
174 ## return the combined sequence and the labels defined above
175 return (seq, labels)
176
177 def switchJetCollection(process,
178 jetCollection,
179 doJTA = True,
180 doBTagging = True,
181 jetCorrLabel = None,
182 doType1MET = True,
183 genJetCollection = cms.InputTag("iterativeCone5GenJets")
184 ):
185 """
186 ------------------------------------------------------------------
187 switch the collection of jets in PAT from the default value to a
188 new jet collection
189
190 process : process
191 jetCollection : input jet collection
192 doBTagging : run b tagging sequence for new jet collection
193 and add it to the new pat jet collection
194 doJTA : run JetTracksAssociation and JetCharge and add
195 it to the new pat jet collection (will autom.
196 be true if doBTagging is set to true)
197 jetCorrLabel : algorithm and type of JEC; use 'None' for no
198 JEC; examples are ('IC5','Calo'), ('SC7',
199 'Calo'), ('KT4','PF')
200 doType1MET : if jetCorrLabel is not 'None', set this to
201 'True' to redo the Type1 MET correction for
202 the new jet colllection; at the moment it must
203 be 'False' for non CaloJets otherwise the
204 JetMET POG module crashes.
205 genJetCollection : GenJet collection to match to
206 ------------------------------------------------------------------
207 """
208 ## save label of old jet collection
209 oldLabel = process.allLayer1Jets.jetSource;
210
211 ## replace input jet collection for generator matches
212 process.jetPartonMatch.src = jetCollection
213 process.jetGenJetMatch.src = jetCollection
214 process.jetGenJetMatch.matched = genJetCollection
215 process.jetPartonAssociation.jets = jetCollection
216
217 ## replace input jet collection for trigger matches
218 massSearchReplaceParam(process.patTrigMatch, 'src', oldLabel, jetCollection)
219
220 ## replace input jet collection for pat jet production
221 process.allLayer1Jets.jetSource = jetCollection
222
223 ## make VInputTag from strings
224 def vit(*args) : return cms.VInputTag( *[ cms.InputTag(x) for x in args ] )
225
226 if (doBTagging):
227 ## replace b tagging sequence
228 (btagSeq, btagLabels) = runBTagging(process, jetCollection, 'AOD')
229 ## add b tagging sequence to the patAODCoreReco
230 ## sequence as it is also needed by ExtraReco
231 process.patAODCoreReco += btagSeq
232 ## replace jet charge associator tag patJetCharge
233 process.patJetCharge.src = btagLabels['jta']
234 ## replace corresponding tags for pat jet production
235 process.allLayer1Jets.trackAssociationSource = btagLabels['jta']
236 process.allLayer1Jets.tagInfoSources = cms.VInputTag( *[ cms.InputTag(x) for x in btagLabels['tagInfos'] ] )
237 process.allLayer1Jets.discriminatorSources = cms.VInputTag( *[ cms.InputTag(x) for x in btagLabels['jetTags'] ] )
238 else:
239 ## remove b tagging from the std sequence
240 process.patAODReco.remove(process.patBTagging)
241 ## switch embedding of b tagging for pat
242 ## jet production to 'False'
243 process.allLayer1Jets.addBTagInfo = False
244
245 if (doJTA or doBTagging):
246 ## replace jet track association
247 if (not doBTagging):
248 ## in case b tagging is switched off do the
249 ## jet track association production here
250 process.load("RecoJets.JetAssociationProducers.ic5JetTracksAssociatorAtVertex_cfi")
251 from RecoJets.JetAssociationProducers.ic5JetTracksAssociatorAtVertex_cfi import ic5JetTracksAssociatorAtVertex
252 process.jetTracksAssociatorAtVertex = ic5JetTracksAssociatorAtVertex.clone(jets = jetCollection)
253 process.patAODReco.replace(process.patJetTracksCharge, process.jetTracksAssociatorAtVertex + process.patJetTracksCharge)
254 process.patJetCharge.src = 'jetTracksAssociatorAtVertex'
255 process.allLayer1Jets.trackAssociationSource = 'jetTracksAssociatorAtVertex'
256 else:
257 ## remove the jet track association from the std
258 ## sequence
259 process.patAODReco.remove(process.patJetTracksCharge)
260 ## switch embedding of track association and jet
261 ## charge estimate to 'False'
262 process.allLayer1Jets.addAssociatedTracks = False
263 process.allLayer1Jets.addJetCharge = False
264
265 if (jetCorrLabel!=None):
266 ## replace jet energy corrections; catch
267 ## a couple of exceptions first
268 if (jetCorrLabel == False ):
269 raise ValueError, "In switchJetCollection 'jetCorrLabel' must be set to 'None', not 'False'"
270 if (jetCorrLabel == "None"):
271 raise ValueError, "In switchJetCollection 'jetCorrLabel' must be set to 'None' (without quotes)"
272 ## check for the correct format
273 if (type(jetCorrLabel)!=type(('IC5','Calo'))):
274 raise ValueError, "In switchJetCollection 'jetCorrLabel' must be 'None', or of type ('Algo','Type')"
275
276 ## switch JEC parameters to the new jet collection
277 process.jetCorrFactors.jetSource = jetCollection
278 switchJECParameters(process.jetCorrFactors, jetCorrLabel[0], jetCorrLabel[1], oldAlgo='IC5',oldType='Calo')
279
280 ## redo the type1MET correction for the new jet collection
281 if (doType1MET):
282 ## in case there is no jet correction service in the paths add it
283 ## as L2L3 if possible, as combined from L2 and L3 otherwise
284 if (not hasattr( process, 'L2L3JetCorrector%s%s' % jetCorrLabel )):
285 setattr( process,
286 'L2L3JetCorrector%s%s' % jetCorrLabel,
287 cms.ESSource("JetCorrectionServiceChain",
288 correctors = cms.vstring('L2RelativeJetCorrector%s%s' % jetCorrLabel,
289 'L3AbsoluteJetCorrector%s%s' % jetCorrLabel),
290 label = cms.string('L2L3JetCorrector%s%s' % jetCorrLabel)
291 )
292 )
293 ## configure the type1MET correction the following muonMET
294 ## corrections have the corMetType1Icone5 as input and are
295 ## automatically correct
296 process.corMetType1Icone5.inputUncorJetsLabel = jetCollection.value()
297 process.corMetType1Icone5.corrector = 'L2L3JetCorrector%s%s' % jetCorrLabel
298 else:
299 ## remove the jetCorrFactors from the std sequence
300 process.patJetMETCorrections.remove(process.jetCorrFactors)
301 ## switch embedding of jetCorrFactors off
302 ## for pat jet production
303 process.allLayer1Jets.addJetCorrFactors = False
304
305 if (oldLabel in process.aodSummary.candidates):
306 ## add the new jet collection to the summary tables
307 process.aodSummary.candidates[process.aodSummary.candidates.index(oldLabel)] = jetCollection
308 else:
309 process.aodSummary.candidates += [jetCollection]
310
311
312 def addJetCollection(process,
313 jetCollection,
314 postfixLabel,
315 doJTA = True,
316 doBTagging = True,
317 jetCorrLabel = None,
318 doType1MET = True,
319 doL1Cleaning = True,
320 doL1Counters = False,
321 genJetCollection=cms.InputTag("iterativeCone5GenJets"),
322 doTrigMatch = False
323 ):
324 """
325 ------------------------------------------------------------------
326 add a new collection of jets in PAT
327
328 process : process
329 jetCollection : input jet collection
330 postfixLabel : label to identify all modules that work with
331 this jet collection
332 doBTagging : run b tagging sequence for new jet collection
333 and add it to the new pat jet collection
334 doJTA : run JetTracksAssociation and JetCharge and add
335 it to the new pat jet collection (will autom.
336 be true if doBTagging is set to true)
337 jetCorrLabel : algorithm and type of JEC; use 'None' for no
338 JEC; examples are ('IC5','Calo'), ('SC7',
339 'Calo'), ('KT4','PF')
340 doType1MET : make also a new MET collection (not yet
341 implemented?)
342 doL1Cleaning : copy also the producer modules for cleanLayer1
343 will be set to 'True' automatically when
344 doL1Counters is 'True'
345 doL1Counters : copy also the filter modules that accept/reject
346 the event looking at the number of jets
347 doTrigMatch :
348 genJetCollection : GenJet collection to match to
349
350 this takes the configuration from the already-configured jets as
351 starting point; replaces before calling addJetCollection will
352 affect also the new jets
353 ------------------------------------------------------------------
354 """
355 ## add module as process to the default sequence
356 def addAlso(label, value):
357 existing = getattr(process, label)
358 setattr( process, label+postfixLabel, value)
359 process.patDefaultSequence.replace( existing, existing*value )
360
361 ## clone and add a module as process to the
362 ## default sequence
363 def addClone(label, **replaceStatements):
364 new = getattr(process, label).clone(**replaceStatements)
365 addAlso(label, new)
366
367 ## add a clone of allLayer1Jets
368 addClone('allLayer1Jets', jetSource = jetCollection, addTrigMatch = doTrigMatch)
369 ## add a clone of selectedLayer1Jets
370 addClone('selectedLayer1Jets', src=cms.InputTag('allLayer1Jets'+postfixLabel))
371 ## add a clone of cleanLayer1Jets
372 if (doL1Cleaning or doL1Counters):
373 addClone('cleanLayer1Jets', src=cms.InputTag('selectedLayer1Jets'+postfixLabel))
374 ## add a clone of countLayer1Jets
375 if (doL1Counters):
376 addClone('countLayer1Jets', src=cms.InputTag('cleanLayer1Jets'+postfixLabel))
377
378 ## attributes of allLayer1Jets
379 l1Jets = getattr(process, 'allLayer1Jets'+postfixLabel)
380
381 ## add a clone of gen jet matching
382 addClone('jetPartonMatch', src = jetCollection)
383 addClone('jetGenJetMatch', src = jetCollection, matched = genJetCollection)
384 ## add a clone of parton and flavour associations
385 addClone('jetPartonAssociation', jets = jetCollection)
386 addClone('jetFlavourAssociation', srcByReference = cms.InputTag('jetPartonAssociation'+postfixLabel))
387
388 ## fix label for input tag
389 def fixInputTag(x): x.setModuleLabel(x.moduleLabel+postfixLabel)
390 ## fix label for vector of input tags
391 def fixVInputTag(x): x[0].setModuleLabel(x[0].moduleLabel+postfixLabel)
392
393 ## provide allLayer1Jet inputs with individual labels
394 fixInputTag(l1Jets.genJetMatch)
395 fixInputTag(l1Jets.genPartonMatch)
396 fixInputTag(l1Jets.JetPartonMapSource)
397
398 ## find potential triggers for trigMatch
399 triggers = MassSearchParamVisitor('src', process.allLayer1Jets.jetSource)
400 process.patTrigMatch.visit(triggers)
401 for mod in triggers.modules():
402 if (doTrigMatch):
403 newmod = mod.clone(src = jetCollection)
404 setattr( process, mod.label()+postfixLabel, newmod )
405 process.patTrigMatch.replace( mod, mod * newmod )
406 for it in l1Jets.trigPrimMatch.value(): fixInputTag(it)
407
408 ## make VInputTag from strings
409 def vit(*args) : return cms.VInputTag( *[ cms.InputTag(x) for x in args ] )
410
411 if (doBTagging):
412 ## add b tagging sequence
413 (btagSeq, btagLabels) = runBTagging(process, jetCollection, postfixLabel)
414 ## add b tagging sequence to the patAODCoreReco
415 ## sequence as it is also needed by ExtraReco
416 process.patAODCoreReco += btagSeq
417 ## add clone of jet charge associator tag
418 addClone('patJetCharge', src=cms.InputTag(btagLabels['jta']))
419 ## replace corresponding tags for pat jet production
420 l1Jets.trackAssociationSource = cms.InputTag(btagLabels['jta'])
421 l1Jets.tagInfoSources = cms.VInputTag( *[ cms.InputTag(x) for x in btagLabels['tagInfos'] ] )
422 l1Jets.discriminatorSources = cms.VInputTag( *[ cms.InputTag(x) for x in btagLabels['jetTags'] ] )
423 ## provide allLayer1Jet jetChargeSource with individual label
424 fixInputTag(l1Jets.jetChargeSource)
425 else:
426 ## switch general b tagging info switch off
427 l1Jets.addBTagInfo = False
428
429 if (doJTA or doBTagging):
430 ## add clone of jet track association
431 if not doBTagging:
432 ## in case b tagging is switched off do the
433 ## jet track association production here
434 process.load("RecoJets.JetAssociationProducers.ic5JetTracksAssociatorAtVertex_cfi")
435 from RecoJets.JetAssociationProducers.ic5JetTracksAssociatorAtVertex_cfi import ic5JetTracksAssociatorAtVertex
436 ## add jet track association module to processes
437 jtaLabel = 'jetTracksAssociatorAtVertex'+postfixLabel
438 setattr( process, jtaLabel, ic5JetTracksAssociatorAtVertex.clone(jets = jetCollection) )
439 process.patAODReco.replace(process.patJetTracksCharge, getattr(process,jtaLabel)+process.patJetTracksCharge)
440 l1Jets.trackAssociationSource = cms.InputTag(jtaLabel)
441 addClone('patJetCharge', src=cms.InputTag(jtaLabel)),
442 fixInputTag(l1Jets.jetChargeSource)
443 else:
444 ## switch embedding of track association and jet
445 ## charge estimate to 'False'
446 l1Jets.addAssociatedTracks = False
447 l1Jets.addJetCharge = False
448 if (jetCorrLabel != None):
449 ## add clone of jet energy corrections;
450 ## catch a couple of exceptions first
451 if (jetCorrLabel == False ):
452 raise ValueError, "In addJetCollection 'jetCorrLabel' must be set to 'None', not 'False'"
453 if (jetCorrLabel == "None"):
454 raise ValueError, "In addJetCollection 'jetCorrLabel' must be set to 'None' (without quotes)"
455 ## check for the correct format
456 if type(jetCorrLabel) != type(('IC5','Calo')):
457 raise ValueError, "In switchJetCollection 'jetCorrLabel' must be 'None', or of type ('Algo','Type')"
458
459 ## add clone of jetCorrFactors
460 addClone('jetCorrFactors', jetSource = jetCollection)
461 switchJECParameters( getattr(process,'jetCorrFactors'+postfixLabel), jetCorrLabel[0], jetCorrLabel[1], oldAlgo='IC5',oldType='Calo' )
462 fixVInputTag(l1Jets.jetCorrFactorsSource)
463
464 ## add a clone of the type1MET correction for the new jet collection
465 if (doType1MET):
466 ## in case there is no jet correction service in the paths add it
467 ## as L2L3 if possible, as combined from L2 and L3 otherwise
468 if not hasattr( process, 'L2L3JetCorrector%s%s' % jetCorrLabel ):
469 setattr( process,
470 'L2L3JetCorrector%s%s' % jetCorrLabel,
471 cms.ESSource("JetCorrectionServiceChain",
472 correctors = cms.vstring('L2RelativeJetCorrector%s%s' % jetCorrLabel,
473 'L3AbsoluteJetCorrector%s%s' % jetCorrLabel),
474 label= cms.string('L2L3JetCorrector%s%s' % jetCorrLabel)
475 )
476 )
477 ## add a clone of the type1MET correction
478 ## and the following muonMET correction
479 addClone('corMetType1Icone5', inputUncorJetsLabel = jetCollection.value(),
480 corrector = cms.string('L2L3JetCorrector%s%s' % jetCorrLabel)
481 )
482 addClone('corMetType1Icone5Muons', uncorMETInputTag = cms.InputTag("corMetType1Icone5"+postfixLabel))
483 addClone('layer1METs', metSource = cms.InputTag("corMetType1Icone5Muons"+postfixLabel),
484 addTrigMatch = doTrigMatch
485 )
486 l1MET = getattr(process, 'layer1METs'+postfixLabel)
487
488 ## find potential triggers for trigMatch
489 mettriggers = MassSearchParamVisitor('src', process.layer1METs.metSource)
490 process.patTrigMatch.visit(mettriggers)
491 for mod in mettriggers.modules():
492 if doTrigMatch:
493 newmod = mod.clone(src = l1MET.metSource)
494 setattr( process, mod.label()+postfixLabel, newmod )
495 process.patTrigMatch.replace( mod, mod * newmod )
496 for it in l1MET.trigPrimMatch.value(): fixInputTag(it)
497
498 ## add new met collections output to the pat summary
499 process.allLayer1Summary.candidates += [ cms.InputTag('layer1METs'+postfixLabel) ]
500 else:
501 ## switch jetCorrFactors off
502 l1Jets.addJetCorrFactors = False
503
504 if (jetCollection not in process.aodSummary.candidates):
505 ## add the new jet collection to the summary tables
506 process.aodSummary.candidates += [ jetCollection ]
507 ## add new allLayer1Jets collection output to the pat summary
508 process.allLayer1Summary.candidates += [ cms.InputTag('allLayer1Jets'+postfixLabel) ]
509 ## add new selectedLayer1Jets collection output to the pat summary
510 process.selectedLayer1Summary.candidates += [ cms.InputTag('selectedLayer1Jets'+postfixLabel) ]