CMS 3D CMS Logo

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