1 from __future__
import print_function
23 return name.replace(
"_",
"IoI")
37 if -1 != line.find(
'end path'):
59 start = line.find(
"'")+1
60 length = line[start:].
find(
"'")
63 if -1 != l.find(
"Analyzer"):
77 pathStartsWith =
"modules on "
79 startOfConsumes =
"All modules and modules in the current process whose products they consume:"
80 skipLineAfterConsumes =
False
83 endOfConsumes =
"All modules (listed by class and label) and all their consumed products."
84 for l
in f.readlines():
86 if l[:len(pathStartsWith)] == pathStartsWith:
92 if l[:len(startOfConsumes)] == startOfConsumes:
93 skipLineAfterConsumes =
True
96 parser = consumesParser
98 if skipLineAfterConsumes:
99 skipLineAfterConsumes =
False
101 if l[:len(endOfConsumes)] == endOfConsumes:
107 print(
"import FWCore.ParameterSet.Config as cms")
108 print(
"process = cms.Process('RECO')")
110 print(
"""process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(2000))
111 process.options = cms.untracked.PSet(
112 # numberOfThreads = cms.untracked.uint32(8),
113 numberOfThreads = cms.untracked.uint32(1),
114 numberOfStreams = cms.untracked.uint32(0),
115 # wantSummary = cms.untracked.bool(True)
118 process.add_(cms.Service("Timing", summaryOnly = cms.untracked.bool(True)))
120 # The following two lines reduce the clutter of repeated printouts
121 # of the same exception message.
122 process.load("FWCore.MessageLogger.MessageLogger_cfi")
124 process.MessageLogger.cerr.enableStatistics = False
126 process.MessageLogger.cerr.FwkReport.reportEvery = 50000
127 process.MessageLogger.cerr.threshold = 'WARNING'
130 print(
"process.source = cms.Source('EmptySource')")
133 modulesWithConsumes = set()
135 pathNamesAsModules = set( (
fixName(n)
for n
in pathParser._pathToModules.iterkeys()) )
137 for m,c
in six.iteritems(consumesParser._consumesForModule):
138 if m
in pathNamesAsModules:
140 if m
in consumesParser._isAnalyzer:
141 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')])))
143 print(
"process.%s = cms.EDProducer('IntProducer', ivalue = cms.int32(1))"%m)
145 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')])))
149 modulesWithConsumes.add(m)
151 for m
in six.itervalues(pathParser._pathToModules):
155 for m
in allModules.difference(modulesWithConsumes):
156 print(
"process.%s = cms.EDProducer('IntProducer', ivalue = cms.int32(1))"%(m))
159 print(
't = cms.Task(*[%s])'%(
",".
join([
"process.%s"%i
for i
in allModules
if i
not in consumesParser._isAnalyzer])))
160 for p,m
in six.iteritems(pathParser._pathToModules):
161 if p
in pathParser._isEndPath:
162 print(
"process.%s = cms.EndPath(%s)"%(p,
"+".
join([
"process.%s"%i
for i
in m])))
165 print(
"process.%s = cms.Path(%s,t)"%(p,
"+".
join([
"process.%s"%i
for i
in m])))
167 print(
"process.%s = cms.Path()"%(p))