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_Collisions2015_25ns_v1/sqlFile/L1Menu_Collisions2015_25ns_v1_mc.db'
98  menuDbTag = 'L1GtTriggerMenu_L1Menu_Collisions2015_25ns_v1_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_Collisions2015_25ns_v1_L1T_Scales_20101224_Imp0_0x102f.xml'
103  else :
104  # use the default L1 trigger menu from the global tag
105  pass
106 
107  ####### end of user choices - do not change the following
108 
109  if l1MenuSource == 'xmlFile' :
110  process.load('L1TriggerConfig.L1GtConfigProducers.l1GtTriggerMenuXml_cfi')
111  process.l1GtTriggerMenuXml.TriggerMenuLuminosity = luminosityDirectory
112  process.l1GtTriggerMenuXml.DefXmlFile = useXmlFile
113 
114  process.load('L1TriggerConfig.L1GtConfigProducers.L1GtTriggerMenuConfig_cff')
115  process.es_prefer_l1GtParameters = cms.ESPrefer('L1GtTriggerMenuXmlProducer','l1GtTriggerMenuXml')
116 
117  elif l1MenuSource == 'sqlFile' :
118  if useSqlFile != '' :
119  from CondCore.DBCommon.CondDBSetup_cfi import CondDBSetup
120  process.l1conddb = cms.ESSource("PoolDBESSource",
121  CondDBSetup,
122  connect = cms.string('sqlite_file:' + useSqlFile),
123  toGet = cms.VPSet(cms.PSet(
124  record = cms.string('L1GtTriggerMenuRcd'),
125  tag = cms.string(menuDbTag))),
126  BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService')
127  )
128  process.es_prefer_l1conddb = cms.ESPrefer("PoolDBESSource", "l1conddb")
129 
130  else :
131  print ' Error: no SQL file is given; please provide a valid SQL file for option sqlFile'
132 
133  return process
134 
135 ##############################################################################
136 
137 def customiseL1Menu_HI(process):
138 
139  # replace the L1 menu from the global tag with one of the following alternatives
140 
141  luminosityDirectory = "startup"
142  useXmlFile = 'L1Menu_CollisionsHeavyIons2011_v0_nobsc_notau_centrality_q2_singletrack.v1.xml'
143 
144  print ' Retrieve L1 trigger menu only from XML file '
145  print ' ', useXmlFile
146  print ' '
147 
148  process.load('L1TriggerConfig.L1GtConfigProducers.l1GtTriggerMenuXml_cfi')
149  process.l1GtTriggerMenuXml.TriggerMenuLuminosity = luminosityDirectory
150  process.l1GtTriggerMenuXml.DefXmlFile = useXmlFile
151 
152  process.load('L1TriggerConfig.L1GtConfigProducers.L1GtTriggerMenuConfig_cff')
153  process.es_prefer_l1GtParameters = cms.ESPrefer('L1GtTriggerMenuXmlProducer','l1GtTriggerMenuXml')
154 
155  return process
156 
157 ##############################################################################
158 
160 
161  # customization of output commands, on top of the output commands selected
162  # in cmsDriver command
163 
164  # examples
165 
166  # drop all products, keep only the products from L1EmulRaw process and the FEDRawDataCollection_
167  #process.output.outputCommands.append('drop *_*_*_*')
168  #process.output.outputCommands.append('keep *_*_*_L1EmulRaw')
169  #process.output.outputCommands.append('keep FEDRawDataCollection_*_*_*')
170 
171 
172  return process
173 
174 
175 ##############################################################################
176 
178  # customization fragment to run L1 emulator starting from a RAW file
179 
180  # run trigger primitive generation on unpacked digis
181  process.load('L1Trigger.Configuration.CaloTriggerPrimitives_cff')
182 
183  process.CaloTPG_SimL1Emulator = cms.Sequence(
184  process.CaloTriggerPrimitives +
185  process.SimL1Emulator )
186 
187  for path in process._Process__paths.itervalues():
188  path.replace(process.SimL1Emulator, process.CaloTPG_SimL1Emulator)
189 
190  # set the new input tags after RawToDigi
191  process.simEcalTriggerPrimitiveDigis.Label = 'ecalDigis'
192  process.simHcalTriggerPrimitiveDigis.inputLabel = cms.VInputTag(
193  cms.InputTag('hcalDigis'),
194  cms.InputTag('hcalDigis')
195  )
196 
197  process.simDtTriggerPrimitiveDigis.digiTag = 'muonDTDigis'
198  process.simCscTriggerPrimitiveDigis.CSCComparatorDigiProducer = cms.InputTag( 'muonCSCDigis', 'MuonCSCComparatorDigi' )
199  process.simCscTriggerPrimitiveDigis.CSCWireDigiProducer = cms.InputTag( 'muonCSCDigis', 'MuonCSCWireDigi' )
200  process.simRpcTriggerDigis.label = 'muonRPCDigis'
201  process.simRpcTechTrigDigis.RPCDigiLabel = 'muonRPCDigis'
202 
203  return process
204 
205 ##############################################################################
206 
208  # customization fragment to run L1 GT emulator starting from a RAW file, with input from unpacked GCT and GMT products
209  # assuming that "RawToDigi_cff" (or "RawToDigi_data_cff") and "SimL1Emulator_cff" have already been loaded
210 
211  # producers for technical triggers:
212  # they must be re-run as their output is not available from RAW2DIGI
213 
214  # BSC Technical Trigger
215  # Note: will normally not work, it requires SimHits (not available from RAW2DIGI)
216  # works only on some MC samples where the SimHits are saved together with the FEDRaw
217  import L1TriggerOffline.L1Analyzer.bscTrigger_cfi
218  process.simBscDigis = L1TriggerOffline.L1Analyzer.bscTrigger_cfi.bscTrigger.clone()
219 
220  # RPC Technical Trigger
221  import L1Trigger.RPCTechnicalTrigger.rpcTechnicalTrigger_cfi
222  process.simRpcTechTrigDigis = L1Trigger.RPCTechnicalTrigger.rpcTechnicalTrigger_cfi.rpcTechnicalTrigger.clone()
223 
224  process.simRpcTriggerDigis.label = 'muonRPCDigis'
225  process.simRpcTechTrigDigis.RPCDigiLabel = 'muonRPCDigis'
226 
227  # HCAL Technical Trigger
229  process.simHcalTechTrigDigis = SimCalorimetry.HcalTrigPrimProducers.hcalTTPRecord_cfi.simHcalTTPRecord.clone()
230 
231 
232  # Global Trigger emulator
233 
234  # do not run calo emulators - instead, use unpacked GCT digis for GT input
235  process.simGtDigis.GctInputTag = 'gctDigis'
236 
237  # do not run muon emulators - instead, use unpacked GMT digis for GT input
238  # (GMT digis produced by same module as the GT digis, as GT and GMT have common unpacker)
239  process.simGtDigis.GmtInputTag = 'gtDigis'
240 
241  # technical triggers
242  process.simGtDigis.TechnicalTriggersInputTags = cms.VInputTag(
243  cms.InputTag( 'simBscDigis' ),
244  cms.InputTag( 'simRpcTechTrigDigis' ),
245  cms.InputTag( 'simHcalTechTrigDigis' )
246  )
247 
248  process.SimL1TechnicalTriggers = cms.Sequence(
249  process.simBscDigis +
250  process.simRpcTechTrigDigis +
251  process.simHcalTechTrigDigis
252  )
253 
254  # run producers for technical triggers, L1 GT emulator only
255  SimL1Emulator = cms.Sequence(
256  process.SimL1TechnicalTriggers +
257  process.simGtDigis )
258 
259  # replace the SimL1Emulator in all paths and sequences
260  for iterable in process.sequences.itervalues():
261  iterable.replace( process.SimL1Emulator, SimL1Emulator)
262  for iterable in process.paths.itervalues():
263  iterable.replace( process.SimL1Emulator, SimL1Emulator)
264  for iterable in process.endpaths.itervalues():
265  iterable.replace( process.SimL1Emulator, SimL1Emulator)
266  process.SimL1Emulator = SimL1Emulator
267 
268  return process
269 
270 ##############################################################################
271 
273  # customization fragment to run calorimeter emulators (TPGs and L1 calorimeter emulators)
274  # and GT emulator starting from a RAW file assuming that "RawToDigi_cff" and "SimL1Emulator_cff"
275  # have already been loaded
276 
277  # run Calo TPGs on unpacked digis
278  process.load('L1Trigger.Configuration.CaloTriggerPrimitives_cff')
279  process.simEcalTriggerPrimitiveDigis.Label = 'ecalDigis'
280  process.simHcalTriggerPrimitiveDigis.inputLabel = cms.VInputTag(
281  cms.InputTag('hcalDigis'),
282  cms.InputTag('hcalDigis')
283  )
284 
285  # do not run muon emulators - instead, use unpacked GMT digis for GT input
286  # (GMT digis produced by same module as the GT digis, as GT and GMT have common unpacker)
287  process.simRpcTechTrigDigis.RPCDigiLabel = 'muonRPCDigis'
288  process.simGtDigis.GmtInputTag = 'gtDigis'
289 
290  # run Calo TPGs, L1 GCT, technical triggers, L1 GT
291  SimL1Emulator = cms.Sequence(
292  process.CaloTriggerPrimitives +
293  process.simRctDigis +
294  process.simGctDigis +
295  process.SimL1TechnicalTriggers +
296  process.simGtDigis )
297 
298  # replace the SimL1Emulator in all paths and sequences
299  for iterable in process.sequences.itervalues():
300  iterable.replace( process.SimL1Emulator, SimL1Emulator)
301  for iterable in process.paths.itervalues():
302  iterable.replace( process.SimL1Emulator, SimL1Emulator)
303  for iterable in process.endpaths.itervalues():
304  iterable.replace( process.SimL1Emulator, SimL1Emulator)
305  process.SimL1Emulator = SimL1Emulator
306 
307  return process
308 
309 ##############################################################################
310 
312 
313  process.load("L1Trigger.GlobalTriggerAnalyzer.l1GtTrigReport_cfi")
314 
315  # boolean flag to select the input record
316  # if true, it will use L1GlobalTriggerRecord
317  #process.l1GtTrigReport.UseL1GlobalTriggerRecord = True
318 
319  # input tag for GT record:
320  # GT emulator: gtDigis (DAQ record)
321  # GT unpacker: gtDigis (DAQ record)
322  # GT lite record: l1GtRecord
323  process.l1GtTrigReport.L1GtRecordInputTag = "gtDigis"
324 
325  process.l1GtTrigReport.PrintVerbosity = 10
326  process.l1GtTrigReport.PrintOutput = 0
327 
328 
329 
330  #
331  return (process)
332 
333 ##############################################################################
def customiseResetPrescalesAndMasks
def customiseResetMasksAlgoTriggers
def customiseUnprescaleTechTriggers
def customiseUnprescaleAlgoTriggers
def customiseResetVetoMasksAlgoTriggers
def customiseL1CaloAndGtEmulatorsFromRaw
def customiseResetMasksTechTriggers
def customiseResetVetoMasksTechTriggers