CMS 3D CMS Logo

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