![]() |
![]() |
The main building routines
Definition at line 151 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::__init__ | ( | self, | |
options, | |||
process = None , |
|||
with_output = False , |
|||
with_input = False |
|||
) |
options taken from old cmsDriver and optparse
Definition at line 154 of file ConfigBuilder.py.
00155 : 00156 """options taken from old cmsDriver and optparse """ 00157 00158 options.outfile_name = options.dirout+options.fileout 00159 00160 self._options = options 00161 00162 if self._options.isData and options.isMC: 00163 raise Exception("ERROR: You may specify only --data or --mc, not both") 00164 #if not self._options.conditions: 00165 # raise Exception("ERROR: No conditions given!\nPlease specify conditions. E.g. via --conditions=IDEAL_30X::All") 00166 00167 if hasattr(self._options,"datatier") and self._options.datatier and 'DQMROOT' in self._options.datatier and 'ENDJOB' in self._options.step: 00168 self._options.step=self._options.step.replace(',ENDJOB','') 00169 00170 # what steps are provided by this class? 00171 stepList = [re.sub(r'^prepare_', '', methodName) for methodName in ConfigBuilder.__dict__ if methodName.startswith('prepare_')] 00172 self.stepMap={} 00173 for step in self._options.step.split(","): 00174 if step=='': continue 00175 stepParts = step.split(":") 00176 stepName = stepParts[0] 00177 if stepName not in stepList and not stepName.startswith('re'): 00178 raise ValueError("Step "+stepName+" unknown") 00179 if len(stepParts)==1: 00180 self.stepMap[stepName]="" 00181 elif len(stepParts)==2: 00182 self.stepMap[stepName]=stepParts[1].split('+') 00183 elif len(stepParts)==3: 00184 self.stepMap[stepName]=(stepParts[2].split('+'),stepParts[1]) 00185 else: 00186 raise ValueError("Step definition "+step+" invalid") 00187 #print "map of steps is:",self.stepMap 00188 00189 self.with_output = with_output 00190 if hasattr(self._options,"no_output_flag") and self._options.no_output_flag: 00191 self.with_output = False 00192 self.with_input = with_input 00193 if process == None: 00194 self.process = cms.Process(self._options.name) 00195 else: 00196 self.process = process 00197 self.imports = [] 00198 self.define_Configs() 00199 self.schedule = list() 00200 00201 # we are doing three things here: 00202 # creating a process to catch errors 00203 # building the code to re-create the process 00204 00205 self.additionalCommands = [] 00206 # TODO: maybe a list of to be dumped objects would help as well 00207 self.blacklist_paths = [] 00208 self.addedObjects = [] 00209 self.additionalOutputs = {} 00210 00211 self.productionFilterSequence = None
def ConfigBuilder::ConfigBuilder::addCommon | ( | self | ) |
Definition at line 271 of file ConfigBuilder.py.
00272 : 00273 if 'HARVESTING' in self.stepMap.keys() or 'ALCAHARVEST' in self.stepMap.keys(): 00274 self.process.options = cms.untracked.PSet( Rethrow = cms.untracked.vstring('ProductNotFound'),fileMode = cms.untracked.string('FULLMERGE')) 00275 else: 00276 self.process.options = cms.untracked.PSet( ) 00277 self.addedObjects.append(("","options")) 00278 00279 if self._options.lazy_download: 00280 self.process.AdaptorConfig = cms.Service("AdaptorConfig", 00281 stats = cms.untracked.bool(True), 00282 enable = cms.untracked.bool(True), 00283 cacheHint = cms.untracked.string("lazy-download"), 00284 readHint = cms.untracked.string("read-ahead-buffered") 00285 ) 00286 self.addedObjects.append(("Setup lazy download","AdaptorConfig")) 00287 00288 #self.process.cmsDriverCommand = cms.untracked.PSet( command=cms.untracked.string('cmsDriver.py '+self._options.arguments) ) 00289 #self.addedObjects.append(("what cmsDriver command was used","cmsDriverCommand")) 00290 00291 if self._options.profile: 00292 (start, interval, eventFormat, jobFormat)=self.profileOptions() 00293 self.process.IgProfService = cms.Service("IgProfService", 00294 reportFirstEvent = cms.untracked.int32(start), 00295 reportEventInterval = cms.untracked.int32(interval), 00296 reportToFileAtPostEvent = cms.untracked.string("| gzip -c > %s"%(eventFormat)), 00297 reportToFileAtPostEndJob = cms.untracked.string("| gzip -c > %s"%(jobFormat))) 00298 self.addedObjects.append(("Setup IGProf Service for profiling","IgProfService"))
def ConfigBuilder::ConfigBuilder::addConditions | ( | self | ) |
Add conditions to the process
Definition at line 673 of file ConfigBuilder.py.
00674 : 00675 """Add conditions to the process""" 00676 if not self._options.conditions: return 00677 00678 if 'FrontierConditions_GlobalTag' in self._options.conditions: 00679 print 'using FrontierConditions_GlobalTag in --conditions is not necessary anymore and will be deprecated soon. please update your command line' 00680 self._options.conditions = self._options.conditions.replace("FrontierConditions_GlobalTag,",'') 00681 00682 self.loadAndRemember(self.ConditionsDefaultCFF) 00683 00684 from Configuration.AlCa.GlobalTag import GlobalTag 00685 self.process.GlobalTag = GlobalTag(self.process.GlobalTag, self._options.conditions, self._options.custom_conditions) 00686 self.additionalCommands.append('from Configuration.AlCa.GlobalTag import GlobalTag') 00687 self.additionalCommands.append('process.GlobalTag = GlobalTag(process.GlobalTag, %s, %s)' % (repr(self._options.conditions), repr(self._options.custom_conditions))) 00688 00689 if self._options.slhc: 00690 self.loadAndRemember("SLHCUpgradeSimulations/Geometry/fakeConditions_%s_cff"%(self._options.slhc,)) 00691
def ConfigBuilder::ConfigBuilder::addCustomise | ( | self | ) |
Include the customise code
Definition at line 692 of file ConfigBuilder.py.
00693 : 00694 """Include the customise code """ 00695 00696 custOpt=self._options.customisation_file.split(",") 00697 custMap={} 00698 for opt in custOpt: 00699 if opt=='': continue 00700 if opt.count('.')>1: 00701 raise Exception("more than . in the specification:"+opt) 00702 fileName=opt.split('.')[0] 00703 if opt.count('.')==0: rest='customise' 00704 else: 00705 rest=opt.split('.')[1] 00706 if rest=='py': rest='customise' #catch the case of --customise file.py 00707 00708 if fileName in custMap: 00709 custMap[fileName].extend(rest.split('+')) 00710 else: 00711 custMap[fileName]=rest.split('+') 00712 00713 if len(custMap)==0: 00714 final_snippet='\n' 00715 else: 00716 final_snippet='\n# customisation of the process.\n' 00717 00718 allFcn=[] 00719 for opt in custMap: 00720 allFcn.extend(custMap[opt]) 00721 for fcn in allFcn: 00722 if allFcn.count(fcn)!=1: 00723 raise Exception("cannot specify twice "+fcn+" as a customisation method") 00724 00725 for f in custMap: 00726 # let python search for that package and do syntax checking at the same time 00727 packageName = f.replace(".py","").replace("/",".") 00728 __import__(packageName) 00729 package = sys.modules[packageName] 00730 00731 # now ask the package for its definition and pick .py instead of .pyc 00732 customiseFile = re.sub(r'\.pyc$', '.py', package.__file__) 00733 00734 final_snippet+='\n# Automatic addition of the customisation function from '+packageName+'\n' 00735 if self._options.inline_custom: 00736 for line in file(customiseFile,'r'): 00737 if "import FWCore.ParameterSet.Config" in line: 00738 continue 00739 final_snippet += line 00740 else: 00741 final_snippet += 'from %s import %s \n'%(packageName,','.join(custMap[f])) 00742 for fcn in custMap[f]: 00743 print "customising the process with",fcn,"from",f 00744 if not hasattr(package,fcn): 00745 #bound to fail at run time 00746 raise Exception("config "+f+" has no function "+fcn) 00747 #execute the command 00748 self.process=getattr(package,fcn)(self.process) 00749 #and print it in the configuration 00750 final_snippet += "\n#call to customisation function "+fcn+" imported from "+packageName 00751 final_snippet += "\nprocess = %s(process)\n"%(fcn,) 00752 00753 if len(custMap)!=0: 00754 final_snippet += '\n# End of customisation functions\n' 00755 00756 ### now for a usuful command 00757 if self._options.customise_commands: 00758 import string 00759 final_snippet +='\n# Customisation from command line' 00760 for com in self._options.customise_commands.split('\\n'): 00761 com=string.lstrip(com) 00762 self.executeAndRemember(com) 00763 final_snippet +='\n'+com 00764 00765 return final_snippet
def ConfigBuilder::ConfigBuilder::addExtraStream | ( | self, | |
name, | |||
stream, | |||
workflow = 'full' |
|||
) |
Definition at line 992 of file ConfigBuilder.py.
00993 : 00994 # define output module and go from there 00995 output = cms.OutputModule("PoolOutputModule") 00996 if stream.selectEvents.parameters_().__len__()!=0: 00997 output.SelectEvents = stream.selectEvents 00998 else: 00999 output.SelectEvents = cms.untracked.PSet() 01000 output.SelectEvents.SelectEvents=cms.vstring() 01001 if isinstance(stream.paths,tuple): 01002 for path in stream.paths: 01003 output.SelectEvents.SelectEvents.append(path.label()) 01004 else: 01005 output.SelectEvents.SelectEvents.append(stream.paths.label()) 01006 01007 01008 01009 if isinstance(stream.content,str): 01010 evtPset=getattr(self.process,stream.content) 01011 for p in evtPset.parameters_(): 01012 setattr(output,p,getattr(evtPset,p)) 01013 if not self._options.inlineEventContent: 01014 def doNotInlineEventContent(instance,label = "process."+stream.content+".outputCommands"): 01015 return label 01016 output.outputCommands.__dict__["dumpPython"] = doNotInlineEventContent 01017 else: 01018 output.outputCommands = stream.content 01019 01020 01021 output.fileName = cms.untracked.string(self._options.dirout+stream.name+'.root') 01022 01023 output.dataset = cms.untracked.PSet( dataTier = stream.dataTier, 01024 filterName = cms.untracked.string(stream.name)) 01025 01026 if self._options.filtername: 01027 output.dataset.filterName= cms.untracked.string(self._options.filtername+"_"+stream.name) 01028 01029 #add an automatic flushing to limit memory consumption 01030 output.eventAutoFlushCompressedSize=cms.untracked.int32(5*1024*1024) 01031 01032 if workflow in ("producers,full"): 01033 if isinstance(stream.paths,tuple): 01034 for path in stream.paths: 01035 self.schedule.append(path) 01036 else: 01037 self.schedule.append(stream.paths) 01038 01039 01040 # in case of relvals we don't want to have additional outputs 01041 if (not self._options.relval) and workflow in ("full","output"): 01042 self.additionalOutputs[name] = output 01043 setattr(self.process,name,output) 01044 01045 if workflow == 'output': 01046 # adjust the select events to the proper trigger results from previous process 01047 filterList = output.SelectEvents.SelectEvents 01048 for i, filter in enumerate(filterList): 01049 filterList[i] = filter+":"+self._options.triggerResultsProcess 01050 01051 return output
def ConfigBuilder::ConfigBuilder::addMaxEvents | ( | self | ) |
Here we decide how many evts will be processed
Definition at line 299 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::addOutput | ( | self | ) |
Add output module to the process
Definition at line 420 of file ConfigBuilder.py.
00421 : 00422 """ Add output module to the process """ 00423 result="" 00424 if self._options.outputDefinition: 00425 if self._options.datatier: 00426 print "--datatier & --eventcontent options ignored" 00427 00428 def anyOf(listOfKeys,dict,opt=None): 00429 for k in listOfKeys: 00430 if k in dict: 00431 toReturn=dict[k] 00432 dict.pop(k) 00433 return toReturn 00434 if opt!=None: 00435 return opt 00436 else: 00437 raise Exception("any of "+','.join(listOfKeys)+" are mandatory entries of --output options") 00438 00439 #new output convention with a list of dict 00440 outList = eval(self._options.outputDefinition) 00441 for (id,outDefDict) in enumerate(outList): 00442 outDefDictStr=outDefDict.__str__() 00443 if not isinstance(outDefDict,dict): 00444 raise Exception("--output needs to be passed a list of dict"+self._options.outputDefinition+" is invalid") 00445 #requires option: tier 00446 theTier=anyOf(['t','tier','dataTier'],outDefDict) 00447 #optional option: eventcontent, filtername, selectEvents, moduleLabel, filename 00448 ## event content 00449 theStreamType=anyOf(['e','ec','eventContent','streamType'],outDefDict,theTier) 00450 theFilterName=anyOf(['f','ftN','filterName'],outDefDict,'') 00451 theSelectEvent=anyOf(['s','sE','selectEvents'],outDefDict,'') 00452 theModuleLabel=anyOf(['l','mL','moduleLabel'],outDefDict,'') 00453 theExtraOutputCommands=anyOf(['o','oC','outputCommands'],outDefDict,'') 00454 # module label has a particular role 00455 if not theModuleLabel: 00456 tryNames=[theStreamType.replace(theTier.replace('-',''),'')+theTier.replace('-','')+'output', 00457 theStreamType.replace(theTier.replace('-',''),'')+theTier.replace('-','')+theFilterName+'output', 00458 theStreamType.replace(theTier.replace('-',''),'')+theTier.replace('-','')+theFilterName+theSelectEvent.split(',')[0].replace(':','for').replace(' ','')+'output' 00459 ] 00460 for name in tryNames: 00461 if not hasattr(self.process,name): 00462 theModuleLabel=name 00463 break 00464 if not theModuleLabel: 00465 raise Exception("cannot find a module label for specification: "+outDefDictStr) 00466 if id==0: 00467 defaultFileName=self._options.outfile_name 00468 else: 00469 defaultFileName=self._options.outfile_name.replace('.root','_in'+theTier+'.root') 00470 00471 theFileName=self._options.dirout+anyOf(['fn','fileName'],outDefDict,defaultFileName) 00472 if not theFileName.endswith('.root'): 00473 theFileName+='.root' 00474 00475 if len(outDefDict.keys()): 00476 raise Exception("unused keys from --output options: "+','.join(outDefDict.keys())) 00477 if theStreamType=='DQMROOT': theStreamType='DQM' 00478 if theStreamType=='ALL': 00479 theEventContent = cms.PSet(outputCommands = cms.untracked.vstring('keep *')) 00480 else: 00481 theEventContent = getattr(self.process, theStreamType+"EventContent") 00482 00483 if theStreamType=='ALCARECO' and not theFilterName: 00484 theFilterName='StreamALCACombined' 00485 00486 CppType='PoolOutputModule' 00487 if theStreamType=='DQM' and theTier=='DQMROOT': CppType='DQMRootOutputModule' 00488 output = cms.OutputModule(CppType, 00489 theEventContent.clone(), 00490 fileName = cms.untracked.string(theFileName), 00491 dataset = cms.untracked.PSet( 00492 dataTier = cms.untracked.string(theTier), 00493 filterName = cms.untracked.string(theFilterName)) 00494 ) 00495 if not theSelectEvent and hasattr(self.process,'generation_step'): 00496 output.SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring('generation_step')) 00497 if theSelectEvent: 00498 output.SelectEvents =cms.untracked.PSet(SelectEvents = cms.vstring(theSelectEvent)) 00499 00500 if hasattr(self.process,theModuleLabel): 00501 raise Exception("the current process already has a module "+theModuleLabel+" defined") 00502 #print "creating output module ",theModuleLabel 00503 setattr(self.process,theModuleLabel,output) 00504 outputModule=getattr(self.process,theModuleLabel) 00505 setattr(self.process,theModuleLabel+'_step',cms.EndPath(outputModule)) 00506 path=getattr(self.process,theModuleLabel+'_step') 00507 self.schedule.append(path) 00508 00509 if not self._options.inlineEventContent and hasattr(self.process,theStreamType+"EventContent"): 00510 def doNotInlineEventContent(instance,label = "cms.untracked.vstring(process."+theStreamType+"EventContent.outputCommands)"): 00511 return label 00512 outputModule.outputCommands.__dict__["dumpPython"] = doNotInlineEventContent 00513 if theExtraOutputCommands: 00514 if not isinstance(theExtraOutputCommands,list): 00515 raise Exception("extra ouput command in --option must be a list of strings") 00516 if hasattr(self.process,theStreamType+"EventContent"): 00517 self.executeAndRemember('process.%s.outputCommands.extend(%s)'%(theModuleLabel,theExtraOutputCommands)) 00518 else: 00519 outputModule.outputCommands.extend(theExtraOutputCommands) 00520 00521 result+="\nprocess."+theModuleLabel+" = "+outputModule.dumpPython() 00522 00523 ##ends the --output options model 00524 return result 00525 00526 streamTypes=self._options.eventcontent.split(',') 00527 tiers=self._options.datatier.split(',') 00528 if not self._options.outputDefinition and len(streamTypes)!=len(tiers): 00529 raise Exception("number of event content arguments does not match number of datatier arguments") 00530 00531 # if the only step is alca we don't need to put in an output 00532 if self._options.step.split(',')[0].split(':')[0] == 'ALCA': 00533 return "\n" 00534 00535 for i,(streamType,tier) in enumerate(zip(streamTypes,tiers)): 00536 if streamType=='': continue 00537 if streamType=='DQMROOT': streamType='DQM' 00538 theEventContent = getattr(self.process, streamType+"EventContent") 00539 if i==0: 00540 theFileName=self._options.outfile_name 00541 theFilterName=self._options.filtername 00542 else: 00543 theFileName=self._options.outfile_name.replace('.root','_in'+streamType+'.root') 00544 theFilterName=self._options.filtername 00545 CppType='PoolOutputModule' 00546 if streamType=='DQM' and tier=='DQMROOT': CppType='DQMRootOutputModule' 00547 output = cms.OutputModule(CppType, 00548 theEventContent, 00549 fileName = cms.untracked.string(theFileName), 00550 dataset = cms.untracked.PSet(dataTier = cms.untracked.string(tier), 00551 filterName = cms.untracked.string(theFilterName) 00552 ) 00553 ) 00554 if hasattr(self.process,"generation_step"): 00555 output.SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring('generation_step')) 00556 00557 if streamType=='ALCARECO': 00558 output.dataset.filterName = cms.untracked.string('StreamALCACombined') 00559 00560 outputModuleName=streamType+'output' 00561 setattr(self.process,outputModuleName,output) 00562 outputModule=getattr(self.process,outputModuleName) 00563 setattr(self.process,outputModuleName+'_step',cms.EndPath(outputModule)) 00564 path=getattr(self.process,outputModuleName+'_step') 00565 self.schedule.append(path) 00566 00567 if not self._options.inlineEventContent: 00568 def doNotInlineEventContent(instance,label = "process."+streamType+"EventContent.outputCommands"): 00569 return label 00570 outputModule.outputCommands.__dict__["dumpPython"] = doNotInlineEventContent 00571 00572 result+="\nprocess."+outputModuleName+" = "+outputModule.dumpPython() 00573 00574 return result
def ConfigBuilder::ConfigBuilder::addSource | ( | self | ) |
Here the source is built. Priority: file, generator
Definition at line 304 of file ConfigBuilder.py.
00305 : 00306 """Here the source is built. Priority: file, generator""" 00307 self.addedObjects.append(("Input source","source")) 00308 00309 def filesFromOption(self): 00310 for entry in self._options.filein.split(','): 00311 print "entry",entry 00312 if entry.startswith("filelist:"): 00313 filesFromList(entry[9:],self.process.source) 00314 elif entry.startswith("dbs:"): 00315 filesFromDBSQuery('find file where dataset = %s'%(entry[4:]),self.process.source) 00316 else: 00317 self.process.source.fileNames.append(self._options.dirin+entry) 00318 if self._options.secondfilein: 00319 if not hasattr(self.process.source,"secondaryFileNames"): 00320 raise Exception("--secondfilein not compatible with "+self._options.filetype+"input type") 00321 for entry in self._options.secondfilein.split(','): 00322 print "entry",entry 00323 if entry.startswith("filelist:"): 00324 self.process.source.secondaryFileNames.extend((filesFromList(entry[9:]))[0]) 00325 elif entry.startswith("dbs:"): 00326 self.process.source.secondaryFileNames.extend((filesFromDBSQuery('find file where dataset = %s'%(entry[4:])))[0]) 00327 else: 00328 self.process.source.secondaryFileNames.append(self._options.dirin+entry) 00329 00330 if self._options.filein: 00331 if self._options.filetype == "EDM": 00332 self.process.source=cms.Source("PoolSource", 00333 fileNames = cms.untracked.vstring(), 00334 secondaryFileNames= cms.untracked.vstring()) 00335 filesFromOption(self) 00336 elif self._options.filetype == "DAT": 00337 self.process.source=cms.Source("NewEventStreamFileReader",fileNames = cms.untracked.vstring()) 00338 filesFromOption(self) 00339 elif self._options.filetype == "LHE": 00340 self.process.source=cms.Source("LHESource", fileNames = cms.untracked.vstring()) 00341 if self._options.filein.startswith("lhe:"): 00342 #list the article directory automatically 00343 args=self._options.filein.split(':') 00344 article=args[1] 00345 print 'LHE input from article ',article 00346 location='/store/lhe/' 00347 import os 00348 textOfFiles=os.popen('cmsLHEtoEOSManager.py -l '+article) 00349 for line in textOfFiles: 00350 for fileName in [x for x in line.split() if '.lhe' in x]: 00351 self.process.source.fileNames.append(location+article+'/'+fileName) 00352 if len(args)>2: 00353 self.process.source.skipEvents = cms.untracked.uint32(int(args[2])) 00354 else: 00355 filesFromOption(self) 00356 00357 00358 elif self._options.filetype == "DQM": 00359 self.process.source=cms.Source("DQMRootSource", 00360 fileNames = cms.untracked.vstring()) 00361 filesFromOption(self) 00362 00363 if ('HARVESTING' in self.stepMap.keys() or 'ALCAHARVEST' in self.stepMap.keys()) and (not self._options.filetype == "DQM"): 00364 self.process.source.processingMode = cms.untracked.string("RunsAndLumis") 00365 00366 if self._options.dbsquery!='': 00367 self.process.source=cms.Source("PoolSource", fileNames = cms.untracked.vstring(),secondaryFileNames = cms.untracked.vstring()) 00368 filesFromDBSQuery(self._options.dbsquery,self.process.source) 00369 00370 if self._options.inputEventContent: 00371 import copy 00372 def dropSecondDropStar(iec): 00373 #drop occurence of 'drop *' in the list 00374 count=0 00375 for item in iec: 00376 if item=='drop *': 00377 if count!=0: 00378 iec.remove(item) 00379 count+=1 00380 00381 00382 ## allow comma separated input eventcontent 00383 if not hasattr(self.process.source,'inputCommands'): self.process.source.inputCommands=cms.untracked.vstring() 00384 for evct in self._options.inputEventContent.split(','): 00385 if evct=='': continue 00386 theEventContent = getattr(self.process, evct+"EventContent") 00387 if hasattr(theEventContent,'outputCommands'): 00388 self.process.source.inputCommands.extend(copy.copy(theEventContent.outputCommands)) 00389 if hasattr(theEventContent,'inputCommands'): 00390 self.process.source.inputCommands.extend(copy.copy(theEventContent.inputCommands)) 00391 00392 dropSecondDropStar(self.process.source.inputCommands) 00393 00394 if not self._options.dropDescendant: 00395 self.process.source.dropDescendantsOfDroppedBranches = cms.untracked.bool(False) 00396 00397 if self._options.inputCommands: 00398 if not hasattr(self.process.source,'inputCommands'): self.process.source.inputCommands=cms.untracked.vstring() 00399 for command in self._options.inputCommands.split(','): 00400 # remove whitespace around the keep/drop statements 00401 command = command.strip() 00402 if command=='': continue 00403 self.process.source.inputCommands.append(command) 00404 if not self._options.dropDescendant: 00405 self.process.source.dropDescendantsOfDroppedBranches = cms.untracked.bool(False) 00406 00407 if self._options.lumiToProcess: 00408 import FWCore.PythonUtilities.LumiList as LumiList 00409 self.process.source.lumisToProcess = cms.untracked.VLuminosityBlockRange( LumiList.LumiList(self._options.lumiToProcess).getCMSSWString().split(',') ) 00410 00411 if 'GEN' in self.stepMap or 'LHE' in self.stepMap or (not self._options.filein and hasattr(self._options, "evt_type")): 00412 if self.process.source is None: 00413 self.process.source=cms.Source("EmptySource") 00414 # if option himix is active, drop possibly duplicate DIGI-RAW info: 00415 if self._options.himix==True: 00416 self.process.source.inputCommands = cms.untracked.vstring('drop *','keep *_generator_*_*','keep *_g4SimHits_*_*') 00417 self.process.source.dropDescendantsOfDroppedBranches=cms.untracked.bool(False) 00418 00419 return
def ConfigBuilder::ConfigBuilder::addStandardSequences | ( | self | ) |
Add selected standard sequences to the process
Definition at line 575 of file ConfigBuilder.py.
00576 : 00577 """ 00578 Add selected standard sequences to the process 00579 """ 00580 # load the pile up file 00581 if self._options.pileup: 00582 pileupSpec=self._options.pileup.split(',')[0] 00583 from Configuration.StandardSequences.Mixing import Mixing,defineMixing 00584 if not pileupSpec in Mixing and '.' not in pileupSpec and 'file:' not in pileupSpec: 00585 raise Exception(pileupSpec+' is not a know mixing scenario:\n available are: '+'\n'.join(Mixing.keys())) 00586 if '.' in pileupSpec: 00587 mixingDict={'file':pileupSpec} 00588 elif pileupSpec.startswith('file:'): 00589 mixingDict={'file':pileupSpec[5:]} 00590 else: 00591 import copy 00592 mixingDict=copy.copy(Mixing[pileupSpec]) 00593 if len(self._options.pileup.split(','))>1: 00594 mixingDict.update(eval(self._options.pileup[self._options.pileup.find(',')+1:])) 00595 if 'file:' in pileupSpec: 00596 #the file is local 00597 self.process.load(mixingDict['file']) 00598 print "inlining mixing module configuration" 00599 self._options.inlineObjets+=',mix' 00600 else: 00601 self.loadAndRemember(mixingDict['file']) 00602 00603 mixingDict.pop('file') 00604 if self._options.pileup_input: 00605 if self._options.pileup_input.startswith('dbs'): 00606 mixingDict['F']=filesFromDBSQuery('find file where dataset = %s'%(self._options.pileup_input[4:],))[0] 00607 else: 00608 mixingDict['F']=self._options.pileup_input.split(',') 00609 specialization=defineMixing(mixingDict,'FASTSIM' in self.stepMap) 00610 for command in specialization: 00611 self.executeAndRemember(command) 00612 if len(mixingDict)!=0: 00613 raise Exception('unused mixing specification: '+mixingDict.keys().__str__()) 00614 00615 00616 # load the geometry file 00617 try: 00618 if len(self.stepMap): 00619 self.loadAndRemember(self.GeometryCFF) 00620 if 'SIM' in self.stepMap or 'reSIM' in self.stepMap: 00621 self.loadAndRemember(self.SimGeometryCFF) 00622 if self.geometryDBLabel: 00623 self.executeAndRemember('process.XMLFromDBSource.label = cms.string("%s")'%(self.geometryDBLabel)) 00624 except ImportError: 00625 print "Geometry option",self._options.geometry,"unknown." 00626 raise 00627 00628 if len(self.stepMap): 00629 self.loadAndRemember(self.magFieldCFF) 00630 00631 # what steps are provided by this class? 00632 stepList = [re.sub(r'^prepare_', '', methodName) for methodName in ConfigBuilder.__dict__ if methodName.startswith('prepare_')] 00633 00634 ### Benedikt can we add here a check that assure that we are going to generate a correct config file? 00635 ### i.e. the harvesting do not have to include other step...... 00636 00637 # look which steps are requested and invoke the corresponding method 00638 for step in self._options.step.split(","): 00639 if step == "": 00640 continue 00641 print step 00642 if step.startswith('re'): 00643 ##add the corresponding input content 00644 if step[2:] not in self._options.donotDropOnInput: 00645 self._options.inputEventContent='%s,%s'%(step.split(":")[0].upper(),self._options.inputEventContent) 00646 step=step[2:] 00647 stepParts = step.split(":") # for format STEP:alternativeSequence 00648 stepName = stepParts[0] 00649 if stepName not in stepList: 00650 raise ValueError("Step "+stepName+" unknown") 00651 if len(stepParts)==1: 00652 getattr(self,"prepare_"+step)(sequence = getattr(self,step+"DefaultSeq")) 00653 elif len(stepParts)==2: 00654 getattr(self,"prepare_"+stepName)(sequence = stepParts[1]) 00655 elif len(stepParts)==3: 00656 getattr(self,"prepare_"+stepName)(sequence = stepParts[1]+','+stepParts[2]) 00657 00658 else: 00659 raise ValueError("Step definition "+step+" invalid") 00660 00661 if self._options.restoreRNDSeeds!=False: 00662 #it is either True, or a process name 00663 if self._options.restoreRNDSeeds==True: 00664 self.executeAndRemember('process.RandomNumberGeneratorService.restoreStateLabel=cms.untracked.string("randomEngineStateProducer")') 00665 else: 00666 self.executeAndRemember('process.RandomNumberGeneratorService.restoreStateTag=cms.untracked.InputTag("randomEngineStateProducer","","%s")'%(self._options.restoreRNDSeeds)) 00667 if self._options.inputEventContent or self._options.inputCommands: 00668 if self._options.inputCommands: 00669 self._options.inputCommands+='keep *_randomEngineStateProducer_*_*,' 00670 else: 00671 self._options.inputCommands='keep *_randomEngineStateProducer_*_*,' 00672
def ConfigBuilder::ConfigBuilder::build_production_info | ( | self, | |
evt_type, | |||
evtnumber | |||
) |
Add useful info for the production.
Definition at line 1752 of file ConfigBuilder.py.
01753 : 01754 """ Add useful info for the production. """ 01755 self.process.configurationMetadata=cms.untracked.PSet\ 01756 (version=cms.untracked.string("$Revision: 1.381.2.13 $"), 01757 name=cms.untracked.string("PyReleaseValidation"), 01758 annotation=cms.untracked.string(evt_type+ " nevts:"+str(evtnumber)) 01759 ) 01760 01761 self.addedObjects.append(("Production Info","configurationMetadata")) 01762
def ConfigBuilder::ConfigBuilder::define_Configs | ( | self | ) |
Definition at line 770 of file ConfigBuilder.py.
00771 : 00772 if len(self.stepMap): 00773 self.loadAndRemember('Configuration/StandardSequences/Services_cff') 00774 if self._options.particleTable not in defaultOptions.particleTableList: 00775 print 'Invalid particle table provided. Options are:' 00776 print defaultOptions.particleTable 00777 sys.exit(-1) 00778 else: 00779 if len(self.stepMap): 00780 self.loadAndRemember('SimGeneral.HepPDTESSource.'+self._options.particleTable+'_cfi') 00781 00782 self.loadAndRemember('FWCore/MessageService/MessageLogger_cfi') 00783 00784 self.ALCADefaultCFF="Configuration/StandardSequences/AlCaRecoStreams_cff" 00785 self.GENDefaultCFF="Configuration/StandardSequences/Generator_cff" 00786 self.SIMDefaultCFF="Configuration/StandardSequences/Sim_cff" 00787 self.DIGIDefaultCFF="Configuration/StandardSequences/Digi_cff" 00788 self.DIGI2RAWDefaultCFF="Configuration/StandardSequences/DigiToRaw_cff" 00789 self.L1EMDefaultCFF='Configuration/StandardSequences/SimL1Emulator_cff' 00790 self.L1MENUDefaultCFF="Configuration/StandardSequences/L1TriggerDefaultMenu_cff" 00791 self.HLTDefaultCFF="Configuration/StandardSequences/HLTtable_cff" 00792 self.RAW2DIGIDefaultCFF="Configuration/StandardSequences/RawToDigi_Data_cff" 00793 self.L1RecoDefaultCFF="Configuration/StandardSequences/L1Reco_cff" 00794 self.RECODefaultCFF="Configuration/StandardSequences/Reconstruction_Data_cff" 00795 self.SKIMDefaultCFF="Configuration/StandardSequences/Skims_cff" 00796 self.POSTRECODefaultCFF="Configuration/StandardSequences/PostRecoGenerator_cff" 00797 self.VALIDATIONDefaultCFF="Configuration/StandardSequences/Validation_cff" 00798 self.L1HwValDefaultCFF = "Configuration/StandardSequences/L1HwVal_cff" 00799 self.DQMOFFLINEDefaultCFF="DQMOffline/Configuration/DQMOffline_cff" 00800 self.HARVESTINGDefaultCFF="Configuration/StandardSequences/Harvesting_cff" 00801 self.ALCAHARVESTDefaultCFF="Configuration/StandardSequences/AlCaHarvesting_cff" 00802 self.ENDJOBDefaultCFF="Configuration/StandardSequences/EndOfProcess_cff" 00803 self.ConditionsDefaultCFF = "Configuration/StandardSequences/FrontierConditions_GlobalTag_cff" 00804 self.CFWRITERDefaultCFF = "Configuration/StandardSequences/CrossingFrameWriter_cff" 00805 self.REPACKDefaultCFF="Configuration/StandardSequences/DigiToRaw_Repack_cff" 00806 00807 if "DATAMIX" in self.stepMap.keys(): 00808 self.DATAMIXDefaultCFF="Configuration/StandardSequences/DataMixer"+self._options.datamix+"_cff" 00809 self.DIGIDefaultCFF="Configuration/StandardSequences/DigiDM_cff" 00810 self.DIGI2RAWDefaultCFF="Configuration/StandardSequences/DigiToRawDM_cff" 00811 self.L1EMDefaultCFF='Configuration/StandardSequences/SimL1EmulatorDM_cff' 00812 00813 self.ALCADefaultSeq=None 00814 self.LHEDefaultSeq='externalLHEProducer' 00815 self.GENDefaultSeq='pgen' 00816 self.SIMDefaultSeq=None 00817 self.DIGIDefaultSeq='pdigi' 00818 self.DATAMIXDefaultSeq=None 00819 self.DIGI2RAWDefaultSeq='DigiToRaw' 00820 self.HLTDefaultSeq='GRun' 00821 self.L1DefaultSeq=None 00822 self.L1REPACKDefaultSeq='GT' 00823 self.HARVESTINGDefaultSeq=None 00824 self.ALCAHARVESTDefaultSeq=None 00825 self.CFWRITERDefaultSeq=None 00826 self.RAW2DIGIDefaultSeq='RawToDigi' 00827 self.L1RecoDefaultSeq='L1Reco' 00828 if 'RAW2DIGI' in self.stepMap and 'RECO' in self.stepMap: 00829 self.RECODefaultSeq='reconstruction' 00830 else: 00831 self.RECODefaultSeq='reconstruction_fromRECO' 00832 00833 self.POSTRECODefaultSeq=None 00834 self.L1HwValDefaultSeq='L1HwVal' 00835 self.DQMDefaultSeq='DQMOffline' 00836 self.FASTSIMDefaultSeq='all' 00837 self.VALIDATIONDefaultSeq='' 00838 self.PATLayer0DefaultSeq='all' 00839 self.ENDJOBDefaultSeq='endOfProcess' 00840 self.REPACKDefaultSeq='DigiToRawRepack' 00841 00842 self.EVTCONTDefaultCFF="Configuration/EventContent/EventContent_cff" 00843 00844 # if fastsim switch event content 00845 if "FASTSIM" in self.stepMap.keys(): 00846 self.GENDefaultSeq='pgen_genonly' 00847 self.EVTCONTDefaultCFF = "FastSimulation/Configuration/EventContent_cff" 00848 self.VALIDATIONDefaultCFF = "FastSimulation.Configuration.Validation_cff" 00849 00850 if not self._options.beamspot: 00851 self._options.beamspot=VtxSmearedDefaultKey 00852 00853 # if its MC then change the raw2digi 00854 if self._options.isMC==True: 00855 self.RAW2DIGIDefaultCFF="Configuration/StandardSequences/RawToDigi_cff" 00856 self.RECODefaultCFF="Configuration/StandardSequences/Reconstruction_cff" 00857 self.DQMOFFLINEDefaultCFF="DQMOffline/Configuration/DQMOfflineMC_cff" 00858 self.ALCADefaultCFF="Configuration/StandardSequences/AlCaRecoStreamsMC_cff" 00859 else: 00860 self._options.beamspot = None 00861 00862 #patch for gen, due to backward incompatibility 00863 if 'reGEN' in self.stepMap: 00864 self.GENDefaultSeq='fixGenInfo' 00865 00866 if self._options.scenario=='nocoll' or self._options.scenario=='cosmics': 00867 self.SIMDefaultCFF="Configuration/StandardSequences/SimNOBEAM_cff" 00868 self._options.beamspot='NoSmear' 00869 00870 if self._options.scenario=='cosmics': 00871 self.DIGIDefaultCFF="Configuration/StandardSequences/DigiCosmics_cff" 00872 self.RECODefaultCFF="Configuration/StandardSequences/ReconstructionCosmics_cff" 00873 self.SKIMDefaultCFF="Configuration/StandardSequences/SkimsCosmics_cff" 00874 self.EVTCONTDefaultCFF="Configuration/EventContent/EventContentCosmics_cff" 00875 self.DQMOFFLINEDefaultCFF="DQMOffline/Configuration/DQMOfflineCosmics_cff" 00876 if self._options.isMC==True: 00877 self.DQMOFFLINEDefaultCFF="DQMOffline/Configuration/DQMOfflineCosmicsMC_cff" 00878 self.HARVESTINGDefaultCFF="Configuration/StandardSequences/HarvestingCosmics_cff" 00879 self.RECODefaultSeq='reconstructionCosmics' 00880 self.DQMDefaultSeq='DQMOfflineCosmics' 00881 00882 if self._options.himix: 00883 print "From the presence of the himix option, we have determined that this is heavy ions and will use '--scenario HeavyIons'." 00884 self._options.scenario='HeavyIons' 00885 00886 if self._options.scenario=='HeavyIons': 00887 if not self._options.beamspot: 00888 self._options.beamspot=VtxSmearedHIDefaultKey 00889 self.HLTDefaultSeq = 'HIon' 00890 if not self._options.himix: 00891 self.GENDefaultSeq='pgen_hi' 00892 else: 00893 self.GENDefaultSeq='pgen_himix' 00894 self.VALIDATIONDefaultCFF="Configuration/StandardSequences/ValidationHeavyIons_cff" 00895 self.VALIDATIONDefaultSeq='' 00896 self.EVTCONTDefaultCFF="Configuration/EventContent/EventContentHeavyIons_cff" 00897 self.RECODefaultCFF="Configuration/StandardSequences/ReconstructionHeavyIons_cff" 00898 self.RECODefaultSeq='reconstructionHeavyIons' 00899 self.ALCADefaultCFF = "Configuration/StandardSequences/AlCaRecoStreamsHeavyIons_cff" 00900 self.DQMOFFLINEDefaultCFF="DQMOffline/Configuration/DQMOfflineHeavyIons_cff" 00901 self.DQMDefaultSeq='DQMOfflineHeavyIons' 00902 self.SKIMDefaultCFF="Configuration/StandardSequences/SkimsHeavyIons_cff" 00903 self.HARVESTINGDefaultCFF="Configuration/StandardSequences/HarvestingHeavyIons_cff" 00904 if self._options.isMC==True: 00905 self.DQMOFFLINEDefaultCFF="DQMOffline/Configuration/DQMOfflineHeavyIonsMC_cff" 00906 00907 00908 self.RAW2RECODefaultSeq=','.join([self.RAW2DIGIDefaultSeq,self.RECODefaultSeq]) 00909 00910 self.USERDefaultSeq='user' 00911 self.USERDefaultCFF=None 00912 00913 # the magnetic field 00914 if self._options.isData: 00915 if self._options.magField==defaultOptions.magField: 00916 print "magnetic field option forced to: AutoFromDBCurrent" 00917 self._options.magField='AutoFromDBCurrent' 00918 self.magFieldCFF = 'Configuration/StandardSequences/MagneticField_'+self._options.magField.replace('.','')+'_cff' 00919 self.magFieldCFF = self.magFieldCFF.replace("__",'_') 00920 00921 # the geometry 00922 self.GeometryCFF='Configuration/StandardSequences/GeometryRecoDB_cff' 00923 self.geometryDBLabel=None 00924 simGeometry='' 00925 if 'FASTSIM' in self.stepMap: 00926 if 'start' in self._options.conditions.lower(): 00927 self.GeometryCFF='FastSimulation/Configuration/Geometries_START_cff' 00928 else: 00929 self.GeometryCFF='FastSimulation/Configuration/Geometries_MC_cff' 00930 else: 00931 def inGeometryKeys(opt): 00932 from Configuration.StandardSequences.GeometryConf import GeometryConf 00933 if opt in GeometryConf: 00934 return GeometryConf[opt] 00935 else: 00936 return opt 00937 00938 geoms=self._options.geometry.split(',') 00939 if len(geoms)==1: geoms=inGeometryKeys(geoms[0]).split(',') 00940 if len(geoms)==2: 00941 #may specify the reco geometry 00942 if '/' in geoms[1] or '_cff' in geoms[1]: 00943 self.GeometryCFF=geoms[1] 00944 else: 00945 self.GeometryCFF='Configuration/StandardSequences/Geometry'+geoms[1]+'_cff' 00946 00947 if (geoms[0].startswith('DB:')): 00948 self.SimGeometryCFF='Configuration/StandardSequences/GeometrySimDB_cff' 00949 self.geometryDBLabel=geoms[0][3:] 00950 print "with DB:" 00951 else: 00952 if '/' in geoms[0] or '_cff' in geoms[0]: 00953 self.SimGeometryCFF=geoms[0] 00954 else: 00955 simGeometry=geoms[0] 00956 if self._options.gflash==True: 00957 self.SimGeometryCFF='Configuration/StandardSequences/Geometry'+geoms[0]+'GFlash_cff' 00958 else: 00959 self.SimGeometryCFF='Configuration/StandardSequences/Geometry'+geoms[0]+'_cff' 00960 00961 # synchronize the geometry configuration and the FullSimulation sequence to be used 00962 if simGeometry not in defaultOptions.geometryExtendedOptions: 00963 self.SIMDefaultCFF="Configuration/StandardSequences/SimIdeal_cff" 00964 00965 # Mixing 00966 if self._options.pileup=='default': 00967 from Configuration.StandardSequences.Mixing import MixingDefaultKey,MixingFSDefaultKey 00968 if 'FASTSIM' in self.stepMap: 00969 self._options.pileup=MixingFSDefaultKey 00970 else: 00971 self._options.pileup=MixingDefaultKey 00972 00973 #not driven by a default cff anymore 00974 if self._options.isData: 00975 self._options.pileup=None 00976 if self._options.isMC==True and self._options.himix==False: 00977 if 'FASTSIM' in self.stepMap: 00978 self._options.pileup='FS_'+self._options.pileup 00979 elif self._options.isMC==True and self._options.himix==True: 00980 self._options.pileup='HiMix' 00981 00982 00983 if self._options.slhc: 00984 if 'stdgeom' not in self._options.slhc: 00985 self.SimGeometryCFF='SLHCUpgradeSimulations.Geometry.%s_cmsSimIdealGeometryXML_cff'%(self._options.slhc,) 00986 self.DIGIDefaultCFF='SLHCUpgradeSimulations/Geometry/Digi_%s_cff'%(self._options.slhc,) 00987 if self._options.pileup!=defaultOptions.pileup: 00988 self._options.pileup='SLHC_%s_%s'%(self._options.pileup,self._options.slhc) 00989 00990 self.REDIGIDefaultSeq=self.DIGIDefaultSeq
def ConfigBuilder::ConfigBuilder::executeAndRemember | ( | self, | |
command | |||
) |
helper routine to remember replace statements
Definition at line 264 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::expandMapping | ( | self, | |
seqList, | |||
mapping, | |||
index = None |
|||
) |
Definition at line 1592 of file ConfigBuilder.py.
01593 : 01594 maxLevel=20 01595 level=0 01596 while '@' in repr(seqList) and level<maxLevel: 01597 level+=1 01598 for specifiedCommand in seqList: 01599 if specifiedCommand.startswith('@'): 01600 location=specifiedCommand[1:] 01601 if not location in mapping: 01602 raise Exception("Impossible to map "+location+" from "+repr(mapping)) 01603 mappedTo=mapping[location] 01604 if index!=None: 01605 mappedTo=mappedTo[index] 01606 seqList.remove(specifiedCommand) 01607 seqList.extend(mappedTo.split('+')) 01608 break; 01609 if level==maxLevel: 01610 raise Exception("Could not fully expand "+repr(seqList)+" from "+repr(mapping))
def ConfigBuilder::ConfigBuilder::finalizeFastSimHLT | ( | self | ) |
Definition at line 1703 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::loadAndRemember | ( | self, | |
includeFile | |||
) |
helper routine to load am memorize imports
Definition at line 255 of file ConfigBuilder.py.
00256 : 00257 """helper routine to load am memorize imports""" 00258 # we could make the imports a on-the-fly data method of the process instance itself 00259 # not sure if the latter is a good idea 00260 includeFile = includeFile.replace('/','.') 00261 self.imports.append(includeFile) 00262 self.process.load(includeFile) 00263 return sys.modules[includeFile]
def ConfigBuilder::ConfigBuilder::loadDefaultOrSpecifiedCFF | ( | self, | |
sequence, | |||
defaultCFF | |||
) |
Definition at line 1057 of file ConfigBuilder.py.
01058 : 01059 if ( len(sequence.split('.'))==1 ): 01060 l=self.loadAndRemember(defaultCFF) 01061 elif ( len(sequence.split('.'))==2 ): 01062 l=self.loadAndRemember(sequence.split('.')[0]) 01063 sequence=sequence.split('.')[1] 01064 else: 01065 print "sub sequence configuration must be of the form dir/subdir/cff.a+b+c or cff.a" 01066 print sequence,"not recognized" 01067 raise 01068 return l
def ConfigBuilder::ConfigBuilder::prepare | ( | self, | |
doChecking = False |
|||
) |
Prepare the configuration string and add missing pieces.
Definition at line 1763 of file ConfigBuilder.py.
01764 : 01765 """ Prepare the configuration string and add missing pieces.""" 01766 01767 self.loadAndRemember(self.EVTCONTDefaultCFF) #load the event contents regardless 01768 self.addMaxEvents() 01769 self.addStandardSequences() 01770 if self.with_input: 01771 self.addSource() 01772 self.addConditions() 01773 01774 01775 outputModuleCfgCode="" 01776 if not 'HARVESTING' in self.stepMap.keys() and not 'SKIM' in self.stepMap.keys() and not 'ALCAHARVEST' in self.stepMap.keys() and not 'ALCAOUTPUT' in self.stepMap.keys() and self.with_output: 01777 outputModuleCfgCode=self.addOutput() 01778 01779 self.addCommon() 01780 01781 self.pythonCfgCode = "# Auto generated configuration file\n" 01782 self.pythonCfgCode += "# using: \n# "+__version__[1:-1]+"\n# "+__source__[1:-1]+'\n' 01783 self.pythonCfgCode += "# with command line options: "+self._options.arguments+'\n' 01784 self.pythonCfgCode += "import FWCore.ParameterSet.Config as cms\n\n" 01785 self.pythonCfgCode += "process = cms.Process('"+self.process.name_()+"')\n\n" 01786 01787 self.pythonCfgCode += "# import of standard configurations\n" 01788 for module in self.imports: 01789 self.pythonCfgCode += ("process.load('"+module+"')\n") 01790 01791 # production info 01792 if not hasattr(self.process,"configurationMetadata"): 01793 self.build_production_info(self._options.evt_type, self._options.number) 01794 else: 01795 #the PSet was added via a load 01796 self.addedObjects.append(("Production Info","configurationMetadata")) 01797 01798 self.pythonCfgCode +="\n" 01799 for comment,object in self.addedObjects: 01800 if comment!="": 01801 self.pythonCfgCode += "\n# "+comment+"\n" 01802 self.pythonCfgCode += dumpPython(self.process,object) 01803 01804 # dump the output definition 01805 self.pythonCfgCode += "\n# Output definition\n" 01806 self.pythonCfgCode += outputModuleCfgCode 01807 01808 # dump all additional outputs (e.g. alca or skim streams) 01809 self.pythonCfgCode += "\n# Additional output definition\n" 01810 #I do not understand why the keys are not normally ordered. 01811 nl=self.additionalOutputs.keys() 01812 nl.sort() 01813 for name in nl: 01814 output = self.additionalOutputs[name] 01815 self.pythonCfgCode += "process.%s = %s" %(name, output.dumpPython()) 01816 tmpOut = cms.EndPath(output) 01817 setattr(self.process,name+'OutPath',tmpOut) 01818 self.schedule.append(tmpOut) 01819 01820 # dump all additional commands 01821 self.pythonCfgCode += "\n# Other statements\n" 01822 for command in self.additionalCommands: 01823 self.pythonCfgCode += command + "\n" 01824 01825 #comma separated list of objects that deserve to be inlined in the configuration (typically from a modified config deep down) 01826 for object in self._options.inlineObjets.split(','): 01827 if not object: 01828 continue 01829 if not hasattr(self.process,object): 01830 print 'cannot inline -'+object+'- : not known' 01831 else: 01832 self.pythonCfgCode +='\n' 01833 self.pythonCfgCode +=dumpPython(self.process,object) 01834 01835 # dump all paths 01836 self.pythonCfgCode += "\n# Path and EndPath definitions\n" 01837 for path in self.process.paths: 01838 if getattr(self.process,path) not in self.blacklist_paths: 01839 self.pythonCfgCode += dumpPython(self.process,path) 01840 01841 for endpath in self.process.endpaths: 01842 if getattr(self.process,endpath) not in self.blacklist_paths: 01843 self.pythonCfgCode += dumpPython(self.process,endpath) 01844 01845 # dump the schedule 01846 self.pythonCfgCode += "\n# Schedule definition\n" 01847 result = "process.schedule = cms.Schedule(" 01848 01849 # handling of the schedule 01850 self.process.schedule = cms.Schedule() 01851 for item in self.schedule: 01852 if not isinstance(item, cms.Schedule): 01853 self.process.schedule.append(item) 01854 else: 01855 self.process.schedule.extend(item) 01856 01857 if hasattr(self.process,"HLTSchedule"): 01858 beforeHLT = self.schedule[:self.schedule.index(self.process.HLTSchedule)] 01859 afterHLT = self.schedule[self.schedule.index(self.process.HLTSchedule)+1:] 01860 pathNames = ['process.'+p.label_() for p in beforeHLT] 01861 result += ','.join(pathNames)+')\n' 01862 result += 'process.schedule.extend(process.HLTSchedule)\n' 01863 pathNames = ['process.'+p.label_() for p in afterHLT] 01864 result += 'process.schedule.extend(['+','.join(pathNames)+'])\n' 01865 else: 01866 pathNames = ['process.'+p.label_() for p in self.schedule] 01867 result ='process.schedule = cms.Schedule('+','.join(pathNames)+')\n' 01868 01869 self.pythonCfgCode += result 01870 01871 #repacked version 01872 if self._options.isRepacked: 01873 self.pythonCfgCode +="\n" 01874 self.pythonCfgCode +="from Configuration.PyReleaseValidation.ConfigBuilder import MassReplaceInputTag\n" 01875 self.pythonCfgCode +="MassReplaceInputTag(process)\n" 01876 MassReplaceInputTag(self.process) 01877 01878 # special treatment in case of production filter sequence 2/2 01879 if self.productionFilterSequence: 01880 self.pythonCfgCode +='# filter all path with the production filter sequence\n' 01881 self.pythonCfgCode +='for path in process.paths:\n' 01882 self.pythonCfgCode +='\tgetattr(process,path)._seq = process.%s * getattr(process,path)._seq \n'%(self.productionFilterSequence,) 01883 pfs = getattr(self.process,self.productionFilterSequence) 01884 for path in self.process.paths: 01885 getattr(self.process,path)._seq = pfs * getattr(self.process,path)._seq 01886 01887 # dump customise fragment 01888 self.pythonCfgCode += self.addCustomise() 01889 01890 # make the .io file 01891 01892 if self._options.io: 01893 #io=open(self._options.python_filename.replace('.py','.io'),'w') 01894 if not self._options.io.endswith('.io'): self._option.io+='.io' 01895 io=open(self._options.io,'w') 01896 ioJson={} 01897 if hasattr(self.process.source,"fileNames"): 01898 if len(self.process.source.fileNames.value()): 01899 ioJson['primary']=self.process.source.fileNames.value() 01900 if hasattr(self.process.source,"secondaryFileNames"): 01901 if len(self.process.source.secondaryFileNames.value()): 01902 ioJson['secondary']=self.process.source.secondaryFileNames.value() 01903 01904 for (o,om) in self.process.outputModules_().items(): 01905 ioJson[o]=om.fileName.value() 01906 #ioJson['GT']=self._options.conditions 01907 ioJson['GT']=self.process.GlobalTag.globaltag.value() 01908 import json 01909 io.write(json.dumps(ioJson)) 01910 return 01911 01912 01913
def ConfigBuilder::ConfigBuilder::prepare_ALCA | ( | self, | |
sequence = None , |
|||
workflow = 'full' |
|||
) |
Enrich the process with alca streams
Definition at line 1102 of file ConfigBuilder.py.
01103 : 01104 """ Enrich the process with alca streams """ 01105 alcaConfig=self.loadDefaultOrSpecifiedCFF(sequence,self.ALCADefaultCFF) 01106 sequence = sequence.split('.')[-1] 01107 01108 # decide which ALCA paths to use 01109 alcaList = sequence.split("+") 01110 maxLevel=0 01111 from Configuration.AlCa.autoAlca import autoAlca 01112 # support @X from autoAlca.py, and recursion support: i.e T0:@Mu+@EG+... 01113 self.expandMapping(alcaList,autoAlca) 01114 01115 for name in alcaConfig.__dict__: 01116 alcastream = getattr(alcaConfig,name) 01117 shortName = name.replace('ALCARECOStream','') 01118 if shortName in alcaList and isinstance(alcastream,cms.FilteredStream): 01119 output = self.addExtraStream(name,alcastream, workflow = workflow) 01120 if 'DQM' in alcaList: 01121 if not self._options.inlineEventContent and hasattr(self.process,name): 01122 self.executeAndRemember('process.' + name + '.outputCommands.append("keep *_MEtoEDMConverter_*_*")') 01123 else: 01124 output.outputCommands.append("keep *_MEtoEDMConverter_*_*") 01125 01126 #rename the HLT process name in the alca modules 01127 if self._options.hltProcess or 'HLT' in self.stepMap: 01128 if isinstance(alcastream.paths,tuple): 01129 for path in alcastream.paths: 01130 self.renameHLTprocessInSequence(path.label()) 01131 else: 01132 self.renameHLTprocessInSequence(alcastream.paths.label()) 01133 01134 for i in range(alcaList.count(shortName)): 01135 alcaList.remove(shortName) 01136 01137 # DQM needs a special handling 01138 elif name == 'pathALCARECODQM' and 'DQM' in alcaList: 01139 path = getattr(alcaConfig,name) 01140 self.schedule.append(path) 01141 alcaList.remove('DQM') 01142 01143 if isinstance(alcastream,cms.Path): 01144 #black list the alca path so that they do not appear in the cfg 01145 self.blacklist_paths.append(alcastream) 01146 01147 01148 if len(alcaList) != 0: 01149 available=[] 01150 for name in alcaConfig.__dict__: 01151 alcastream = getattr(alcaConfig,name) 01152 if isinstance(alcastream,cms.FilteredStream): 01153 available.append(name.replace('ALCARECOStream','')) 01154 print "The following alcas could not be found "+str(alcaList) 01155 print "available ",available 01156 #print "verify your configuration, ignoring for now" 01157 raise Exception("The following alcas could not be found "+str(alcaList))
def ConfigBuilder::ConfigBuilder::prepare_ALCAHARVEST | ( | self, | |
sequence = None |
|||
) |
Enrich the process with AlCaHarvesting step
Definition at line 1674 of file ConfigBuilder.py.
01675 : 01676 """ Enrich the process with AlCaHarvesting step """ 01677 harvestingConfig = self.loadAndRemember(self.ALCAHARVESTDefaultCFF) 01678 sequence=sequence.split(".")[-1] 01679 01680 # decide which AlcaHARVESTING paths to use 01681 harvestingList = sequence.split("+") 01682 for name in harvestingConfig.__dict__: 01683 harvestingstream = getattr(harvestingConfig,name) 01684 if name in harvestingList and isinstance(harvestingstream,cms.Path): 01685 self.schedule.append(harvestingstream) 01686 self.executeAndRemember("process.PoolDBOutputService.toPut.append(process.ALCAHARVEST" + name + "_dbOutput)") 01687 self.executeAndRemember("process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVEST" + name + "_metadata)") 01688 harvestingList.remove(name) 01689 # append the common part at the end of the sequence 01690 lastStep = getattr(harvestingConfig,"ALCAHARVESTDQMSaveAndMetadataWriter") 01691 self.schedule.append(lastStep) 01692 01693 if len(harvestingList) != 0 and 'dummyHarvesting' not in harvestingList : 01694 print "The following harvesting could not be found : ", harvestingList 01695 raise Exception("The following harvesting could not be found : "+str(harvestingList)) 01696 01697
def ConfigBuilder::ConfigBuilder::prepare_ALCAOUTPUT | ( | self, | |
sequence = None |
|||
) |
Definition at line 1099 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_ALCAPRODUCER | ( | self, | |
sequence = None |
|||
) |
Definition at line 1096 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_CFWRITER | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the crossing frame writer step
Definition at line 1277 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_DATAMIX | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the digitisation step
Definition at line 1283 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_DIGI | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the digitisation step
Definition at line 1264 of file ConfigBuilder.py.
01265 : 01266 """ Enrich the schedule with the digitisation step""" 01267 self.loadDefaultOrSpecifiedCFF(sequence,self.DIGIDefaultCFF) 01268 01269 if self._options.gflash==True: 01270 self.loadAndRemember("Configuration/StandardSequences/GFlashDIGI_cff") 01271 01272 if self._options.himix==True: 01273 self.loadAndRemember("SimGeneral/MixingModule/himixDIGI_cff") 01274 01275 self.scheduleSequence(sequence.split('.')[-1],'digitisation_step') 01276 return
def ConfigBuilder::ConfigBuilder::prepare_DIGI2RAW | ( | self, | |
sequence = None |
|||
) |
Definition at line 1289 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_DQM | ( | self, | |
sequence = 'DQMOffline' |
|||
) |
Definition at line 1611 of file ConfigBuilder.py.
01612 : 01613 # this one needs replacement 01614 01615 self.loadDefaultOrSpecifiedCFF(sequence,self.DQMOFFLINEDefaultCFF) 01616 sequenceList=sequence.split('.')[-1].split('+') 01617 from DQMOffline.Configuration.autoDQM import autoDQM 01618 self.expandMapping(sequenceList,autoDQM,index=0) 01619 01620 if len(set(sequenceList))!=len(sequenceList): 01621 sequenceList=list(set(sequenceList)) 01622 print "Duplicate entries for DQM:, using",sequenceList 01623 pathName='dqmoffline_step' 01624 01625 for (i,sequence) in enumerate(sequenceList): 01626 if (i!=0): 01627 pathName='dqmoffline_%d_step'%(i) 01628 01629 if 'HLT' in self.stepMap.keys() or self._options.hltProcess: 01630 self.renameHLTprocessInSequence(sequence) 01631 01632 # if both HLT and DQM are run in the same process, schedule [HLT]DQM in an EndPath 01633 if 'HLT' in self.stepMap.keys(): 01634 # need to put [HLT]DQM in an EndPath, to access the HLT trigger results 01635 setattr(self.process,pathName, cms.EndPath( getattr(self.process, sequence ) ) ) 01636 else: 01637 # schedule DQM as a standard Path 01638 setattr(self.process,pathName, cms.Path( getattr(self.process, sequence) ) ) 01639 self.schedule.append(getattr(self.process,pathName)) 01640
def ConfigBuilder::ConfigBuilder::prepare_ENDJOB | ( | self, | |
sequence = 'endOfProcess' |
|||
) |
Definition at line 1698 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_FASTSIM | ( | self, | |
sequence = "all" |
|||
) |
Enrich the schedule with fastsim
Definition at line 1707 of file ConfigBuilder.py.
01708 : 01709 """Enrich the schedule with fastsim""" 01710 self.loadAndRemember("FastSimulation/Configuration/FamosSequences_cff") 01711 01712 if sequence in ('all','allWithHLTFiltering',''): 01713 if not 'HLT' in self.stepMap.keys(): 01714 self.prepare_HLT(sequence=None) 01715 01716 self.executeAndRemember("process.famosSimHits.SimulateCalorimetry = True") 01717 self.executeAndRemember("process.famosSimHits.SimulateTracking = True") 01718 01719 self.executeAndRemember("process.simulation = cms.Sequence(process.simulationWithFamos)") 01720 self.executeAndRemember("process.HLTEndSequence = cms.Sequence(process.reconstructionWithFamos)") 01721 01722 # since we have HLT here, the process should be called HLT 01723 self._options.name = "HLT" 01724 01725 # if we don't want to filter after HLT but simulate everything regardless of what HLT tells, we have to add reconstruction explicitly 01726 if sequence == 'all' and not 'HLT' in self.stepMap.keys(): #(a) 01727 self.finalizeFastSimHLT() 01728 elif sequence == 'famosWithEverything': 01729 self.process.fastsim_step = cms.Path( getattr(self.process, "famosWithEverything") ) 01730 self.schedule.append(self.process.fastsim_step) 01731 01732 # now the additional commands we need to make the config work 01733 self.executeAndRemember("process.VolumeBasedMagneticFieldESProducer.useParametrizedTrackerField = True") 01734 else: 01735 print "FastSim setting", sequence, "unknown." 01736 raise ValueError 01737 01738 if 'Flat' in self._options.beamspot: 01739 beamspotType = 'Flat' 01740 elif 'Gauss' in self._options.beamspot: 01741 beamspotType = 'Gaussian' 01742 else: 01743 beamspotType = 'BetaFunc' 01744 self.loadAndRemember('IOMC.EventVertexGenerators.VtxSmearedParameters_cfi') 01745 beamspotName = 'process.%sVtxSmearingParameters' %(self._options.beamspot) 01746 self.executeAndRemember(beamspotName+'.type = cms.string("%s")'%(beamspotType)) 01747 self.executeAndRemember('process.famosSimHits.VertexGenerator = '+beamspotName) 01748 if hasattr(self.process,'famosPileUp'): 01749 self.executeAndRemember('process.famosPileUp.VertexGenerator = '+beamspotName) 01750 01751
def ConfigBuilder::ConfigBuilder::prepare_GEN | ( | self, | |
sequence = None |
|||
) |
load the fragment of generator configuration
Definition at line 1174 of file ConfigBuilder.py.
01175 : 01176 """ load the fragment of generator configuration """ 01177 loadFailure=False 01178 #remove trailing .py 01179 #support old style .cfi by changing into something.cfi into something_cfi 01180 #remove python/ from the name 01181 loadFragment = self._options.evt_type.replace('.py','',).replace('.','_').replace('python/','') 01182 #standard location of fragments 01183 if not '/' in loadFragment: 01184 loadFragment='Configuration.Generator.'+loadFragment 01185 else: 01186 loadFragment=loadFragment.replace('/','.') 01187 try: 01188 print "Loading generator fragment from",loadFragment 01189 __import__(loadFragment) 01190 except: 01191 loadFailure=True 01192 if self.process.source and self.process.source.type_()=='EmptySource': 01193 raise Exception("Neither gen fragment of input files provided: this is an inconsistent GEN step configuration") 01194 01195 if not loadFailure: 01196 generatorModule=sys.modules[loadFragment] 01197 genModules=generatorModule.__dict__ 01198 if self._options.hideGen: 01199 self.loadAndRemember(loadFragment) 01200 else: 01201 self.process.load(loadFragment) 01202 # expose the objects from that fragment to the configuration 01203 import FWCore.ParameterSet.Modules as cmstypes 01204 for name in genModules: 01205 theObject = getattr(generatorModule,name) 01206 if isinstance(theObject, cmstypes._Module): 01207 self._options.inlineObjets=name+','+self._options.inlineObjets 01208 elif isinstance(theObject, cms.Sequence) or isinstance(theObject, cmstypes.ESProducer): 01209 self._options.inlineObjets+=','+name 01210 01211 if sequence == self.GENDefaultSeq or sequence == 'pgen_genonly' or ( sequence == 'pgen_hi' and 'generator' in genModules): 01212 if 'ProductionFilterSequence' in genModules and ('generator' in genModules or 'hiSignal' in genModules): 01213 self.productionFilterSequence = 'ProductionFilterSequence' 01214 elif 'generator' in genModules: 01215 self.productionFilterSequence = 'generator' 01216 01217 """ Enrich the schedule with the rest of the generation step """ 01218 self.loadDefaultOrSpecifiedCFF(sequence,self.GENDefaultCFF) 01219 genSeqName=sequence.split('.')[-1] 01220 01221 if not 'FASTSIM' in self.stepMap: 01222 try: 01223 from Configuration.StandardSequences.VtxSmeared import VtxSmeared 01224 self.loadAndRemember(VtxSmeared[self._options.beamspot]) 01225 except ImportError: 01226 raise Exception("VertexSmearing type or beamspot "+self._options.beamspot+" unknown.") 01227 01228 if self._options.scenario == 'HeavyIons' and self._options.himix: 01229 self.loadAndRemember("SimGeneral/MixingModule/himixGEN_cff") 01230 01231 self.process.generation_step = cms.Path( getattr(self.process,genSeqName) ) 01232 self.schedule.append(self.process.generation_step) 01233 01234 #register to the genstepfilter the name of the path (static right now, but might evolve) 01235 self.executeAndRemember('process.genstepfilter.triggerConditions=cms.vstring("generation_step")') 01236 01237 if 'reGEN' in self.stepMap: 01238 #stop here 01239 return 01240 01241 """ Enrich the schedule with the summary of the filter step """ 01242 #the gen filter in the endpath 01243 self.loadAndRemember("GeneratorInterface/Core/genFilterSummary_cff") 01244 self.scheduleSequenceAtEnd('genFilterSummary','genfiltersummary_step') 01245 return
def ConfigBuilder::ConfigBuilder::prepare_HARVESTING | ( | self, | |
sequence = None |
|||
) |
Enrich the process with harvesting step
Definition at line 1641 of file ConfigBuilder.py.
01642 : 01643 """ Enrich the process with harvesting step """ 01644 self.EDMtoMECFF='Configuration/StandardSequences/EDMtoME'+self._options.harvesting+'_cff' 01645 self.loadAndRemember(self.EDMtoMECFF) 01646 self.scheduleSequence('EDMtoME','edmtome_step') 01647 01648 harvestingConfig = self.loadDefaultOrSpecifiedCFF(sequence,self.HARVESTINGDefaultCFF) 01649 sequence = sequence.split('.')[-1] 01650 01651 # decide which HARVESTING paths to use 01652 harvestingList = sequence.split("+") 01653 from DQMOffline.Configuration.autoDQM import autoDQM 01654 self.expandMapping(harvestingList,autoDQM,index=1) 01655 01656 if len(set(harvestingList))!=len(harvestingList): 01657 harvestingList=list(set(harvestingList)) 01658 print "Duplicate entries for HARVESTING, using",harvestingList 01659 01660 for name in harvestingList: 01661 if not name in harvestingConfig.__dict__: 01662 print name,"is not a possible harvesting type. Available are",harvestingConfig.__dict__.keys() 01663 continue 01664 harvestingstream = getattr(harvestingConfig,name) 01665 if isinstance(harvestingstream,cms.Path): 01666 self.schedule.append(harvestingstream) 01667 self.blacklist_paths.append(harvestingstream) 01668 if isinstance(harvestingstream,cms.Sequence): 01669 setattr(self.process,name+"_step",cms.Path(harvestingstream)) 01670 self.schedule.append(getattr(self.process,name+"_step")) 01671 01672 self.scheduleSequence('DQMSaver','dqmsave_step') 01673 return
def ConfigBuilder::ConfigBuilder::prepare_HLT | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the HLT simulation step
Definition at line 1324 of file ConfigBuilder.py.
01325 : 01326 """ Enrich the schedule with the HLT simulation step""" 01327 if not sequence: 01328 print "no specification of the hlt menu has been given, should never happen" 01329 raise Exception('no HLT sequence provided') 01330 01331 if '@' in sequence: 01332 # case where HLT:@something was provided 01333 from Configuration.HLT.autoHLT import autoHLT 01334 key = sequence[1:] 01335 if key in autoHLT: 01336 sequence = autoHLT[key] 01337 else: 01338 raise ValueError('no HLT mapping key "%s" found in autoHLT' % key) 01339 01340 if ',' in sequence: 01341 # case where HLT:something:something was provided 01342 self.executeAndRemember('import HLTrigger.Configuration.Utilities') 01343 optionsForHLT = {} 01344 if self._options.scenario == 'HeavyIons': 01345 optionsForHLT['type'] = 'HIon' 01346 else: 01347 optionsForHLT['type'] = 'GRun' 01348 optionsForHLTConfig = ', '.join('%s=%s' % (key, repr(val)) for (key, val) in optionsForHLT.iteritems()) 01349 self.executeAndRemember('process.loadHltConfiguration("%s",%s)'%(sequence.replace(',',':'),optionsForHLTConfig)) 01350 else: 01351 if 'FASTSIM' in self.stepMap: 01352 self.loadAndRemember('HLTrigger/Configuration/HLT_%s_Famos_cff' % sequence) 01353 else: 01354 self.loadAndRemember('HLTrigger/Configuration/HLT_%s_cff' % sequence) 01355 01356 if self._options.isMC: 01357 self._options.customisation_file+=",HLTrigger/Configuration/customizeHLTforMC.customizeHLTforMC" 01358 01359 if self._options.name != 'HLT': 01360 self.additionalCommands.append('from HLTrigger.Configuration.CustomConfigs import ProcessName') 01361 self.additionalCommands.append('process = ProcessName(process)') 01362 self.additionalCommands.append('') 01363 from HLTrigger.Configuration.CustomConfigs import ProcessName 01364 self.process = ProcessName(self.process) 01365 01366 self.schedule.append(self.process.HLTSchedule) 01367 [self.blacklist_paths.append(path) for path in self.process.HLTSchedule if isinstance(path,(cms.Path,cms.EndPath))] 01368 if ('FASTSIM' in self.stepMap and 'HLT' in self.stepMap): 01369 self.finalizeFastSimHLT() 01370
def ConfigBuilder::ConfigBuilder::prepare_L1 | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the L1 simulation step
Definition at line 1299 of file ConfigBuilder.py.
01300 : 01301 """ Enrich the schedule with the L1 simulation step""" 01302 if not sequence: 01303 self.loadAndRemember(self.L1EMDefaultCFF) 01304 else: 01305 # let the L1 package decide for the scenarios available 01306 from L1Trigger.Configuration.ConfigBuilder import getConfigsForScenario 01307 listOfImports = getConfigsForScenario(sequence) 01308 for file in listOfImports: 01309 self.loadAndRemember(file) 01310 self.scheduleSequence('SimL1Emulator','L1simulation_step') 01311 return
def ConfigBuilder::ConfigBuilder::prepare_L1HwVal | ( | self, | |
sequence = 'L1HwVal' |
|||
) |
Enrich the schedule with L1 HW validation
Definition at line 1389 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_L1Reco | ( | self, | |
sequence = "L1Reco" |
|||
) |
Enrich the schedule with L1 reconstruction
Definition at line 1396 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_L1REPACK | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the L1 simulation step, running the L1 emulator on data unpacked from the RAW collection, and repacking the result in a new RAW collection
Definition at line 1312 of file ConfigBuilder.py.
01313 : 01314 """ Enrich the schedule with the L1 simulation step, running the L1 emulator on data unpacked from the RAW collection, and repacking the result in a new RAW collection""" 01315 if sequence is not 'GT': 01316 print 'Running the full L1 emulator is not supported yet' 01317 raise Exception('unsupported feature') 01318 if sequence is 'GT': 01319 self.loadAndRemember('Configuration/StandardSequences/SimL1EmulatorRepack_GT_cff') 01320 if self._options.scenario == 'HeavyIons': 01321 self.renameInputTagsInSequence("SimL1Emulator","rawDataCollector","rawDataRepacker") 01322 self.scheduleSequence('SimL1Emulator','L1simulation_step') 01323
def ConfigBuilder::ConfigBuilder::prepare_LHE | ( | self, | |
sequence = None |
|||
) |
Definition at line 1158 of file ConfigBuilder.py.
01159 : 01160 #load the fragment 01161 ##make it loadable 01162 loadFragment = self._options.evt_type.replace('.py','',).replace('.','_').replace('python/','').replace('/','.') 01163 print "Loading lhe fragment from",loadFragment 01164 __import__(loadFragment) 01165 self.process.load(loadFragment) 01166 ##inline the modules 01167 self._options.inlineObjets+=','+sequence 01168 01169 getattr(self.process,sequence).nEvents = int(self._options.number) 01170 01171 #schedule it 01172 self.process.lhe_step = cms.Path( getattr( self.process,sequence) ) 01173 self.schedule.append( self.process.lhe_step )
def ConfigBuilder::ConfigBuilder::prepare_POSTRECO | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the postreco step
Definition at line 1458 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_RAW2DIGI | ( | self, | |
sequence = "RawToDigi" |
|||
) |
Definition at line 1382 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_RAW2RECO | ( | self, | |
sequence = None |
|||
) |
Definition at line 1371 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_RECO | ( | self, | |
sequence = "reconstruction" |
|||
) |
Enrich the schedule with reconstruction
Definition at line 1402 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_REPACK | ( | self, | |
sequence = None |
|||
) |
Definition at line 1294 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_SIM | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the simulation step
Definition at line 1246 of file ConfigBuilder.py.
01247 : 01248 """ Enrich the schedule with the simulation step""" 01249 self.loadAndRemember(self.SIMDefaultCFF) 01250 if self._options.gflash==True: 01251 self.loadAndRemember("Configuration/StandardSequences/GFlashSIM_cff") 01252 01253 if self._options.magField=='0T': 01254 self.executeAndRemember("process.g4SimHits.UseMagneticField = cms.bool(False)") 01255 01256 if self._options.himix==True: 01257 if self._options.geometry in defaultOptions.geometryExtendedOptions: 01258 self.loadAndRemember("SimGeneral/MixingModule/himixSIMExtended_cff") 01259 else: 01260 self.loadAndRemember("SimGeneral/MixingModule/himixSIMIdeal_cff") 01261 01262 self.scheduleSequence('psim','simulation_step') 01263 return
def ConfigBuilder::ConfigBuilder::prepare_SKIM | ( | self, | |
sequence = "all" |
|||
) |
Enrich the schedule with skimming fragments
Definition at line 1408 of file ConfigBuilder.py.
01409 : 01410 ''' Enrich the schedule with skimming fragments''' 01411 skimConfig = self.loadDefaultOrSpecifiedCFF(sequence,self.SKIMDefaultCFF) 01412 sequence = sequence.split('.')[-1] 01413 01414 skimlist=sequence.split('+') 01415 ## support @Mu+DiJet+@Electron configuration via autoSkim.py 01416 from Configuration.Skimming.autoSkim import autoSkim 01417 self.expandMapping(skimlist,autoSkim) 01418 01419 #print "dictionnary for skims:",skimConfig.__dict__ 01420 for skim in skimConfig.__dict__: 01421 skimstream = getattr(skimConfig,skim) 01422 if isinstance(skimstream,cms.Path): 01423 #black list the alca path so that they do not appear in the cfg 01424 self.blacklist_paths.append(skimstream) 01425 if (not isinstance(skimstream,cms.FilteredStream)): 01426 continue 01427 shortname = skim.replace('SKIMStream','') 01428 if (sequence=="all"): 01429 self.addExtraStream(skim,skimstream) 01430 elif (shortname in skimlist): 01431 self.addExtraStream(skim,skimstream) 01432 #add a DQM eventcontent for this guy 01433 if self._options.datatier!="": 01434 self.process.load(self.EVTCONTDefaultCFF) 01435 skimstreamDQM = cms.FilteredStream( 01436 responsible = skimstream.responsible, 01437 name = skimstream.name+'DQM', 01438 paths = skimstream.paths, 01439 selectEvents = skimstream.selectEvents, 01440 content = self._options.datatier+'EventContent', 01441 dataTier = cms.untracked.string(self._options.datatier) 01442 ) 01443 self.addExtraStream(skim+'DQM',skimstreamDQM) 01444 for i in range(skimlist.count(shortname)): 01445 skimlist.remove(shortname) 01446 01447 01448 01449 if (skimlist.__len__()!=0 and sequence!="all"): 01450 print 'WARNING, possible typo with SKIM:'+'+'.join(skimlist) 01451 raise Exception('WARNING, possible typo with SKIM:'+'+'.join(skimlist))
def ConfigBuilder::ConfigBuilder::prepare_USER | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with a user defined sequence
Definition at line 1452 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_VALIDATION | ( | self, | |
sequence = 'validation' |
|||
) |
Definition at line 1465 of file ConfigBuilder.py.
01466 : 01467 self.loadDefaultOrSpecifiedCFF(sequence,self.VALIDATIONDefaultCFF) 01468 #in case VALIDATION:something:somethingelse -> something,somethingelse 01469 sequence=sequence.split('.')[-1] 01470 if sequence.find(',')!=-1: 01471 prevalSeqName=sequence.split(',')[0] 01472 valSeqName=sequence.split(',')[1] 01473 else: 01474 postfix='' 01475 if sequence: 01476 postfix='_'+sequence 01477 prevalSeqName='prevalidation'+postfix 01478 valSeqName='validation'+postfix 01479 if not hasattr(self.process,valSeqName): 01480 prevalSeqName='' 01481 valSeqName=sequence 01482 01483 if not 'DIGI' in self.stepMap and not 'FASTSIM' in self.stepMap and not valSeqName.startswith('genvalid'): 01484 if self._options.restoreRNDSeeds==False and not self._options.restoreRNDSeeds==True: 01485 self._options.restoreRNDSeeds=True 01486 01487 #rename the HLT process in validation steps 01488 if ('HLT' in self.stepMap and not 'FASTSIM' in self.stepMap) or self._options.hltProcess: 01489 self.renameHLTprocessInSequence(valSeqName) 01490 if prevalSeqName: 01491 self.renameHLTprocessInSequence(prevalSeqName) 01492 01493 if prevalSeqName: 01494 self.process.prevalidation_step = cms.Path( getattr(self.process, prevalSeqName ) ) 01495 self.schedule.append(self.process.prevalidation_step) 01496 01497 self.process.validation_step = cms.EndPath( getattr(self.process,valSeqName ) ) 01498 self.schedule.append(self.process.validation_step) 01499 01500 if not 'DIGI' in self.stepMap and not 'FASTSIM' in self.stepMap: 01501 self.executeAndRemember("process.mix.playback = True") 01502 01503 if hasattr(self.process,"genstepfilter") and len(self.process.genstepfilter.triggerConditions): 01504 #will get in the schedule, smoothly 01505 self.process.validation_step._seq = self.process.genstepfilter * self.process.validation_step._seq 01506 01507 return 01508
def ConfigBuilder::ConfigBuilder::profileOptions | ( | self | ) |
addIgProfService Function to add the igprof profile service so that you can dump in the middle of the run.
Definition at line 212 of file ConfigBuilder.py.
00213 : 00214 """ 00215 addIgProfService 00216 Function to add the igprof profile service so that you can dump in the middle 00217 of the run. 00218 """ 00219 profileOpts = self._options.profile.split(':') 00220 profilerStart = 1 00221 profilerInterval = 100 00222 profilerFormat = None 00223 profilerJobFormat = None 00224 00225 if len(profileOpts): 00226 #type, given as first argument is unused here 00227 profileOpts.pop(0) 00228 if len(profileOpts): 00229 startEvent = profileOpts.pop(0) 00230 if not startEvent.isdigit(): 00231 raise Exception("%s is not a number" % startEvent) 00232 profilerStart = int(startEvent) 00233 if len(profileOpts): 00234 eventInterval = profileOpts.pop(0) 00235 if not eventInterval.isdigit(): 00236 raise Exception("%s is not a number" % eventInterval) 00237 profilerInterval = int(eventInterval) 00238 if len(profileOpts): 00239 profilerFormat = profileOpts.pop(0) 00240 00241 00242 if not profilerFormat: 00243 profilerFormat = "%s___%s___%s___%s___%s___%s___%%I.gz" % (self._options.evt_type.replace("_cfi", ""), 00244 self._options.step, 00245 self._options.pileup, 00246 self._options.conditions, 00247 self._options.datatier, 00248 self._options.profileTypeLabel) 00249 if not profilerJobFormat and profilerFormat.endswith(".gz"): 00250 profilerJobFormat = profilerFormat.replace(".gz", "_EndOfJob.gz") 00251 elif not profilerJobFormat: 00252 profilerJobFormat = profilerFormat + "_EndOfJob.gz" 00253 00254 return (profilerStart,profilerInterval,profilerFormat,profilerJobFormat)
def ConfigBuilder::ConfigBuilder::renameHLTprocessInSequence | ( | self, | |
sequence, | |||
proc = None , |
|||
HLTprocess = 'HLT' |
|||
) |
Definition at line 1578 of file ConfigBuilder.py.
01579 : 01580 if self._options.hltProcess: 01581 proc=self._options.hltProcess 01582 else: 01583 proc=self.process.name_() 01584 if proc==HLTprocess: return 01585 # look up all module in dqm sequence 01586 print "replacing %s process name - sequence %s will use '%s'" % (HLTprocess,sequence, proc) 01587 getattr(self.process,sequence).visit(ConfigBuilder.MassSearchReplaceProcessNameVisitor(HLTprocess,proc,whitelist = ("subSystemFolder",))) 01588 if 'from Configuration.PyReleaseValidation.ConfigBuilder import ConfigBuilder' not in self.additionalCommands: 01589 self.additionalCommands.append('from Configuration.PyReleaseValidation.ConfigBuilder import ConfigBuilder') 01590 self.additionalCommands.append('process.%s.visit(ConfigBuilder.MassSearchReplaceProcessNameVisitor("%s", "%s", whitelist = ("subSystemFolder",)))'% (sequence,HLTprocess, proc)) 01591
def ConfigBuilder::ConfigBuilder::renameInputTagsInSequence | ( | self, | |
sequence, | |||
oldT = "rawDataCollector" , |
|||
newT = "rawDataRepacker" |
|||
) |
Definition at line 1568 of file ConfigBuilder.py.
01569 : 01570 print "Replacing all InputTag %s => %s"%(oldT,newT) 01571 from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag 01572 massSearchReplaceAnyInputTag(getattr(self.process,sequence),oldT,newT) 01573 loadMe='from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag' 01574 if not loadMe in self.additionalCommands: 01575 self.additionalCommands.append(loadMe) 01576 self.additionalCommands.append('massSearchReplaceAnyInputTag(process.%s,"%s","%s",False)'%(sequence,oldT,newT))
def ConfigBuilder::ConfigBuilder::scheduleSequence | ( | self, | |
seq, | |||
prefix, | |||
what = 'Path' |
|||
) |
Definition at line 1069 of file ConfigBuilder.py.
01070 : 01071 if '*' in seq: 01072 #create only one path with all sequences in it 01073 for i,s in enumerate(seq.split('*')): 01074 if i==0: 01075 setattr(self.process,prefix,getattr(cms,what)( getattr(self.process, s) )) 01076 else: 01077 p=getattr(self.process,prefix) 01078 p+=getattr(self.process, s) 01079 self.schedule.append(getattr(self.process,prefix)) 01080 return 01081 else: 01082 #create as many path as many sequences 01083 if not '+' in seq: 01084 setattr(self.process,prefix,getattr(cms,what)( getattr(self.process, seq) )) 01085 self.schedule.append(getattr(self.process,prefix)) 01086 else: 01087 for i,s in enumerate(seq.split('+')): 01088 sn=prefix+'%d'%(i) 01089 setattr(self.process,sn,getattr(cms,what)( getattr(self.process, s) )) 01090 self.schedule.append(getattr(self.process,sn)) 01091 return
def ConfigBuilder::ConfigBuilder::scheduleSequenceAtEnd | ( | self, | |
seq, | |||
prefix | |||
) |
Definition at line 1092 of file ConfigBuilder.py.
ConfigBuilder::ConfigBuilder::_options [private] |
Definition at line 154 of file ConfigBuilder.py.
Definition at line 154 of file ConfigBuilder.py.
Definition at line 154 of file ConfigBuilder.py.
Definition at line 154 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 154 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 1641 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 154 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 154 of file ConfigBuilder.py.
Definition at line 154 of file ConfigBuilder.py.
Definition at line 1763 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 154 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 154 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 770 of file ConfigBuilder.py.
Definition at line 154 of file ConfigBuilder.py.
Definition at line 154 of file ConfigBuilder.py.