CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
customizeGEMDigi.py
Go to the documentation of this file.
2 
3 
4 # PSet of mixObjects that only keeps muon collections (and SimTracks with SimVertices)
5 mixObjects_dt_csc_rpc = cms.PSet(
6  mixCH = cms.PSet(
7  crossingFrames = cms.untracked.vstring(),
8  input = cms.VInputTag(),
9  type = cms.string('PCaloHit'),
10  subdets = cms.vstring()
11  ),
12  mixHepMC = cms.PSet(
13  input = cms.VInputTag(cms.InputTag("generator")),
14  makeCrossingFrame = cms.untracked.bool(True),
15  type = cms.string('HepMCProduct')
16  ),
17  mixVertices = cms.PSet(
18  input = cms.VInputTag(cms.InputTag("g4SimHits")),
19  makeCrossingFrame = cms.untracked.bool(True),
20  type = cms.string('SimVertex')
21  ),
22  mixSH = cms.PSet(
23  crossingFrames = cms.untracked.vstring(
24  'MuonCSCHits',
25  'MuonDTHits',
26  'MuonRPCHits'
27  ),
28  input = cms.VInputTag(
29  cms.InputTag("g4SimHits","MuonCSCHits"),
30  cms.InputTag("g4SimHits","MuonDTHits"),
31  cms.InputTag("g4SimHits","MuonRPCHits")),
32  type = cms.string('PSimHit'),
33  subdets = cms.vstring(
34  'MuonCSCHits',
35  'MuonDTHits',
36  'MuonRPCHits'
37  )
38  ),
39  mixTracks = cms.PSet(
40  input = cms.VInputTag(cms.InputTag("g4SimHits")),
41  makeCrossingFrame = cms.untracked.bool(True),
42  type = cms.string('SimTrack')
43  )
44 )
45 
46 
47 # Customize process.mix to be used for running muon (DT, CSC, RPC) digi only.
48 # - remove non-muon digitizers that are now run as part of mixing process
49 # - delete all the digitizers' aliases.
50 # - drop unnecessary mixObjects
52  process.mix.digitizers = digitizers = cms.PSet()
53  digi_aliases = filter(lambda n: 'Digi' in n, process.aliases.keys())
54  for a in digi_aliases: process.__delattr__(a)
55  process.mix.mixObjects = mixObjects_dt_csc_rpc
56  return process
57 
58 
59 # customize process.mix by appending GEM SimHit collection definitions to mix.mixObjects.mixSH
60 def customize_mix_addGEM(process):
61  process.mix.mixObjects.mixSH.crossingFrames.append('MuonGEMHits')
62  process.mix.mixObjects.mixSH.input.append(cms.InputTag("g4SimHits","MuonGEMHits"))
63  process.mix.mixObjects.mixSH.subdets.append('MuonGEMHits')
64  return process
65 
66 
67 # customize process.mix by appending ME0 SimHit collection definitions to mix.mixObjects.mixSH
68 def customize_mix_addME0(process):
69  process.mix.mixObjects.mixSH.crossingFrames.append('MuonME0Hits')
70  process.mix.mixObjects.mixSH.input.append(cms.InputTag("g4SimHits","MuonME0Hits"))
71  process.mix.mixObjects.mixSH.subdets.append('MuonME0Hits')
72  return process
73 
74 
75 # Customize process.mix to be used for running muon (DT, CSC, RPC + GEM) digi only.
76 # - first do such customization for (DT, CSC, RPC)
77 # - append GEM SimHit collection definitions to mix.mixObjects.mixSH
79  process = customize_mix_muon_only(process)
80  process = customize_mix_addGEM(process)
81  return process
82 
83 
84 # Customize process.mix to be used for running muon (DT, CSC, RPC + GEM) digi only.
85 # - first do such customization for (DT, CSC, RPC)
86 # - append GEM SimHit collection definitions to mix.mixObjects.mixSH
88  process = customize_mix_muon_only(process)
89  process = customize_mix_addGEM(process)
90  process = customize_mix_addME0(process)
91  return process
92 
93 
94 # Add simMuonGEMDigis to the list of modules served by RandomNumberGeneratorService
96  process.RandomNumberGeneratorService.simMuonGEMDigis = cms.PSet(
97  initialSeed = cms.untracked.uint32(1234567),
98  engineName = cms.untracked.string('HepJamesRandom')
99  )
100  return process
101 
102 
103 # Add simMuonME0Digis to the list of modules served by RandomNumberGeneratorService
105  process.RandomNumberGeneratorService.simMuonME0Digis = cms.PSet(
106  initialSeed = cms.untracked.uint32(1234567),
107  engineName = cms.untracked.string('HepJamesRandom')
108  )
109  return process
110 
111 
112 ## load the digitizer and pad producer
113 def load_GEM_digitizers(process):
114  process.load('SimMuon.GEMDigitizer.muonGEMDigi_cff')
115  return process
116 
117 
118 ## load the digitizer and pad producer
119 def load_ME0_digitizers(process):
120  process.load('SimMuon.GEMDigitizer.muonME0DigisPreReco_cfi')
121  return process
122 
123 
124 # customize the full digitization sequence pdigi by adding GEMs
126  process = load_GEM_digitizers(process)
127  process = customize_random_GEMDigi(process)
128  process = customize_mix_addGEM(process)
129  process.doAllDigi = cms.Sequence(
130  process.calDigi +
131  process.muonDigi
132  )
133  process.pdigi = cms.Sequence(
134  cms.SequencePlaceholder("randomEngineStateProducer")*
135  cms.SequencePlaceholder("mix")*
136  process.doAllDigi*
137  process.addPileupInfo
138  )
139  process = append_GEMDigi_event(process)
140  return process
141 
142 
143 # customize the digitization sequence pdigi to only digitize DT+CSC+RPC+GEM
145  process = load_GEM_digitizers(process)
146  process = customize_random_GEMDigi(process)
147  process = customize_mix_addGEM_muon_only(process)
148  process.muonDigi = cms.Sequence(
149  process.simMuonCSCDigis +
150  process.simMuonDTDigis +
151  process.simMuonRPCDigis +
152  process.simMuonGEMDigis +
153  process.simMuonGEMPadDigis
154  )
155  process.pdigi = cms.Sequence(
156  cms.SequencePlaceholder("randomEngineStateProducer")*
157  cms.SequencePlaceholder("mix")*
158  process.muonDigi
159  )
160  process = append_GEMDigi_event(process)
161  return process
162 
163 
164 # customize the digitization sequence pdigi to only digitize GEM
166  process = load_GEM_digitizers(process)
167  process = customize_random_GEMDigi(process)
168  process = customize_mix_addGEM_muon_only(process)
169  process.pdigi = cms.Sequence(
170  cms.SequencePlaceholder("randomEngineStateProducer")*
171  cms.SequencePlaceholder("mix")*
172  process.simMuonGEMDigis*
173  process.simMuonGEMPadDigis
174  )
175  process = append_GEMDigi_event(process)
176  return process
177 
178 
179 # customize the full digitization sequence pdigi by adding GEMs
181  process = load_GEM_digitizers(process)
182  process = load_ME0_digitizers(process)
183  process = customize_random_GEMDigi(process)
184  process = customize_random_ME0Digi(process)
185  process = customize_mix_addGEM(process)
186  process = customize_mix_addME0(process)
187  process.muonDigi = cms.Sequence(
188  process.simMuonCSCDigis +
189  process.simMuonDTDigis +
190  process.simMuonRPCDigis +
191  process.simMuonGEMDigis +
192  process.simMuonGEMPadDigis +
193  process.simMuonME0Digis
194  )
195  process.doAllDigi = cms.Sequence(
196  process.calDigi +
197  process.muonDigi
198  )
199  process.pdigi = cms.Sequence(
200  cms.SequencePlaceholder("randomEngineStateProducer")*
201  cms.SequencePlaceholder("mix")*
202  process.doAllDigi*
203  process.addPileupInfo
204  )
205  process = append_GEMDigi_event(process)
206  return process
207 
208 
209 # customize the digitization sequence pdigi to only digitize DT+CSC+RPC+GEM
211  process = load_GEM_digitizers(process)
212  process = load_ME0_digitizers(process)
213  process = customize_random_GEMDigi(process)
214  process = customize_random_ME0Digi(process)
215  process = customize_mix_addGEM_addME0_muon_only(process)
216  process.muonDigi = cms.Sequence(
217  process.simMuonCSCDigis +
218  process.simMuonDTDigis +
219  process.simMuonRPCDigis +
220  process.simMuonGEMDigis +
221  process.simMuonGEMPadDigis +
222  process.simMuonME0Digis
223  )
224  process.pdigi = cms.Sequence(
225  cms.SequencePlaceholder("randomEngineStateProducer")*
226  cms.SequencePlaceholder("mix")*
227  process.muonDigi
228  )
229  process = append_GEMDigi_event(process)
230  return process
231 
232 
233 # customize the digitization sequence pdigi to only digitize GEM
235  process = load_GEM_digitizers(process)
236  process = load_ME0_digitizers(process)
237  process = customize_random_GEMDigi(process)
238  process = customize_random_ME0Digi(process)
239  process = customize_mix_addGEM_addME0_muon_only(process)
240  process.pdigi = cms.Sequence(
241  cms.SequencePlaceholder("randomEngineStateProducer")*
242  cms.SequencePlaceholder("mix")*
243  process.simMuonGEMDigis*
244  process.simMuonGEMPadDigis*
245  process.simMuonME0Digis
246  )
247  process = append_GEMDigi_event(process)
248  return process
249 
250 
251 # insert the GEMDigi and GEMPadDigi collection to the event
252 def append_GEMDigi_event(process):
253  alist=['AODSIM','RECOSIM','FEVTSIM','FEVTDEBUG','FEVTDEBUGHLT','RECODEBUG','RAWRECOSIMHLT','RAWRECODEBUGHLT']
254  for a in alist:
255  b=a+'output'
256  if hasattr(process,b):
257  getattr(process,b).outputCommands.append('keep *_simMuonGEMDigis_*_*')
258  getattr(process,b).outputCommands.append('keep *_simMuonGEMPadDigis_*_*')
259  getattr(process,b).outputCommands.append('keep *_simMuonME0Digis_*_*')
260  return process
def load_ME0_digitizers
load the digitizer and pad producer
def customize_digi_addGEM_addME0_gem_only
def load_GEM_digitizers
load the digitizer and pad producer
def customize_mix_addGEM_muon_only
def customize_digi_addGEM_addME0_muon_only
def customize_mix_addGEM_addME0_muon_only