17 |
|
from random import SystemRandom |
18 |
|
|
19 |
|
from ProdCommon.CMSConfigTools.ConfigAPI.CfgInterface import CfgInterface |
20 |
– |
from FWCore.ParameterSet.Config import include |
20 |
|
import FWCore.ParameterSet.Types as CfgTypes |
21 |
|
|
22 |
|
MyRandom = SystemRandom() |
120 |
|
firstLumi = int(elem.getAttribute("FirstLumi")) |
121 |
|
|
122 |
|
generator = str(elem.getAttribute('Generator')) |
123 |
+ |
inputBlocks = str(elem.getAttribute('InputBlocks')) |
124 |
|
inputFiles = str(elem.getAttribute('InputFiles')) |
125 |
|
parentFiles = str(elem.getAttribute('ParentFiles')) |
126 |
|
lumis = str(elem.getAttribute('Lumis')) |
127 |
|
|
128 |
+ |
report(inputBlocks,inputFiles,parentFiles,lumis) |
129 |
+ |
|
130 |
|
# Read Input python config file |
131 |
|
|
132 |
|
handle = open(fileName, 'r') |
149 |
|
if maxEvents: |
150 |
|
cfg.maxEvents.setMaxEventsInput(maxEvents) |
151 |
|
|
152 |
< |
if skipEvents: |
152 |
> |
if skipEvents and inModule.sourceType not in ['EmptySource']: |
153 |
|
inModule.setSkipEvents(skipEvents) |
154 |
|
|
155 |
|
# Set "skip events" for various generators |
188 |
|
print "RandomNumberGeneratorService found, will attempt to change seeds" |
189 |
|
from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper |
190 |
|
ranGenerator = cfg.data.services['RandomNumberGeneratorService'] |
191 |
+ |
|
192 |
+ |
ranModules = getattr(ranGenerator, "moduleSeeds", None) |
193 |
+ |
oldSource = getattr(ranGenerator, "sourceSeed", None) |
194 |
+ |
if ranModules != None or oldSource != None: |
195 |
+ |
msg = "Your random number seeds are set in an old,\n" |
196 |
+ |
msg += "deprecated style. Please change to new style:\n" |
197 |
+ |
msg += "https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideEDMRandomNumberGeneratorService" |
198 |
+ |
raise ConfigException(msg) |
199 |
+ |
|
200 |
|
randSvc = RandomNumberServiceHelper(ranGenerator) |
201 |
|
|
202 |
|
incrementSeedList = [] |
236 |
|
print cmsProcess.dumpPython() |
237 |
|
|
238 |
|
|
239 |
+ |
def report( inputBlocks='', inputFiles='', parentFiles='', lumis='' ): |
240 |
+ |
""" |
241 |
+ |
Writes the 4 parameters to a file, one parameter per line. |
242 |
+ |
""" |
243 |
+ |
outFile = open('%s/inputsReport.txt'%os.environ['RUNTIME_AREA'],"a") |
244 |
+ |
|
245 |
+ |
# InputFileList=inputFiles.split(',') |
246 |
+ |
# parentFilesList= parentFiles.split(',') |
247 |
+ |
# lumisList= lumis.split(',') |
248 |
+ |
|
249 |
+ |
## replacing , with ; otherwise report.py will split it as a new parameter |
250 |
+ |
txt = '' |
251 |
+ |
txt += 'inputBlocks='+inputBlocks.replace(',',';')+'\n' |
252 |
+ |
txt += 'inputFiles='+inputFiles.replace(',',';')+'\n' |
253 |
+ |
txt += 'parentFiles='+parentFiles.replace(',',';')+'\n' |
254 |
+ |
txt += 'lumisRange='+lumis.replace(',',';')+'\n' |
255 |
+ |
outFile.write(str(txt)) |
256 |
+ |
outFile.close() |
257 |
+ |
return |
258 |
+ |
|
259 |
+ |
|
260 |
|
if __name__ == '__main__' : |
261 |
|
exit_status = main(sys.argv[1:]) |
262 |
|
sys.exit(exit_status) |