CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
cmsswPreprocessor.CmsswPreprocessor Class Reference

Public Member Functions

def __init__
 
def run
 

Public Attributes

 command
 
 configFile
 

Detailed Description

Definition at line 5 of file cmsswPreprocessor.py.

Constructor & Destructor Documentation

def cmsswPreprocessor.CmsswPreprocessor.__init__ (   self,
  configFile,
  command = "cmsRun" 
)

Definition at line 6 of file cmsswPreprocessor.py.

6 
7  def __init__(self,configFile,command="cmsRun") :
8  self.configFile=configFile
9  self.command=command

Member Function Documentation

def cmsswPreprocessor.CmsswPreprocessor.run (   self,
  component,
  wd,
  firstEvent,
  nEvents 
)

Definition at line 10 of file cmsswPreprocessor.py.

References cmsswPreprocessor.CmsswPreprocessor.command, runall.testit.command, WorkFlow.WorkFlowBlock.command, ConfigBuilder.ConfigBuilder.command, cmsswPreprocessor.CmsswPreprocessor.configFile, and cmsRelvalreport.exit.

10 
11  def run(self,component,wd,firstEvent,nEvents):
12  print wd,firstEvent,nEvents
13  if nEvents is None:
14  nEvents = -1
15  cmsswConfig = imp.load_source("cmsRunProcess",self.configFile)
16  inputfiles= []
17  for fn in component.files :
18  if not re.match("file:.*",fn) and not re.match("root:.*",fn) :
19  fn="file:"+fn
20  inputfiles.append(fn)
21  cmsswConfig.process.source.fileNames = inputfiles
22  cmsswConfig.process.maxEvents.input=nEvents
23  #fixme: implement skipEvent / firstevent
24 
25  outfilename=wd+"/cmsswPreProcessing.root"
26  for outName in cmsswConfig.process.endpath.moduleNames() :
27  out = getattr(cmsswConfig.process,outName)
28  out.fileName = outfilename
29  if not hasattr(component,"options"):
30  component.options = CFG(name="postCmsrunOptions")
31  #use original as primary and new as secondary
32  #component.options.inputFiles= component.files
33  #component.options.secondaryInputFiles=[outfilename]
34 
35  #use new as primary and original as secondary
36  component.options.secondaryInputFiles= component.files
37  component.options.inputFiles=[outfilename]
38  component.files=[outfilename]
39 
40  configfile=wd+"/cmsRun_config.py"
41  f = open(configfile, 'w')
42  f.write(cmsswConfig.process.dumpPython())
43  f.close()
44  runstring="%s %s >& %s/cmsRun.log" % (self.command,configfile,wd)
45  print "Running pre-processor: %s " %runstring
46  ret=os.system(runstring)
47  if ret != 0:
48  print "CMSRUN failed"
49  exit(ret)
50  return component

Member Data Documentation

cmsswPreprocessor.CmsswPreprocessor.command

Definition at line 8 of file cmsswPreprocessor.py.

Referenced by cmsRelvalreport.Profile._profile_edmsize(), cmsRelvalreport.Profile._profile_igprof(), cmsRelvalreport.Profile._profile_Memcheck_Valgrind(), cmsRelvalreport.Profile._profile_None(), cmsRelvalreport.Profile._profile_valgrindfce(), cmsRelvalreport.Profile._save_output(), and cmsswPreprocessor.CmsswPreprocessor.run().

cmsswPreprocessor.CmsswPreprocessor.configFile

Definition at line 7 of file cmsswPreprocessor.py.

Referenced by cmsswPreprocessor.CmsswPreprocessor.run().