CMS 3D CMS Logo

CustomConfigs.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 # The following 2 imports are provided for backward compatibility reasons.
4 # The functions used to be defined in this file.
5 from FWCore.ParameterSet.MassReplace import massReplaceInputTag as MassReplaceInputTag
6 from FWCore.ParameterSet.MassReplace import massReplaceParameter as MassReplaceParameter
7 
8 def ProcessName(process):
9 # processname modifications
10 
11  if 'hltTrigReport' in process.__dict__:
12  process.hltTrigReport.HLTriggerResults = cms.InputTag( 'TriggerResults','',process.name_() )
13 
14  return(process)
15 
16 
17 def Base(process):
18 # default modifications
19 
20  process.options.wantSummary = cms.untracked.bool(True)
21  process.options.numberOfThreads = cms.untracked.uint32( 4 )
22  process.options.numberOfStreams = cms.untracked.uint32( 0 )
23  process.options.sizeOfStackForThreadsInKB = cms.untracked.uint32( 10*1024 )
24 
25  process.MessageLogger.TriggerSummaryProducerAOD=cms.untracked.PSet()
26  process.MessageLogger.L1GtTrigReport=cms.untracked.PSet()
27  process.MessageLogger.L1TGlobalSummary=cms.untracked.PSet()
28  process.MessageLogger.HLTrigReport=cms.untracked.PSet()
29 
30 # No longer override - instead use GT config as provided via cmsDriver
31 
37 
38  process=ProcessName(process)
39 
40  return(process)
41 
42 
43 def L1T(process):
44 # modifications when running L1T only
45 
46  def _legacyStage1(process):
47  labels = ['gtDigis','simGtDigis','newGtDigis','hltGtDigis']
48  for label in labels:
49  if label in process.__dict__:
50  process.load('L1Trigger.GlobalTriggerAnalyzer.l1GtTrigReport_cfi')
51  process.l1GtTrigReport.L1GtRecordInputTag = cms.InputTag( label )
52  process.L1AnalyzerEndpath = cms.EndPath( process.l1GtTrigReport )
53  process.schedule.append(process.L1AnalyzerEndpath)
54 
55  def _stage2(process):
56  labels = ['gtStage2Digis','simGtStage2Digis','newGtStage2Digis','hltGtStage2Digis']
57  for label in labels:
58  if label in process.__dict__:
59  process.load('L1Trigger.L1TGlobal.L1TGlobalSummary_cfi')
60  process.L1TGlobalSummary.AlgInputTag = cms.InputTag( label )
61  process.L1TGlobalSummary.ExtInputTag = cms.InputTag( label )
62  process.L1TAnalyzerEndpath = cms.EndPath(process.L1TGlobalSummary )
63  process.schedule.append(process.L1TAnalyzerEndpath)
64 
65  from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger
66  (~stage2L1Trigger).toModify(process, _legacyStage1)
67  stage2L1Trigger.toModify(process, _stage2)
68 
69  if hasattr(process,'TriggerMenu'):
70  delattr(process,'TriggerMenu')
71 
72  process=Base(process)
73 
74  return(process)
75 
76 
77 def L1THLT(process):
78 # modifications when running L1T+HLT
79 
80  if not ('HLTAnalyzerEndpath' in process.__dict__) :
81  def _legacyStage1(process):
82  if 'hltGtDigis' in process.__dict__:
83  from HLTrigger.Configuration.HLT_Fake_cff import fragment
84  process.hltL1GtTrigReport = fragment.hltL1GtTrigReport
85  process.hltTrigReport = fragment.hltTrigReport
86  process.HLTAnalyzerEndpath = cms.EndPath(process.hltGtDigis + process.hltL1GtTrigReport + process.hltTrigReport)
87  process.schedule.append(process.HLTAnalyzerEndpath)
88 
89  def _stage2(process):
90  if 'hltGtStage2ObjectMap' in process.__dict__:
91  from HLTrigger.Configuration.HLT_FULL_cff import fragment
92  process.hltL1TGlobalSummary = fragment.hltL1TGlobalSummary
93  process.hltTrigReport = fragment.hltTrigReport
94  process.HLTAnalyzerEndpath = cms.EndPath(process.hltGtStage2Digis + process.hltL1TGlobalSummary + process.hltTrigReport)
95  process.schedule.append(process.HLTAnalyzerEndpath)
96 
97  from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger
98  (~stage2L1Trigger).toModify(process, _legacyStage1)
99  stage2L1Trigger.toModify(process, _stage2)
100 
101  if hasattr(process,'TriggerMenu'):
102  delattr(process,'TriggerMenu')
103 
104  process=Base(process)
105 
106  return(process)
107 
108 
109 def HLTDropPrevious(process):
110 # drop on input the previous HLT results
111  process.source.inputCommands = cms.untracked.vstring (
112  'keep *',
113  'drop *_hltL1GtObjectMap_*_*',
114  'drop *_TriggerResults_*_*',
115  'drop *_hltTriggerSummaryAOD_*_*',
116  )
117 
118  process=Base(process)
119 
120  return(process)
121 
122 
123 def L1REPACK(process,sequence="Full"):
124 
125  from Configuration.Eras.Era_Run3_cff import Run3
126  l1repack = cms.Process('L1REPACK',Run3)
127  l1repack.load('Configuration.StandardSequences.SimL1EmulatorRepack_'+sequence+'_cff')
128 
129  for module in l1repack.es_sources_():
130  if (not hasattr(process,module)):
131  setattr(process,module,getattr(l1repack,module))
132  for module in l1repack.es_producers_():
133  if (not hasattr(process,module)):
134  setattr(process,module,getattr(l1repack,module))
135 
136  for module in l1repack.SimL1Emulator.expandAndClone().moduleNames():
137  setattr(process,module,getattr(l1repack,module))
138  for task in l1repack.tasks_():
139  setattr(process,task,getattr(l1repack,task))
140  for sequence in l1repack.sequences_():
141  setattr(process,sequence,getattr(l1repack,sequence))
142  process.SimL1Emulator = l1repack.SimL1Emulator
143 
144  for path in process.paths_():
145  getattr(process,path).insert(0,process.SimL1Emulator)
146  for path in process.endpaths_():
147  getattr(process,path).insert(0,process.SimL1Emulator)
148 
149  # special L1T cleanup
150  cleanupL1T = ('SimL1TCalorimeter'
151  ,'SimL1TCalorimeterTask'
152  ,'SimL1TMuonCommon'
153  ,'SimL1TMuonCommonTask'
154  ,'SimL1TMuon'
155  ,'SimL1TMuonTask'
156  ,'SimL1TechnicalTriggers'
157  ,'SimL1TechnicalTriggersTask'
158  ,'SimL1EmulatorCore'
159  ,'SimL1EmulatorCoreTask'
160  ,'ecalDigiSequence'
161  ,'ecalDigiTask'
162  ,'hcalDigiSequence'
163  ,'hcalDigiTask'
164  ,'calDigi'
165  ,'calDigiTask'
166  ,'me0TriggerPseudoDigis'
167  ,'me0TriggerPseudoDigiTask'
168  ,'simMuonGEMPadTask'
169  ,'hgcalTriggerPrimitives'
170  ,'hgcalTriggerPrimitivesTask'
171  ,'hgcalVFE'
172  ,'hgcalVFEProducer'
173  ,'hgcalBackEndLayer2'
174  ,'hgcalBackEndLayer2Producer'
175  ,'hgcalTowerMap'
176  ,'hgcalTowerMapProducer'
177  ,'hgcalConcentrator'
178  ,'hgcalConcentratorProducer'
179  ,'hgcalBackEndLayer1'
180  ,'hgcalBackEndLayer1Producer'
181  ,'hgcalTower'
182  ,'hgcalTowerProducer'
183  ,'hgcalTriggerGeometryESProducer')
184  for obj in cleanupL1T:
185  if hasattr(process,obj):
186  delattr(process,obj)
187 
188  return process
189 
190 def L1XML(process,xmlFile=None):
191 
192 # xmlFile="L1Menu_Collisions2016_dev_v3.xml"
193 
194  if ((xmlFile is None) or (xmlFile=="")):
195  return process
196 
197  process.L1TriggerMenu= cms.ESProducer("L1TUtmTriggerMenuESProducer",
198  L1TriggerMenuFile= cms.string(xmlFile)
199  )
200  process.ESPreferL1TXML = cms.ESPrefer("L1TUtmTriggerMenuESProducer","L1TriggerMenu")
201 
202  return process
203 
204 def CTPPSRun2Geometry(process):
205  if hasattr(process,'ctppsGeometryESModule'):
206  process.ctppsGeometryESModule.isRun2 = True
207  return(process)
CustomConfigs.L1T
def L1T(process)
Definition: CustomConfigs.py:43
CustomConfigs.L1THLT
def L1THLT(process)
Definition: CustomConfigs.py:77
mathSSE::return
return((rh ^ lh) &mask)
CustomConfigs.L1XML
def L1XML(process, xmlFile=None)
Definition: CustomConfigs.py:190
CustomConfigs.Base
def Base(process)
Definition: CustomConfigs.py:17
CustomConfigs.HLTDropPrevious
def HLTDropPrevious(process)
Definition: CustomConfigs.py:109
CustomConfigs.L1REPACK
def L1REPACK(process, sequence="Full")
Definition: CustomConfigs.py:123
CustomConfigs.ProcessName
def ProcessName(process)
Definition: CustomConfigs.py:8
CustomConfigs.CTPPSRun2Geometry
def CTPPSRun2Geometry(process)
Definition: CustomConfigs.py:204
edm::eventsetup::heterocontainer::insert
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:50