8 from TauAnalysis.MCEmbeddingTools.rerunParticleFlow
import updateInputTags
11 for sequenceName
in process.sequences:
12 sequence = getattr(process, sequenceName)
14 moduleNameOld = moduleOld.label()
15 if moduleNameOld
in sequence.moduleNames():
17 sequence.replace(moduleOld, modulesNew)
18 for pathName
in process.paths:
19 path = getattr(process, pathName)
21 if moduleNameOld
in path.moduleNames():
23 path.replace(moduleOld, modulesNew)
28 trackAssocParamsForMuonCleaning = TrackAssociatorParameterBlock.TrackAssociatorParameters
30 process.muonCaloEnergyDepositsAllCrossed = cms.EDProducer(
'MuonCaloCleanerAllCrossed',
31 trackAssociator = trackAssocParamsForMuonCleaning,
32 selectedMuons = process.customization_options.ZmumuCollection,
33 esRecHits = cms.InputTag(
"ecalPreshowerRecHit",
"EcalRecHitsES", inputProcess)
35 process.ProductionFilterSequence += process.muonCaloEnergyDepositsAllCrossed
37 recHitCaloCleanerAllCrossedConfig = cms.PSet(
38 srcEnergyDepositMapMuPlus = cms.InputTag(
"muonCaloEnergyDepositsAllCrossed",
"energyDepositsMuPlus"),
39 srcEnergyDepositMapMuMinus = cms.InputTag(
"muonCaloEnergyDepositsAllCrossed",
"energyDepositsMuMinus"),
40 typeEnergyDepositMap = cms.string(
"absolute"),
43 recHitCaloCleanerByDistanceConfig =
None
44 if process.customization_options.cleaningMode ==
'DEDX':
45 process.muonCaloEnergyDepositsByDistance = cms.EDProducer(
'MuonCaloCleanerByDistance',
46 muons = cms.InputTag(
"muonCaloDistances",
"muons"),
47 distanceMapMuPlus = cms.InputTag(
"muonCaloDistances",
"distancesMuPlus"),
48 distanceMapMuMinus = cms.InputTag(
"muonCaloDistances",
"distancesMuMinus"),
49 energyDepositCorrection = cms.PSet(
50 H_Ecal_EcalBarrel = cms.double(process.customization_options.muonCaloCleaningSF.value()*0.9),
51 H_Ecal_EcalEndcap = cms.double(process.customization_options.muonCaloCleaningSF.value()*0.9),
52 H_Hcal_HcalBarrel = cms.double(process.customization_options.muonCaloCleaningSF.value()*1.1),
53 H_Hcal_HcalOuter = cms.double(process.customization_options.muonCaloCleaningSF.value()*0.8),
54 H_Hcal_HcalEndcap = cms.double(process.customization_options.muonCaloCleaningSF.value()*0.9),
55 H_Hcal_HcalForward = cms.double(process.customization_options.muonCaloCleaningSF.value()*0.000),
56 H_Hcal_HcalOther = cms.double(process.customization_options.muonCaloCleaningSF.value()*0.000)
58 verbosity = cms.int32(0)
60 process.ProductionFilterSequence += process.muonCaloEnergyDepositsByDistance
62 recHitCaloCleanerByDistanceConfig = cms.PSet(
63 srcEnergyDepositMapMuPlus = cms.InputTag(
"muonCaloEnergyDepositsByDistance",
"energyDepositsMuPlus"),
64 srcEnergyDepositMapMuMinus = cms.InputTag(
"muonCaloEnergyDepositsByDistance",
"energyDepositsMuMinus"),
65 typeEnergyDepositMap = cms.string(
"absolute"),
67 elif process.customization_options.cleaningMode ==
'PF':
69 process.pfMuonCaloEnergyDeposits = cms.EDProducer(
'PFMuonCaloCleaner',
70 selectedMuons = process.customization_options.ZmumuCollection,
71 pfCandidates = cms.InputTag(
"particleFlowForPFMuonCleaning"),
72 dRmatch = cms.double(0.3),
73 verbosity = cms.int32(0)
75 process.ProductionFilterSequence += process.pfMuonCaloEnergyDeposits
77 recHitCaloCleanerByDistanceConfig = cms.PSet(
78 srcEnergyDepositMapMuPlus = cms.InputTag(
"pfMuonCaloEnergyDeposits",
"energyDepositsMuPlus"),
79 srcEnergyDepositMapMuMinus = cms.InputTag(
"pfMuonCaloEnergyDeposits",
"energyDepositsMuMinus"),
80 typeEnergyDepositMap = cms.string(
"absolute"),
83 raise ValueError(
"Invalid Configuration parameter 'cleaningMode' = %s !!" % process.customization_options.cleaningMode)
91 if not process.customization_options.skipCaloRecHitMixing.value():
92 process.castorrecoORG = process.castorreco.clone()
93 process.castorreco = cms.EDProducer(
"CastorRecHitMixer",
94 recHitCaloCleanerAllCrossedConfig,
97 collection1 = cms.InputTag(
"castorrecoORG"),
98 collection2 = cms.InputTag(
"castorreco",
"", inputProcess),
99 killNegEnergyBeforeMixing1 = cms.bool(
False),
100 killNegEnergyBeforeMixing2 = cms.bool(
True),
101 muonEnSutractionMode = cms.string(
"subtractFromCollection2BeforeMixing"),
102 killNegEnergyAfterMixing = cms.bool(
False)
105 verbosity = cms.int32(0)
109 print(
"WARNING: disabling mixing of CASTOR recHit collection, this setting should be used for DEBUGGING only !!")
117 if not process.customization_options.skipCaloRecHitMixing.value():
118 process.hfrecoORG = process.hfreco.clone()
119 process.hfreco = cms.EDProducer(
"HFRecHitMixer",
120 recHitCaloCleanerAllCrossedConfig,
123 collection1 = cms.InputTag(
"hfrecoORG"),
124 collection2 = cms.InputTag(
"hfreco",
"", inputProcess),
125 killNegEnergyBeforeMixing1 = cms.bool(
False),
126 killNegEnergyBeforeMixing2 = cms.bool(
True),
127 muonEnSutractionMode = cms.string(
"subtractFromCollection2BeforeMixing"),
128 killNegEnergyAfterMixing = cms.bool(
False)
131 verbosity = cms.int32(0)
135 print(
"WARNING: disabling mixing of HF recHit collection, this setting should be used for DEBUGGING only !!")
138 if not process.customization_options.skipCaloRecHitMixing.value():
139 process.ecalPreshowerRecHitORG = process.ecalPreshowerRecHit.clone()
140 process.ecalPreshowerRecHit = cms.EDProducer(
"EcalRecHitMixer",
141 recHitCaloCleanerAllCrossedConfig,
144 collection1 = cms.InputTag(
"ecalPreshowerRecHitORG",
"EcalRecHitsES"),
145 collection2 = cms.InputTag(
"ecalPreshowerRecHit",
"EcalRecHitsES", inputProcess),
146 killNegEnergyBeforeMixing1 = cms.bool(
False),
147 killNegEnergyBeforeMixing2 = cms.bool(
True),
148 muonEnSutractionMode = cms.string(
"subtractFromCollection2BeforeMixing"),
149 killNegEnergyAfterMixing = cms.bool(
False)
152 verbosity = cms.int32(0)
154 replaceModule_or_Sequence(process, process.ecalPreshowerRecHit, process.ecalPreshowerRecHitORG*process.ecalPreshowerRecHit)
156 print(
"WARNING: disabling mixing of ES recHit collection, this setting should be used for DEBUGGING only !!")
159 if not process.customization_options.skipCaloRecHitMixing.value():
160 print "Mixing ECAL recHit collections"
161 process.ecalRecHitORG = process.ecalRecHit.clone()
162 process.ecalRecHit = cms.EDProducer(
"EcalRecHitMixer",
163 recHitCaloCleanerByDistanceConfig,
166 collection1 = cms.InputTag(
"ecalRecHitORG",
"EcalRecHitsEB"),
167 collection2 = cms.InputTag(
"ecalRecHit",
"EcalRecHitsEB", inputProcess),
168 killNegEnergyBeforeMixing1 = cms.bool(
False),
169 killNegEnergyBeforeMixing2 = cms.bool(
True),
170 muonEnSutractionMode = cms.string(
"subtractFromCollection2BeforeMixing"),
171 killNegEnergyAfterMixing = cms.bool(
False)
174 collection1 = cms.InputTag(
"ecalRecHitORG",
"EcalRecHitsEE"),
175 collection2 = cms.InputTag(
"ecalRecHit",
"EcalRecHitsEE", inputProcess),
176 killNegEnergyBeforeMixing1 = cms.bool(
False),
177 killNegEnergyBeforeMixing2 = cms.bool(
True),
178 muonEnSutractionMode = cms.string(
"subtractFromCollection2BeforeMixing"),
179 killNegEnergyAfterMixing = cms.bool(
False)
182 verbosity = cms.int32(0)
186 print(
"WARNING: disabling mixing of EB and EE recHit collections, this setting should be used for DEBUGGING only !!")
189 if not process.customization_options.skipCaloRecHitMixing.value():
190 print "Mixing HCAL recHit collection"
191 process.hbherecoORG = process.hbhereco.clone()
192 process.hbhereco = cms.EDProducer(
"HBHERecHitMixer",
193 recHitCaloCleanerByDistanceConfig,
196 collection1 = cms.InputTag(
"hbherecoORG",
""),
197 collection2 = cms.InputTag(
"hbhereco",
"", inputProcess),
198 killNegEnergyBeforeMixing1 = cms.bool(
False),
199 killNegEnergyBeforeMixing2 = cms.bool(
True),
200 muonEnSutractionMode = cms.string(
"subtractFromCollection2BeforeMixing"),
201 killNegEnergyAfterMixing = cms.bool(
False)
204 verbosity = cms.int32(0)
208 process.horecoORG = process.horeco.clone()
209 process.horeco = cms.EDProducer(
"HORecHitMixer",
210 recHitCaloCleanerByDistanceConfig,
213 collection1 = cms.InputTag(
"horecoORG",
""),
214 collection2 = cms.InputTag(
"horeco",
"", inputProcess),
215 killNegEnergyBeforeMixing1 = cms.bool(
False),
216 killNegEnergyBeforeMixing2 = cms.bool(
True),
217 muonEnSutractionMode = cms.string(
"subtractFromCollection2BeforeMixing"),
218 killNegEnergyAfterMixing = cms.bool(
False)
221 verbosity = cms.int32(0)
225 print(
"WARNING: disabling mixing of HB, HE and HO recHit collections, this setting should be used for DEBUGGING only !!")
228 process.muonDetHits = cms.EDProducer(
'MuonDetCleaner',
229 trackAssociator = trackAssocParamsForMuonCleaning,
230 selectedMuons = process.customization_options.ZmumuCollection,
231 verbosity = cms.int32(0)
233 if process.customization_options.replaceGenOrRecMuonMomenta.value() ==
"gen":
234 process.muonDetHits.trackAssociator.muonMaxDistanceX = cms.double(1.e+3)
235 process.muonDetHits.trackAssociator.muonMaxDistanceX = cms.double(1.e+3)
236 process.muonDetHits.trackAssociator.dRMuonPreselection = cms.double(0.5)
237 process.ProductionFilterSequence += process.muonDetHits
239 recHitMuonDetCleanerConfig = cms.PSet(
240 srcHitMapMuPlus = cms.InputTag(
"muonDetHits",
"hitsMuPlus"),
241 srcHitMapMuMinus = cms.InputTag(
"muonDetHits",
"hitsMuMinus"),
242 verbosity = cms.int32(0)
245 if process.customization_options.muonMixingMode.value() == 2:
247 configtools.cloneProcessingSnippet(process, process.muonlocalreco,
"ORG")
248 process.reconstruction_step.replace(process.dt1DRecHits, process.muonlocalrecoORG*process.dt1DRecHits)
250 if process.customization_options.muonMixingMode.value() == 1
or \
251 process.customization_options.muonMixingMode.value() == 2:
253 print "Mixing CSC recHit collection"
254 process.csc2DRecHitsORG = process.csc2DRecHits.clone()
255 process.csc2DRecHits = cms.EDProducer(
"CSCRecHitMixer",
256 recHitMuonDetCleanerConfig,
259 collection1 = cms.InputTag(
"csc2DRecHitsORG",
""),
260 cleanCollection1 = cms.bool(
False),
261 collection2 = cms.InputTag(
"csc2DRecHits",
"", inputProcess),
262 cleanCollection2 = cms.bool(
True)
269 print "Mixing DT recHit collection"
270 process.dt1DRecHitsORG = process.dt1DRecHits.clone()
271 process.dt1DRecHits = cms.EDProducer(
"DTRecHitMixer",
272 recHitMuonDetCleanerConfig,
275 collection1 = cms.InputTag(
"dt1DRecHitsORG",
""),
276 cleanCollection1 = cms.bool(
False),
277 collection2 = cms.InputTag(
"dt1DRecHits",
"", inputProcess),
278 cleanCollection2 = cms.bool(
True)
285 print "Mixing RPC recHit collection"
286 process.rpcRecHitsORG = process.rpcRecHits.clone()
287 process.rpcRecHits = cms.EDProducer(
"RPCRecHitMixer",
288 recHitMuonDetCleanerConfig,
291 collection1 = cms.InputTag(
"rpcRecHitsORG",
""),
292 cleanCollection1 = cms.bool(
False),
293 collection2 = cms.InputTag(
"rpcRecHits",
"", inputProcess),
294 cleanCollection2 = cms.bool(
True)
300 if process.customization_options.muonMixingMode.value() == 2
or \
301 process.customization_options.muonMixingMode.value() == 3:
305 process.MuonTransientTrackingRecHitBuilderESProducerFromDisk = process.MuonTransientTrackingRecHitBuilderESProducer.clone(
306 ComponentName = cms.string(
'MuonRecHitBuilderFromDisk'),
307 ComputeCoarseLocalPositionFromDisk = cms.bool(
True)
309 process.ttrhbwrFromDisk = process.ttrhbwr.clone(
310 ComponentName = cms.string(
'WithTrackAngleFromDisk'),
311 ComputeCoarseLocalPositionFromDisk = cms.bool(
True)
313 process.glbTrackQual.RefitterParameters.MuonRecHitBuilder = cms.string(
'MuonRecHitBuilderFromDisk')
314 process.glbTrackQual.RefitterParameters.TrackerRecHitBuilder = cms.string(
'WithTrackAngleFromDisk')
316 process.globalMuonsORG = process.globalMuons.clone()
317 process.cleanedGlobalMuons = cms.EDProducer(
"GlobalMuonTrackCleaner",
318 selectedMuons = process.customization_options.ZmumuCollection,
319 tracks = cms.VInputTag(
"globalMuons"),
320 dRmatch = cms.double(3.e-1),
321 removeDuplicates = cms.bool(
True),
322 type = cms.string(
"links"),
323 srcMuons = cms.InputTag(
"muons"),
324 verbosity = cms.int32(0)
326 process.globalMuons = cms.EDProducer(
"GlobalMuonTrackMixer",
329 collection1 = cms.InputTag(
"globalMuonsORG",
"",
"EmbeddedRECO"),
330 collection2 = cms.InputTag(
"cleanedGlobalMuons"),
333 verbosity = cms.int32(0)
335 replaceModule_or_Sequence(process, process.globalMuons, process.cleanedGlobalMuons*process.globalMuonsORG*process.globalMuons)
337 process.standAloneMuonsORG = process.standAloneMuons.clone()
338 process.cleanedStandAloneMuons = process.cleanedGeneralTracks.clone(
339 tracks = cms.VInputTag(
340 cms.InputTag(
"standAloneMuons" ,
""),
341 cms.InputTag(
"standAloneMuons",
"UpdatedAtVtx"),
343 type = cms.string(
"outer tracks"),
344 verbosity = cms.int32(0)
346 process.standAloneMuons = cms.EDProducer(
"TrackMixer",
349 collection1 = cms.InputTag(
"standAloneMuonsORG",
"",
"EmbeddedRECO"),
350 collection2 = cms.InputTag(
"cleanedStandAloneMuons",
"")
353 collection1 = cms.InputTag(
"standAloneMuonsORG",
"UpdatedAtVtx",
"EmbeddedRECO"),
354 collection2 = cms.InputTag(
"cleanedStandAloneMuons",
"UpdatedAtVtx")
357 verbosity = cms.int32(0)
359 replaceModule_or_Sequence(process, process.standAloneMuons, process.cleanedStandAloneMuons*process.standAloneMuonsORG*process.standAloneMuons)
361 process.tevMuonsORG = process.tevMuons.clone()
362 if not process.customization_options.skipMuonDetRecHitMixing.value():
363 process.tevMuonsORG.RefitterParameters.CSCRecSegmentLabel = cms.InputTag(
"csc2DRecHitsORG")
364 process.tevMuonsORG.RefitterParameters.DTRecSegmentLabel = cms.InputTag(
"dt1DRecHitsORG")
365 process.tevMuonsORG.RefitterParameters.RPCRecSegmentLabel = cms.InputTag(
"rpcRecHitsORG")
366 process.tevMuonsORG.MuonCollectionLabel = cms.InputTag(
"globalMuonsORG")
367 process.cleanedTeVMuons = cms.EDProducer(
"TeVMuonTrackCleaner",
368 selectedMuons = process.customization_options.ZmumuCollection,
369 tracks = cms.VInputTag(
370 cms.InputTag(
"tevMuons",
"default"),
371 cms.InputTag(
"tevMuons",
"dyt"),
372 cms.InputTag(
"tevMuons",
"firstHit"),
373 cms.InputTag(
"tevMuons",
"picky")
375 dRmatch = cms.double(3.e-1),
376 removeDuplicates = cms.bool(
True),
377 type = cms.string(
"tev"),
378 srcGlobalMuons_cleaned = cms.InputTag(
"cleanedGlobalMuons"),
379 verbosity = cms.int32(0)
381 process.tevMuons = cms.EDProducer(
"TeVMuonTrackMixer",
384 collection1 = cms.InputTag(
"tevMuonsORG",
"default",
"EmbeddedRECO"),
385 collection2 = cms.InputTag(
"cleanedTeVMuons",
"default")
388 collection1 = cms.InputTag(
"tevMuonsORG",
"dyt",
"EmbeddedRECO"),
389 collection2 = cms.InputTag(
"cleanedTeVMuons",
"dyt")
392 collection1 = cms.InputTag(
"tevMuonsORG",
"firstHit",
"EmbeddedRECO"),
393 collection2 = cms.InputTag(
"cleanedTeVMuons",
"firstHit")
396 collection1 = cms.InputTag(
"tevMuonsORG",
"picky",
"EmbeddedRECO"),
397 collection2 = cms.InputTag(
"cleanedTeVMuons",
"picky")
400 srcGlobalMuons_cleaned = cms.InputTag(
"cleanedGlobalMuons"),
401 verbosity = cms.int32(0)
def replaceModule_or_Sequence
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.