CMS 3D CMS Logo

customizeMuonDigi.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 
4 """
5 Important note to developers: the random number services of the GEM and
6 ME0 digi modules are no longer initialized in this file. Instead, they
7 are automically initialized through the --era (Run3, Phase2) command.
8 In case cmsRun or cmsDriver crashes because of RandomNumberGeneratorSerivce,
9 you may have forgotten to specify the correct era!
10 
11  --Sven Dildick
12 """
13 
14 
15 # Customize process.mix to be used for running muon (DT, CSC, RPC) digi only.
16 # - remove non-muon digitizers that are now run as part of mixing process
17 # - delete all the digitizers' aliases.
18 # - drop unnecessary mixObjects
20  process.mix.digitizers = digitizers = cms.PSet()
21  digi_aliases = [n for n in process.aliases.keys() if 'Digi' in n]
22  for a in digi_aliases: process.__delattr__(a)
23  from SimGeneral.MixingModule.mixObjects_cfi import theMixObjects
24  process.mix.mixObjects = theMixObjects
25  process.mix.mixObjects.mixCH = cms.PSet()
26  process.mix.mixObjects.mixSH.crossingFrames = cms.untracked.vstring(
27  'MuonCSCHits',
28  'MuonDTHits',
29  'MuonRPCHits'
30  )
31  process.mix.mixObjects.mixSH.input = cms.VInputTag(
32  cms.InputTag("g4SimHits","MuonCSCHits"),
33  cms.InputTag("g4SimHits","MuonDTHits"),
34  cms.InputTag("g4SimHits","MuonRPCHits")
35  )
36  process.mix.mixObjects.mixSH.subdets = cms.vstring(
37  'MuonCSCHits',
38  'MuonDTHits',
39  'MuonRPCHits'
40  )
41  return process
42 
43 
44 # customize process.mix by appending GEM SimHit collection definitions to mix.mixObjects.mixSH
45 def customize_mix_addGEM(process):
46  process.mix.mixObjects.mixSH.crossingFrames.append('MuonGEMHits')
47  process.mix.mixObjects.mixSH.input.append(cms.InputTag("g4SimHits","MuonGEMHits"))
48  process.mix.mixObjects.mixSH.subdets.append('MuonGEMHits')
49  return process
50 
51 
52 # customize process.mix by appending ME0 SimHit collection definitions to mix.mixObjects.mixSH
53 def customize_mix_addME0(process):
54  process.mix.mixObjects.mixSH.crossingFrames.append('MuonME0Hits')
55  process.mix.mixObjects.mixSH.input.append(cms.InputTag("g4SimHits","MuonME0Hits"))
56  process.mix.mixObjects.mixSH.subdets.append('MuonME0Hits')
57  return process
58 
59 
60 ## load the digitizer and pad producer
61 def load_GEM_digitizers(process):
62  process.load('SimMuon.GEMDigitizer.muonGEMDigi_cff')
63  return process
64 
65 
66 ## load the digitizer and pad producer
67 def load_ME0_digitizers(process):
68  process.load('SimMuon.GEMDigitizer.muonME0Digi_cff')
69  return process
70 
71 
72 # Customize process.mix to be used for running muon (DT, CSC, RPC + GEM) digi only.
73 # - first do such customization for (DT, CSC, RPC)
74 # - append GEM SimHit collection definitions to mix.mixObjects.mixSH
76  process = customize_mix_muon_only(process)
77  process = customize_mix_addGEM(process)
78  return process
79 
80 
81 # Customize process.mix to be used for running muon (DT, CSC, RPC + ME0) digi only.
82 # - first do such customization for (DT, CSC, RPC)
83 # - append ME0 SimHit collection definitions to mix.mixObjects.mixSH
85  process = customize_mix_muon_only(process)
86  process = customize_mix_addME0(process)
87  return process
88 
89 
90 # Customize process.mix to be used for running muon (DT, CSC, RPC, GEM, ME0) digi only.
91 # - first do such customization for (DT, CSC, RPC)
92 # - append GEM SimHit collection definitions to mix.mixObjects.mixSH
93 # - append ME0 SimHit collection definitions to mix.mixObjects.mixSH
95  process = customize_mix_muon_only(process)
96  process = customize_mix_addGEM(process)
97  process = customize_mix_addME0(process)
98  return process
99 
100 
101 # customize the digitization sequence pdigi to only digitize GEM
103  process = load_GEM_digitizers(process)
104  process = customize_mix_addGEM_muon_only(process)
105  process.pdigi = cms.Sequence(
106  cms.SequencePlaceholder("randomEngineStateProducer")*
107  cms.SequencePlaceholder("mix")*
108  process.muonGEMDigi
109  )
110  process = append_GEMDigi_event(process)
111  return process
112 
113 
114 # customize the digitization sequence pdigi to only digitize ME0
116  process = load_ME0_digitizers(process)
117  process = customize_mix_addME0_muon_only(process)
118  process.pdigi = cms.Sequence(
119  cms.SequencePlaceholder("randomEngineStateProducer")*
120  cms.SequencePlaceholder("mix")*
121  process.muonME0Digi
122  )
123  process = append_ME0Digi_event(process)
124  return process
125 
126 
127 # customize the digitization sequence pdigi to only digitize GEM, ME0
129  process = load_GEM_digitizers(process)
130  process = load_ME0_digitizers(process)
131  process = customize_mix_addGEM_addME0_muon_only(process)
132  process.pdigi = cms.Sequence(
133  cms.SequencePlaceholder("randomEngineStateProducer")*
134  cms.SequencePlaceholder("mix")*
135  process.muonGEMDigi*
136  process.muonME0Digi
137  )
138  process = append_GEMDigi_event(process)
139  return process
140 
141 
142 # customize the digitization sequence pdigi to only digitize DT+CSC+RPC+GEM
144  process = load_GEM_digitizers(process)
145  process = customize_mix_addGEM_muon_only(process)
146  process.muonDigi = cms.Sequence(
147  process.simMuonCSCDigis +
148  process.simMuonDTDigis +
149  process.simMuonRPCDigis +
150  process.muonGEMDigi
151  )
152  process.pdigi = cms.Sequence(
153  cms.SequencePlaceholder("randomEngineStateProducer")*
154  cms.SequencePlaceholder("mix")*
155  process.muonDigi
156  )
157  process = append_GEMDigi_event(process)
158  return process
159 
160 
161 # customize the digitization sequence pdigi to only digitize DT+CSC+RPC+GEM+ME0
163  process = load_GEM_digitizers(process)
164  process = load_ME0_digitizers(process)
165  process = customize_mix_addGEM_addME0_muon_only(process)
166  process.muonDigi = cms.Sequence(
167  process.simMuonCSCDigis +
168  process.simMuonDTDigis +
169  process.simMuonRPCDigis +
170  process.muonGEMDigi +
171  process.muonME0Digi
172  )
173  process.pdigi = cms.Sequence(
174  cms.SequencePlaceholder("randomEngineStateProducer")*
175  cms.SequencePlaceholder("mix")*
176  process.muonDigi
177  )
178  process = append_GEMDigi_event(process)
179  return process
180 
181 
182 # customize the full digitization sequence pdigi by adding GEMs
184  process = load_GEM_digitizers(process)
185  process = customize_mix_addGEM(process)
186  process.doAllDigi = cms.Sequence(
187  process.calDigi +
188  process.muonDigi +
189  process.muonGEMDigi
190  )
191  process.pdigi = cms.Sequence(
192  cms.SequencePlaceholder("randomEngineStateProducer")*
193  cms.SequencePlaceholder("mix")*
194  process.doAllDigi*
195  process.addPileupInfo
196  )
197  process = append_GEMDigi_event(process)
198  return process
199 
200 
201 # customize the full digitization sequence pdigi by adding GEMs
203  process = load_GEM_digitizers(process)
204  process = load_ME0_digitizers(process)
205  process = customize_mix_addGEM(process)
206  process = customize_mix_addME0(process)
207  process.doAllDigi = cms.Sequence(
208  process.calDigi +
209  process.muonDigi +
210  process.muonGEMDigi +
211  process.muonME0Digi
212  )
213  process.pdigi = cms.Sequence(
214  cms.SequencePlaceholder("randomEngineStateProducer")*
215  cms.SequencePlaceholder("mix")*
216  process.doAllDigi*
217  process.addPileupInfo
218  )
219  process = append_GEMDigi_event(process)
220  return process
221 
222 
223 # insert the GEMDigi and GEMPadDigi collection to the event
224 def append_GEMDigi_event(process):
225  alist=['AODSIM','RECOSIM','FEVTSIM','FEVTDEBUG','FEVTDEBUGHLT','RECODEBUG','RAWRECOSIMHLT','RAWRECODEBUGHLT']
226  for a in alist:
227  b=a+'output'
228  if hasattr(process,b):
229  getattr(process,b).outputCommands.extend(['keep *_g4SimHits_Muon*_*', 'keep *_*Muon*_*_*'])
230 
231  return process
232 
233 # Customizations for the background
235  process.simMuonGEMDigis.doBkgNoise = False
236  return process
237 
239  process.simMuonGEMDigis.rateFact = 1
240  return process
241 
242 # Customizations for the background (to be updated once the realistic digi is in place)
244  process.simMuonME0PseudoDigis.simulateElectronBkg = False
245  process.simMuonME0PseudoDigis.simulateNeutralBkg = False
246  return process
247 
249  process.simMuonME0PseudoDigis.rateFact = 1
250  return process
251 
252 # Customizations for the background
254  process.simMuonRPCDigis.doBkgNoise = False
255  return process
256 
257 # adding re-digi costumisation - to be used for dedicated trigger studies
258 def customise_rpcRedigi(process):
259  process.load('Configuration.StandardSequences.Digi_cff')
260  process.simMuonRPCReDigis = process.simMuonRPCDigis.clone()
261  process.simMuonRPCReDigis.digiModelConfig = process.simMuonRPCDigis.digiModelConfig.clone(
262  IRPC_time_resolution = cms.double(1.5),
263  IRPC_electronics_jitter = cms.double(0.1),
264  )
265  process.simMuonRPCReDigis.digiIRPCModelConfig = process.simMuonRPCReDigis.digiModelConfig.clone(
266  IRPC_time_resolution = cms.double(1.0),
267  do_Y_coordinate = cms.bool(True),
268  )
269  process.simMuonRPCReDigis.digiModel = cms.string('RPCSimModelTiming')
270  process.RandomNumberGeneratorService.simMuonRPCReDigis = cms.PSet(
271  initialSeed = cms.untracked.uint32(13579),
272  engineName = cms.untracked.string('TRandom3')
273  )
274  process.rpcRecHits.rpcDigiLabel = cms.InputTag("simMuonRPCReDigis")
275  process.validationMuonRPCDigis.rpcDigiTag = cms.untracked.InputTag("simMuonRPCReDigis")
276  process.reconstruction_step.replace(
277  process.rpcRecHits,
278  cms.Sequence(process.simMuonRPCReDigis+process.rpcRecHits)
279  )
280  return process
def append_GEMDigi_event(process)
def customize_mix_addGEM_muon_only(process)
def customize_mix_muon_only(process)
def customize_digi_addGEM_addME0_muon_only(process)
def customise_rpcRedigi(process)
def customize_digi_addGEM_gem_only(process)
def customize_digi_noME0safety(process)
def customize_mix_addME0(process)
def customize_digi_addGEM_addME0_gem_me0_only(process)
def load_ME0_digitizers(process)
load the digitizer and pad producer
def customize_digi_noGEMbkg(process)
def customize_mix_addME0_muon_only(process)
def customize_digi_noGEMsafety(process)
def load_GEM_digitizers(process)
load the digitizer and pad producer
def customize_digi_addGEM_addME0(process)
def customize_digi_addGEM(process)
def customize_digi_addGEM_muon_only(process)
def customize_digi_addME0_me0_only(process)
def customize_mix_addGEM(process)
def customize_digi_noME0bkg(process)
def customize_digi_noRPCbkg(process)
def customize_mix_addGEM_addME0_muon_only(process)