1 import FWCore.ParameterSet.Config
as cms
3 from FWCore.ParameterSet.MassReplace
import massReplaceInputTag,massSearchReplaceAnyInputTag
9 if 'hltTrigReport' in process.__dict__:
10 process.hltTrigReport.HLTriggerResults = cms.InputTag(
'TriggerResults',
'',process.name_() )
18 process.options.wantSummary =
True 19 process.options.numberOfThreads = 4
20 process.options.numberOfStreams = 0
21 process.options.sizeOfStackForThreadsInKB = 10*1024
23 process.MessageLogger.TriggerSummaryProducerAOD = cms.untracked.PSet()
24 process.MessageLogger.L1GtTrigReport = cms.untracked.PSet()
25 process.MessageLogger.L1TGlobalSummary = cms.untracked.PSet()
26 process.MessageLogger.HLTrigReport = cms.untracked.PSet()
44 def _legacyStage1(process):
45 labels = [
'gtDigis',
'simGtDigis',
'newGtDigis',
'hltGtDigis']
47 if label
in process.__dict__:
48 process.load(
'L1Trigger.GlobalTriggerAnalyzer.l1GtTrigReport_cfi')
49 process.l1GtTrigReport.L1GtRecordInputTag = cms.InputTag( label )
50 process.L1AnalyzerEndpath = cms.EndPath( process.l1GtTrigReport )
51 process.schedule.append(process.L1AnalyzerEndpath)
54 labels = [
'gtStage2Digis',
'simGtStage2Digis',
'newGtStage2Digis',
'hltGtStage2Digis']
56 if label
in process.__dict__:
57 process.load(
'L1Trigger.L1TGlobal.L1TGlobalSummary_cfi')
58 process.L1TGlobalSummary.AlgInputTag = cms.InputTag( label )
59 process.L1TGlobalSummary.ExtInputTag = cms.InputTag( label )
60 process.L1TAnalyzerEndpath = cms.EndPath(process.L1TGlobalSummary )
61 process.schedule.append(process.L1TAnalyzerEndpath)
63 from Configuration.Eras.Modifier_stage2L1Trigger_cff
import stage2L1Trigger
64 (~stage2L1Trigger).toModify(process, _legacyStage1)
65 stage2L1Trigger.toModify(process, _stage2)
67 if hasattr(process,
'TriggerMenu'):
68 delattr(process,
'TriggerMenu')
78 if not (
'HLTAnalyzerEndpath' in process.__dict__) :
79 def _legacyStage1(process):
80 if 'hltGtDigis' in process.__dict__:
81 from HLTrigger.Configuration.HLT_Fake_cff
import fragment
82 process.hltL1GtTrigReport = fragment.hltL1GtTrigReport
83 process.hltTrigReport = fragment.hltTrigReport
84 process.HLTAnalyzerEndpath = cms.EndPath(process.hltGtDigis + process.hltL1GtTrigReport + process.hltTrigReport)
85 process.schedule.append(process.HLTAnalyzerEndpath)
88 if 'hltGtStage2ObjectMap' in process.__dict__:
89 from HLTrigger.Configuration.HLT_FULL_cff
import fragment
90 process.hltL1TGlobalSummary = fragment.hltL1TGlobalSummary
91 process.hltTrigReport = fragment.hltTrigReport
92 process.HLTAnalyzerEndpath = cms.EndPath(process.hltGtStage2Digis + process.hltL1TGlobalSummary + process.hltTrigReport)
93 process.schedule.append(process.HLTAnalyzerEndpath)
95 from Configuration.Eras.Modifier_stage2L1Trigger_cff
import stage2L1Trigger
96 (~stage2L1Trigger).toModify(process, _legacyStage1)
97 stage2L1Trigger.toModify(process, _stage2)
99 if hasattr(process,
'TriggerMenu'):
100 delattr(process,
'TriggerMenu')
102 process=
Base(process)
109 Customisations for running HLT+RECO in the same job, 110 removing ESSources and ESProducers from Tasks (needed to run HLT+RECO tests on GPU) 111 - when Reconstruction_cff is loaded, it brings in Tasks that include 112 GPU-related ES modules with the same names as they have in HLT configs 113 - in TSG tests, these GPU-related RECO Tasks are not included in the Schedule 114 (because the "gpu" process-modifier is not used); 115 this causes the ES modules not to be executed, thus making them unavailable to HLT producers 116 - this workaround removes ES modules from Tasks, making their execution independent of the content of the Schedule; 117 with reference to https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideAboutPythonConfigFile?rev=92#Behavior_when_an_ESProducer_ESSo, 118 this workaround avoids "Case 3" by reverting to "Case 2" 119 - this workaround only affects Tasks of non-HLT steps, as the addition of ES modules to Tasks is not supported in ConfDB 120 (none of the Tasks used in the HLT step can contain ES modules in the first place, modulo customisations outside ConfDB) 122 for taskName
in process.tasks_():
123 task = process.tasks_()[taskName]
124 esModulesToRemove = set()
125 for modName
in task.moduleNames():
126 module = getattr(process, modName)
127 if isinstance(module, cms.ESSource)
or isinstance(module, cms.ESProducer):
128 esModulesToRemove.add(module)
129 for esModule
in esModulesToRemove:
130 task.remove(esModule)
137 Customisation of GlobalTag for Online BeamSpot 138 - edits the GlobalTag ESSource to load the tags used to produce the HLT beamspot 139 - these tags are not available in the Offline GT, which is the GT presently used in HLT+RECO tests 140 - not loading these tags (i.e. not using this customisation) does not result in a runtime error, 141 but it leads to an HLT beamspot different to the one obtained when running HLT alone 143 if hasattr(process,
'GlobalTag'):
144 if not hasattr(process.GlobalTag,
'toGet'):
145 process.GlobalTag.toGet = cms.VPSet()
146 process.GlobalTag.toGet += [
148 record = cms.string(
'BeamSpotOnlineLegacyObjectsRcd'),
149 tag = cms.string(
'BeamSpotOnlineLegacy')
152 record = cms.string(
'BeamSpotOnlineHLTObjectsRcd'),
153 tag = cms.string(
'BeamSpotOnlineHLT')
162 process.source.inputCommands = cms.untracked.vstring (
164 'drop *_hltL1GtObjectMap_*_*',
165 'drop *_TriggerResults_*_*',
166 'drop *_hltTriggerSummaryAOD_*_*',
169 process =
Base(process)
176 from Configuration.Eras.Era_Run3_cff
import Run3
177 l1repack = cms.Process(
'L1REPACK', Run3)
178 l1repack.load(
'Configuration.StandardSequences.SimL1EmulatorRepack_'+sequence+
'_cff')
180 for module
in l1repack.es_sources_():
181 if not hasattr(process, module):
182 setattr(process, module, getattr(l1repack, module))
183 for module
in l1repack.es_producers_():
184 if not hasattr(process, module):
185 setattr(process, module, getattr(l1repack, module))
187 for module
in l1repack.SimL1Emulator.expandAndClone().moduleNames():
188 setattr(process, module, getattr(l1repack, module))
189 for taskName, task
in l1repack.tasks_().
items():
190 if l1repack.SimL1Emulator.contains(task):
191 setattr(process, taskName, task)
192 for sequenceName, sequence
in l1repack.sequences_().
items():
193 if l1repack.SimL1Emulator.contains(sequence):
194 setattr(process, sequenceName, sequence)
196 process.SimL1Emulator = l1repack.SimL1Emulator
198 for path
in process.paths_():
199 getattr(process,path).
insert(0,process.SimL1Emulator)
200 for path
in process.endpaths_():
201 getattr(process,path).
insert(0,process.SimL1Emulator)
205 'l1tHGCalTriggerGeometryESProducer',
207 if hasattr(process, obj):
208 delattr(process, obj)
217 if ((xmlFile
is None)
or (xmlFile==
"")):
220 process.L1TriggerMenu= cms.ESProducer(
"L1TUtmTriggerMenuESProducer",
221 L1TriggerMenuFile= cms.string(xmlFile)
223 process.ESPreferL1TXML = cms.ESPrefer(
"L1TUtmTriggerMenuESProducer",
"L1TriggerMenu")
230 Customise the L1REPACK step (re-emulation of L1-Trigger) to run on the repacked RAW data 231 produced at HLT during Heavy-Ion data-taking (collection: "rawDataRepacker") 232 - replace "rawDataCollector" with "rawDataRepacker" in the L1T-emulation sequence 234 if hasattr(process, l1tSequenceLabel)
and isinstance(getattr(process, l1tSequenceLabel), cms.Sequence):
236 sequence = getattr(process, l1tSequenceLabel),
237 oldInputTag =
'rawDataCollector',
238 newInputTag =
'rawDataRepacker',
240 moduleLabelOnly =
True,
241 skipLabelTest =
False 244 warnMsg =
'no customisation applied, because the cms.Sequence "'+l1tSequenceLabel+
'" is not available.' 245 print(
'# WARNING -- customiseL1TforHIonRepackedRAW: '+warnMsg)
250 Customise the L1REPACK step (re-emulation of L1-Trigger) to run on the repacked RAWPrime data 251 produced at HLT during Heavy-Ion data-taking (collection: "rawPrimeDataRepacker") 252 - replace "rawDataCollector" with "rawPrimeDataRepacker" in the L1T-emulation sequence 253 (in terms of L1T information, "rawDataRepacker" and "rawPrimeDataRepacker" are equivalent) 255 if hasattr(process, l1tSequenceLabel)
and isinstance(getattr(process, l1tSequenceLabel), cms.Sequence):
257 sequence = getattr(process, l1tSequenceLabel),
258 oldInputTag =
'rawDataCollector',
259 newInputTag =
'rawPrimeDataRepacker',
261 moduleLabelOnly =
True,
262 skipLabelTest =
False 265 warnMsg =
'no customisation applied, because the cms.Sequence "'+l1tSequenceLabel+
'" is not available.' 266 print(
'# WARNING -- customiseL1TforHIonRepackedRAWPrime: '+warnMsg)
271 Customise a HLT menu to run on the repacked RAW data 272 produced at HLT during Heavy-Ion data-taking (collection: "rawDataRepacker") 273 - replace "rawDataCollector" with "rawDataRepacker::@skipCurrentProcess" 277 old =
'rawDataCollector',
278 new =
'rawDataRepacker::@skipCurrentProcess',
280 moduleLabelOnly =
False,
281 skipLabelTest =
False 287 Customise a HLT menu to run on the repacked RAWPrime data 288 produced at HLT during Heavy-Ion data-taking (collections: "rawPrimeDataRepacker" + "hltSiStripClusters2ApproxClusters") 289 - delete modules of type 'SiStripRawToDigiModule', 'SiStripDigiToRawModule' and 'SiStripZeroSuppression' 290 - delete SiStripApproxClusters producer and HLT-HIon RAW-data repackers (e.g. "rawPrimeDataRepacker") 291 - replace SiStripClusterizers with SiStripClusters built from SiStripApproxClusters 293 if not useRawDataCollector:
296 old =
'rawDataCollector',
297 new =
'rawPrimeDataRepacker::@skipCurrentProcess',
299 moduleLabelOnly =
False,
300 skipLabelTest =
False 305 for foo
in [
'SiStripRawToDigiModule',
'SiStripDigiToRawModule',
'SiStripZeroSuppression']:
307 moduleLabels.add(mod.label())
308 for foo
in moduleLabels:
309 delattr(process, foo)
313 siStripApproxClustersModuleLabel,
315 'rawPrimeDataRepacker',
316 'rawDataReducedFormat',
318 if hasattr(process, foo):
319 delattr(process, foo)
324 moduleLabels.add(mod.label())
325 for foo
in moduleLabels:
326 setattr(process, foo, cms.EDProducer(
'SiStripApprox2Clusters',
327 inputApproxClusters = cms.InputTag(siStripApproxClustersModuleLabel)
334 Customise a configuration with L1T+HLT steps to run on the repacked RAW data 335 produced at HLT during Heavy-Ion data-taking (collection: "rawDataRepacker") 336 - in the L1T step, replace "rawDataCollector" with "rawDataRepacker" 337 - no customisation needed for the HLT step 338 (the HLT modules consume the "rawDataCollector" produced by the L1T step) 345 Customise a configuration with L1T+HLT steps to run on the repacked RAWPrime data 346 produced at HLT during Heavy-Ion data-taking (collections: "rawPrimeDataRepacker" + "hltSiStripClusters2ApproxClusters") 347 - in the L1T step, replace "rawDataCollector" with "rawPrimeDataRepacker" 348 - in the HLT step, apply the customisations needed for the SiStripApproxClusters 349 (the HLT modules consume the "rawDataCollector" produced by the L1T step) def customiseL1TforHIonRepackedRAW(process, l1tSequenceLabel='SimL1Emulator')
def customiseHLTforHIonRepackedRAWPrime(process, useRawDataCollector=False, siStripApproxClustersModuleLabel='hltSiStripClusters2ApproxClusters')
def producers_by_type(process, types)
def massSearchReplaceAnyInputTag(sequence, oldInputTag, newInputTag, verbose=False, moduleLabelOnly=False, skipLabelTest=False)
def customiseHLTforHIonRepackedRAW(process)
def HLTDropPrevious(process)
def L1XML(process, xmlFile=None)
def customiseL1THLTforHIonRepackedRAWPrime(process)
def L1REPACK(process, sequence="Full")
def customiseL1TforHIonRepackedRAWPrime(process, l1tSequenceLabel='SimL1Emulator')
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def massReplaceInputTag(process, old="rawDataCollector", new="rawDataRepacker", verbose=False, moduleLabelOnly=False, skipLabelTest=False)
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
def customiseGlobalTagForOnlineBeamSpot(process)
def customiseL1THLTforHIonRepackedRAW(process)