1 from __future__
import print_function
22 return name.replace(
"_",
"IoI")
36 if -1 != line.find(
'end path'):
58 start = line.find(
"'")+1
59 length = line[start:].
find(
"'")
62 if -1 != l.find(
"Analyzer"):
76 pathStartsWith =
"modules on "
78 startOfConsumes =
"All modules and modules in the current process whose products they consume:"
79 skipLineAfterConsumes =
False
82 endOfConsumes =
"All modules (listed by class and label) and all their consumed products."
83 for l
in f.readlines():
85 if l[:len(pathStartsWith)] == pathStartsWith:
91 if l[:len(startOfConsumes)] == startOfConsumes:
92 skipLineAfterConsumes =
True
95 parser = consumesParser
97 if skipLineAfterConsumes:
98 skipLineAfterConsumes =
False
100 if l[:len(endOfConsumes)] == endOfConsumes:
106 print(
"import FWCore.ParameterSet.Config as cms")
107 print(
"process = cms.Process('RECO')")
109 print(
"""process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(2000))
110 process.options = cms.untracked.PSet(
111 # numberOfThreads = cms.untracked.uint32(8),
112 numberOfThreads = cms.untracked.uint32(1),
113 numberOfStreams = cms.untracked.uint32(0),
114 # wantSummary = cms.untracked.bool(True)
117 process.add_(cms.Service("Timing", summaryOnly = cms.untracked.bool(True)))
119 # The following two lines reduce the clutter of repeated printouts
120 # of the same exception message.
121 process.load("FWCore.MessageLogger.MessageLogger_cfi")
123 process.MessageLogger.cerr.enableStatistics = False
125 process.MessageLogger.cerr.FwkReport.reportEvery = 50000
126 process.MessageLogger.cerr.threshold = 'WARNING'
129 print(
"process.source = cms.Source('EmptySource')")
132 modulesWithConsumes = set()
134 pathNamesAsModules = set( (
fixName(n)
for n
in pathParser._pathToModules.iterkeys()) )
136 for m,c
in consumesParser._consumesForModule.items():
137 if m
in pathNamesAsModules:
139 if m
in consumesParser._isAnalyzer:
140 print(
"process.%s = cms.EDAnalyzer('MultipleIntsAnalyzer', getFromModules = cms.untracked.VInputTag(*[%s]))"%(m,
",".
join([
"cms.InputTag('%s')"%i
for i
in (n
for n
in c
if n !=
'TriggerResults')])))
142 print(
"process.%s = cms.EDProducer('IntProducer', ivalue = cms.int32(1))"%m)
144 print(
"process.%s = cms.EDProducer('AddIntsProducer', labels = cms.VInputTag(*[%s]))"%(m,
",".
join([
"'%s'"%i
for i
in (n
for n
in c
if n !=
'TriggerResults')])))
148 modulesWithConsumes.add(m)
150 for m
in pathParser._pathToModules.values():
154 for m
in allModules.difference(modulesWithConsumes):
155 print(
"process.%s = cms.EDProducer('IntProducer', ivalue = cms.int32(1))"%(m))
158 print(
't = cms.Task(*[%s])'%(
",".
join([
"process.%s"%i
for i
in allModules
if i
not in consumesParser._isAnalyzer])))
159 for p,m
in pathParser._pathToModules.items():
160 if p
in pathParser._isEndPath:
161 print(
"process.%s = cms.EndPath(%s)"%(p,
"+".
join([
"process.%s"%i
for i
in m])))
164 print(
"process.%s = cms.Path(%s,t)"%(p,
"+".
join([
"process.%s"%i
for i
in m])))
166 print(
"process.%s = cms.Path()"%(p))