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