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
2 #
3 # V.M. Ghete 2010-06-09
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/sqlFile/L1Menu_CollisionsHeavyIons2010_v0_mc.db'
98  menuDbTag = 'L1GtTriggerMenu_L1Menu_CollisionsHeavyIons2010_v0_mc'
99  elif l1MenuSource == 'xmlFile' :
100  # the menu will be read from an XML file instead of the global tag
101  luminosityDirectory = "startup"
102  useXmlFile = 'L1Menu_CollisionsHeavyIons2010_v0_L1T_Scales_20080926_startup_Imp0_0x101b.xml'
103 
104  else :
105  print ' Using default L1 trigger menu from Global Tag '
106 
107  ####### end of user choices - do not change the
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
201 
202  # producers for technical triggers:
203  # they must be re-run as their output is not available from RAW2DIGI
204 
205  # BSC Technical Trigger
206  # Note: will normally not work, it requires SimHits (not available from RAW2DIGI)
207  # works only on some MC samples where the SimHits are saved together with the FEDRaw
208  import L1TriggerOffline.L1Analyzer.bscTrigger_cfi
209  process.simBscDigis = L1TriggerOffline.L1Analyzer.bscTrigger_cfi.bscTrigger.clone()
210 
211  # RPC Technical Trigger
212  import L1Trigger.RPCTechnicalTrigger.rpcTechnicalTrigger_cfi
213  process.simRpcTechTrigDigis = L1Trigger.RPCTechnicalTrigger.rpcTechnicalTrigger_cfi.rpcTechnicalTrigger.clone()
214 
215  process.simRpcTriggerDigis.label = 'muonRPCDigis'
216  process.simRpcTechTrigDigis.RPCDigiLabel = 'muonRPCDigis'
217 
218  # HCAL Technical Trigger
220  process.simHcalTechTrigDigis = SimCalorimetry.HcalTrigPrimProducers.hcalTTPRecord_cfi.simHcalTTPRecord.clone()
221 
222 
223  # Global Trigger emulator
224  simGtDigis.TechnicalTriggersInputTags = cms.VInputTag(
225  cms.InputTag( 'simBscDigis' ),
226  cms.InputTag( 'simRpcTechTrigDigis' ),
227  cms.InputTag( 'simHcalTechTrigDigis' )
228  )
229 
230  process.SimL1TechnicalTriggers = cms.Sequence(
231  process.simBscDigis +
232  process.simRpcTechTrigDigis +
233  process.simHcalTechTrigDigis
234  )
235 
236  process.L1GtEmulator = cms.Sequence(
237  process.SimL1TechnicalTriggers +
238  process.simGtDigis )
239 
240  for path in process._Process__paths.itervalues():
241  path.replace(process.SimL1Emulator, process.L1GtEmulator)
242 
243  return process
244 
245 ##############################################################################
246 
248  # customization fragment to run calorimeter emulators (TPGs and L1 calorimeter emulators)
249  # and GT emulator starting from a RAW file assuming that "RawToDigi_cff" and "SimL1Emulator_cff"
250  # have already been loaded
251 
252  # run Calo TPGs on unpacked digis
253  process.load('L1Trigger.Configuration.CaloTriggerPrimitives_cff')
254  process.simEcalTriggerPrimitiveDigis.Label = 'ecalDigis'
255  process.simHcalTriggerPrimitiveDigis.inputLabel = cms.VInputTag(
256  cms.InputTag('hcalDigis'),
257  cms.InputTag('hcalDigis')
258  )
259 
260  # do not run muon emulators - instead, use unpacked GMT digis for GT input
261  # (GMT digis produced by same module as the GT digis, as GT and GMT have common unpacker)
262  process.simRpcTechTrigDigis.RPCDigiLabel = 'muonRPCDigis'
263  process.simGtDigis.GmtInputTag = 'gtDigis'
264 
265  # run Calo TPGs, L1 GCT, technical triggers, L1 GT
266  SimL1Emulator = cms.Sequence(
267  process.CaloTriggerPrimitives +
268  process.simRctDigis +
269  process.simGctDigis +
270  process.SimL1TechnicalTriggers +
271  process.simGtDigis )
272 
273  # replace the SimL1Emulator in all paths and sequences
274  for iterable in process.sequences.itervalues():
275  iterable.replace( process.SimL1Emulator, SimL1Emulator)
276  for iterable in process.paths.itervalues():
277  iterable.replace( process.SimL1Emulator, SimL1Emulator)
278  for iterable in process.endpaths.itervalues():
279  iterable.replace( process.SimL1Emulator, SimL1Emulator)
280  process.SimL1Emulator = SimL1Emulator
281 
282  return process
283 
284 ##############################################################################
285 
287 
288  process.load("L1Trigger.GlobalTriggerAnalyzer.l1GtTrigReport_cfi")
289 
290  # boolean flag to select the input record
291  # if true, it will use L1GlobalTriggerRecord
292  #process.l1GtTrigReport.UseL1GlobalTriggerRecord = True
293 
294  # input tag for GT record:
295  # GT emulator: gtDigis (DAQ record)
296  # GT unpacker: gtDigis (DAQ record)
297  # GT lite record: l1GtRecord
298  process.l1GtTrigReport.L1GtRecordInputTag = "gtDigis"
299 
300  process.l1GtTrigReport.PrintVerbosity = 2
301  process.l1GtTrigReport.PrintOutput = 0
302 
303 
304 
305  #
306  return (process)
307 
308 ##############################################################################
def customiseResetPrescalesAndMasks
def customiseResetMasksAlgoTriggers
def customiseUnprescaleTechTriggers
def customiseUnprescaleAlgoTriggers
def customiseResetVetoMasksAlgoTriggers
def customiseL1CaloAndGtEmulatorsFromRaw
def customiseResetMasksTechTriggers
def customiseResetVetoMasksTechTriggers