CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
customizeME0Digi.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
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("generatorSmeared"),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 # a modifier to append ME0 SimHit collection definitions to mixObjects.mixSH
60 def mixObjects_addME0(mixSH):
61  mixSH.crossingFrames.append('MuonME0Hits')
62  mixSH.input.append(cms.InputTag("g4SimHits","MuonME0Hits"))
63  mixSH.subdets.append('MuonME0Hits')
64  return mixSH
65 
66 
67 # customize process.mix by appending ME0 SimHit collection definitions to mix.mixObjects.mixSH
68 def customize_mix_addME0(process):
69  mixObjects_addME0(process.mix.mixObjects.mixSH)
70  return process
71 
72 
73 # Customize process.mix to be used for running muon (DT, CSC, RPC + ME0) digi only.
74 # - first do such customization for (DT, CSC, RPC)
75 # - append ME0 SimHit collection definitions to mix.mixObjects.mixSH
77  process = customize_mix_muon_only(process)
78  mixObjects_addME0(process.mix.mixObjects.mixSH)
79  return process
80 
81 
82 # Add simMuonME0Digis to the list of modules served by RandomNumberGeneratorService
84  process.RandomNumberGeneratorService.simMuonME0Digis = cms.PSet(
85  initialSeed = cms.untracked.uint32(1234567),
86  engineName = cms.untracked.string('HepJamesRandom')
87  )
88  return process
89 
90 
91 ## load the digitizer
92 def load_ME0_digitizer(process):
93  process.load('SimMuon.GEMDigitizer.muonME0DigisPreReco_cfi')
94  return process
95 
96 
97 # customize the full digitization sequence pdigi by adding ME0s
98 def customize_digi_addME0(process):
99  process = load_ME0_digitizer(process)
100  process = customize_random_ME0Digi(process)
101  process = customize_mix_addME0(process)
102  process.muonDigi = cms.Sequence(
103  process.simMuonCSCDigis +
104  process.simMuonDTDigis +
105  process.simMuonRPCDigis +
106  process.simMuonME0Digis
107  )
108  process.doAllDigi = cms.Sequence(
109  process.calDigi +
110  process.muonDigi
111  )
112  process.pdigi = cms.Sequence(
113  cms.SequencePlaceholder("randomEngineStateProducer")*
114  cms.SequencePlaceholder("mix")*
115  process.doAllDigi*
116  process.trackingParticles*
117  process.addPileupInfo
118  )
119  process = append_ME0Digi_event(process)
120  return process
121 
122 
123 # customize the digitization sequence pdigi to only digitize DT+CSC+RPC+ME0
125  process = load_ME0_digitizer(process)
126  process = customize_random_ME0Digi(process)
127  process = customize_mix_addME0_muon_only(process)
128  process.muonDigi = cms.Sequence(
129  process.simMuonCSCDigis +
130  process.simMuonDTDigis +
131  process.simMuonRPCDigis +
132  process.simMuonME0Digis
133  )
134  process.pdigi = cms.Sequence(
135  cms.SequencePlaceholder("randomEngineStateProducer")*
136  cms.SequencePlaceholder("mix")*
137  process.muonDigi
138  )
139  process = append_ME0Digi_event(process)
140  return process
141 
142 
143 # customize the digitization sequence pdigi to only digitize ME0
145  process = load_ME0_digitizer(process)
146  process = customize_random_ME0Digi(process)
147  process = customize_mix_addME0_muon_only(process)
148  process.pdigi = cms.Sequence(
149  cms.SequencePlaceholder("randomEngineStateProducer")*
150  cms.SequencePlaceholder("mix")*
151  process.simMuonME0Digis
152  )
153  process = append_ME0Digi_event(process)
154  return process
155 
156 
157 # insert the ME0Digi collection to the event
158 def append_ME0Digi_event(process):
159  alist=['AODSIM','RECOSIM','FEVTSIM','FEVTDEBUG','FEVTDEBUGHLT','RECODEBUG','RAWRECOSIMHLT','RAWRECODEBUGHLT']
160  for a in alist:
161  b=a+'output'
162  if hasattr(process,b):
163  getattr(process,b).outputCommands.append('keep *_simMuonME0Digis_*_*')
164  return process
def load_ME0_digitizer
load the digitizer
def customize_mix_addME0_muon_only