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.
1 import FWCore.ParameterSet.Config as cms
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.GlobalTag.snapshotTime = cms.string("9999-12-31 23:59:59.000")
35 
36  process=ProcessName(process)
37 
38  return(process)
39 
40 
41 def L1T(process):
42 # modifications when running L1T only
43 
44  process.load('L1Trigger.GlobalTriggerAnalyzer.l1GtTrigReport_cfi')
45  labels = ['gtDigis','simGtDigis','newGtDigis','hltGtDigis']
46  for label in labels:
47  if label in process.__dict__:
48  process.l1GtTrigReport.L1GtRecordInputTag = cms.InputTag( label )
49 
50  process.L1AnalyzerEndpath = cms.EndPath( process.l1GtTrigReport )
51  process.schedule.append(process.L1AnalyzerEndpath)
52 
53  process=Base(process)
54 
55  return(process)
56 
57 
58 def L1THLT(process):
59 # modifications when running L1T+HLT
60 
61  if not ('HLTAnalyzerEndpath' in process.__dict__) :
62  from HLTrigger.Configuration.HLT_FULL_cff import fragment
63  process.hltGtDigis = fragment.hltGtDigis
64  process.hltL1GtTrigReport = fragment.hltL1GtTrigReport
65  process.hltTrigReport = fragment.hltTrigReport
66  process.HLTAnalyzerEndpath = cms.EndPath(process.hltGtDigis + process.hltL1GtTrigReport + process.hltTrigReport)
67  process.schedule.append(process.HLTAnalyzerEndpath)
68 
69  process=Base(process)
70 
71  return(process)
72 
73 
74 def HLTDropPrevious(process):
75 # drop on input the previous HLT results
76  process.source.inputCommands = cms.untracked.vstring (
77  'keep *',
78  'drop *_hltL1GtObjectMap_*_*',
79  'drop *_TriggerResults_*_*',
80  'drop *_hltTriggerSummaryAOD_*_*',
81  )
82 
83  process=Base(process)
84 
85  return(process)
86 
87 
88 def MassReplaceInputTag(process,old="rawDataCollector",new="rawDataRepacker",verbose=False,moduleLabelOnly=False,skipLabelTest=False):
89 # replace InputTag values (adapted from Configuration/Applications/python/ConfigBuilder.py)
90  from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag
91  for s in process.paths_().keys():
92  massSearchReplaceAnyInputTag(getattr(process,s),old,new,verbose,moduleLabelOnly,skipLabelTest)
93  for s in process.endpaths_().keys():
94  massSearchReplaceAnyInputTag(getattr(process,s),old,new,verbose,moduleLabelOnly,skipLabelTest)
95  return(process)
96 
97 def MassReplaceParameter(process,name="label",old="rawDataCollector",new="rawDataRepacker",verbose=False):
98 # replace values of named parameters
99  from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceParam
100  for s in process.paths_().keys():
101  massSearchReplaceParam(getattr(process,s),name,old,new,verbose)
102  for s in process.endpaths_().keys():
103  massSearchReplaceParam(getattr(process,s),name,old,new,verbose)
104  return(process)
105 
106 def L1REPACK(process):
107 # Replace only the L1 parts and keep the rest
108  if 'DigiToRaw' in process.__dict__:
109  process.DigiToRaw = cms.Sequence(process.l1tDigiToRawSeq + process.l1GtPack + process.l1GtEvmPack + process.rawDataCollector)
110  if 'rawDataCollector' in process.__dict__:
111  process.rawDataCollector.RawCollectionList = cms.VInputTag(
112  cms.InputTag('gctDigiToRaw'),
113  cms.InputTag('l1tDigiToRaw'),
114  cms.InputTag('l1GtPack'),
115  cms.InputTag('l1GtEvmPack'),
116  cms.InputTag('rawDataCollector', processName=cms.InputTag.skipCurrentProcess())
117  )
118 
119  process=L1T(process)
120 
121  return process
return((rh^lh)&mask)
def massSearchReplaceAnyInputTag
Definition: helpers.py:262
def massSearchReplaceParam
Definition: helpers.py:249
def MassReplaceInputTag
def MassReplaceParameter