ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/writeCfg.py
(Generate patch)

Comparing COMP/CRAB/python/writeCfg.py (file contents):
Revision 1.18 by ewv, Mon May 4 21:45:43 2009 UTC vs.
Revision 1.21 by ewv, Fri Jun 19 18:46:54 2009 UTC

# Line 39 | Line 39 | def main(argv) :
39      """
40      writeCfg
41  
42 <    - Read in existing, user supplied cfg or pycfg file
43 <    - Modify job specific parameters based on environment variables
44 <    - Write out modified cfg or pycfg file
42 >    - Read in existing, user supplied cfg or pickled pycfg file
43 >    - Modify job specific parameters based on environment variables and arguments.xml
44 >    - Write out modified cfg or pickled pycfg file
45  
46      required parameters: none
47  
# Line 89 | Line 89 | def main(argv) :
89          print main.__doc__
90          sys.exit()
91  
92 <  # Read in XML and get optional Parameters
92 >  # Read in Environment, XML and get optional Parameters
93  
94      nJob       = int(os.environ.get('NJob',      '0'))
95 +    preserveSeeds  = os.environ.get('PreserveSeeds','')
96 +    incrementSeeds = os.environ.get('IncrementSeeds','')
97  
98    # Defaults
99  
# Line 111 | Line 113 | def main(argv) :
113                  skipEvents = int(elem.getAttribute("SkipEvents"))
114              if elem.getAttribute("FirstEvent"):
115                  firstEvent = int(elem.getAttribute("FirstEvent"))
114            if elem.getAttribute("CompHEPFirstEvent"):
115                compHEPFirstEvent = int(elem.getAttribute("CompHEPFirstEvent"))
116              if elem.getAttribute("FirstRun"):
117                  firstRun = int(elem.getAttribute("FirstRun"))
118  
119 +            generator      = str(elem.getAttribute('Generator'))
120              inputFiles     = str(elem.getAttribute('InputFiles'))
121              parentFiles    = str(elem.getAttribute('ParentFiles'))
121            preserveSeeds  = str(elem.getAttribute('PreserveSeeds'))
122            incrementSeeds = str(elem.getAttribute('IncrementSeeds'))
122  
123    # Read Input cfg or python cfg file, FUTURE: Get rid cfg mode
124  
# Line 154 | Line 153 | def main(argv) :
153  
154      if skipEvents:
155          inModule.setSkipEvents(skipEvents)
156 <    if firstEvent != -1:
156 >
157 >    # Set "skip events" for various generators
158 >    if generator == 'comphep':
159 >        cmsProcess.source.CompHEPFirstEvent = CfgTypes.int32(firstEvent)
160 >    elif generator == 'lhe':
161 >        cmsProcess.source.skipEvents = CfgTypes.untracked(CfgTypes.uint32(firstEvent))
162 >        cmsProcess.source.firstEvent = CfgTypes.untracked(CfgTypes.uint32(firstEvent+1))
163 >    elif firstEvent != -1: # (Old? Madgraph)
164          cmsProcess.source.firstEvent = CfgTypes.untracked(CfgTypes.uint32(firstEvent))
165 <    if compHEPFirstEvent:
160 <        cmsProcess.source.CompHEPFirstEvent = CfgTypes.int32(compHEPFirstEvent)
165 >
166      if inputFiles:
167          inputFileNames = inputFiles.split(',')
168          inModule.setFileNames(*inputFileNames)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines