CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1Trigger_custom.py
Go to the documentation of this file.
1 # customization fragments to be used with cmsDriver and hltGetConfiguration
2 #
3 # V.M. Ghete 2010-06-09 initial version
4 
5 import FWCore.ParameterSet.Config as cms
6 
8 
9  # temporary solution FIXME
10 
11  process.load("L1TriggerConfig.L1GtConfigProducers.L1GtPrescaleFactorsAlgoTrigConfig_cff")
12  process.es_prefer_l1GtPrescaleFactorsAlgoTrig = cms.ESPrefer(
13  "L1GtPrescaleFactorsAlgoTrigTrivialProducer", "l1GtPrescaleFactorsAlgoTrig")
14 
15 
16  return (process)
17 
18 ##############################################################################
19 
21 
22  # temporary solution FIXME
23 
24  process.load("L1TriggerConfig.L1GtConfigProducers.L1GtPrescaleFactorsTechTrigConfig_cff")
25  process.es_prefer_l1GtPrescaleFactorsTechTrig = cms.ESPrefer(
26  "L1GtPrescaleFactorsTechTrigTrivialProducer", "l1GtPrescaleFactorsTechTrig")
27 
28  return (process)
29 
30 ##############################################################################
31 
33 
34  process.load("L1TriggerConfig.L1GtConfigProducers.L1GtTriggerMaskAlgoTrigConfig_cff")
35  process.es_prefer_l1GtTriggerMaskAlgoTrig = cms.ESPrefer(
36  "L1GtTriggerMaskAlgoTrigTrivialProducer", "l1GtTriggerMaskAlgoTrig")
37 
38  return (process)
39 
40 ##############################################################################
41 
43 
44  process.load("L1TriggerConfig.L1GtConfigProducers.L1GtTriggerMaskTechTrigConfig_cff")
45  process.es_prefer_l1GtTriggerMaskTechTrig = cms.ESPrefer(
46  "L1GtTriggerMaskTechTrigTrivialProducer", "l1GtTriggerMaskTechTrig")
47 
48  return (process)
49 
50 ##############################################################################
51 
53 
54  process.load("L1TriggerConfig.L1GtConfigProducers.L1GtTriggerMaskVetoAlgoTrigConfig_cff")
55  process.es_prefer_l1GtTriggerMaskVetoAlgoTrig = cms.ESPrefer(
56  "L1GtTriggerMaskVetoAlgoTrigTrivialProducer", "l1GtTriggerMaskVetoAlgoTrig")
57 
58  return (process)
59 
60 ##############################################################################
61 
63 
64  process.load("L1TriggerConfig.L1GtConfigProducers.L1GtTriggerMaskVetoTechTrigConfig_cff")
65  process.es_prefer_l1GtTriggerMaskVetoTechTrig = cms.ESPrefer(
66  "L1GtTriggerMaskVetoTechTrigTrivialProducer", "l1GtTriggerMaskVetoTechTrig")
67 
68  return (process)
69 
70 ##############################################################################
71 
73  process = customiseUnprescaleAlgoTriggers( process )
74  process = customiseUnprescaleTechTriggers( process )
75  process = customiseResetMasksAlgoTriggers( process )
76  process = customiseResetMasksTechTriggers( process )
77  process = customiseResetVetoMasksAlgoTriggers( process )
78  process = customiseResetVetoMasksTechTriggers( process )
79 
80  return (process)
81 
82 ##############################################################################
83 
84 def customiseL1Menu(process):
85 
86  # replace the L1 menu from the global tag with one of the following alternatives
87 
88  ####### user choices
89 
90  #l1MenuSource='globalTag'
91  #l1MenuSource='sqlFile'
92  l1MenuSource='xmlFile'
93 
94 
95  if l1MenuSource == 'sqlFile' :
96  # the menu will be read from the SQL file instead of the global tag
97  useSqlFile = '/afs/cern.ch/user/g/ghete/public/L1Menu/L1Menu_CollisionsHeavyIons2013_v0/sqlFile/L1Menu_CollisionsHeavyIons2013_v0_mc.db'
98  menuDbTag = 'L1GtTriggerMenu_L1Menu_CollisionsHeavyIons2013_v0_mc'
99  elif l1MenuSource == 'xmlFile' :
100  # the menu will be read from an XML file instead of the global tag - must copy the file in luminosityDirectory
101  luminosityDirectory = "startup"
102  useXmlFile = 'L1Menu_CollisionsHeavyIons2013_v0_L1T_Scales_20101224_Imp0_0x102c.xml'
103 
104  else :
105  print ' Using default L1 trigger menu from Global Tag '
106 
107  ####### end of user choices - do not change the following
108 
109  if l1MenuSource == 'xmlFile' :
110  print ' Retrieve L1 trigger menu only from XML file '
111  print ' ', useXmlFile
112  print ' '
113 
114  process.load('L1TriggerConfig.L1GtConfigProducers.l1GtTriggerMenuXml_cfi')
115  process.l1GtTriggerMenuXml.TriggerMenuLuminosity = luminosityDirectory
116  process.l1GtTriggerMenuXml.DefXmlFile = useXmlFile
117 
118  process.load('L1TriggerConfig.L1GtConfigProducers.L1GtTriggerMenuConfig_cff')
119  process.es_prefer_l1GtParameters = cms.ESPrefer('L1GtTriggerMenuXmlProducer','l1GtTriggerMenuXml')
120 
121 
122 
123  elif l1MenuSource == 'sqlFile' :
124  if useSqlFile != '' :
125  print ' Retrieve L1 trigger menu only from SQLlite file '
126  print ' ', useSqlFile
127  print ' '
128 
129  from CondCore.DBCommon.CondDBSetup_cfi import CondDBSetup
130  process.l1conddb = cms.ESSource("PoolDBESSource",
131  CondDBSetup,
132  connect = cms.string('sqlite_file:' + useSqlFile),
133  toGet = cms.VPSet(cms.PSet(
134  record = cms.string('L1GtTriggerMenuRcd'),
135  tag = cms.string(menuDbTag))),
136  BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService')
137  )
138  process.es_prefer_l1conddb = cms.ESPrefer("PoolDBESSource", "l1conddb")
139 
140  else :
141  print ' Error: no SQL file is given; please provide a valid SQL file for option sqlFile'
142 
143  else :
144  print ''
145 
146 
147  return process
148 
149 ##############################################################################
150 
152 
153  # customization of output commands, on top of the output commands selected
154  # in cmsDriver command
155 
156  # examples
157 
158  # drop all products, keep only the products from L1EmulRaw process and the FEDRawDataCollection_
159  #process.output.outputCommands.append('drop *_*_*_*')
160  #process.output.outputCommands.append('keep *_*_*_L1EmulRaw')
161  #process.output.outputCommands.append('keep FEDRawDataCollection_*_*_*')
162 
163 
164  return process
165 
166 
167 ##############################################################################
168 
170  # customization fragment to run L1 emulator starting from a RAW file
171 
172  # run trigger primitive generation on unpacked digis
173  process.load('L1Trigger.Configuration.CaloTriggerPrimitives_cff')
174 
175  process.CaloTPG_SimL1Emulator = cms.Sequence(
176  process.CaloTriggerPrimitives +
177  process.SimL1Emulator )
178 
179  for path in process._Process__paths.itervalues():
180  path.replace(process.SimL1Emulator, process.CaloTPG_SimL1Emulator)
181 
182  # set the new input tags after RawToDigi
183  process.simEcalTriggerPrimitiveDigis.Label = 'ecalDigis'
184  process.simHcalTriggerPrimitiveDigis.inputLabel = cms.VInputTag(
185  cms.InputTag('hcalDigis'),
186  cms.InputTag('hcalDigis')
187  )
188 
189  process.simDtTriggerPrimitiveDigis.digiTag = 'muonDTDigis'
190  process.simCscTriggerPrimitiveDigis.CSCComparatorDigiProducer = cms.InputTag( 'muonCSCDigis', 'MuonCSCComparatorDigi' )
191  process.simCscTriggerPrimitiveDigis.CSCWireDigiProducer = cms.InputTag( 'muonCSCDigis', 'MuonCSCWireDigi' )
192  process.simRpcTriggerDigis.label = 'muonRPCDigis'
193  process.simRpcTechTrigDigis.RPCDigiLabel = 'muonRPCDigis'
194 
195  return process
196 
197 ##############################################################################
198 
200  # customization fragment to run L1 GT emulator starting from a RAW file, with input from unpacked GCT and GMT products
201  # assuming that "RawToDigi_cff" (or "RawToDigi_data_cff") and "SimL1Emulator_cff" have already been loaded
202 
203  # producers for technical triggers:
204  # they must be re-run as their output is not available from RAW2DIGI
205 
206  # BSC Technical Trigger
207  # Note: will normally not work, it requires SimHits (not available from RAW2DIGI)
208  # works only on some MC samples where the SimHits are saved together with the FEDRaw
209  import L1TriggerOffline.L1Analyzer.bscTrigger_cfi
210  process.simBscDigis = L1TriggerOffline.L1Analyzer.bscTrigger_cfi.bscTrigger.clone()
211 
212  # RPC Technical Trigger
213  import L1Trigger.RPCTechnicalTrigger.rpcTechnicalTrigger_cfi
214  process.simRpcTechTrigDigis = L1Trigger.RPCTechnicalTrigger.rpcTechnicalTrigger_cfi.rpcTechnicalTrigger.clone()
215 
216  process.simRpcTriggerDigis.label = 'muonRPCDigis'
217  process.simRpcTechTrigDigis.RPCDigiLabel = 'muonRPCDigis'
218 
219  # HCAL Technical Trigger
221  process.simHcalTechTrigDigis = SimCalorimetry.HcalTrigPrimProducers.hcalTTPRecord_cfi.simHcalTTPRecord.clone()
222 
223 
224  # Global Trigger emulator
225 
226  # do not run calo emulators - instead, use unpacked GCT digis for GT input
227  process.simGtDigis.GctInputTag = 'gctDigis'
228 
229  # do not run muon emulators - instead, use unpacked GMT digis for GT input
230  # (GMT digis produced by same module as the GT digis, as GT and GMT have common unpacker)
231  process.simGtDigis.GmtInputTag = 'gtDigis'
232 
233  # technical triggers
234  process.simGtDigis.TechnicalTriggersInputTags = cms.VInputTag(
235  cms.InputTag( 'simBscDigis' ),
236  cms.InputTag( 'simRpcTechTrigDigis' ),
237  cms.InputTag( 'simHcalTechTrigDigis' )
238  )
239 
240  process.SimL1TechnicalTriggers = cms.Sequence(
241  process.simBscDigis +
242  process.simRpcTechTrigDigis +
243  process.simHcalTechTrigDigis
244  )
245 
246  # run producers for technical triggers, L1 GT emulator only
247  SimL1Emulator = cms.Sequence(
248  process.SimL1TechnicalTriggers +
249  process.simGtDigis )
250 
251  # replace the SimL1Emulator in all paths and sequences
252  for iterable in process.sequences.itervalues():
253  iterable.replace( process.SimL1Emulator, SimL1Emulator)
254  for iterable in process.paths.itervalues():
255  iterable.replace( process.SimL1Emulator, SimL1Emulator)
256  for iterable in process.endpaths.itervalues():
257  iterable.replace( process.SimL1Emulator, SimL1Emulator)
258  process.SimL1Emulator = SimL1Emulator
259 
260  return process
261 
262 ##############################################################################
263 
265  # customization fragment to run calorimeter emulators (TPGs and L1 calorimeter emulators)
266  # and GT emulator starting from a RAW file assuming that "RawToDigi_cff" and "SimL1Emulator_cff"
267  # have already been loaded
268 
269  # run Calo TPGs on unpacked digis
270  process.load('L1Trigger.Configuration.CaloTriggerPrimitives_cff')
271  process.simEcalTriggerPrimitiveDigis.Label = 'ecalDigis'
272  process.simHcalTriggerPrimitiveDigis.inputLabel = cms.VInputTag(
273  cms.InputTag('hcalDigis'),
274  cms.InputTag('hcalDigis')
275  )
276 
277  # do not run muon emulators - instead, use unpacked GMT digis for GT input
278  # (GMT digis produced by same module as the GT digis, as GT and GMT have common unpacker)
279  process.simRpcTechTrigDigis.RPCDigiLabel = 'muonRPCDigis'
280  process.simGtDigis.GmtInputTag = 'gtDigis'
281 
282  # run Calo TPGs, L1 GCT, technical triggers, L1 GT
283  SimL1Emulator = cms.Sequence(
284  process.CaloTriggerPrimitives +
285  process.simRctDigis +
286  process.simGctDigis +
287  process.SimL1TechnicalTriggers +
288  process.simGtDigis )
289 
290  # replace the SimL1Emulator in all paths and sequences
291  for iterable in process.sequences.itervalues():
292  iterable.replace( process.SimL1Emulator, SimL1Emulator)
293  for iterable in process.paths.itervalues():
294  iterable.replace( process.SimL1Emulator, SimL1Emulator)
295  for iterable in process.endpaths.itervalues():
296  iterable.replace( process.SimL1Emulator, SimL1Emulator)
297  process.SimL1Emulator = SimL1Emulator
298 
299  return process
300 
301 ##############################################################################
302 
304 
305  process.load("L1Trigger.GlobalTriggerAnalyzer.l1GtTrigReport_cfi")
306 
307  # boolean flag to select the input record
308  # if true, it will use L1GlobalTriggerRecord
309  #process.l1GtTrigReport.UseL1GlobalTriggerRecord = True
310 
311  # input tag for GT record:
312  # GT emulator: gtDigis (DAQ record)
313  # GT unpacker: gtDigis (DAQ record)
314  # GT lite record: l1GtRecord
315  process.l1GtTrigReport.L1GtRecordInputTag = "gtDigis"
316 
317  process.l1GtTrigReport.PrintVerbosity = 10
318  process.l1GtTrigReport.PrintOutput = 0
319 
320 
321 
322  #
323  return (process)
324 
325 ##############################################################################
def customiseResetPrescalesAndMasks
def customiseResetMasksAlgoTriggers
def customiseUnprescaleTechTriggers
def customiseUnprescaleAlgoTriggers
def customiseResetVetoMasksAlgoTriggers
def customiseL1CaloAndGtEmulatorsFromRaw
def customiseResetMasksTechTriggers
def customiseResetVetoMasksTechTriggers