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.1 by ewv, Fri Dec 14 17:53:36 2007 UTC vs.
Revision 1.2 by ewv, Tue Feb 19 17:19:14 2008 UTC

# Line 3 | Line 3
3   import sys, getopt, string
4   import imp
5   import os
6 + import random
7 + from random import SystemRandom
8 + _inst  = SystemRandom()
9  
10   from ProdCommon.CMSConfigTools.ConfigAPI.CfgInterface import CfgInterface
11   from FWCore.ParameterSet.DictTypes import SortedKeysDict
# Line 31 | Line 34 | def main(argv) :
34    """
35  
36    # defaults
37 <  maxEvents = 0
38 <  skipEvents = 0
37 >  maxEvents      = 0
38 >  skipEvents     = 0
39    inputFileNames = None
40 <  debug = False
40 >  firstRun       = 0
41 >  sourceSeed     = 0
42 >  vtxSeed        = 0
43 >  g4Seed         = 0
44 >  mixSeed        = 0
45 >  debug          = False
46  
47    try:
48      opts, args = getopt.getopt(argv, "", ["debug", "help","inputFiles=","maxEvents=","skipEvents="])
# Line 58 | Line 66 | def main(argv) :
66        inputFiles = inputFiles.replace('\\','')
67        inputFiles = inputFiles.replace('"','')
68        inputFileNames = inputFiles.split(',')
69 +    elif opt == "--firstRun":
70 +      firstRun = int(arg)
71 +    elif opt == "--sourceSeed":
72 +      sourceSeed = int(arg)
73 +    elif opt == "--vtxSeed":
74 +      vtxSeed = int(arg)
75 +    elif opt == "--g4Seed":
76 +      g4Seed = int(arg)
77 +    elif opt == "--mixSeed":
78 +      mixSeed = int(arg)
79  
80    # Parse remaining parameters
81  
# Line 95 | Line 113 | def main(argv) :
113    if (inputFileNames):
114      inModule.setFileNames(*inputFileNames)
115  
116 +  # Pythia parameters
117 +  if (firstRun):
118 +    inModule.setFirstRun(firstRun)
119 +  if (sourceSeed) :
120 +    ranGenerator = cfg.data.services['RandomNumberGeneratorService']
121 +    ranGenerator.sourceSeed = CfgTypes.untracked(CfgTypes.uint32(sourceSeed))
122 +    if (vtxSeed) :
123 +      ranModules   = ranGenerator.moduleSeeds
124 +      ranModules.VtxSmeared = CfgTypes.untracked(CfgTypes.uint32(vtxSeed))
125 +    if (g4Seed) :
126 +      ranModules   = ranGenerator.moduleSeeds
127 +      ranModules.g4SimHits = CfgTypes.untracked(CfgTypes.uint32(g4Seed))
128 +    if (mixSeed) :
129 +      ranModules   = ranGenerator.moduleSeeds
130 +      ranModules.mix = CfgTypes.untracked(CfgTypes.uint32(mixSeed))
131 +
132 +  # Randomize all seeds
133 +
134 +  print "There are ",cfg.seedCount()," seeds"
135 +  seedList = [random.randint(100,200) for i in range(cfg.seedCount)]
136 +  seedTuple = seedList.tuple()
137 +
138 +  cfg.insertSeeds(*seedTuple)
139 +
140    # Write out new config file
141  
142    outFile = open(outFileName,"w")

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines