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.22 by ewv, Wed Jul 29 21:20:03 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'))
122 <            preserveSeeds  = str(elem.getAttribute('PreserveSeeds'))
122 <            incrementSeeds = str(elem.getAttribute('IncrementSeeds'))
122 >            lumis          = str(elem.getAttribute('Lumis'))
123  
124    # Read Input cfg or python cfg file, FUTURE: Get rid cfg mode
125  
# Line 154 | Line 154 | def main(argv) :
154  
155      if skipEvents:
156          inModule.setSkipEvents(skipEvents)
157 <    if firstEvent != -1:
157 >
158 >    # Set "skip events" for various generators
159 >    if generator == 'comphep':
160 >        cmsProcess.source.CompHEPFirstEvent = CfgTypes.int32(firstEvent)
161 >    elif generator == 'lhe':
162 >        cmsProcess.source.skipEvents = CfgTypes.untracked(CfgTypes.uint32(firstEvent))
163 >        cmsProcess.source.firstEvent = CfgTypes.untracked(CfgTypes.uint32(firstEvent+1))
164 >    elif firstEvent != -1: # (Old? Madgraph)
165          cmsProcess.source.firstEvent = CfgTypes.untracked(CfgTypes.uint32(firstEvent))
166 <    if compHEPFirstEvent:
160 <        cmsProcess.source.CompHEPFirstEvent = CfgTypes.int32(compHEPFirstEvent)
166 >
167      if inputFiles:
168          inputFileNames = inputFiles.split(',')
169          inModule.setFileNames(*inputFileNames)
# Line 167 | Line 173 | def main(argv) :
173          parentFileNames = parentFiles.split(',')
174          inModule.setSecondaryFileNames(*parentFileNames)
175  
176 +    if lumis:
177 +        lumiRanges = lumis.split(',')
178 +        inModule.setLumisToProcess(*lumiRanges)
179 +
180      # Pythia parameters
181      if (firstRun):
182          inModule.setFirstRun(firstRun)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines