![]() |
![]() |
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 674 of file ConfigBuilder.py.
00675 : 00676 """Add conditions to the process""" 00677 if not self._options.conditions: return 00678 00679 if 'auto:' in self._options.conditions: 00680 from Configuration.AlCa.autoCond import autoCond 00681 key=self._options.conditions.split(':')[-1] 00682 if key not in autoCond: 00683 raise Exception('no correspondance for '+self._options.conditions+'\n available keys are'+','.join(autoCond.keys())) 00684 else: 00685 self._options.conditions = autoCond[key] 00686 00687 # the option can be a list of GT name and connection string 00688 00689 if isinstance(self._options.conditions,tuple): 00690 if self._options.custom_conditions: 00691 self._options.custom_conditions+='+'+self._options.conditions[1] 00692 else: 00693 self._options.custom_conditions=self._options.conditions[1] 00694 self._options.conditions=self._options.conditions[0] 00695 00696 00697 if 'FrontierConditions_GlobalTag' in self._options.conditions: 00698 print 'using FrontierConditions_GlobalTag in --conditions is not necessary anymore and will be deprecated soon. please update your command line' 00699 self._options.conditions = self._options.conditions.replace("FrontierConditions_GlobalTag,",'') 00700 00701 conditions = self._options.conditions.split(',') 00702 00703 gtName = str( conditions[0] ) 00704 if len(conditions) > 1: 00705 connect = str( conditions[1] ) 00706 if len(conditions) > 2: 00707 pfnPrefix = str( conditions[2] ) 00708 00709 self.loadAndRemember(self.ConditionsDefaultCFF) 00710 00711 # set the global tag 00712 self.executeAndRemember("process.GlobalTag.globaltag = '%s'" % gtName) 00713 if len(conditions) > 1: 00714 self.executeAndRemember("process.GlobalTag.connect = '%s'" % connect) 00715 if len(conditions) > 2: 00716 self.executeAndRemember("process.GlobalTag.pfnPrefix = cms.untracked.string('%s')" % pfnPrefix) 00717 00718 if self._options.slhc: 00719 self.loadAndRemember("SLHCUpgradeSimulations/Geometry/fakeConditions_%s_cff"%(self._options.slhc,)) 00720 00721 if self._options.custom_conditions!="": 00722 specs=self._options.custom_conditions.split('+') 00723 self.executeAndRemember("process.GlobalTag.toGet = cms.VPSet()") 00724 for spec in specs: 00725 #format is tag=<...>,record=<...>,connect=<...>,label=<...> with connect and label optionnal 00726 items=spec.split(',') 00727 payloadSpec={} 00728 allowedFields=['tag','record','connect','label'] 00729 for i,item in enumerate(items): 00730 if '=' in item: 00731 field=item.split('=')[0] 00732 if not field in allowedFields: 00733 raise Exception('in --custom_conditions, '+field+' is not a valid field') 00734 payloadSpec[field]=item.split('=')[1] 00735 else: 00736 payloadSpec[allowedFields[i]]=item 00737 if (not 'record' in payloadSpec) or (not 'tag' in payloadSpec): 00738 raise Exception('conditions cannot be customised with: '+repr(payloadSpec)+' no record or tag field available') 00739 payloadSpecToAppend='' 00740 for i,item in enumerate(allowedFields): 00741 if not item in payloadSpec: continue 00742 if not payloadSpec[item]: continue 00743 if i<2: untracked='' 00744 else: untracked='untracked.' 00745 payloadSpecToAppend+='%s=cms.%sstring("%s"),'%(item,untracked,payloadSpec[item]) 00746 print 'customising the GlogalTag with:',payloadSpecToAppend 00747 self.executeAndRemember('process.GlobalTag.toGet.append(cms.PSet(%s))'%(payloadSpecToAppend,))
def ConfigBuilder::ConfigBuilder::addCustomise | ( | self | ) |
Include the customise code
Definition at line 748 of file ConfigBuilder.py.
00749 : 00750 """Include the customise code """ 00751 00752 custOpt=self._options.customisation_file.split(",") 00753 custMap={} 00754 for opt in custOpt: 00755 if opt=='': continue 00756 if opt.count('.')>1: 00757 raise Exception("more than . in the specification:"+opt) 00758 fileName=opt.split('.')[0] 00759 if opt.count('.')==0: rest='customise' 00760 else: 00761 rest=opt.split('.')[1] 00762 if rest=='py': rest='customise' #catch the case of --customise file.py 00763 00764 if fileName in custMap: 00765 custMap[fileName].extend(rest.split('+')) 00766 else: 00767 custMap[fileName]=rest.split('+') 00768 00769 if len(custMap)==0: 00770 final_snippet='\n' 00771 else: 00772 final_snippet='\n# customisation of the process.\n' 00773 00774 allFcn=[] 00775 for opt in custMap: 00776 allFcn.extend(custMap[opt]) 00777 for fcn in allFcn: 00778 if allFcn.count(fcn)!=1: 00779 raise Exception("cannot specify twice "+fcn+" as a customisation method") 00780 00781 for f in custMap: 00782 # let python search for that package and do syntax checking at the same time 00783 packageName = f.replace(".py","").replace("/",".") 00784 __import__(packageName) 00785 package = sys.modules[packageName] 00786 00787 # now ask the package for its definition and pick .py instead of .pyc 00788 customiseFile = re.sub(r'\.pyc$', '.py', package.__file__) 00789 00790 final_snippet+='\n# Automatic addition of the customisation function from '+packageName+'\n' 00791 if self._options.inline_custom: 00792 for line in file(customiseFile,'r'): 00793 if "import FWCore.ParameterSet.Config" in line: 00794 continue 00795 final_snippet += line 00796 else: 00797 final_snippet += 'from %s import %s \n'%(packageName,','.join(custMap[f])) 00798 for fcn in custMap[f]: 00799 print "customising the process with",fcn,"from",f 00800 if not hasattr(package,fcn): 00801 #bound to fail at run time 00802 raise Exception("config "+f+" has no function "+fcn) 00803 #execute the command 00804 self.process=getattr(package,fcn)(self.process) 00805 #and print it in the configuration 00806 final_snippet += "\n#call to customisation function "+fcn+" imported from "+packageName 00807 final_snippet += "\nprocess = %s(process)\n"%(fcn,) 00808 00809 if len(custMap)!=0: 00810 final_snippet += '\n# End of customisation functions\n' 00811 00812 ### now for a usuful command 00813 if self._options.customise_commands: 00814 import string 00815 final_snippet +='\n# Customisation from command line' 00816 for com in self._options.customise_commands.split('\\n'): 00817 com=string.lstrip(com) 00818 self.executeAndRemember(com) 00819 final_snippet +='\n'+com 00820 00821 return final_snippet
def ConfigBuilder::ConfigBuilder::addExtraStream | ( | self, | |
name, | |||
stream, | |||
workflow = 'full' |
|||
) |
Definition at line 1047 of file ConfigBuilder.py.
01048 : 01049 # define output module and go from there 01050 output = cms.OutputModule("PoolOutputModule") 01051 if stream.selectEvents.parameters_().__len__()!=0: 01052 output.SelectEvents = stream.selectEvents 01053 else: 01054 output.SelectEvents = cms.untracked.PSet() 01055 output.SelectEvents.SelectEvents=cms.vstring() 01056 if isinstance(stream.paths,tuple): 01057 for path in stream.paths: 01058 output.SelectEvents.SelectEvents.append(path.label()) 01059 else: 01060 output.SelectEvents.SelectEvents.append(stream.paths.label()) 01061 01062 01063 01064 if isinstance(stream.content,str): 01065 evtPset=getattr(self.process,stream.content) 01066 for p in evtPset.parameters_(): 01067 setattr(output,p,getattr(evtPset,p)) 01068 if not self._options.inlineEventContent: 01069 def doNotInlineEventContent(instance,label = "process."+stream.content+".outputCommands"): 01070 return label 01071 output.outputCommands.__dict__["dumpPython"] = doNotInlineEventContent 01072 else: 01073 output.outputCommands = stream.content 01074 01075 01076 output.fileName = cms.untracked.string(self._options.dirout+stream.name+'.root') 01077 01078 output.dataset = cms.untracked.PSet( dataTier = stream.dataTier, 01079 filterName = cms.untracked.string(stream.name)) 01080 01081 if self._options.filtername: 01082 output.dataset.filterName= cms.untracked.string(self._options.filtername+"_"+stream.name) 01083 01084 #add an automatic flushing to limit memory consumption 01085 output.eventAutoFlushCompressedSize=cms.untracked.int32(5*1024*1024) 01086 01087 if workflow in ("producers,full"): 01088 if isinstance(stream.paths,tuple): 01089 for path in stream.paths: 01090 self.schedule.append(path) 01091 else: 01092 self.schedule.append(stream.paths) 01093 01094 01095 # in case of relvals we don't want to have additional outputs 01096 if (not self._options.relval) and workflow in ("full","output"): 01097 self.additionalOutputs[name] = output 01098 setattr(self.process,name,output) 01099 01100 if workflow == 'output': 01101 # adjust the select events to the proper trigger results from previous process 01102 filterList = output.SelectEvents.SelectEvents 01103 for i, filter in enumerate(filterList): 01104 filterList[i] = filter+":"+self._options.triggerResultsProcess 01105 01106 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 421 of file ConfigBuilder.py.
00422 : 00423 """ Add output module to the process """ 00424 result="" 00425 if self._options.outputDefinition: 00426 if self._options.datatier: 00427 print "--datatier & --eventcontent options ignored" 00428 00429 def anyOf(listOfKeys,dict,opt=None): 00430 for k in listOfKeys: 00431 if k in dict: 00432 toReturn=dict[k] 00433 dict.pop(k) 00434 return toReturn 00435 if opt!=None: 00436 return opt 00437 else: 00438 raise Exception("any of "+','.join(listOfKeys)+" are mandatory entries of --output options") 00439 00440 #new output convention with a list of dict 00441 outList = eval(self._options.outputDefinition) 00442 for (id,outDefDict) in enumerate(outList): 00443 outDefDictStr=outDefDict.__str__() 00444 if not isinstance(outDefDict,dict): 00445 raise Exception("--output needs to be passed a list of dict"+self._options.outputDefinition+" is invalid") 00446 #requires option: tier 00447 theTier=anyOf(['t','tier','dataTier'],outDefDict) 00448 #optional option: eventcontent, filtername, selectEvents, moduleLabel, filename 00449 ## event content 00450 theStreamType=anyOf(['e','ec','eventContent','streamType'],outDefDict,theTier) 00451 theFilterName=anyOf(['f','ftN','filterName'],outDefDict,'') 00452 theSelectEvent=anyOf(['s','sE','selectEvents'],outDefDict,'') 00453 theModuleLabel=anyOf(['l','mL','moduleLabel'],outDefDict,'') 00454 theExtraOutputCommands=anyOf(['o','oC','outputCommands'],outDefDict,'') 00455 # module label has a particular role 00456 if not theModuleLabel: 00457 tryNames=[theStreamType.replace(theTier.replace('-',''),'')+theTier.replace('-','')+'output', 00458 theStreamType.replace(theTier.replace('-',''),'')+theTier.replace('-','')+theFilterName+'output', 00459 theStreamType.replace(theTier.replace('-',''),'')+theTier.replace('-','')+theFilterName+theSelectEvent.split(',')[0].replace(':','for').replace(' ','')+'output' 00460 ] 00461 for name in tryNames: 00462 if not hasattr(self.process,name): 00463 theModuleLabel=name 00464 break 00465 if not theModuleLabel: 00466 raise Exception("cannot find a module label for specification: "+outDefDictStr) 00467 if id==0: 00468 defaultFileName=self._options.outfile_name 00469 else: 00470 defaultFileName=self._options.outfile_name.replace('.root','_in'+theTier+'.root') 00471 00472 theFileName=self._options.dirout+anyOf(['fn','fileName'],outDefDict,defaultFileName) 00473 if not theFileName.endswith('.root'): 00474 theFileName+='.root' 00475 00476 if len(outDefDict.keys()): 00477 raise Exception("unused keys from --output options: "+','.join(outDefDict.keys())) 00478 if theStreamType=='DQMROOT': theStreamType='DQM' 00479 if theStreamType=='ALL': 00480 theEventContent = cms.PSet(outputCommands = cms.untracked.vstring('keep *')) 00481 else: 00482 theEventContent = getattr(self.process, theStreamType+"EventContent") 00483 00484 if theStreamType=='ALCARECO' and not theFilterName: 00485 theFilterName='StreamALCACombined' 00486 00487 CppType='PoolOutputModule' 00488 if theStreamType=='DQM' and theTier=='DQMROOT': CppType='DQMRootOutputModule' 00489 output = cms.OutputModule(CppType, 00490 theEventContent.clone(), 00491 fileName = cms.untracked.string(theFileName), 00492 dataset = cms.untracked.PSet( 00493 dataTier = cms.untracked.string(theTier), 00494 filterName = cms.untracked.string(theFilterName)) 00495 ) 00496 if not theSelectEvent and hasattr(self.process,'generation_step'): 00497 output.SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring('generation_step')) 00498 if theSelectEvent: 00499 output.SelectEvents =cms.untracked.PSet(SelectEvents = cms.vstring(theSelectEvent)) 00500 00501 if hasattr(self.process,theModuleLabel): 00502 raise Exception("the current process already has a module "+theModuleLabel+" defined") 00503 #print "creating output module ",theModuleLabel 00504 setattr(self.process,theModuleLabel,output) 00505 outputModule=getattr(self.process,theModuleLabel) 00506 setattr(self.process,theModuleLabel+'_step',cms.EndPath(outputModule)) 00507 path=getattr(self.process,theModuleLabel+'_step') 00508 self.schedule.append(path) 00509 00510 if not self._options.inlineEventContent and hasattr(self.process,theStreamType+"EventContent"): 00511 def doNotInlineEventContent(instance,label = "cms.untracked.vstring(process."+theStreamType+"EventContent.outputCommands)"): 00512 return label 00513 outputModule.outputCommands.__dict__["dumpPython"] = doNotInlineEventContent 00514 if theExtraOutputCommands: 00515 if not isinstance(theExtraOutputCommands,list): 00516 raise Exception("extra ouput command in --option must be a list of strings") 00517 if hasattr(self.process,theStreamType+"EventContent"): 00518 self.executeAndRemember('process.%s.outputCommands.extend(%s)'%(theModuleLabel,theExtraOutputCommands)) 00519 else: 00520 outputModule.outputCommands.extend(theExtraOutputCommands) 00521 00522 result+="\nprocess."+theModuleLabel+" = "+outputModule.dumpPython() 00523 00524 ##ends the --output options model 00525 return result 00526 00527 streamTypes=self._options.eventcontent.split(',') 00528 tiers=self._options.datatier.split(',') 00529 if not self._options.outputDefinition and len(streamTypes)!=len(tiers): 00530 raise Exception("number of event content arguments does not match number of datatier arguments") 00531 00532 # if the only step is alca we don't need to put in an output 00533 if self._options.step.split(',')[0].split(':')[0] == 'ALCA': 00534 return "\n" 00535 00536 for i,(streamType,tier) in enumerate(zip(streamTypes,tiers)): 00537 if streamType=='': continue 00538 if streamType=='DQMROOT': streamType='DQM' 00539 theEventContent = getattr(self.process, streamType+"EventContent") 00540 if i==0: 00541 theFileName=self._options.outfile_name 00542 theFilterName=self._options.filtername 00543 else: 00544 theFileName=self._options.outfile_name.replace('.root','_in'+streamType+'.root') 00545 theFilterName=self._options.filtername 00546 CppType='PoolOutputModule' 00547 if streamType=='DQM' and tier=='DQMROOT': CppType='DQMRootOutputModule' 00548 output = cms.OutputModule(CppType, 00549 theEventContent, 00550 fileName = cms.untracked.string(theFileName), 00551 dataset = cms.untracked.PSet(dataTier = cms.untracked.string(tier), 00552 filterName = cms.untracked.string(theFilterName) 00553 ) 00554 ) 00555 if hasattr(self.process,"generation_step"): 00556 output.SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring('generation_step')) 00557 00558 if streamType=='ALCARECO': 00559 output.dataset.filterName = cms.untracked.string('StreamALCACombined') 00560 00561 outputModuleName=streamType+'output' 00562 setattr(self.process,outputModuleName,output) 00563 outputModule=getattr(self.process,outputModuleName) 00564 setattr(self.process,outputModuleName+'_step',cms.EndPath(outputModule)) 00565 path=getattr(self.process,outputModuleName+'_step') 00566 self.schedule.append(path) 00567 00568 if not self._options.inlineEventContent: 00569 def doNotInlineEventContent(instance,label = "process."+streamType+"EventContent.outputCommands"): 00570 return label 00571 outputModule.outputCommands.__dict__["dumpPython"] = doNotInlineEventContent 00572 00573 result+="\nprocess."+outputModuleName+" = "+outputModule.dumpPython() 00574 00575 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.eventsToProcess=cms.untracked.VEventRange( LumiList.LumiList(self._options.lumiToProcess).getCMSSWString().split(',') ) 00410 00411 00412 if 'GEN' in self.stepMap.keys() or (not self._options.filein and hasattr(self._options, "evt_type")): 00413 if self.process.source is None: 00414 self.process.source=cms.Source("EmptySource") 00415 # if option himix is active, drop possibly duplicate DIGI-RAW info: 00416 if self._options.himix==True: 00417 self.process.source.inputCommands = cms.untracked.vstring('drop *','keep *_generator_*_*','keep *_g4SimHits_*_*') 00418 self.process.source.dropDescendantsOfDroppedBranches=cms.untracked.bool(False) 00419 00420 return
def ConfigBuilder::ConfigBuilder::addStandardSequences | ( | self | ) |
Add selected standard sequences to the process
Definition at line 576 of file ConfigBuilder.py.
00577 : 00578 """ 00579 Add selected standard sequences to the process 00580 """ 00581 # load the pile up file 00582 if self._options.pileup: 00583 pileupSpec=self._options.pileup.split(',')[0] 00584 from Configuration.StandardSequences.Mixing import Mixing,defineMixing 00585 if not pileupSpec in Mixing and '.' not in pileupSpec and 'file:' not in pileupSpec: 00586 raise Exception(pileupSpec+' is not a know mixing scenario:\n available are: '+'\n'.join(Mixing.keys())) 00587 if '.' in pileupSpec: 00588 mixingDict={'file':pileupSpec} 00589 elif pileupSpec.startswith('file:'): 00590 mixingDict={'file':pileupSpec[5:]} 00591 else: 00592 import copy 00593 mixingDict=copy.copy(Mixing[pileupSpec]) 00594 if len(self._options.pileup.split(','))>1: 00595 mixingDict.update(eval(self._options.pileup[self._options.pileup.find(',')+1:])) 00596 if 'file:' in pileupSpec: 00597 #the file is local 00598 self.process.load(mixingDict['file']) 00599 print "inlining mixing module configuration" 00600 self._options.inlineObjets+=',mix' 00601 else: 00602 self.loadAndRemember(mixingDict['file']) 00603 00604 mixingDict.pop('file') 00605 if self._options.pileup_input: 00606 if self._options.pileup_input.startswith('dbs'): 00607 mixingDict['F']=filesFromDBSQuery('find file where dataset = %s'%(self._options.pileup_input[4:],))[0] 00608 else: 00609 mixingDict['F']=self._options.pileup_input.split(',') 00610 specialization=defineMixing(mixingDict,'FASTSIM' in self.stepMap) 00611 for command in specialization: 00612 self.executeAndRemember(command) 00613 if len(mixingDict)!=0: 00614 raise Exception('unused mixing specification: '+mixingDict.keys().__str__()) 00615 00616 00617 # load the geometry file 00618 try: 00619 if len(self.stepMap): 00620 self.loadAndRemember(self.GeometryCFF) 00621 if 'SIM' in self.stepMap or 'reSIM' in self.stepMap: 00622 self.loadAndRemember(self.SimGeometryCFF) 00623 if self.geometryDBLabel: 00624 self.executeAndRemember('process.XMLFromDBSource.label = cms.string("%s")'%(self.geometryDBLabel)) 00625 except ImportError: 00626 print "Geometry option",self._options.geometry,"unknown." 00627 raise 00628 00629 if len(self.stepMap): 00630 self.loadAndRemember(self.magFieldCFF) 00631 00632 # what steps are provided by this class? 00633 stepList = [re.sub(r'^prepare_', '', methodName) for methodName in ConfigBuilder.__dict__ if methodName.startswith('prepare_')] 00634 00635 ### Benedikt can we add here a check that assure that we are going to generate a correct config file? 00636 ### i.e. the harvesting do not have to include other step...... 00637 00638 # look which steps are requested and invoke the corresponding method 00639 for step in self._options.step.split(","): 00640 if step == "": 00641 continue 00642 print step 00643 if step.startswith('re'): 00644 ##add the corresponding input content 00645 if step[2:] not in self._options.donotDropOnInput: 00646 self._options.inputEventContent='%s,%s'%(step.split(":")[0].upper(),self._options.inputEventContent) 00647 step=step[2:] 00648 stepParts = step.split(":") # for format STEP:alternativeSequence 00649 stepName = stepParts[0] 00650 if stepName not in stepList: 00651 raise ValueError("Step "+stepName+" unknown") 00652 if len(stepParts)==1: 00653 getattr(self,"prepare_"+step)(sequence = getattr(self,step+"DefaultSeq")) 00654 elif len(stepParts)==2: 00655 getattr(self,"prepare_"+stepName)(sequence = stepParts[1]) 00656 elif len(stepParts)==3: 00657 getattr(self,"prepare_"+stepName)(sequence = stepParts[1]+','+stepParts[2]) 00658 00659 else: 00660 raise ValueError("Step definition "+step+" invalid") 00661 00662 if self._options.restoreRNDSeeds!=False: 00663 #it is either True, or a process name 00664 if self._options.restoreRNDSeeds==True: 00665 self.executeAndRemember('process.RandomNumberGeneratorService.restoreStateLabel=cms.untracked.string("randomEngineStateProducer")') 00666 else: 00667 self.executeAndRemember('process.RandomNumberGeneratorService.restoreStateTag=cms.untracked.InputTag("randomEngineStateProducer","","%s")'%(self._options.restoreRNDSeeds)) 00668 if self._options.inputEventContent or self._options.inputCommands: 00669 if self._options.inputCommands: 00670 self._options.inputCommands+='keep *_randomEngineStateProducer_*_*,' 00671 else: 00672 self._options.inputCommands='keep *_randomEngineStateProducer_*_*,' 00673
def ConfigBuilder::ConfigBuilder::build_production_info | ( | self, | |
evt_type, | |||
evtnumber | |||
) |
Add useful info for the production.
Definition at line 1774 of file ConfigBuilder.py.
01775 : 01776 """ Add useful info for the production. """ 01777 self.process.configurationMetadata=cms.untracked.PSet\ 01778 (version=cms.untracked.string("$Revision: 1.381.2.1 $"), 01779 name=cms.untracked.string("PyReleaseValidation"), 01780 annotation=cms.untracked.string(evt_type+ " nevts:"+str(evtnumber)) 01781 ) 01782 01783 self.addedObjects.append(("Production Info","configurationMetadata")) 01784
def ConfigBuilder::ConfigBuilder::define_Configs | ( | self | ) |
Definition at line 826 of file ConfigBuilder.py.
00827 : 00828 if len(self.stepMap): 00829 self.loadAndRemember('Configuration/StandardSequences/Services_cff') 00830 if self._options.particleTable not in defaultOptions.particleTableList: 00831 print 'Invalid particle table provided. Options are:' 00832 print defaultOptions.particleTable 00833 sys.exit(-1) 00834 else: 00835 if len(self.stepMap): 00836 self.loadAndRemember('SimGeneral.HepPDTESSource.'+self._options.particleTable+'_cfi') 00837 00838 self.loadAndRemember('FWCore/MessageService/MessageLogger_cfi') 00839 00840 self.ALCADefaultCFF="Configuration/StandardSequences/AlCaRecoStreams_cff" 00841 self.GENDefaultCFF="Configuration/StandardSequences/Generator_cff" 00842 self.SIMDefaultCFF="Configuration/StandardSequences/Sim_cff" 00843 self.DIGIDefaultCFF="Configuration/StandardSequences/Digi_cff" 00844 self.DIGI2RAWDefaultCFF="Configuration/StandardSequences/DigiToRaw_cff" 00845 self.L1EMDefaultCFF='Configuration/StandardSequences/SimL1Emulator_cff' 00846 self.L1MENUDefaultCFF="Configuration/StandardSequences/L1TriggerDefaultMenu_cff" 00847 self.HLTDefaultCFF="Configuration/StandardSequences/HLTtable_cff" 00848 self.RAW2DIGIDefaultCFF="Configuration/StandardSequences/RawToDigi_Data_cff" 00849 self.L1RecoDefaultCFF="Configuration/StandardSequences/L1Reco_cff" 00850 self.RECODefaultCFF="Configuration/StandardSequences/Reconstruction_Data_cff" 00851 self.SKIMDefaultCFF="Configuration/StandardSequences/Skims_cff" 00852 self.POSTRECODefaultCFF="Configuration/StandardSequences/PostRecoGenerator_cff" 00853 self.VALIDATIONDefaultCFF="Configuration/StandardSequences/Validation_cff" 00854 self.L1HwValDefaultCFF = "Configuration/StandardSequences/L1HwVal_cff" 00855 self.DQMOFFLINEDefaultCFF="DQMOffline/Configuration/DQMOffline_cff" 00856 self.HARVESTINGDefaultCFF="Configuration/StandardSequences/Harvesting_cff" 00857 self.ALCAHARVESTDefaultCFF="Configuration/StandardSequences/AlCaHarvesting_cff" 00858 self.ENDJOBDefaultCFF="Configuration/StandardSequences/EndOfProcess_cff" 00859 self.ConditionsDefaultCFF = "Configuration/StandardSequences/FrontierConditions_GlobalTag_cff" 00860 self.CFWRITERDefaultCFF = "Configuration/StandardSequences/CrossingFrameWriter_cff" 00861 self.REPACKDefaultCFF="Configuration/StandardSequences/DigiToRaw_Repack_cff" 00862 00863 if "DATAMIX" in self.stepMap.keys(): 00864 self.DATAMIXDefaultCFF="Configuration/StandardSequences/DataMixer"+self._options.datamix+"_cff" 00865 self.DIGIDefaultCFF="Configuration/StandardSequences/DigiDM_cff" 00866 self.DIGI2RAWDefaultCFF="Configuration/StandardSequences/DigiToRawDM_cff" 00867 self.L1EMDefaultCFF='Configuration/StandardSequences/SimL1EmulatorDM_cff' 00868 00869 self.ALCADefaultSeq=None 00870 self.SIMDefaultSeq=None 00871 self.GENDefaultSeq='pgen' 00872 self.DIGIDefaultSeq='pdigi' 00873 self.DATAMIXDefaultSeq=None 00874 self.DIGI2RAWDefaultSeq='DigiToRaw' 00875 self.HLTDefaultSeq='GRun' 00876 self.L1DefaultSeq=None 00877 self.L1REPACKDefaultSeq='GT' 00878 self.HARVESTINGDefaultSeq=None 00879 self.ALCAHARVESTDefaultSeq=None 00880 self.CFWRITERDefaultSeq=None 00881 self.RAW2DIGIDefaultSeq='RawToDigi' 00882 self.L1RecoDefaultSeq='L1Reco' 00883 if 'RAW2DIGI' in self.stepMap and 'RECO' in self.stepMap: 00884 self.RECODefaultSeq='reconstruction' 00885 else: 00886 self.RECODefaultSeq='reconstruction_fromRECO' 00887 00888 self.POSTRECODefaultSeq=None 00889 self.L1HwValDefaultSeq='L1HwVal' 00890 self.DQMDefaultSeq='DQMOffline' 00891 self.FASTSIMDefaultSeq='all' 00892 self.VALIDATIONDefaultSeq='' 00893 self.PATLayer0DefaultSeq='all' 00894 self.ENDJOBDefaultSeq='endOfProcess' 00895 self.REPACKDefaultSeq='DigiToRawRepack' 00896 00897 self.EVTCONTDefaultCFF="Configuration/EventContent/EventContent_cff" 00898 00899 # if fastsim switch event content 00900 if "FASTSIM" in self.stepMap.keys(): 00901 self.GENDefaultSeq='pgen_genonly' 00902 self.EVTCONTDefaultCFF = "FastSimulation/Configuration/EventContent_cff" 00903 self.VALIDATIONDefaultCFF = "FastSimulation.Configuration.Validation_cff" 00904 00905 if not self._options.beamspot: 00906 self._options.beamspot=VtxSmearedDefaultKey 00907 00908 # if its MC then change the raw2digi 00909 if self._options.isMC==True: 00910 self.RAW2DIGIDefaultCFF="Configuration/StandardSequences/RawToDigi_cff" 00911 self.RECODefaultCFF="Configuration/StandardSequences/Reconstruction_cff" 00912 self.DQMOFFLINEDefaultCFF="DQMOffline/Configuration/DQMOfflineMC_cff" 00913 self.ALCADefaultCFF="Configuration/StandardSequences/AlCaRecoStreamsMC_cff" 00914 else: 00915 self._options.beamspot = None 00916 00917 #patch for gen, due to backward incompatibility 00918 if 'reGEN' in self.stepMap: 00919 self.GENDefaultSeq='fixGenInfo' 00920 00921 if self._options.scenario=='nocoll' or self._options.scenario=='cosmics': 00922 self.SIMDefaultCFF="Configuration/StandardSequences/SimNOBEAM_cff" 00923 self._options.beamspot='NoSmear' 00924 00925 if self._options.scenario=='cosmics': 00926 self.DIGIDefaultCFF="Configuration/StandardSequences/DigiCosmics_cff" 00927 self.RECODefaultCFF="Configuration/StandardSequences/ReconstructionCosmics_cff" 00928 self.SKIMDefaultCFF="Configuration/StandardSequences/SkimsCosmics_cff" 00929 self.EVTCONTDefaultCFF="Configuration/EventContent/EventContentCosmics_cff" 00930 self.DQMOFFLINEDefaultCFF="DQMOffline/Configuration/DQMOfflineCosmics_cff" 00931 if self._options.isMC==True: 00932 self.DQMOFFLINEDefaultCFF="DQMOffline/Configuration/DQMOfflineCosmicsMC_cff" 00933 self.HARVESTINGDefaultCFF="Configuration/StandardSequences/HarvestingCosmics_cff" 00934 self.RECODefaultSeq='reconstructionCosmics' 00935 self.DQMDefaultSeq='DQMOfflineCosmics' 00936 00937 if self._options.himix: 00938 print "From the presence of the himix option, we have determined that this is heavy ions and will use '--scenario HeavyIons'." 00939 self._options.scenario='HeavyIons' 00940 00941 if self._options.scenario=='HeavyIons': 00942 if not self._options.beamspot: 00943 self._options.beamspot=VtxSmearedHIDefaultKey 00944 self.HLTDefaultSeq = 'HIon' 00945 if not self._options.himix: 00946 self.GENDefaultSeq='pgen_hi' 00947 else: 00948 self.GENDefaultSeq='pgen_himix' 00949 self.VALIDATIONDefaultCFF="Configuration/StandardSequences/ValidationHeavyIons_cff" 00950 self.VALIDATIONDefaultSeq='' 00951 self.EVTCONTDefaultCFF="Configuration/EventContent/EventContentHeavyIons_cff" 00952 self.RECODefaultCFF="Configuration/StandardSequences/ReconstructionHeavyIons_cff" 00953 self.RECODefaultSeq='reconstructionHeavyIons' 00954 self.ALCADefaultCFF = "Configuration/StandardSequences/AlCaRecoStreamsHeavyIons_cff" 00955 self.DQMOFFLINEDefaultCFF="DQMOffline/Configuration/DQMOfflineHeavyIons_cff" 00956 self.DQMDefaultSeq='DQMOfflineHeavyIons' 00957 self.SKIMDefaultCFF="Configuration/StandardSequences/SkimsHeavyIons_cff" 00958 self.HARVESTINGDefaultCFF="Configuration/StandardSequences/HarvestingHeavyIons_cff" 00959 if self._options.isMC==True: 00960 self.DQMOFFLINEDefaultCFF="DQMOffline/Configuration/DQMOfflineHeavyIonsMC_cff" 00961 00962 00963 self.RAW2RECODefaultSeq=','.join([self.RAW2DIGIDefaultSeq,self.RECODefaultSeq]) 00964 00965 self.USERDefaultSeq='user' 00966 self.USERDefaultCFF=None 00967 00968 # the magnetic field 00969 if self._options.isData: 00970 if self._options.magField==defaultOptions.magField: 00971 print "magnetic field option forced to: AutoFromDBCurrent" 00972 self._options.magField='AutoFromDBCurrent' 00973 self.magFieldCFF = 'Configuration/StandardSequences/MagneticField_'+self._options.magField.replace('.','')+'_cff' 00974 self.magFieldCFF = self.magFieldCFF.replace("__",'_') 00975 00976 # the geometry 00977 self.GeometryCFF='Configuration/StandardSequences/GeometryRecoDB_cff' 00978 self.geometryDBLabel=None 00979 simGeometry='' 00980 if 'FASTSIM' in self.stepMap: 00981 if 'start' in self._options.conditions.lower(): 00982 self.GeometryCFF='FastSimulation/Configuration/Geometries_START_cff' 00983 else: 00984 self.GeometryCFF='FastSimulation/Configuration/Geometries_MC_cff' 00985 else: 00986 def inGeometryKeys(opt): 00987 from Configuration.StandardSequences.GeometryConf import GeometryConf 00988 if opt in GeometryConf: 00989 return GeometryConf[opt] 00990 else: 00991 return opt 00992 00993 geoms=self._options.geometry.split(',') 00994 if len(geoms)==1: geoms=inGeometryKeys(geoms[0]).split(',') 00995 if len(geoms)==2: 00996 #may specify the reco geometry 00997 if '/' in geoms[1] or '_cff' in geoms[1]: 00998 self.GeometryCFF=geoms[1] 00999 else: 01000 self.GeometryCFF='Configuration/StandardSequences/Geometry'+geoms[1]+'_cff' 01001 01002 if (geoms[0].startswith('DB:')): 01003 self.SimGeometryCFF='Configuration/StandardSequences/GeometrySimDB_cff' 01004 self.geometryDBLabel=geoms[0][3:] 01005 print "with DB:" 01006 else: 01007 if '/' in geoms[0] or '_cff' in geoms[0]: 01008 self.SimGeometryCFF=geoms[0] 01009 else: 01010 simGeometry=geoms[0] 01011 if self._options.gflash==True: 01012 self.SimGeometryCFF='Configuration/StandardSequences/Geometry'+geoms[0]+'GFlash_cff' 01013 else: 01014 self.SimGeometryCFF='Configuration/StandardSequences/Geometry'+geoms[0]+'_cff' 01015 01016 # synchronize the geometry configuration and the FullSimulation sequence to be used 01017 if simGeometry not in defaultOptions.geometryExtendedOptions: 01018 self.SIMDefaultCFF="Configuration/StandardSequences/SimIdeal_cff" 01019 01020 # Mixing 01021 if self._options.pileup=='default': 01022 from Configuration.StandardSequences.Mixing import MixingDefaultKey,MixingFSDefaultKey 01023 if 'FASTSIM' in self.stepMap: 01024 self._options.pileup=MixingFSDefaultKey 01025 else: 01026 self._options.pileup=MixingDefaultKey 01027 01028 #not driven by a default cff anymore 01029 if self._options.isData: 01030 self._options.pileup=None 01031 if self._options.isMC==True and self._options.himix==False: 01032 if 'FASTSIM' in self.stepMap: 01033 self._options.pileup='FS_'+self._options.pileup 01034 elif self._options.isMC==True and self._options.himix==True: 01035 self._options.pileup='HiMix' 01036 01037 01038 if self._options.slhc: 01039 if 'stdgeom' not in self._options.slhc: 01040 self.SimGeometryCFF='SLHCUpgradeSimulations.Geometry.%s_cmsSimIdealGeometryXML_cff'%(self._options.slhc,) 01041 self.DIGIDefaultCFF='SLHCUpgradeSimulations/Geometry/Digi_%s_cff'%(self._options.slhc,) 01042 if self._options.pileup!=defaultOptions.pileup: 01043 self._options.pileup='SLHC_%s_%s'%(self._options.pileup,self._options.slhc) 01044 01045 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 1614 of file ConfigBuilder.py.
01615 : 01616 maxLevel=20 01617 level=0 01618 while '@' in repr(seqList) and level<maxLevel: 01619 level+=1 01620 for specifiedCommand in seqList: 01621 if specifiedCommand.startswith('@'): 01622 location=specifiedCommand[1:] 01623 if not location in mapping: 01624 raise Exception("Impossible to map "+location+" from "+repr(mapping)) 01625 mappedTo=mapping[location] 01626 if index!=None: 01627 mappedTo=mappedTo[index] 01628 seqList.remove(specifiedCommand) 01629 seqList.extend(mappedTo.split('+')) 01630 break; 01631 if level==maxLevel: 01632 raise Exception("Could not fully expand "+repr(seqList)+" from "+repr(mapping))
def ConfigBuilder::ConfigBuilder::finalizeFastSimHLT | ( | self | ) |
Definition at line 1725 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 1112 of file ConfigBuilder.py.
01113 : 01114 if ( len(sequence.split('.'))==1 ): 01115 l=self.loadAndRemember(defaultCFF) 01116 elif ( len(sequence.split('.'))==2 ): 01117 l=self.loadAndRemember(sequence.split('.')[0]) 01118 sequence=sequence.split('.')[1] 01119 else: 01120 print "sub sequence configuration must be of the form dir/subdir/cff.a+b+c or cff.a" 01121 print sequence,"not recognized" 01122 raise 01123 return l
def ConfigBuilder::ConfigBuilder::prepare | ( | self, | |
doChecking = False |
|||
) |
Prepare the configuration string and add missing pieces.
Definition at line 1785 of file ConfigBuilder.py.
01786 : 01787 """ Prepare the configuration string and add missing pieces.""" 01788 01789 self.loadAndRemember(self.EVTCONTDefaultCFF) #load the event contents regardless 01790 self.addMaxEvents() 01791 self.addStandardSequences() 01792 if self.with_input: 01793 self.addSource() 01794 self.addConditions() 01795 01796 01797 outputModuleCfgCode="" 01798 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: 01799 outputModuleCfgCode=self.addOutput() 01800 01801 self.addCommon() 01802 01803 self.pythonCfgCode = "# Auto generated configuration file\n" 01804 self.pythonCfgCode += "# using: \n# "+__version__[1:-1]+"\n# "+__source__[1:-1]+'\n' 01805 self.pythonCfgCode += "# with command line options: "+self._options.arguments+'\n' 01806 self.pythonCfgCode += "import FWCore.ParameterSet.Config as cms\n\n" 01807 self.pythonCfgCode += "process = cms.Process('"+self.process.name_()+"')\n\n" 01808 01809 self.pythonCfgCode += "# import of standard configurations\n" 01810 for module in self.imports: 01811 self.pythonCfgCode += ("process.load('"+module+"')\n") 01812 01813 # production info 01814 if not hasattr(self.process,"configurationMetadata"): 01815 self.build_production_info(self._options.evt_type, self._options.number) 01816 else: 01817 #the PSet was added via a load 01818 self.addedObjects.append(("Production Info","configurationMetadata")) 01819 01820 self.pythonCfgCode +="\n" 01821 for comment,object in self.addedObjects: 01822 if comment!="": 01823 self.pythonCfgCode += "\n# "+comment+"\n" 01824 self.pythonCfgCode += dumpPython(self.process,object) 01825 01826 # dump the output definition 01827 self.pythonCfgCode += "\n# Output definition\n" 01828 self.pythonCfgCode += outputModuleCfgCode 01829 01830 # dump all additional outputs (e.g. alca or skim streams) 01831 self.pythonCfgCode += "\n# Additional output definition\n" 01832 #I do not understand why the keys are not normally ordered. 01833 nl=self.additionalOutputs.keys() 01834 nl.sort() 01835 for name in nl: 01836 output = self.additionalOutputs[name] 01837 self.pythonCfgCode += "process.%s = %s" %(name, output.dumpPython()) 01838 tmpOut = cms.EndPath(output) 01839 setattr(self.process,name+'OutPath',tmpOut) 01840 self.schedule.append(tmpOut) 01841 01842 # dump all additional commands 01843 self.pythonCfgCode += "\n# Other statements\n" 01844 for command in self.additionalCommands: 01845 self.pythonCfgCode += command + "\n" 01846 01847 #comma separated list of objects that deserve to be inlined in the configuration (typically from a modified config deep down) 01848 for object in self._options.inlineObjets.split(','): 01849 if not object: 01850 continue 01851 if not hasattr(self.process,object): 01852 print 'cannot inline -'+object+'- : not known' 01853 else: 01854 self.pythonCfgCode +='\n' 01855 self.pythonCfgCode +=dumpPython(self.process,object) 01856 01857 # dump all paths 01858 self.pythonCfgCode += "\n# Path and EndPath definitions\n" 01859 for path in self.process.paths: 01860 if getattr(self.process,path) not in self.blacklist_paths: 01861 self.pythonCfgCode += dumpPython(self.process,path) 01862 01863 for endpath in self.process.endpaths: 01864 if getattr(self.process,endpath) not in self.blacklist_paths: 01865 self.pythonCfgCode += dumpPython(self.process,endpath) 01866 01867 # dump the schedule 01868 self.pythonCfgCode += "\n# Schedule definition\n" 01869 result = "process.schedule = cms.Schedule(" 01870 01871 # handling of the schedule 01872 self.process.schedule = cms.Schedule() 01873 for item in self.schedule: 01874 if not isinstance(item, cms.Schedule): 01875 self.process.schedule.append(item) 01876 else: 01877 self.process.schedule.extend(item) 01878 01879 if hasattr(self.process,"HLTSchedule"): 01880 beforeHLT = self.schedule[:self.schedule.index(self.process.HLTSchedule)] 01881 afterHLT = self.schedule[self.schedule.index(self.process.HLTSchedule)+1:] 01882 pathNames = ['process.'+p.label_() for p in beforeHLT] 01883 result += ','.join(pathNames)+')\n' 01884 result += 'process.schedule.extend(process.HLTSchedule)\n' 01885 pathNames = ['process.'+p.label_() for p in afterHLT] 01886 result += 'process.schedule.extend(['+','.join(pathNames)+'])\n' 01887 else: 01888 pathNames = ['process.'+p.label_() for p in self.schedule] 01889 result ='process.schedule = cms.Schedule('+','.join(pathNames)+')\n' 01890 01891 self.pythonCfgCode += result 01892 01893 #repacked version 01894 if self._options.isRepacked: 01895 self.pythonCfgCode +="\n" 01896 self.pythonCfgCode +="from Configuration.PyReleaseValidation.ConfigBuilder import MassReplaceInputTag\n" 01897 self.pythonCfgCode +="MassReplaceInputTag(process)\n" 01898 MassReplaceInputTag(self.process) 01899 01900 # special treatment in case of production filter sequence 2/2 01901 if self.productionFilterSequence: 01902 self.pythonCfgCode +='# filter all path with the production filter sequence\n' 01903 self.pythonCfgCode +='for path in process.paths:\n' 01904 self.pythonCfgCode +='\tgetattr(process,path)._seq = process.%s * getattr(process,path)._seq \n'%(self.productionFilterSequence,) 01905 pfs = getattr(self.process,self.productionFilterSequence) 01906 for path in self.process.paths: 01907 getattr(self.process,path)._seq = pfs * getattr(self.process,path)._seq 01908 01909 # dump customise fragment 01910 self.pythonCfgCode += self.addCustomise() 01911 01912 # make the .io file 01913 01914 if self._options.io: 01915 #io=open(self._options.python_filename.replace('.py','.io'),'w') 01916 if not self._options.io.endswith('.io'): self._option.io+='.io' 01917 io=open(self._options.io,'w') 01918 ioJson={} 01919 if hasattr(self.process.source,"fileNames"): 01920 if len(self.process.source.fileNames.value()): 01921 ioJson['primary']=self.process.source.fileNames.value() 01922 if hasattr(self.process.source,"secondaryFileNames"): 01923 if len(self.process.source.secondaryFileNames.value()): 01924 ioJson['secondary']=self.process.source.secondaryFileNames.value() 01925 01926 for (o,om) in self.process.outputModules_().items(): 01927 ioJson[o]=om.fileName.value() 01928 ioJson['GT']=self._options.conditions 01929 import json 01930 io.write(json.dumps(ioJson)) 01931 return 01932 01933 01934
def ConfigBuilder::ConfigBuilder::prepare_ALCA | ( | self, | |
sequence = None , |
|||
workflow = 'full' |
|||
) |
Enrich the process with alca streams
Definition at line 1157 of file ConfigBuilder.py.
01158 : 01159 """ Enrich the process with alca streams """ 01160 alcaConfig=self.loadDefaultOrSpecifiedCFF(sequence,self.ALCADefaultCFF) 01161 sequence = sequence.split('.')[-1] 01162 01163 # decide which ALCA paths to use 01164 alcaList = sequence.split("+") 01165 maxLevel=0 01166 from Configuration.AlCa.autoAlca import autoAlca 01167 # support @X from autoAlca.py, and recursion support: i.e T0:@Mu+@EG+... 01168 self.expandMapping(alcaList,autoAlca) 01169 01170 for name in alcaConfig.__dict__: 01171 alcastream = getattr(alcaConfig,name) 01172 shortName = name.replace('ALCARECOStream','') 01173 if shortName in alcaList and isinstance(alcastream,cms.FilteredStream): 01174 output = self.addExtraStream(name,alcastream, workflow = workflow) 01175 if 'DQM' in alcaList: 01176 if not self._options.inlineEventContent and hasattr(self.process,name): 01177 self.executeAndRemember('process.' + name + '.outputCommands.append("keep *_MEtoEDMConverter_*_*")') 01178 else: 01179 output.outputCommands.append("keep *_MEtoEDMConverter_*_*") 01180 01181 #rename the HLT process name in the alca modules 01182 if self._options.hltProcess or 'HLT' in self.stepMap: 01183 if isinstance(alcastream.paths,tuple): 01184 for path in alcastream.paths: 01185 self.renameHLTprocessInSequence(path.label()) 01186 else: 01187 self.renameHLTprocessInSequence(alcastream.paths.label()) 01188 01189 for i in range(alcaList.count(shortName)): 01190 alcaList.remove(shortName) 01191 01192 # DQM needs a special handling 01193 elif name == 'pathALCARECODQM' and 'DQM' in alcaList: 01194 path = getattr(alcaConfig,name) 01195 self.schedule.append(path) 01196 alcaList.remove('DQM') 01197 01198 if isinstance(alcastream,cms.Path): 01199 #black list the alca path so that they do not appear in the cfg 01200 self.blacklist_paths.append(alcastream) 01201 01202 01203 if len(alcaList) != 0: 01204 available=[] 01205 for name in alcaConfig.__dict__: 01206 alcastream = getattr(alcaConfig,name) 01207 if isinstance(alcastream,cms.FilteredStream): 01208 available.append(name.replace('ALCARECOStream','')) 01209 print "The following alcas could not be found "+str(alcaList) 01210 print "available ",available 01211 #print "verify your configuration, ignoring for now" 01212 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 1696 of file ConfigBuilder.py.
01697 : 01698 """ Enrich the process with AlCaHarvesting step """ 01699 harvestingConfig = self.loadAndRemember(self.ALCAHARVESTDefaultCFF) 01700 sequence=sequence.split(".")[-1] 01701 01702 # decide which AlcaHARVESTING paths to use 01703 harvestingList = sequence.split("+") 01704 for name in harvestingConfig.__dict__: 01705 harvestingstream = getattr(harvestingConfig,name) 01706 if name in harvestingList and isinstance(harvestingstream,cms.Path): 01707 self.schedule.append(harvestingstream) 01708 self.executeAndRemember("process.PoolDBOutputService.toPut.append(process.ALCAHARVEST" + name + "_dbOutput)") 01709 self.executeAndRemember("process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVEST" + name + "_metadata)") 01710 harvestingList.remove(name) 01711 # append the common part at the end of the sequence 01712 lastStep = getattr(harvestingConfig,"ALCAHARVESTDQMSaveAndMetadataWriter") 01713 self.schedule.append(lastStep) 01714 01715 if len(harvestingList) != 0 and 'dummyHarvesting' not in harvestingList : 01716 print "The following harvesting could not be found : ", harvestingList 01717 raise Exception("The following harvesting could not be found : "+str(harvestingList)) 01718 01719
def ConfigBuilder::ConfigBuilder::prepare_ALCAOUTPUT | ( | self, | |
sequence = None |
|||
) |
Definition at line 1154 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_ALCAPRODUCER | ( | self, | |
sequence = None |
|||
) |
Definition at line 1151 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_CFWRITER | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the crossing frame writer step
Definition at line 1313 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_DATAMIX | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the digitisation step
Definition at line 1319 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_DIGI | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the digitisation step
Definition at line 1300 of file ConfigBuilder.py.
01301 : 01302 """ Enrich the schedule with the digitisation step""" 01303 self.loadDefaultOrSpecifiedCFF(sequence,self.DIGIDefaultCFF) 01304 01305 if self._options.gflash==True: 01306 self.loadAndRemember("Configuration/StandardSequences/GFlashDIGI_cff") 01307 01308 if self._options.himix==True: 01309 self.loadAndRemember("SimGeneral/MixingModule/himixDIGI_cff") 01310 01311 self.scheduleSequence(sequence.split('.')[-1],'digitisation_step') 01312 return
def ConfigBuilder::ConfigBuilder::prepare_DIGI2RAW | ( | self, | |
sequence = None |
|||
) |
Definition at line 1325 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_DQM | ( | self, | |
sequence = 'DQMOffline' |
|||
) |
Definition at line 1633 of file ConfigBuilder.py.
01634 : 01635 # this one needs replacement 01636 01637 self.loadDefaultOrSpecifiedCFF(sequence,self.DQMOFFLINEDefaultCFF) 01638 sequenceList=sequence.split('.')[-1].split('+') 01639 from DQMOffline.Configuration.autoDQM import autoDQM 01640 self.expandMapping(sequenceList,autoDQM,index=0) 01641 01642 if len(set(sequenceList))!=len(sequenceList): 01643 sequenceList=list(set(sequenceList)) 01644 print "Duplicate entries for DQM:, using",sequenceList 01645 pathName='dqmoffline_step' 01646 01647 for (i,sequence) in enumerate(sequenceList): 01648 if (i!=0): 01649 pathName='dqmoffline_%d_step'%(i) 01650 01651 if 'HLT' in self.stepMap.keys() or self._options.hltProcess: 01652 self.renameHLTprocessInSequence(sequence) 01653 01654 # if both HLT and DQM are run in the same process, schedule [HLT]DQM in an EndPath 01655 if 'HLT' in self.stepMap.keys(): 01656 # need to put [HLT]DQM in an EndPath, to access the HLT trigger results 01657 setattr(self.process,pathName, cms.EndPath( getattr(self.process, sequence ) ) ) 01658 else: 01659 # schedule DQM as a standard Path 01660 setattr(self.process,pathName, cms.Path( getattr(self.process, sequence) ) ) 01661 self.schedule.append(getattr(self.process,pathName)) 01662
def ConfigBuilder::ConfigBuilder::prepare_ENDJOB | ( | self, | |
sequence = 'endOfProcess' |
|||
) |
Definition at line 1720 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_FASTSIM | ( | self, | |
sequence = "all" |
|||
) |
Enrich the schedule with fastsim
Definition at line 1729 of file ConfigBuilder.py.
01730 : 01731 """Enrich the schedule with fastsim""" 01732 self.loadAndRemember("FastSimulation/Configuration/FamosSequences_cff") 01733 01734 if sequence in ('all','allWithHLTFiltering',''): 01735 if not 'HLT' in self.stepMap.keys(): 01736 self.prepare_HLT(sequence=None) 01737 01738 self.executeAndRemember("process.famosSimHits.SimulateCalorimetry = True") 01739 self.executeAndRemember("process.famosSimHits.SimulateTracking = True") 01740 01741 self.executeAndRemember("process.simulation = cms.Sequence(process.simulationWithFamos)") 01742 self.executeAndRemember("process.HLTEndSequence = cms.Sequence(process.reconstructionWithFamos)") 01743 01744 # since we have HLT here, the process should be called HLT 01745 self._options.name = "HLT" 01746 01747 # if we don't want to filter after HLT but simulate everything regardless of what HLT tells, we have to add reconstruction explicitly 01748 if sequence == 'all' and not 'HLT' in self.stepMap.keys(): #(a) 01749 self.finalizeFastSimHLT() 01750 elif sequence == 'famosWithEverything': 01751 self.process.fastsim_step = cms.Path( getattr(self.process, "famosWithEverything") ) 01752 self.schedule.append(self.process.fastsim_step) 01753 01754 # now the additional commands we need to make the config work 01755 self.executeAndRemember("process.VolumeBasedMagneticFieldESProducer.useParametrizedTrackerField = True") 01756 else: 01757 print "FastSim setting", sequence, "unknown." 01758 raise ValueError 01759 01760 if 'Flat' in self._options.beamspot: 01761 beamspotType = 'Flat' 01762 elif 'Gauss' in self._options.beamspot: 01763 beamspotType = 'Gaussian' 01764 else: 01765 beamspotType = 'BetaFunc' 01766 self.loadAndRemember('IOMC.EventVertexGenerators.VtxSmearedParameters_cfi') 01767 beamspotName = 'process.%sVtxSmearingParameters' %(self._options.beamspot) 01768 self.executeAndRemember(beamspotName+'.type = cms.string("%s")'%(beamspotType)) 01769 self.executeAndRemember('process.famosSimHits.VertexGenerator = '+beamspotName) 01770 if hasattr(self.process,'famosPileUp'): 01771 self.executeAndRemember('process.famosPileUp.VertexGenerator = '+beamspotName) 01772 01773
def ConfigBuilder::ConfigBuilder::prepare_GEN | ( | self, | |
sequence = None |
|||
) |
load the fragment of generator configuration
Definition at line 1213 of file ConfigBuilder.py.
01214 : 01215 """ load the fragment of generator configuration """ 01216 loadFailure=False 01217 #remove trailing .py 01218 #support old style .cfi by changing into something.cfi into something_cfi 01219 #remove python/ from the name 01220 loadFragment = self._options.evt_type.replace('.py','',).replace('.','_').replace('python/','') 01221 #standard location of fragments 01222 if not '/' in loadFragment: 01223 loadFragment='Configuration.Generator.'+loadFragment 01224 else: 01225 loadFragment=loadFragment.replace('/','.') 01226 try: 01227 print "Loading generator fragment from",loadFragment 01228 __import__(loadFragment) 01229 except: 01230 loadFailure=True 01231 if self.process.source and self.process.source.type_()=='EmptySource': 01232 raise Exception("Neither gen fragment of input files provided: this is an inconsistent GEN step configuration") 01233 01234 if not loadFailure: 01235 generatorModule=sys.modules[loadFragment] 01236 genModules=generatorModule.__dict__ 01237 if self._options.hideGen: 01238 self.loadAndRemember(loadFragment) 01239 else: 01240 self.process.load(loadFragment) 01241 # expose the objects from that fragment to the configuration 01242 import FWCore.ParameterSet.Modules as cmstypes 01243 for name in genModules: 01244 theObject = getattr(generatorModule,name) 01245 if isinstance(theObject, cmstypes._Module): 01246 self._options.inlineObjets=name+','+self._options.inlineObjets 01247 elif isinstance(theObject, cms.Sequence) or isinstance(theObject, cmstypes.ESProducer): 01248 self._options.inlineObjets+=','+name 01249 01250 if sequence == self.GENDefaultSeq or sequence == 'pgen_genonly': 01251 if 'ProductionFilterSequence' in genModules and ('generator' in genModules or 'hiSignal' in genModules): 01252 self.productionFilterSequence = 'ProductionFilterSequence' 01253 elif 'generator' in genModules: 01254 self.productionFilterSequence = 'generator' 01255 01256 """ Enrich the schedule with the rest of the generation step """ 01257 self.loadDefaultOrSpecifiedCFF(sequence,self.GENDefaultCFF) 01258 genSeqName=sequence.split('.')[-1] 01259 01260 if not 'FASTSIM' in self.stepMap: 01261 try: 01262 from Configuration.StandardSequences.VtxSmeared import VtxSmeared 01263 self.loadAndRemember(VtxSmeared[self._options.beamspot]) 01264 except ImportError: 01265 raise Exception("VertexSmearing type or beamspot "+self._options.beamspot+" unknown.") 01266 01267 if self._options.scenario == 'HeavyIons' and self._options.himix: 01268 self.loadAndRemember("SimGeneral/MixingModule/himixGEN_cff") 01269 01270 self.process.generation_step = cms.Path( getattr(self.process,genSeqName) ) 01271 self.schedule.append(self.process.generation_step) 01272 01273 if 'reGEN' in self.stepMap: 01274 #stop here 01275 return 01276 01277 """ Enrich the schedule with the summary of the filter step """ 01278 #the gen filter in the endpath 01279 self.loadAndRemember("GeneratorInterface/Core/genFilterSummary_cff") 01280 self.scheduleSequenceAtEnd('genFilterSummary','genfiltersummary_step') 01281 return
def ConfigBuilder::ConfigBuilder::prepare_HARVESTING | ( | self, | |
sequence = None |
|||
) |
Enrich the process with harvesting step
Definition at line 1663 of file ConfigBuilder.py.
01664 : 01665 """ Enrich the process with harvesting step """ 01666 self.EDMtoMECFF='Configuration/StandardSequences/EDMtoME'+self._options.harvesting+'_cff' 01667 self.loadAndRemember(self.EDMtoMECFF) 01668 self.scheduleSequence('EDMtoME','edmtome_step') 01669 01670 harvestingConfig = self.loadDefaultOrSpecifiedCFF(sequence,self.HARVESTINGDefaultCFF) 01671 sequence = sequence.split('.')[-1] 01672 01673 # decide which HARVESTING paths to use 01674 harvestingList = sequence.split("+") 01675 from DQMOffline.Configuration.autoDQM import autoDQM 01676 self.expandMapping(harvestingList,autoDQM,index=1) 01677 01678 if len(set(harvestingList))!=len(harvestingList): 01679 harvestingList=list(set(harvestingList)) 01680 print "Duplicate entries for HARVESTING, using",harvestingList 01681 01682 for name in harvestingList: 01683 if not name in harvestingConfig.__dict__: 01684 print name,"is not a possible harvesting type. Available are",harvestingConfig.__dict__.keys() 01685 continue 01686 harvestingstream = getattr(harvestingConfig,name) 01687 if isinstance(harvestingstream,cms.Path): 01688 self.schedule.append(harvestingstream) 01689 self.blacklist_paths.append(harvestingstream) 01690 if isinstance(harvestingstream,cms.Sequence): 01691 setattr(self.process,name+"_step",cms.Path(harvestingstream)) 01692 self.schedule.append(getattr(self.process,name+"_step")) 01693 01694 self.scheduleSequence('DQMSaver','dqmsave_step') 01695 return
def ConfigBuilder::ConfigBuilder::prepare_HLT | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the HLT simulation step
Definition at line 1360 of file ConfigBuilder.py.
01361 : 01362 """ Enrich the schedule with the HLT simulation step""" 01363 if not sequence: 01364 print "no specification of the hlt menu has been given, should never happen" 01365 raise Exception('no HLT sequence provided') 01366 else: 01367 if ',' in sequence: 01368 #case where HLT:something:something was provided 01369 self.executeAndRemember('import HLTrigger.Configuration.Utilities') 01370 optionsForHLT = {} 01371 if self._options.scenario == 'HeavyIons': 01372 optionsForHLT['type'] = 'HIon' 01373 else: 01374 optionsForHLT['type'] = 'GRun' 01375 optionsForHLTConfig = ', '.join('%s=%s' % (key, repr(val)) for (key, val) in optionsForHLT.iteritems()) 01376 self.executeAndRemember('process.loadHltConfiguration("%s",%s)'%(sequence.replace(',',':'),optionsForHLTConfig)) 01377 else: 01378 if 'FASTSIM' in self.stepMap: 01379 self.loadAndRemember('HLTrigger/Configuration/HLT_%s_Famos_cff' % sequence) 01380 else: 01381 self.loadAndRemember('HLTrigger/Configuration/HLT_%s_cff' % sequence) 01382 01383 if self._options.name!='HLT': 01384 self.additionalCommands.append('from HLTrigger.Configuration.CustomConfigs import ProcessName') 01385 self.additionalCommands.append('process=ProcessName(process)') 01386 from HLTrigger.Configuration.CustomConfigs import ProcessName 01387 self.process=ProcessName(self.process) 01388 01389 self.schedule.append(self.process.HLTSchedule) 01390 [self.blacklist_paths.append(path) for path in self.process.HLTSchedule if isinstance(path,(cms.Path,cms.EndPath))] 01391 if ('FASTSIM' in self.stepMap and 'HLT' in self.stepMap): 01392 self.finalizeFastSimHLT() 01393
def ConfigBuilder::ConfigBuilder::prepare_L1 | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the L1 simulation step
Definition at line 1335 of file ConfigBuilder.py.
01336 : 01337 """ Enrich the schedule with the L1 simulation step""" 01338 if not sequence: 01339 self.loadAndRemember(self.L1EMDefaultCFF) 01340 else: 01341 # let the L1 package decide for the scenarios available 01342 from L1Trigger.Configuration.ConfigBuilder import getConfigsForScenario 01343 listOfImports = getConfigsForScenario(sequence) 01344 for file in listOfImports: 01345 self.loadAndRemember(file) 01346 self.scheduleSequence('SimL1Emulator','L1simulation_step') 01347 return
def ConfigBuilder::ConfigBuilder::prepare_L1HwVal | ( | self, | |
sequence = 'L1HwVal' |
|||
) |
Enrich the schedule with L1 HW validation
Definition at line 1412 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_L1Reco | ( | self, | |
sequence = "L1Reco" |
|||
) |
Enrich the schedule with L1 reconstruction
Definition at line 1419 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 1348 of file ConfigBuilder.py.
01349 : 01350 """ 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""" 01351 if sequence is not 'GT': 01352 print 'Running the full L1 emulator is not supported yet' 01353 raise Exception('unsupported feature') 01354 if sequence is 'GT': 01355 self.loadAndRemember('Configuration/StandardSequences/SimL1EmulatorRepack_GT_cff') 01356 if self._options.scenario == 'HeavyIons': 01357 self.renameInputTagsInSequence("SimL1Emulator","rawDataCollector","rawDataRepacker") 01358 self.scheduleSequence('SimL1Emulator','L1simulation_step') 01359
def ConfigBuilder::ConfigBuilder::prepare_POSTRECO | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the postreco step
Definition at line 1481 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_RAW2DIGI | ( | self, | |
sequence = "RawToDigi" |
|||
) |
Definition at line 1405 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_RAW2RECO | ( | self, | |
sequence = None |
|||
) |
Definition at line 1394 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_RECO | ( | self, | |
sequence = "reconstruction" |
|||
) |
Enrich the schedule with reconstruction
Definition at line 1425 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_REPACK | ( | self, | |
sequence = None |
|||
) |
Definition at line 1330 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_SIM | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the simulation step
Definition at line 1282 of file ConfigBuilder.py.
01283 : 01284 """ Enrich the schedule with the simulation step""" 01285 self.loadAndRemember(self.SIMDefaultCFF) 01286 if self._options.gflash==True: 01287 self.loadAndRemember("Configuration/StandardSequences/GFlashSIM_cff") 01288 01289 if self._options.magField=='0T': 01290 self.executeAndRemember("process.g4SimHits.UseMagneticField = cms.bool(False)") 01291 01292 if self._options.himix==True: 01293 if self._options.geometry in defaultOptions.geometryExtendedOptions: 01294 self.loadAndRemember("SimGeneral/MixingModule/himixSIMExtended_cff") 01295 else: 01296 self.loadAndRemember("SimGeneral/MixingModule/himixSIMIdeal_cff") 01297 01298 self.scheduleSequence('psim','simulation_step') 01299 return
def ConfigBuilder::ConfigBuilder::prepare_SKIM | ( | self, | |
sequence = "all" |
|||
) |
Enrich the schedule with skimming fragments
Definition at line 1431 of file ConfigBuilder.py.
01432 : 01433 ''' Enrich the schedule with skimming fragments''' 01434 skimConfig = self.loadDefaultOrSpecifiedCFF(sequence,self.SKIMDefaultCFF) 01435 sequence = sequence.split('.')[-1] 01436 01437 skimlist=sequence.split('+') 01438 ## support @Mu+DiJet+@Electron configuration via autoSkim.py 01439 from Configuration.Skimming.autoSkim import autoSkim 01440 self.expandMapping(skimlist,autoSkim) 01441 01442 #print "dictionnary for skims:",skimConfig.__dict__ 01443 for skim in skimConfig.__dict__: 01444 skimstream = getattr(skimConfig,skim) 01445 if isinstance(skimstream,cms.Path): 01446 #black list the alca path so that they do not appear in the cfg 01447 self.blacklist_paths.append(skimstream) 01448 if (not isinstance(skimstream,cms.FilteredStream)): 01449 continue 01450 shortname = skim.replace('SKIMStream','') 01451 if (sequence=="all"): 01452 self.addExtraStream(skim,skimstream) 01453 elif (shortname in skimlist): 01454 self.addExtraStream(skim,skimstream) 01455 #add a DQM eventcontent for this guy 01456 if self._options.datatier!="": 01457 self.process.load(self.EVTCONTDefaultCFF) 01458 skimstreamDQM = cms.FilteredStream( 01459 responsible = skimstream.responsible, 01460 name = skimstream.name+'DQM', 01461 paths = skimstream.paths, 01462 selectEvents = skimstream.selectEvents, 01463 content = self._options.datatier+'EventContent', 01464 dataTier = cms.untracked.string(self._options.datatier) 01465 ) 01466 self.addExtraStream(skim+'DQM',skimstreamDQM) 01467 for i in range(skimlist.count(shortname)): 01468 skimlist.remove(shortname) 01469 01470 01471 01472 if (skimlist.__len__()!=0 and sequence!="all"): 01473 print 'WARNING, possible typo with SKIM:'+'+'.join(skimlist) 01474 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 1475 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_VALIDATION | ( | self, | |
sequence = 'validation' |
|||
) |
Definition at line 1488 of file ConfigBuilder.py.
01489 : 01490 self.loadDefaultOrSpecifiedCFF(sequence,self.VALIDATIONDefaultCFF) 01491 #in case VALIDATION:something:somethingelse -> something,somethingelse 01492 sequence=sequence.split('.')[-1] 01493 if sequence.find(',')!=-1: 01494 prevalSeqName=sequence.split(',')[0] 01495 valSeqName=sequence.split(',')[1] 01496 else: 01497 postfix='' 01498 if sequence: 01499 postfix='_'+sequence 01500 prevalSeqName='prevalidation'+postfix 01501 valSeqName='validation'+postfix 01502 if not hasattr(self.process,valSeqName): 01503 prevalSeqName='' 01504 valSeqName=sequence 01505 01506 if not 'DIGI' in self.stepMap and not 'FASTSIM' in self.stepMap and not valSeqName.startswith('genvalid'): 01507 if self._options.restoreRNDSeeds==False and not self._options.restoreRNDSeeds==True: 01508 self._options.restoreRNDSeeds=True 01509 01510 #rename the HLT process in validation steps 01511 if ('HLT' in self.stepMap and not 'FASTSIM' in self.stepMap) or self._options.hltProcess: 01512 self.renameHLTprocessInSequence(valSeqName) 01513 if prevalSeqName: 01514 self.renameHLTprocessInSequence(prevalSeqName) 01515 01516 if prevalSeqName: 01517 self.process.prevalidation_step = cms.Path( getattr(self.process, prevalSeqName ) ) 01518 self.schedule.append(self.process.prevalidation_step) 01519 01520 if valSeqName.startswith('genvalid'): 01521 self.process.validation_step = cms.Path( getattr(self.process,valSeqName ) ) 01522 else: 01523 self.process.validation_step = cms.EndPath( getattr(self.process,valSeqName ) ) 01524 self.schedule.append(self.process.validation_step) 01525 01526 if not 'DIGI' in self.stepMap and not 'FASTSIM' in self.stepMap: 01527 self.executeAndRemember("process.mix.playback = True") 01528 01529 return 01530
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 1600 of file ConfigBuilder.py.
01601 : 01602 if self._options.hltProcess: 01603 proc=self._options.hltProcess 01604 else: 01605 proc=self.process.name_() 01606 if proc==HLTprocess: return 01607 # look up all module in dqm sequence 01608 print "replacing %s process name - sequence %s will use '%s'" % (HLTprocess,sequence, proc) 01609 getattr(self.process,sequence).visit(ConfigBuilder.MassSearchReplaceProcessNameVisitor(HLTprocess,proc,whitelist = ("subSystemFolder",))) 01610 if 'from Configuration.PyReleaseValidation.ConfigBuilder import ConfigBuilder' not in self.additionalCommands: 01611 self.additionalCommands.append('from Configuration.PyReleaseValidation.ConfigBuilder import ConfigBuilder') 01612 self.additionalCommands.append('process.%s.visit(ConfigBuilder.MassSearchReplaceProcessNameVisitor("%s", "%s", whitelist = ("subSystemFolder",)))'% (sequence,HLTprocess, proc)) 01613
def ConfigBuilder::ConfigBuilder::renameInputTagsInSequence | ( | self, | |
sequence, | |||
oldT = "rawDataCollector" , |
|||
newT = "rawDataRepacker" |
|||
) |
Definition at line 1590 of file ConfigBuilder.py.
01591 : 01592 print "Replacing all InputTag %s => %s"%(oldT,newT) 01593 from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag 01594 massSearchReplaceAnyInputTag(getattr(self.process,sequence),oldT,newT) 01595 loadMe='from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag' 01596 if not loadMe in self.additionalCommands: 01597 self.additionalCommands.append(loadMe) 01598 self.additionalCommands.append('massSearchReplaceAnyInputTag(process.%s,"%s","%s",False)'%(sequence,oldT,newT))
def ConfigBuilder::ConfigBuilder::scheduleSequence | ( | self, | |
seq, | |||
prefix, | |||
what = 'Path' |
|||
) |
Definition at line 1124 of file ConfigBuilder.py.
01125 : 01126 if '*' in seq: 01127 #create only one path with all sequences in it 01128 for i,s in enumerate(seq.split('*')): 01129 if i==0: 01130 setattr(self.process,prefix,getattr(cms,what)( getattr(self.process, s) )) 01131 else: 01132 p=getattr(self.process,prefix) 01133 p+=getattr(self.process, s) 01134 self.schedule.append(getattr(self.process,prefix)) 01135 return 01136 else: 01137 #create as many path as many sequences 01138 if not '+' in seq: 01139 setattr(self.process,prefix,getattr(cms,what)( getattr(self.process, seq) )) 01140 self.schedule.append(getattr(self.process,prefix)) 01141 else: 01142 for i,s in enumerate(seq.split('+')): 01143 sn=prefix+'%d'%(i) 01144 setattr(self.process,sn,getattr(cms,what)( getattr(self.process, s) )) 01145 self.schedule.append(getattr(self.process,sn)) 01146 return
def ConfigBuilder::ConfigBuilder::scheduleSequenceAtEnd | ( | self, | |
seq, | |||
prefix | |||
) |
Definition at line 1147 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 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 154 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 1663 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 154 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 154 of file ConfigBuilder.py.
Definition at line 154 of file ConfigBuilder.py.
Definition at line 1785 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 154 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 154 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 826 of file ConfigBuilder.py.
Definition at line 154 of file ConfigBuilder.py.
Definition at line 154 of file ConfigBuilder.py.