4 from PhysicsTools.HeppyCore.framework.config
import CFG
6 def __init__(self,configFile,command="cmsRun") :
10 def run(self,component,wd,firstEvent,nEvents):
11 print wd,firstEvent,nEvents
14 cmsswConfig = imp.load_source(
"cmsRunProcess",self.
configFile)
16 for fn
in component.files :
17 if not re.match(
"file:.*",fn)
and not re.match(
"root:.*",fn) :
20 cmsswConfig.process.source.fileNames = inputfiles
21 cmsswConfig.process.maxEvents.input=nEvents
24 outfilename=wd+
"/cmsswPreProcessing.root"
25 for outName
in cmsswConfig.process.endpath.moduleNames() :
26 out = getattr(cmsswConfig.process,outName)
27 out.fileName = outfilename
28 if not hasattr(component,
"options"):
29 component.options = CFG(name=
"postCmsrunOptions")
35 component.options.secondaryInputFiles= component.files
36 component.options.inputFiles=[outfilename]
37 component.files=[outfilename]
39 configfile=wd+
"/cmsRun_config.py"
40 f = open(configfile,
'w')
41 f.write(cmsswConfig.process.dumpPython())
43 runstring=
"%s %s >& %s/cmsRun.log" % (self.
command,configfile,wd)
44 print "Running pre-processor: %s " %runstring
45 ret=os.system(runstring)