CMS 3D CMS Logo

customisers.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 
4 ### Various set of customise functions needed for embedding
5 from __future__ import print_function
6 import FWCore.ParameterSet.Config as cms
7 from FWCore.ParameterSet.Utilities import cleanUnscheduled
8 
9 import six
10 
11 ################################ Customizer for skimming ###########################
12 ### There are four different parts.
13 ##First step is the SELECT (former SKIM) part, where we identfy the events which are good for Embedding. Need to store RAWRECO [RAW is needed for the MERG and RECO for the CLEAN step]
14 ##Second step is the CLEAN input are PAT muons with RECO information. After this step only RAW plus some special collections needed for the MERG step must be saved
15 ##Third step is the SIM. The input is the externalLHEProducer, which must be produced before (At the moment we do it parallel to the CLEAN step). Again only save RAW of the SELECT and only save what is need for the MERG step
16 ##Last step is the MERG step. Which is the usally reconstruction, where the input produces are replaced by merg producer, which mix the SIM and CLEAN inputs.
17 
18 ## Some comments on this approach. All steps runs the RECO sequence until the end in the moment. It would be possible to stop after the all inputs which are needed for the MERG step are generated (which happens at a very early state of the reconstruction. But with this approach we are able to get the RECO (and PAT aka miniAOD) of all four step SELECT (orginal event), SIM, CLEAN and MERGED. Therefor one only needs to SAVE the corresponding output (in cmsDriver change output to RAW -> RAW,RECO,PAT)
19 
20 ####################### Some basic functions ####################
21 ## Helper Class, which summerizes in which step which Producer (Cleaner Merger), should be loaded. It is also usefull to define which collection should be stored for the next step
22 ## E.g What is needed for MERGE must be produce in the CLEAN and SIM step
23 
24 
26  def __init__(self, module_name, manipulator_name, steps = ["SELECT","CLEAN","SIM","MERGE"], instance=[""], merge_prefix = ""):
27  self.module_name = module_name
28  self.manipulator_name = manipulator_name
29  self.steps = steps
30  self.instance = instance
31  self.merger_name = manipulator_name+"ColMerger"
32  self.cleaner_name = manipulator_name+"ColCleaner"
33  self.merge_prefix = merge_prefix
34 
35 
36 
37 
38 to_bemanipulate = []
39 
40 
41 to_bemanipulate.append(module_manipulate(module_name = 'siPixelClusters', manipulator_name = "Pixel", steps = ["SELECT","CLEAN"] ))
42 to_bemanipulate.append(module_manipulate(module_name = 'siStripClusters', manipulator_name = "Strip", steps = ["SELECT","CLEAN"] ))
43 
44 to_bemanipulate.append(module_manipulate(module_name = 'generalTracks', manipulator_name = "Track", steps = ["SIM", "MERGE"]))
45 to_bemanipulate.append(module_manipulate(module_name = 'muons1stStep', manipulator_name = "Muon", steps = ["SIM", "MERGE"]))
46 to_bemanipulate.append(module_manipulate(module_name = 'gedGsfElectronsTmp', manipulator_name = "GsfElectron", steps = ["SIM", "MERGE"]))
47 to_bemanipulate.append(module_manipulate(module_name = 'gedPhotonsTmp', manipulator_name = "Photon", steps = ["SIM", "MERGE"]))
48 to_bemanipulate.append(module_manipulate(module_name = 'particleFlowTmp', manipulator_name = "PF", steps = ["SIM", "MERGE"], instance=["","CleanedHF","CleanedCosmicsMuons","CleanedTrackerAndGlobalMuons","CleanedFakeMuons","CleanedPunchThroughMuons","CleanedPunchThroughNeutralHadrons","AddedMuonsAndHadrons"]))
49 
50 
51 to_bemanipulate.append(module_manipulate(module_name = 'ecalRecHit', manipulator_name = "EcalRecHit", instance= ["EcalRecHitsEB","EcalRecHitsEE"]))
52 to_bemanipulate.append(module_manipulate(module_name = 'ecalPreshowerRecHit', manipulator_name = "EcalRecHit", instance= ["EcalRecHitsES"]))
53 
54 to_bemanipulate.append(module_manipulate(module_name = 'hbheprereco', manipulator_name = "HBHERecHit"))
55 to_bemanipulate.append(module_manipulate(module_name = 'hbhereco', manipulator_name = "HBHERecHit"))
56 to_bemanipulate.append(module_manipulate(module_name = 'zdcreco', manipulator_name = "ZDCRecHit"))
57 
58 to_bemanipulate.append(module_manipulate(module_name = 'horeco', manipulator_name = "HORecHit"))
59 to_bemanipulate.append(module_manipulate(module_name = 'hfreco', manipulator_name = "HFRecHit"))
60 to_bemanipulate.append(module_manipulate(module_name = 'castorreco', manipulator_name = "CastorRecHit"))
61 
62 
63 to_bemanipulate.append(module_manipulate(module_name = 'dt1DRecHits', manipulator_name = "DTRecHit", steps = ["SELECT","CLEAN"] ))
64 to_bemanipulate.append(module_manipulate(module_name = 'dt1DCosmicRecHits', manipulator_name = "DTRecHit", steps = ["SELECT","CLEAN"] ))
65 
66 to_bemanipulate.append(module_manipulate(module_name = 'csc2DRecHits', manipulator_name = "CSCRecHit", steps = ["SELECT","CLEAN"] ))
67 to_bemanipulate.append(module_manipulate(module_name = 'rpcRecHits', manipulator_name = "RPCRecHit", steps = ["SELECT","CLEAN"] ))
68 
69 
70 def modify_outputModules(process, keep_drop_list = [], module_veto_list = [] ):
71  outputModulesList = [key for key,value in six.iteritems(process.outputModules)]
72  for outputModule in outputModulesList:
73  if outputModule in module_veto_list:
74  continue
75  outputModule = getattr(process, outputModule)
76  for add_element in keep_drop_list:
77  outputModule.outputCommands.extend(add_element)
78  return process
79 
80 
81 
82 ################################ Customizer for Selecting ###########################
83 
84 def keepSelected(dataTier):
85  ret_vstring = cms.untracked.vstring(
86  # "drop *_*_*_"+dataTier,
87  "keep *_patMuonsAfterID_*_"+dataTier,
88  "keep *_slimmedMuons_*_"+dataTier,
89  "keep *_selectedMuonsForEmbedding_*_"+dataTier,
90  "keep recoVertexs_offlineSlimmedPrimaryVertices_*_"+dataTier,
91  "keep *_firstStepPrimaryVertices_*_"+dataTier,
92  "keep *_offlineBeamSpot_*_"+dataTier
93  )
94  for akt_manimod in to_bemanipulate:
95  if "CLEAN" in akt_manimod.steps:
96  ret_vstring.append("keep *_"+akt_manimod.module_name+"_*_"+dataTier)
97  return ret_vstring
98 
99 def customiseSelecting(process,reselect=False):
100  if reselect:
101  process._Process__name = "RESELECT"
102  dataTier="RESELECT"
103  else:
104  process._Process__name = "SELECT"
105  dataTier="SELECT"
106 
107  process.load('TauAnalysis.MCEmbeddingTools.SelectingProcedure_cff')
108  process.patMuonsAfterKinCuts.src = cms.InputTag("slimmedMuons","",dataTier)
109  process.patMuonsAfterID = process.patMuonsAfterLooseID.clone()
110 
111  process.selecting = cms.Path(process.makePatMuonsZmumuSelection)
112  process.schedule.insert(-1, process.selecting)
113 
114  outputModulesList = [key for key,value in six.iteritems(process.outputModules)]
115  for outputModule in outputModulesList:
116  outputModule = getattr(process, outputModule)
117  outputModule.SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring("selecting"))
118  outputModule.outputCommands.extend(keepSelected(dataTier))
119 
120  process = customisoptions(process)
121  return modify_outputModules(process,[keepSelected(dataTier)])
122 
124  return customiseSelecting(process,reselect=True)
125 
126 ################################ Customizer for cleaining ###########################
128  ret_vstring = cms.untracked.vstring(
129 # "drop *_*_*_LHEembeddingCLEAN",
130 # "drop *_*_*_CLEAN"
131  )
132 
133  for akt_manimod in to_bemanipulate:
134  if "MERGE" in akt_manimod.steps:
135  ret_vstring.append("keep *_"+akt_manimod.module_name+"_*_LHEembeddingCLEAN")
136  ret_vstring.append("keep *_"+akt_manimod.module_name+"_*_CLEAN")
137  ret_vstring.append("keep *_standAloneMuons_*_LHEembeddingCLEAN")
138  ret_vstring.append("keep *_glbTrackQual_*_LHEembeddingCLEAN")
139  return ret_vstring
140 
141 
142 
143 def customiseCleaning(process, changeProcessname=True,reselect=False):
144  if changeProcessname:
145  process._Process__name = "CLEAN"
146  if reselect:
147  dataTier="RESELECT"
148  else:
149  dataTier="SELECT"
150  ## Needed for the Calo Cleaner, could also be put into a function wich fix the input parameters
151  from TrackingTools.TrackAssociator.default_cfi import TrackAssociatorParameterBlock
152  TrackAssociatorParameterBlock.TrackAssociatorParameters.CSCSegmentCollectionLabel = cms.InputTag("cscSegments","",dataTier)
153  TrackAssociatorParameterBlock.TrackAssociatorParameters.CaloTowerCollectionLabel = cms.InputTag("towerMaker","",dataTier)
154  TrackAssociatorParameterBlock.TrackAssociatorParameters.DTRecSegment4DCollectionLabel = cms.InputTag("dt4DSegments","",dataTier)
155  TrackAssociatorParameterBlock.TrackAssociatorParameters.EBRecHitCollectionLabel = cms.InputTag("ecalRecHit","EcalRecHitsEB",dataTier)
156  TrackAssociatorParameterBlock.TrackAssociatorParameters.EERecHitCollectionLabel = cms.InputTag("ecalRecHit","EcalRecHitsEE",dataTier)
157  TrackAssociatorParameterBlock.TrackAssociatorParameters.HBHERecHitCollectionLabel = cms.InputTag("hbhereco","",dataTier)
158  TrackAssociatorParameterBlock.TrackAssociatorParameters.HORecHitCollectionLabel = cms.InputTag("horeco","",dataTier)
159 
160 
161  MuonImput = cms.InputTag("selectedMuonsForEmbedding","","") ## This are the muon
162  for akt_manimod in to_bemanipulate:
163  if "CLEAN" in akt_manimod.steps:
164  oldCollections_in = cms.VInputTag()
165  for instance in akt_manimod.instance:
166  oldCollections_in.append(cms.InputTag(akt_manimod.module_name,instance,dataTier))
167  setattr(process, akt_manimod.module_name, cms.EDProducer(akt_manimod.cleaner_name,MuonCollection = MuonImput,TrackAssociatorParameters = TrackAssociatorParameterBlock.TrackAssociatorParameters,oldCollection = oldCollections_in))
168  process.ecalPreshowerRecHit.TrackAssociatorParameters.usePreshower = cms.bool(True)
169  process = customisoptions(process)
170  return modify_outputModules(process,[keepSelected(dataTier),keepCleaned()],["MINIAODoutput"])
171 
172 
173 ################################ Customizer for simulaton ###########################
174 def keepLHE():
175  ret_vstring = cms.untracked.vstring()
176  ret_vstring.append("keep *_externalLHEProducer_*_LHEembedding")
177  ret_vstring.append("keep *_externalLHEProducer_*_LHEembeddingCLEAN")
178  return ret_vstring
179 
180 
182  ret_vstring = cms.untracked.vstring()
183  for akt_manimod in to_bemanipulate:
184  if "MERGE" in akt_manimod.steps:
185  ret_vstring.append("keep *_"+akt_manimod.module_name+"_*_SIMembedding")
186  ret_vstring.append("keep *_genParticles_*_SIMembedding")
187  ret_vstring.append("keep *_standAloneMuons_*_SIMembedding")
188  ret_vstring.append("keep *_glbTrackQual_*_SIMembedding")
189  ret_vstring.append("keep *_generator_*_SIMembedding")
190  ret_vstring.append("keep *_addPileupInfo_*_SIMembedding")
191  ret_vstring.append("keep *_slimmedAddPileupInfo_*_*")
192  return ret_vstring
193 
194 
195 
196 
197 def customiseLHE(process, changeProcessname=True,reselect=False):
198  if reselect:
199  dataTier="RESELECT"
200  else:
201  dataTier="SELECT"
202  if changeProcessname:
203  process._Process__name = "LHEembedding"
204  process.load('TauAnalysis.MCEmbeddingTools.EmbeddingLHEProducer_cfi')
205  if reselect:
206  process.externalLHEProducer.vertices=cms.InputTag("offlineSlimmedPrimaryVertices","","RESELECT")
207  process.lheproduction = cms.Path(process.makeexternalLHEProducer)
208  process.schedule.insert(0,process.lheproduction)
209 
210 
211  process = customisoptions(process)
212  return modify_outputModules(process,[keepSelected(dataTier),keepCleaned(), keepLHE()],["MINIAODoutput"])
213 
214 
215 def customiseGenerator(process, changeProcessname=True,reselect=False):
216  if reselect:
217  dataTier="RESELECT"
218  else:
219  dataTier="SELECT"
220  if changeProcessname:
221  process._Process__name = "SIMembedding"
222 
223  ## here correct the vertex collection
224 
225  process.load('TauAnalysis.MCEmbeddingTools.EmbeddingVertexCorrector_cfi')
226  process.VtxSmeared = process.VtxCorrectedToInput.clone()
227  print("Correcting Vertex in genEvent to one from input. Replaced 'VtxSmeared' with the Corrector.")
228 
229  # Remove BeamSpot Production, use the one from selected data instead.
230  process.reconstruction.remove(process.offlineBeamSpot)
231 
232  # Disable noise simulation
233  process.mix.digitizers.castor.doNoise = cms.bool(False)
234 
235  process.mix.digitizers.ecal.doESNoise = cms.bool(False)
236  process.mix.digitizers.ecal.doENoise = cms.bool(False)
237 
238  process.mix.digitizers.hcal.doNoise = cms.bool(False)
239  process.mix.digitizers.hcal.doThermalNoise = cms.bool(False)
240  process.mix.digitizers.hcal.doHPDNoise = cms.bool(False)
241 
242  process.mix.digitizers.pixel.AddNoisyPixels = cms.bool(False)
243  process.mix.digitizers.pixel.AddNoise = cms.bool(False)
244 
245  process.mix.digitizers.strip.Noise = cms.bool(False)
246 
247 
248  process = customisoptions(process)
249  ##process = fix_input_tags(process)
250 
251  return modify_outputModules(process,[keepSelected(dataTier),keepCleaned(),keepSimulated()],["AODSIMoutput"])
252 
254  return customiseGenerator(process,reselect=True)
255 
256 ################################ Customizer for merging ###########################
257 def keepMerged(dataTier="SELECT"):
258  ret_vstring = cms.untracked.vstring()
259  ret_vstring.append("drop *_*_*_"+dataTier)
260  ret_vstring.append("keep *_prunedGenParticles_*_MERGE")
261  ret_vstring.append("keep *_generator_*_SIMembedding")
262  return ret_vstring
263 
264 
265 def customiseKeepPrunedGenParticles(process,reselect=False):
266  if reselect:
267  dataTier="RESELECT"
268  else:
269  dataTier="SELECT"
270 
271  process.load('PhysicsTools.PatAlgos.slimming.genParticles_cff')
272  process.merge_step += process.prunedGenParticlesWithStatusOne
273  process.load('PhysicsTools.PatAlgos.slimming.prunedGenParticles_cfi')
274  process.merge_step += process.prunedGenParticles
275  process.load('PhysicsTools.PatAlgos.slimming.packedGenParticles_cfi')
276  process.merge_step += process.packedGenParticles
277 
278  process.load('PhysicsTools.PatAlgos.mcMatchLayer0.muonMatch_cfi')
279  process.merge_step += process.muonMatch
280  process.load('PhysicsTools.PatAlgos.mcMatchLayer0.electronMatch_cfi')
281  process.merge_step += process.electronMatch
282  process.load('PhysicsTools.PatAlgos.mcMatchLayer0.photonMatch_cfi')
283  process.merge_step += process.photonMatch
284  process.load('PhysicsTools.PatAlgos.mcMatchLayer0.tauMatch_cfi')
285  process.merge_step += process.tauMatch
286  process.load('PhysicsTools.JetMCAlgos.TauGenJets_cfi')
287  process.merge_step += process.tauGenJets
288  process.load('PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff')
289  process.merge_step += process.patJetPartons
290  process.load('PhysicsTools.PatAlgos.mcMatchLayer0.jetMatch_cfi')
291  process.merge_step += process.patJetPartonMatch
292 
293  process.muonMatch.matched = "prunedGenParticles"
294  process.electronMatch.matched = "prunedGenParticles"
295  process.electronMatch.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
296  process.photonMatch.matched = "prunedGenParticles"
297  process.photonMatch.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
298  process.tauMatch.matched = "prunedGenParticles"
299  process.tauGenJets.GenParticles = "prunedGenParticles"
300  ##Boosted taus
301  #process.tauMatchBoosted.matched = "prunedGenParticles"
302  #process.tauGenJetsBoosted.GenParticles = "prunedGenParticles"
303  process.patJetPartons.particles = "prunedGenParticles"
304  process.patJetPartonMatch.matched = "prunedGenParticles"
305  process.patJetPartonMatch.mcStatus = [ 3, 23 ]
306  process.patJetGenJetMatch.matched = "slimmedGenJets"
307  process.patJetGenJetMatchAK8.matched = "slimmedGenJetsAK8"
308  process.patMuons.embedGenMatch = False
309  process.patElectrons.embedGenMatch = False
310  process.patPhotons.embedGenMatch = False
311  process.patTaus.embedGenMatch = False
312  process.patTausBoosted.embedGenMatch = False
313  process.patJets.embedGenPartonMatch = False
314  #also jet flavour must be switched
315  process.patJetFlavourAssociation.rParam = 0.4
316 
317  process.schedule.insert(0,process.merge_step)
318  process = customisoptions(process)
319  return modify_outputModules(process, [keepMerged(dataTier)])
320 
321 
322 def customiseMerging(process, changeProcessname=True,reselect=False):
323  if changeProcessname:
324  process._Process__name = "MERGE"
325  if reselect:
326  dataTier="RESELECT"
327  else:
328  dataTier="SELECT"
329 
330 
331  process.source.inputCommands = cms.untracked.vstring()
332  process.source.inputCommands.append("keep *_*_*_*")
333 
334  #process.source.inputCommands.append("drop *_*_*_SELECT")
335  #process.source.inputCommands.append("drop *_*_*_SIMembedding")
336  #process.source.inputCommands.append("drop *_*_*_LHEembeddingCLEAN")
337  #process.source.inputCommands.extend(keepSimulated())
338  #process.source.inputCommands.extend(keepCleaned())
339 
340  process.load('Configuration.StandardSequences.Reconstruction_Data_cff')
341  process.merge_step = cms.Path()
342 
343 
344  for akt_manimod in to_bemanipulate:
345  if "MERGE" in akt_manimod.steps:
346  #if akt_manimod.module_name != 'particleFlowTmp':
347  # continue
348  print(akt_manimod.module_name)
349  mergCollections_in = cms.VInputTag()
350  for instance in akt_manimod.instance:
351  mergCollections_in.append(cms.InputTag(akt_manimod.merge_prefix+akt_manimod.module_name,instance,"SIMembedding"))
352  mergCollections_in.append(cms.InputTag(akt_manimod.merge_prefix+akt_manimod.module_name,instance,"LHEembeddingCLEAN"))## Mayb make some process history magic which finds out if it was CLEAN or LHEembeddingCLEAN step
353  setattr(process, akt_manimod.module_name, cms.EDProducer(akt_manimod.merger_name,
354  mergCollections = mergCollections_in
355  )
356  )
357  process.merge_step +=getattr(process, akt_manimod.module_name)
358 
359 
360  process.merge_step += process.doAlldEdXEstimators
361  process.merge_step += process.vertexreco
362  process.unsortedOfflinePrimaryVertices.beamSpotLabel = cms.InputTag("offlineBeamSpot","",dataTier)
363  process.ak4CaloJetsForTrk.srcPVs = cms.InputTag("firstStepPrimaryVertices","",dataTier)
364 
365  process.muons.FillDetectorBasedIsolation = cms.bool(False)
366  process.muons.FillSelectorMaps = cms.bool(False)
367  process.muons.FillShoweringInfo = cms.bool(False)
368  process.muons.FillCosmicsIdMap = cms.bool(False)
369 
370 
371  process.merge_step += process.highlevelreco
372 
373  #process.merge_step.remove(process.reducedEcalRecHitsEE)
374  #process.merge_step.remove(process.reducedEcalRecHitsEB)
375 
376  process.merge_step.remove(process.ak4JetTracksAssociatorExplicit)
377 
378  process.merge_step.remove(process.pfTrack)
379  process.merge_step.remove(process.pfConversions)
380  process.merge_step.remove(process.pfV0)
381  process.merge_step.remove(process.particleFlowDisplacedVertexCandidate)
382  process.merge_step.remove(process.particleFlowDisplacedVertex)
383  process.merge_step.remove(process.pfDisplacedTrackerVertex)
384  process.merge_step.remove(process.pfTrackElec)
385  process.merge_step.remove(process.electronsWithPresel)
386  process.merge_step.remove(process.mvaElectrons)
387  process.merge_step.remove(process.particleFlowBlock)
388  process.merge_step.remove(process.particleFlowEGamma)
389  process.merge_step.remove(process.gedGsfElectronCores)
390  # process.merge_step.remove(process.gedGsfElectronsTmp)
391  process.merge_step.remove(process.gedPhotonCore)
392  process.merge_step.remove(process.ecalDrivenGsfElectronCores)
393  process.merge_step.remove(process.ecalDrivenGsfElectrons)
394  process.merge_step.remove(process.uncleanedOnlyElectronSeeds)
395  process.merge_step.remove(process.uncleanedOnlyAllConversions)
396  process.merge_step.remove(process.uncleanedOnlyPfTrack)
397  process.merge_step.remove(process.uncleanedOnlyPfTrackElec)
398  process.merge_step.remove(process.uncleanedOnlyGsfElectrons)
399  process.merge_step.remove(process.uncleanedOnlyElectronCkfTrackCandidates)
400  process.merge_step.remove(process.cosmicsVeto)
401  process.merge_step.remove(process.cosmicsVetoTrackCandidates)
402  # process.merge_step.remove(process.ecalDrivenGsfElectronCores)
403  # process.merge_step.remove(process.ecalDrivenGsfElectrons)
404  # process.merge_step.remove(process.gedPhotonsTmp)
405  # process.merge_step.remove(process.particleFlowTmp)
406  process.merge_step.remove(process.hcalnoise)
407 
408  process.load('CommonTools.ParticleFlow.genForPF2PAT_cff')
409 
410  process.merge_step += process.genForPF2PATSequence
411 
412  process.schedule.insert(0,process.merge_step)
413  # process.load('PhysicsTools.PatAlgos.slimming.slimmedGenJets_cfi')
414 
415  process = customisoptions(process)
416  return modify_outputModules(process, [keepMerged(dataTier)])
417 
418 def customiseMerging_Reselect(process, changeProcessname=True):
419  return customiseMerging(process, changeProcessname=changeProcessname, reselect=True)
420 
421 ################################ cross Customizers ###########################
422 
423 def customiseLHEandCleaning(process,reselect=False):
424  process._Process__name = "LHEembeddingCLEAN"
425  process = customiseCleaning(process,changeProcessname=False,reselect=reselect)
426  process = customiseLHE(process,changeProcessname=False,reselect=reselect)
427  return process
428 
430  return customiseLHEandCleaning(process,reselect=True)
431 
432 ################################ additionla Customizer ###########################
433 
434 def customisoptions(process):
435  if not hasattr(process, "options"):
436  process.options = cms.untracked.PSet()
437  process.options.emptyRunLumiMode = cms.untracked.string('doNotHandleEmptyRunsAndLumis')
438  if not hasattr(process, "bunchSpacingProducer"):
439  process.bunchSpacingProducer = cms.EDProducer("BunchSpacingProducer")
440  process.bunchSpacingProducer.bunchSpacingOverride = cms.uint32(25)
441  process.bunchSpacingProducer.overrideBunchSpacing = cms.bool(True)
442  process.options.numberOfThreads = cms.untracked.uint32(1)
443  process.options.numberOfStreams = cms.untracked.uint32(0)
444  return process
445 
446 ############################### MC specific Customizer ###########################
447 
449  process.load("TauAnalysis.MCEmbeddingTools.DYToMuMuGenFilter_cfi")
450  process.ZToMuMuFilter = cms.Path(process.dYToMuMuGenFilter)
451  process.schedule.insert(-1,process.ZToMuMuFilter)
452  return process
453 
455  process.load("TauAnalysis.MCEmbeddingTools.TTbartoMuMuGenFilter_cfi")
456  process.MCFilter = cms.Path(process.TTbartoMuMuGenFilter)
457  return customiseMCFilter(process)
458 
459 def customiseMCFilter(process):
460  process.schedule.insert(-1,process.MCFilter)
461  outputModulesList = [key for key,value in six.iteritems(process.outputModules)]
462  for outputModule in outputModulesList:
463  outputModule = getattr(process, outputModule)
464  outputModule.SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring("MCFilter"))
465  return process
466 
467 def fix_input_tags(process, formodules = ["generalTracks","cscSegments","dt4DSegments","rpcRecHits"]):
468  def change_tags_process(test_input):
469  if isinstance(test_input, cms.InputTag):
470  if test_input.getModuleLabel() in formodules:
471  test_input.setProcessName(process._Process__name)
472 
473  def search_for_tags(pset):
474  if isinstance(pset, dict):
475  for key in pset:
476  if isinstance(pset[key], cms.VInputTag):
477  for akt_inputTag in pset[key]:
478  change_tags_process(akt_inputTag)
479  elif isinstance(pset[key], cms.PSet):
480  search_for_tags(pset[key].__dict__)
481  elif isinstance(pset[key], cms.VPSet):
482  for akt_pset in pset[key]:
483  search_for_tags(akt_pset.__dict__)
484  else:
485  change_tags_process(pset[key])
486  else:
487  print("must be python dict not a ",type(pset))
488 
489  for module in process.producers_():
490  search_for_tags(getattr(process, module).__dict__)
491  for module in process.filters_():
492  search_for_tags(getattr(process, module).__dict__)
493  for module in process.analyzers_():
494  search_for_tags(getattr(process, module).__dict__)
495 
496  return process
def customiseSelecting(process, reselect=False)
Definition: customisers.py:99
def customiseLHEandCleaning_Reselect(process)
Definition: customisers.py:429
def customiseSelecting_Reselect(process)
Definition: customisers.py:123
def keepCleaned()
Customizer for cleaining ###########################.
Definition: customisers.py:127
def customiseGenerator(process, changeProcessname=True, reselect=False)
Definition: customisers.py:215
Customizer for skimming ########################### There are four different parts.
Definition: customisers.py:25
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:65
def keepLHE()
Customizer for simulaton ###########################.
Definition: customisers.py:174
def customiseKeepPrunedGenParticles(process, reselect=False)
Definition: customisers.py:265
def keepSimulated()
Definition: customisers.py:181
def keepMerged(dataTier="SELECT")
Customizer for merging ###########################.
Definition: customisers.py:257
def customiseFilterZToMuMu(process)
MC specific Customizer ###########################.
Definition: customisers.py:448
def customiseMerging(process, changeProcessname=True, reselect=False)
Definition: customisers.py:322
def fix_input_tags(process, formodules=["generalTracks", cscSegments, dt4DSegments, rpcRecHits)
Definition: customisers.py:467
def customiseMerging_Reselect(process, changeProcessname=True)
Definition: customisers.py:418
def customiseLHEandCleaning(process, reselect=False)
cross Customizers ###########################
Definition: customisers.py:423
def customiseMCFilter(process)
Definition: customisers.py:459
def __init__(self, module_name, manipulator_name, steps=["SELECT", CLEAN, SIM, MERGE, instance=[""], merge_prefix="")
Definition: customisers.py:26
def customisoptions(process)
additionla Customizer ###########################
Definition: customisers.py:434
def modify_outputModules(process, keep_drop_list=[], module_veto_list=[])
Definition: customisers.py:70
def customiseLHE(process, changeProcessname=True, reselect=False)
Definition: customisers.py:197
def keepSelected(dataTier)
Customizer for Selecting ###########################.
Definition: customisers.py:84
def customiseGenerator_Reselect(process)
Definition: customisers.py:253
def customiseCleaning(process, changeProcessname=True, reselect=False)
Definition: customisers.py:143
def customiseFilterTTbartoMuMu(process)
Definition: customisers.py:454