CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CustomConfigs.py
Go to the documentation of this file.
2 
3 def ProcessName(process):
4 # processname modifications
5 
6  if 'hltTrigReport' in process.__dict__:
7  process.hltTrigReport.HLTriggerResults = cms.InputTag( 'TriggerResults','',process.name_() )
8 
9  if 'hltDQMHLTScalers' in process.__dict__:
10  process.hltDQMHLTScalers.triggerResults = cms.InputTag( 'TriggerResults','',process.name_() )
11 
12  if 'hltDQML1SeedLogicScalers' in process.__dict__:
13  process.hltDQML1SeedLogicScalers.processname = process.name_()
14 
15  return(process)
16 
17 
18 def Base(process):
19 # default modifications
20 
21  process.options.wantSummary = cms.untracked.bool(True)
22 
23  process.MessageLogger.categories.append('TriggerSummaryProducerAOD')
24  process.MessageLogger.categories.append('L1GtTrigReport')
25  process.MessageLogger.categories.append('HLTrigReport')
26 
27 #
28 # No longer override - instead use GT config as provided via cmsDriver
29 ## override the GlobalTag, connection string and pfnPrefix
30 # if 'GlobalTag' in process.__dict__:
31 # process.GlobalTag.connect = 'frontier://FrontierProd/CMS_CONDITIONS'
32 # process.GlobalTag.pfnPrefix = cms.untracked.string('frontier://Frontie#rProd/')
33 #
34  process=ProcessName(process)
35 
36  return(process)
37 
38 
39 def L1T(process):
40 # modifications when running L1T only
41 
42  process.load('L1Trigger.GlobalTriggerAnalyzer.l1GtTrigReport_cfi')
43  labels = ['gtDigis','simGtDigis','newGtDigis','hltGtDigis']
44  for label in labels:
45  if label in process.__dict__:
46  process.l1GtTrigReport.L1GtRecordInputTag = cms.InputTag( label )
47 
48  process.L1AnalyzerEndpath = cms.EndPath( process.l1GtTrigReport )
49  process.schedule.append(process.L1AnalyzerEndpath)
50 
51  process=Base(process)
52 
53  return(process)
54 
55 
56 def L1THLT(process):
57 # modifications when running L1T+HLT
58 
59  if not ('HLTAnalyzerEndpath' in process.__dict__) :
60  from HLTrigger.Configuration.HLT_FULL_cff import fragment
61  process.hltL1GtTrigReport = fragment.hltL1GtTrigReport
62  process.hltTrigReport = fragment.hltTrigReport
63  process.HLTAnalyzerEndpath = cms.EndPath(process.hltL1GtTrigReport + process.hltTrigReport)
64  process.schedule.append(process.HLTAnalyzerEndpath)
65 
66  process=Base(process)
67 
68  return(process)
69 
70 
71 def FASTSIM(process):
72 # modifications when running L1T+HLT
73 
74  process=L1THLT(process)
75  process.hltL1GtTrigReport.L1GtRecordInputTag = cms.InputTag("simGtDigis")
76 
77  return(process)
78 
79 
80 def HLTDropPrevious(process):
81 # drop on input the previous HLT results
82  process.source.inputCommands = cms.untracked.vstring (
83  'keep *',
84  'drop *_hltL1GtObjectMap_*_*',
85  'drop *_TriggerResults_*_*',
86  'drop *_hltTriggerSummaryAOD_*_*',
87  )
88 
89  process=Base(process)
90 
91  return(process)
92 
93 
94 def MassReplaceInputTag(process,old="rawDataCollector",new="rawDataRepacker",verbose=False,moduleLabelOnly=False,skipLabelTest=False):
95 # replace InputTag values (adapted from Configuration/Applications/python/ConfigBuilder.py)
96  from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag
97  for s in process.paths_().keys():
98  massSearchReplaceAnyInputTag(getattr(process,s),old,new,verbose,moduleLabelOnly,skipLabelTest)
99  for s in process.endpaths_().keys():
100  massSearchReplaceAnyInputTag(getattr(process,s),old,new,verbose,moduleLabelOnly,skipLabelTest)
101  return(process)
102 
103 def MassReplaceParameter(process,name="label",old="rawDataCollector",new="rawDataRepacker",verbose=False):
104 # replace values of named parameters
105  from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceParam
106  for s in process.paths_().keys():
107  massSearchReplaceParam(getattr(process,s),name,old,new,verbose)
108  for s in process.endpaths_().keys():
109  massSearchReplaceParam(getattr(process,s),name,old,new,verbose)
110  return(process)
111 
112 def L1REPACK(process):
113 # Replace only the L1 parts and keep the rest
114  if 'DigiToRaw' in process.__dict__:
115  process.DigiToRaw = cms.Sequence(process.l1tDigiToRawSeq + process.l1GtPack + process.l1GtEvmPack + process.rawDataCollector)
116  if 'rawDataCollector' in process.__dict__:
117  process.rawDataCollector.RawCollectionList = cms.VInputTag(
118  cms.InputTag('gctDigiToRaw'),
119  cms.InputTag('l1tDigiToRaw'),
120  cms.InputTag('l1GtPack'),
121  cms.InputTag('l1GtEvmPack'),
122  cms.InputTag('rawDataCollector', processName=cms.InputTag.skipCurrentProcess())
123  )
124 
125  process=L1T(process)
126 
127  return process
return((rh^lh)&mask)
def massSearchReplaceAnyInputTag
Definition: helpers.py:262
def massSearchReplaceParam
Definition: helpers.py:249
def MassReplaceInputTag
def MassReplaceParameter