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 = customize_random_GEMDigi(process)
127  process = customize_mix_addGEM(process)
128  process.doAllDigi = cms.Sequence(process.trDigi + process.calDigi + process.muonDigi)
129  process.pdigi = cms.Sequence(
130  cms.SequencePlaceholder("randomEngineStateProducer")*
131  cms.SequencePlaceholder("mix")*
132  process.doAllDigi*
133  process.addPileupInfo
134  )
135  process = append_GEMDigi_event(process)
136  return process
137 
138 
139 # customize the digitization sequence pdigi to only digitize DT+CSC+RPC+GEM
141  process = customize_random_GEMDigi(process)
142  process = customize_mix_addGEM_muon_only(process)
143  process.muonDigi = cms.Sequence(process.simMuonCSCDigis + process.simMuonDTDigis + process.simMuonRPCDigis + process.simMuonGEMDigis + process.simMuonGEMPadDigis)
144  process.pdigi = cms.Sequence(
145  cms.SequencePlaceholder("randomEngineStateProducer")*
146  cms.SequencePlaceholder("mix")*
147  process.muonDigi
148  )
149  process = append_GEMDigi_event(process)
150  return process
151 
152 
153 # customize the digitization sequence pdigi to only digitize GEM
155  process = customize_random_GEMDigi(process)
156  process = customize_mix_addGEM_muon_only(process)
157  process.pdigi = cms.Sequence(
158  cms.SequencePlaceholder("randomEngineStateProducer")*
159  cms.SequencePlaceholder("mix")*
160  process.simMuonGEMDigis*
161  process.simMuonGEMPadDigis
162  )
163  process = append_GEMDigi_event(process)
164  return process
165 
166 
167 # customize the full digitization sequence pdigi by adding GEMs
169  process = load_GEM_digitizers(process)
170  process = load_ME0_digitizers(process)
171  process = customize_random_GEMDigi(process)
172  process = customize_random_ME0Digi(process)
173  process = customize_mix_addGEM(process)
174  process = customize_mix_addME0(process)
175  process.muonDigi = cms.Sequence(
176  process.simMuonCSCDigis +
177  process.simMuonDTDigis +
178  process.simMuonRPCDigis +
179  process.simMuonGEMDigis +
180  process.simMuonGEMPadDigis +
181  process.simMuonME0Digis
182  )
183  process.doAllDigi = cms.Sequence(
184  process.calDigi +
185  process.muonDigi
186  )
187  process.pdigi = cms.Sequence(
188  cms.SequencePlaceholder("randomEngineStateProducer")*
189  cms.SequencePlaceholder("mix")*
190  process.doAllDigi*
191  process.addPileupInfo
192  )
193  process = append_GEMDigi_event(process)
194  return process
195 
196 
197 # customize the digitization sequence pdigi to only digitize DT+CSC+RPC+GEM
199  process = load_GEM_digitizers(process)
200  process = load_ME0_digitizers(process)
201  process = customize_random_GEMDigi(process)
202  process = customize_random_ME0Digi(process)
203  process = customize_mix_addGEM_addME0_muon_only(process)
204  process.muonDigi = cms.Sequence(
205  process.simMuonCSCDigis +
206  process.simMuonDTDigis +
207  process.simMuonRPCDigis +
208  process.simMuonGEMDigis +
209  process.simMuonGEMPadDigis +
210  process.simMuonME0Digis
211  )
212  process.pdigi = cms.Sequence(
213  cms.SequencePlaceholder("randomEngineStateProducer")*
214  cms.SequencePlaceholder("mix")*
215  process.muonDigi
216  )
217  process = append_GEMDigi_event(process)
218  return process
219 
220 
221 # customize the digitization sequence pdigi to only digitize GEM
223  process = load_GEM_digitizers(process)
224  process = load_ME0_digitizers(process)
225  process = customize_random_GEMDigi(process)
226  process = customize_random_ME0Digi(process)
227  process = customize_mix_addGEM_addME0_muon_only(process)
228  process.pdigi = cms.Sequence(
229  cms.SequencePlaceholder("randomEngineStateProducer")*
230  cms.SequencePlaceholder("mix")*
231  process.simMuonGEMDigis*
232  process.simMuonGEMPadDigis*
233  process.simMuonME0Digis
234  )
235  process = append_GEMDigi_event(process)
236  return process
237 
238 
239 # insert the GEMDigi and GEMPadDigi collection to the event
240 def append_GEMDigi_event(process):
241  alist=['AODSIM','RECOSIM','FEVTSIM','FEVTDEBUG','FEVTDEBUGHLT','RECODEBUG','RAWRECOSIMHLT','RAWRECODEBUGHLT']
242  for a in alist:
243  b=a+'output'
244  if hasattr(process,b):
245  getattr(process,b).outputCommands.append('keep *_simMuonGEMDigis_*_*')
246  getattr(process,b).outputCommands.append('keep *_simMuonGEMPadDigis_*_*')
247  getattr(process,b).outputCommands.append('keep *_simMuonME0Digis_*_*')
248  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