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  if 'hltDQMHLTScalers' in process.__dict__:
15  process.hltDQMHLTScalers.triggerResults = cms.InputTag( 'TriggerResults','',process.name_() )
16 
17  if 'hltDQML1SeedLogicScalers' in process.__dict__:
18  process.hltDQML1SeedLogicScalers.processname = process.name_()
19 
20  return(process)
21 
22 
23 def Base(process):
24 # default modifications
25 
26  process.options.wantSummary = cms.untracked.bool(True)
27  process.options.numberOfThreads = cms.untracked.uint32( 4 )
28  process.options.numberOfStreams = cms.untracked.uint32( 0 )
29  process.options.sizeOfStackForThreadsInKB = cms.untracked.uint32( 10*1024 )
30 
31  process.MessageLogger.categories.append('TriggerSummaryProducerAOD')
32  process.MessageLogger.categories.append('L1GtTrigReport')
33  process.MessageLogger.categories.append('L1TGlobalSummary')
34  process.MessageLogger.categories.append('HLTrigReport')
35 
36 # No longer override - instead use GT config as provided via cmsDriver
37 ## override the GlobalTag, connection string and pfnPrefix
38 # if 'GlobalTag' in process.__dict__:
39 # process.GlobalTag.connect = 'frontier://FrontierProd/CMS_CONDITIONS'
40 # process.GlobalTag.pfnPrefix = cms.untracked.string('frontier://Frontie#rProd/')
41 #
42 # process.GlobalTag.snapshotTime = cms.string("9999-12-31 23:59:59.000")
43 
44  process=ProcessName(process)
45 
46  return(process)
47 
48 
49 def L1T(process):
50 # modifications when running L1T only
51 
52  labels = ['gtDigis','simGtDigis','newGtDigis','hltGtDigis']
53  for label in labels:
54  if label in process.__dict__:
55  process.load('L1Trigger.GlobalTriggerAnalyzer.l1GtTrigReport_cfi')
56  process.l1GtTrigReport.L1GtRecordInputTag = cms.InputTag( label )
57  process.L1AnalyzerEndpath = cms.EndPath( process.l1GtTrigReport )
58  process.schedule.append(process.L1AnalyzerEndpath)
59 
60  labels = ['gtStage2Digis','simGtStage2Digis','newGtStage2Digis','hltGtStage2Digis']
61  for label in labels:
62  if label in process.__dict__:
63  process.load('L1Trigger.L1TGlobal.L1TGlobalSummary_cfi')
64  process.L1TGlobalSummary.AlgInputTag = cms.InputTag( label )
65  process.L1TGlobalSummary.ExtInputTag = cms.InputTag( label )
66  process.L1TAnalyzerEndpath = cms.EndPath(process.L1TGlobalSummary )
67  process.schedule.append(process.L1TAnalyzerEndpath)
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  if 'hltGtDigis' in process.__dict__:
82  from HLTrigger.Configuration.HLT_Fake_cff import fragment
83  process.hltL1GtTrigReport = fragment.hltL1GtTrigReport
84  process.hltTrigReport = fragment.hltTrigReport
85  process.HLTAnalyzerEndpath = cms.EndPath(process.hltGtDigis + process.hltL1GtTrigReport + process.hltTrigReport)
86  process.schedule.append(process.HLTAnalyzerEndpath)
87 
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)
94 
95  if hasattr(process,'TriggerMenu'):
96  delattr(process,'TriggerMenu')
97 
98  process=Base(process)
99 
100  return(process)
101 
102 
103 def HLTDropPrevious(process):
104 # drop on input the previous HLT results
105  process.source.inputCommands = cms.untracked.vstring (
106  'keep *',
107  'drop *_hltL1GtObjectMap_*_*',
108  'drop *_TriggerResults_*_*',
109  'drop *_hltTriggerSummaryAOD_*_*',
110  )
111 
112  process=Base(process)
113 
114  return(process)
115 
116 
117 def L1REPACK(process,sequence="Full"):
118 
119  from Configuration.StandardSequences.Eras import eras
120 
121  l1repack = cms.Process('L1REPACK',eras.Run2_2017)
122  l1repack.load('Configuration.StandardSequences.SimL1EmulatorRepack_'+sequence+'_cff')
123 
124  for module in l1repack.es_sources_():
125  if (not hasattr(process,module)):
126  setattr(process,module,getattr(l1repack,module))
127  for module in l1repack.es_producers_():
128  if (not hasattr(process,module)):
129  setattr(process,module,getattr(l1repack,module))
130 
131  for module in l1repack.SimL1Emulator.expandAndClone().moduleNames():
132  setattr(process,module,getattr(l1repack,module))
133  for sequence in l1repack.sequences_():
134  setattr(process,sequence,getattr(l1repack,sequence))
135  process.SimL1Emulator = l1repack.SimL1Emulator
136 
137  for path in process.paths_():
138  getattr(process,path).insert(0,process.SimL1Emulator)
139  for path in process.endpaths_():
140  getattr(process,path).insert(0,process.SimL1Emulator)
141 
142  return process
143 
144 def L1XML(process,xmlFile=None):
145 
146 # xmlFile="L1Menu_Collisions2016_dev_v3.xml"
147 
148  if ((xmlFile is None) or (xmlFile=="")):
149  return process
150 
151  process.L1TriggerMenu= cms.ESProducer("L1TUtmTriggerMenuESProducer",
152  L1TriggerMenuFile= cms.string(xmlFile)
153  )
154  process.ESPreferL1TXML = cms.ESPrefer("L1TUtmTriggerMenuESProducer","L1TriggerMenu")
155 
156  return process
def L1T(process)
override the GlobalTag, connection string and pfnPrefix if 'GlobalTag' in process.__dict__: process.GlobalTag.connect = 'frontier://FrontierProd/CMS_CONDITIONS' process.GlobalTag.pfnPrefix = cms.untracked.string('frontier://Frontie#rProd/')
def L1THLT(process)
def Base(process)
def HLTDropPrevious(process)
def ProcessName(process)
Definition: CustomConfigs.py:8
def L1XML(process, xmlFile=None)
def L1REPACK(process, sequence="Full")
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:49
return(e1-e2)*(e1-e2)+dp *dp