CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
muonCustoms.py
Go to the documentation of this file.
2 
3 
4 def unganged_me1a_geometry(process):
5  """Customise digi/reco geometry to use unganged ME1/a channels
6  """
7  process.CSCGeometryESModule.useGangedStripsInME1a = False
8  process.idealForDigiCSCGeometry.useGangedStripsInME1a = False
9  return process
10 
11 
13  """CSC digitizer customization
14  with bunchTimingOffsets tuned to center trigger stubs at bx6
15  when pretrigger with 3 layers and median stub timing are used
16  """
17  ## Make sure there's no bad chambers/channels
18  #process.simMuonCSCDigis.strips.readBadChambers = True
19  #process.simMuonCSCDigis.wires.readBadChannels = True
20  #process.simMuonCSCDigis.digitizeBadChambers = True
21 
22  ## Customised timing offsets so that ALCTs and CLCTs times are centered in signal BX.
23  ## These offsets below were tuned for the case of 3 layer pretriggering
24  ## and median stub timing algorithm.
25  process.simMuonCSCDigis.strips.bunchTimingOffsets = cms.vdouble(0.0,
26  37.53, 37.66, 55.4, 48.2, 54.45, 53.78, 53.38, 54.12, 51.98, 51.28)
27  process.simMuonCSCDigis.wires.bunchTimingOffsets = cms.vdouble(0.0,
28  22.88, 22.55, 29.28, 30.0, 30.0, 30.5, 31.0, 29.5, 29.1, 29.88)
29 
30  return process
31 
32 
34  """ Pick up upgrade condions data directly from DB tags using ESPrefer's.
35  Might be useful when dealing with a global tag that doesn't include
36  'unganged' CSC conditions.
37  """
38  myconds = [
39  ('CSCDBGainsRcd', 'CSCDBGains_ungangedME11A_mc'),
40  ('CSCDBNoiseMatrixRcd', 'CSCDBNoiseMatrix_ungangedME11A_mc'),
41  ('CSCDBCrosstalkRcd', 'CSCDBCrosstalk_ungangedME11A_mc'),
42  ('CSCDBPedestalsRcd', 'CSCDBPedestals_ungangedME11A_mc'),
43  ('CSCDBGasGainCorrectionRcd', 'CSCDBGasGainCorrection_ungangedME11A_mc'),
44  ('CSCDBChipSpeedCorrectionRcd', 'CSCDBChipSpeedCorrection_ungangedME11A_mc')
45  ]
46 
48  for (classname, tag) in myconds:
49  print classname, tag
50  sourcename = 'unganged_' + classname
51  process.__setattr__(sourcename, cscConditions.clone())
52  process.__getattribute__(sourcename).toGet = cms.VPSet( cms.PSet( record = cms.string(classname), tag = cms.string(tag)) )
53  process.__getattribute__(sourcename).connect = cms.string('frontier://FrontierProd/CMS_COND_CSC_000')
54  process.__setattr__('esp_' + classname, cms.ESPrefer("PoolDBESSource", sourcename) )
55 
56  del cscConditions
57 
58  return process
59 
60 
62  """Settings for the upgrade raw vs offline condition channel translation
63  """
64  process.CSCIndexerESProducer.AlgoName=cms.string("CSCIndexerPostls1")
65  process.CSCChannelMapperESProducer.AlgoName=cms.string("CSCChannelMapperPostls1")
66  return process
67 
68 
69 def remove_from_all_paths(process, module_name):
70  """Remove process.module_name from all the paths in process:
71  """
72 
73  # trivial case first:
74  if not hasattr(process, module_name):
75  return process
76 
77  # walk over all the paths:
78  for path_name in process._Process__paths.keys():
79  the_path = getattr(process, path_name)
80  module_names = the_path.moduleNames()
81  if module_name in module_names:
82  the_path.remove(getattr(process, module_name))
83  return process
84 
85 
87  """A sanity check to make sure that standard cmsDriver paths
88  have modules with expected names. If some paths would not have
89  expected modules, the procedure would only print WARNINGs.
90  """
91  # list of (pathName, expected moduleName) tuples:
92  paths_modules = [
93  ('digitisation_step', 'simMuonCSCDigis'),
94  ('L1simulation_step', 'simCscTriggerPrimitiveDigis'),
95  ('L1simulation_step', 'simCsctfTrackDigis'),
96  ('raw2digi_step', 'muonCSCDigis'),
97  ('raw2digi_step', 'csctfDigis'),
98  ('digi2raw_step', 'cscpacker'),
99  ('digi2raw_step', 'csctfpacker'),
100  ('reconstruction', 'csc2DRecHits'),
101  ('dqmoffline_step', 'muonAnalyzer'),
102  #('dqmHarvesting', ''),
103  ('validation_step', 'relvalMuonBits')
104  ]
105  # verify:
106  for path_name, module_name in paths_modules:
107  if hasattr(process, path_name) and not hasattr(process, module_name):
108  print "WARNING: module %s is not in %s path!!!" % (module_name, path_name)
109  print " This path has the following modules:"
110  print " ", getattr(process, path_name).moduleNames(),"\n"
111 
112 
113 # ------------------------------------------------------------------
114 
116  """Customise digi/reco geometry to use unganged ME1/a channels
117  """
118  process = unganged_me1a_geometry(process)
119  return process
120 
121 
123  """Customise CSC digitization to use unganged ME1/a channels
124  """
125  process = customise_csc_Indexing(process)
126  process = digitizer_timing_pre3_median(process)
127  return process
128 
129 
131  """Configure the local CSC trigger stubs emulator with the upgrade
132  algorithm version that efficiently uses unganged ME1a
133  """
134 
135  process = customise_csc_Indexing(process)
136 
137  from L1Trigger.CSCTriggerPrimitives.cscTriggerPrimitiveDigisPostLS1_cfi import cscTriggerPrimitiveDigisPostLS1
138  process.simCscTriggerPrimitiveDigis = cscTriggerPrimitiveDigisPostLS1
139  process.simCscTriggerPrimitiveDigis.CSCComparatorDigiProducer = cms.InputTag( 'simMuonCSCDigis', 'MuonCSCComparatorDigi')
140  process.simCscTriggerPrimitiveDigis.CSCWireDigiProducer = cms.InputTag( 'simMuonCSCDigis', 'MuonCSCWireDigi')
141 
142  return process
143 
144 
146  """Regular CSCTF configuration adapted to deal with unganged ME1a
147  """
148 
149  from L1Trigger.CSCTrackFinder.csctfTrackDigisUngangedME1a_cfi import csctfTrackDigisUngangedME1a
150  process.simCsctfTrackDigis = csctfTrackDigisUngangedME1a
151  process.simCsctfTrackDigis.DTproducer = cms.untracked.InputTag("simDtTriggerPrimitiveDigis")
152  process.simCsctfTrackDigis.SectorReceiverInput = cms.untracked.InputTag("simCscTriggerPrimitiveDigis", "MPCSORTED")
153 
154  return process
155 
156 
158  """Customise both stubs and TF emulators
159  """
160  process = customise_csc_L1Stubs(process)
161  process = customise_csc_L1TrackFinder(process)
162  return process
163 
164 
165 def customise_csc_Packer(process):
166  """Get rid of process.cscpacker and process.csctfpacker in all the paths
167  """
168  process = remove_from_all_paths(process, 'cscpacker')
169  process = remove_from_all_paths(process, 'csctfpacker')
170  return process
171 
172 
174  """Get rid of process.muonCSCDigis and process.csctfDigis in all the paths
175  """
176  process = remove_from_all_paths(process, 'muonCSCDigis')
177  process = remove_from_all_paths(process, 'csctfDigis')
178  return process
179 
180 
182  """Adjust L1Extra producer's input tags for the use case
183  when we want to run L1Extra without packing-unpacking first
184  """
185  l1ep = process.l1extraParticles
186  #l1ep.centralBxOnly = cms.bool(True)
187  #l1ep.produceMuonParticles = cms.bool(True)
188  #l1ep.produceCaloParticles = cms.bool(False)
189  #l1ep.ignoreHtMiss = cms.bool(False)
190  l1ep.muonSource = cms.InputTag('simGmtDigis')
191  l1ep.etTotalSource = cms.InputTag('simGctDigis')
192  l1ep.nonIsolatedEmSource = cms.InputTag('simGctDigis', 'nonIsoEm')
193  l1ep.etMissSource = cms.InputTag('simGctDigis')
194  l1ep.forwardJetSource = cms.InputTag('simGctDigis', 'forJets')
195  l1ep.centralJetSource = cms.InputTag('simGctDigis', 'cenJets')
196  l1ep.tauJetSource = cms.InputTag('simGctDigis', 'tauJets')
197  l1ep.isolatedEmSource = cms.InputTag('simGctDigis', 'isoEm')
198  l1ep.etHadSource = cms.InputTag('simGctDigis')
199  l1ep.htMissSource = cms.InputTag("simGctDigis")
200  l1ep.hfRingEtSumsSource = cms.InputTag("simGctDigis")
201  l1ep.hfRingBitCountsSource = cms.InputTag("simGctDigis")
202  return process
203 
204 
206  """Configure the CSC rechit producer
207  to handle unganged ME1a for upgrade studies
208  """
209  #
210  process = customise_csc_Indexing(process)
211 
212  # Turn off some flags for CSCRecHitD that are turned ON in default config
213  process.csc2DRecHits.readBadChannels = cms.bool(False)
214  process.csc2DRecHits.CSCUseGasGainCorrection = cms.bool(False)
215 
216  # Switch input for CSCRecHitD to s i m u l a t e d digis
217  process.csc2DRecHits.wireDigiTag = cms.InputTag("simMuonCSCDigis", "MuonCSCWireDigi")
218  process.csc2DRecHits.stripDigiTag = cms.InputTag("simMuonCSCDigis", "MuonCSCStripDigi")
219 
220  return process
221 
222 
223 def customise_csc_DQM(process):
224  """At this point: get rid of process.muonAnalyzer, adjust cscMonitor's input
225  """
226  process = remove_from_all_paths(process, 'muonAnalyzer')
227 
228  process.cscMonitor.clctDigiTag = cms.InputTag("simCscTriggerPrimitiveDigis")
229  process.cscMonitor.stripDigiTag = cms.InputTag("simMuonCSCDigis", "MuonCSCStripDigi")
230  process.cscMonitor.wireDigiTag = cms.InputTag("simMuonCSCDigis", "MuonCSCWireDigi")
231  process.cscMonitor.alctDigiTag = cms.InputTag("simCscTriggerPrimitiveDigis")
232 
233  process.l1tCsctf.statusProducer=cms.InputTag("null")
234  process.l1tCsctf.lctProducer=cms.InputTag("null")
235  process.l1tCsctf.trackProducer=cms.InputTag("null")
236  process.l1tCsctf.mbProducer=cms.InputTag("null")
237 
238  return process
239 
240 
242  """At this point, just get rid of process.relvalMuonBits
243  """
244  process = remove_from_all_paths(process, 'relvalMuonBits')
245  return process
246 
247 
249  """Full set of the CSC PostLS1 related customizations.
250  It's tied to specific expected module names.
251  Therefore, a sanity check is done first to make sure that
252  standard cmsDriver paths have modules with such expected names.
253  """
254 
255  # a simple sanity check first
257 
258  # use unganged geometry
259  process = customise_csc_Geometry(process)
260 
261  # digitizer
262  if hasattr(process, 'simMuonCSCDigis'):
263  process = customise_csc_Digitizer(process)
264 
265  # L1 stub emulator upgrade algorithm
266  if hasattr(process, 'simCscTriggerPrimitiveDigis'):
267  process = customise_csc_L1Stubs(process)
268 
269  # CSCTF that can deal with unganged ME1a
270  if hasattr(process, 'simCsctfTrackDigis'):
271  process = customise_csc_L1TrackFinder(process)
272 
273  # packer - simply get rid of it
274  if hasattr(process, 'cscpacker') or hasattr(process, 'csctfpacker'):
275  process = customise_csc_Packer(process)
276 
277  # unpacker - simply get rid of it
278  if hasattr(process, 'muonCSCDigis') or hasattr(process, 'csctfDigis'):
279  process = customise_csc_Unpacker(process)
280 
281  # CSC RecHiti producer adjustments
282  if hasattr(process, 'csc2DRecHits'):
283  process = customise_csc_LocalReco(process)
284 
285  # DQM
286  if hasattr(process, 'cscMonitor'):
287  process = customise_csc_DQM(process)
288 
289  # Validation
290  if hasattr(process, 'relvalMuonBits'):
291  process = customise_csc_Validation(process)
292 
293  return process
294 
295 def customise_csc_hlt(process):
296 
297  process.CSCGeometryESModule.useGangedStripsInME1a = False
298 
299  process.hltCsc2DRecHits.readBadChannels = cms.bool(False)
300  process.hltCsc2DRecHits.CSCUseGasGainCorrections = cms.bool(False)
301 
302  process = customise_csc_Indexing(process)
303 
304  # Switch input for CSCRecHitD to s i m u l a t e d digis
305 
306  process.hltCsc2DRecHits.wireDigiTag = cms.InputTag("simMuonCSCDigis","MuonCSCWireDigi")
307  process.hltCsc2DRecHits.stripDigiTag = cms.InputTag("simMuonCSCDigis","MuonCSCStripDigi")
308 
309  return process
def customise_csc_L1Extra_allsim
Definition: muonCustoms.py:181
def customise_csc_Unpacker
Definition: muonCustoms.py:173
def customise_csc_Digitizer
Definition: muonCustoms.py:122
def unganged_me1a_geometry
Definition: muonCustoms.py:4
def customise_csc_Indexing
Definition: muonCustoms.py:61
def customise_csc_LocalReco
Definition: muonCustoms.py:205
def customise_csc_Geometry
Definition: muonCustoms.py:115
def customise_csc_L1TrackFinder
Definition: muonCustoms.py:145
def customise_csc_L1Emulator
Definition: muonCustoms.py:157
def customise_csc_cond_ungangedME11A_mc
Definition: muonCustoms.py:33
def customise_csc_DQM
Definition: muonCustoms.py:223
def customise_csc_Validation
Definition: muonCustoms.py:241
def remove_from_all_paths
Definition: muonCustoms.py:69
def csc_PathVsModule_SanityCheck
Definition: muonCustoms.py:86
def customise_csc_hlt
Definition: muonCustoms.py:295
def customise_csc_PostLS1
Definition: muonCustoms.py:248
def digitizer_timing_pre3_median
Definition: muonCustoms.py:12
def customise_csc_Packer
Definition: muonCustoms.py:165
def customise_csc_L1Stubs
Definition: muonCustoms.py:130