CMS 3D CMS Logo

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_v2/sqlFile/L1Menu_Collisions2015_25ns_v2_mc.db'
98  menuDbTag = 'L1GtTriggerMenu_L1Menu_Collisions2015_25ns_v2_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_v2_L1T_Scales_20141121_Imp0_0x1030.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 
138 
139  # customization of output commands, on top of the output commands selected
140  # in cmsDriver command
141 
142  # examples
143 
144  # drop all products, keep only the products from L1EmulRaw process and the FEDRawDataCollection_
145  #process.output.outputCommands.append('drop *_*_*_*')
146  #process.output.outputCommands.append('keep *_*_*_L1EmulRaw')
147  #process.output.outputCommands.append('keep FEDRawDataCollection_*_*_*')
148 
149 
150  return process
151 
152 
153 ##############################################################################
154 
156  # customization fragment to run L1 emulator starting from a RAW file
157 
158  # run trigger primitive generation on unpacked digis
159  process.load('L1Trigger.Configuration.CaloTriggerPrimitives_cff')
160 
161  process.CaloTPG_SimL1Emulator = cms.Sequence(
162  process.CaloTriggerPrimitives +
163  process.SimL1Emulator )
164 
165  for path in process._Process__paths.itervalues():
166  path.replace(process.SimL1Emulator, process.CaloTPG_SimL1Emulator)
167 
168  # set the new input tags after RawToDigi
169  process.simEcalTriggerPrimitiveDigis.Label = 'ecalDigis'
170  process.simHcalTriggerPrimitiveDigis.inputLabel = cms.VInputTag(
171  cms.InputTag('hcalDigis'),
172  cms.InputTag('hcalDigis')
173  )
174 
175  process.simDtTriggerPrimitiveDigis.digiTag = 'muonDTDigis'
176  process.simCscTriggerPrimitiveDigis.CSCComparatorDigiProducer = cms.InputTag( 'muonCSCDigis', 'MuonCSCComparatorDigi' )
177  process.simCscTriggerPrimitiveDigis.CSCWireDigiProducer = cms.InputTag( 'muonCSCDigis', 'MuonCSCWireDigi' )
178  process.simRpcTriggerDigis.label = 'muonRPCDigis'
179  process.simRpcTechTrigDigis.RPCDigiLabel = 'muonRPCDigis'
180 
181  return process
182 
183 ##############################################################################
184 
186  # customization fragment to run L1 GT emulator starting from a RAW file, with input from unpacked GCT and GMT products
187  # assuming that "RawToDigi_cff" (or "RawToDigi_data_cff") and "SimL1Emulator_cff" have already been loaded
188 
189  # producers for technical triggers:
190  # they must be re-run as their output is not available from RAW2DIGI
191 
192  # BSC Technical Trigger
193  # Note: will normally not work, it requires SimHits (not available from RAW2DIGI)
194  # works only on some MC samples where the SimHits are saved together with the FEDRaw
195  import L1TriggerOffline.L1Analyzer.bscTrigger_cfi
196  process.simBscDigis = L1TriggerOffline.L1Analyzer.bscTrigger_cfi.bscTrigger.clone()
197 
198  # RPC Technical Trigger
199  import L1Trigger.RPCTechnicalTrigger.rpcTechnicalTrigger_cfi
200  process.simRpcTechTrigDigis = L1Trigger.RPCTechnicalTrigger.rpcTechnicalTrigger_cfi.rpcTechnicalTrigger.clone()
201 
202  process.simRpcTriggerDigis.label = 'muonRPCDigis'
203  process.simRpcTechTrigDigis.RPCDigiLabel = 'muonRPCDigis'
204 
205  # HCAL Technical Trigger
207  process.simHcalTechTrigDigis = SimCalorimetry.HcalTrigPrimProducers.hcalTTPRecord_cfi.simHcalTTPRecord.clone()
208 
209 
210  # Global Trigger emulator
211 
212  # do not run calo emulators - instead, use unpacked GCT digis for GT input
213  process.simGtDigis.GctInputTag = 'gctDigis'
214 
215  # do not run muon emulators - instead, use unpacked GMT digis for GT input
216  # (GMT digis produced by same module as the GT digis, as GT and GMT have common unpacker)
217  process.simGtDigis.GmtInputTag = 'gtDigis'
218 
219  # technical triggers
220  process.simGtDigis.TechnicalTriggersInputTags = cms.VInputTag(
221  cms.InputTag( 'simBscDigis' ),
222  cms.InputTag( 'simRpcTechTrigDigis' ),
223  cms.InputTag( 'simHcalTechTrigDigis' )
224  )
225 
226  process.SimL1TechnicalTriggers = cms.Sequence(
227  process.simBscDigis +
228  process.simRpcTechTrigDigis +
229  process.simHcalTechTrigDigis
230  )
231 
232  # run producers for technical triggers, L1 GT emulator only
233  SimL1Emulator = cms.Sequence(
234  process.SimL1TechnicalTriggers +
235  process.simGtDigis )
236 
237  # replace the SimL1Emulator in all paths and sequences
238  for iterable in process.sequences.itervalues():
239  iterable.replace( process.SimL1Emulator, SimL1Emulator)
240  for iterable in process.paths.itervalues():
241  iterable.replace( process.SimL1Emulator, SimL1Emulator)
242  for iterable in process.endpaths.itervalues():
243  iterable.replace( process.SimL1Emulator, SimL1Emulator)
244  process.SimL1Emulator = SimL1Emulator
245 
246  return process
247 
248 ##############################################################################
249 
251  # customization fragment to run calorimeter emulators (TPGs and L1 calorimeter emulators)
252  # and GT emulator starting from a RAW file assuming that "RawToDigi_cff" and "SimL1Emulator_cff"
253  # have already been loaded
254 
255  # run Calo TPGs on unpacked digis
256  process.load('L1Trigger.Configuration.CaloTriggerPrimitives_cff')
257  process.simEcalTriggerPrimitiveDigis.Label = 'ecalDigis'
258  process.simHcalTriggerPrimitiveDigis.inputLabel = cms.VInputTag(
259  cms.InputTag('hcalDigis'),
260  cms.InputTag('hcalDigis')
261  )
262 
263  # do not run muon emulators - instead, use unpacked GMT digis for GT input
264  # (GMT digis produced by same module as the GT digis, as GT and GMT have common unpacker)
265  process.simRpcTechTrigDigis.RPCDigiLabel = 'muonRPCDigis'
266  process.simGtDigis.GmtInputTag = 'gtDigis'
267 
268  # run Calo TPGs, L1 GCT, technical triggers, L1 GT
269  SimL1Emulator = cms.Sequence(
270  process.CaloTriggerPrimitives +
271  process.simRctDigis +
272  process.simGctDigis +
273  process.SimL1TechnicalTriggers +
274  process.simGtDigis )
275 
276  # replace the SimL1Emulator in all paths and sequences
277  for iterable in process.sequences.itervalues():
278  iterable.replace( process.SimL1Emulator, SimL1Emulator)
279  for iterable in process.paths.itervalues():
280  iterable.replace( process.SimL1Emulator, SimL1Emulator)
281  for iterable in process.endpaths.itervalues():
282  iterable.replace( process.SimL1Emulator, SimL1Emulator)
283  process.SimL1Emulator = SimL1Emulator
284 
285  return process
286 
287 ##############################################################################
288 
290 
291  process.load("L1Trigger.GlobalTriggerAnalyzer.l1GtTrigReport_cfi")
292 
293  # boolean flag to select the input record
294  # if true, it will use L1GlobalTriggerRecord
295  #process.l1GtTrigReport.UseL1GlobalTriggerRecord = True
296 
297  # input tag for GT record:
298  # GT emulator: gtDigis (DAQ record)
299  # GT unpacker: gtDigis (DAQ record)
300  # GT lite record: l1GtRecord
301  process.l1GtTrigReport.L1GtRecordInputTag = "gtDigis"
302 
303  process.l1GtTrigReport.PrintVerbosity = 10
304  process.l1GtTrigReport.PrintOutput = 0
305 
306 
307 
308  #
309  return (process)
310 
311 ##############################################################################
def customiseOutputCommands(process)
def customiseL1TriggerReport(process)
def customiseL1CaloAndGtEmulatorsFromRaw(process)
def customiseResetPrescalesAndMasks(process)
def customiseL1EmulatorFromRaw(process)
def customiseUnprescaleTechTriggers(process)
def customiseL1GtEmulatorFromRaw(process)
def customiseUnprescaleAlgoTriggers(process)
def customiseResetVetoMasksTechTriggers(process)
def customiseResetMasksAlgoTriggers(process)
def customiseL1Menu(process)
def customiseResetMasksTechTriggers(process)
def customiseResetVetoMasksAlgoTriggers(process)