The main building routines
Definition at line 59 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 62 of file ConfigBuilder.py.
00063 : 00064 """options taken from old cmsDriver and optparse """ 00065 00066 options.outfile_name = options.dirout+options.fileout 00067 00068 self._options = options 00069 00070 if self._options.isData and options.isMC: 00071 raise Exception("ERROR: You may specify only --data or --mc, not both") 00072 if not self._options.conditions: 00073 raise Exception("ERROR: No conditions given!\nPlease specify conditions. E.g. via --conditions=IDEAL_30X::All") 00074 00075 # what steps are provided by this class? 00076 stepList = [re.sub(r'^prepare_', '', methodName) for methodName in ConfigBuilder.__dict__ if methodName.startswith('prepare_')] 00077 self.stepMap={} 00078 for step in self._options.step.split(","): 00079 if step=='': continue 00080 stepParts = step.split(":") 00081 stepName = stepParts[0] 00082 if stepName not in stepList: 00083 raise ValueError("Step "+stepName+" unknown") 00084 if len(stepParts)==1: 00085 self.stepMap[stepName]="" 00086 elif len(stepParts)==2: 00087 self.stepMap[stepName]=stepParts[1].split('+') 00088 elif len(stepParts)==3: 00089 self.stepMap[stepName]=(stepParts[2].split('+'),stepParts[1]) 00090 else: 00091 raise ValueError("Step definition "+step+" invalid") 00092 #print "map of steps is:",self.stepMap 00093 00094 self.with_output = with_output 00095 if hasattr(self._options,"no_output_flag") and self._options.no_output_flag: 00096 self.with_output = False 00097 self.with_input = with_input 00098 if process == None: 00099 self.process = cms.Process(self._options.name) 00100 else: 00101 self.process = process 00102 self.imports = [] 00103 self.define_Configs() 00104 self.schedule = list() 00105 00106 # we are doing three things here: 00107 # creating a process to catch errors 00108 # building the code to re-create the process 00109 00110 self.additionalCommands = [] 00111 # TODO: maybe a list of to be dumped objects would help as well 00112 self.blacklist_paths = [] 00113 self.addedObjects = [] 00114 self.additionalOutputs = {} 00115 00116 self.productionFilterSequence = None 00117 00118
def ConfigBuilder::ConfigBuilder::addCommon | ( | self | ) |
Definition at line 135 of file ConfigBuilder.py.
00136 : 00137 if 'HARVESTING' in self.stepMap.keys() or 'ALCAHARVEST' in self.stepMap.keys(): 00138 self.process.options = cms.untracked.PSet( Rethrow = cms.untracked.vstring('ProductNotFound'),fileMode = cms.untracked.string('FULLMERGE')) 00139 else: 00140 self.process.options = cms.untracked.PSet( ) 00141 self.addedObjects.append(("","options")) 00142 00143 if self._options.lazy_download: 00144 self.process.AdaptorConfig = cms.Service("AdaptorConfig", 00145 stats = cms.untracked.bool(True), 00146 enable = cms.untracked.bool(True), 00147 cacheHint = cms.untracked.string("lazy-download"), 00148 readHint = cms.untracked.string("read-ahead-buffered") 00149 ) 00150 self.addedObjects.append(("Setup lazy download","AdaptorConfig")) 00151 00152 #self.process.cmsDriverCommand = cms.untracked.PSet( command=cms.untracked.string('cmsDriver.py '+self._options.arguments) ) 00153 #self.addedObjects.append(("what cmsDriver command was used","cmsDriverCommand"))
def ConfigBuilder::ConfigBuilder::addConditions | ( | self | ) |
Add conditions to the process
Definition at line 427 of file ConfigBuilder.py.
00428 : 00429 """Add conditions to the process""" 00430 00431 if 'auto:' in self._options.conditions: 00432 from autoCond import autoCond 00433 key=self._options.conditions.split(':')[-1] 00434 if key not in autoCond: 00435 raise Exception('no correspondance for '+self._options.conditions+'\n available keys are'+','.join(autoCond.keys())) 00436 else: 00437 self._options.conditions = autoCond[key] 00438 00439 # the option can be a list of GT name and connection string 00440 00441 #it is insane to keep this replace in: dependency on changes in DataProcessing 00442 conditions = self._options.conditions.replace("FrontierConditions_GlobalTag,",'').split(',') 00443 gtName = str( conditions[0] ) 00444 if len(conditions) > 1: 00445 connect = str( conditions[1] ) 00446 if len(conditions) > 2: 00447 pfnPrefix = str( conditions[2] ) 00448 00449 self.loadAndRemember(self.ConditionsDefaultCFF) 00450 00451 # set the global tag 00452 self.executeAndRemember("process.GlobalTag.globaltag = '%s'" % gtName) 00453 if len(conditions) > 1: 00454 self.executeAndRemember("process.GlobalTag.connect = '%s'" % connect) 00455 if len(conditions) > 2: 00456 self.executeAndRemember("process.GlobalTag.pfnPrefix = cms.untracked.string('%s')" % pfnPrefix) 00457 00458 if self._options.custom_conditions!="": 00459 specs=self._options.custom_conditions.split('+') 00460 self.executeAndRemember("process.GlobalTag.toGet = cms.VPSet()") 00461 for spec in specs: 00462 # format Tag,Rcd,connect+Tag,Rcd+ 00463 spl=spec.split(',') 00464 rcd="" 00465 tag="" 00466 connect="" 00467 if len(spl)>=2: 00468 tag=spl[0] 00469 rcd=spl[1] 00470 if len(spl)==3: 00471 connect=spl[2] 00472 else: 00473 print "cannot interpret GT customisation from ",spec,"within",self._options.custom_conditions 00474 raise 00475 00476 # customise now 00477 if connect=="": 00478 self.executeAndRemember('process.GlobalTag.toGet.append(cms.PSet(record=cms.string("%s"),tag=cms.string("%s")))'%(rcd,tag)) 00479 else: 00480 self.executeAndRemember('process.GlobalTag.toGet.append(cms.PSet(record=cms.string("%s"),tag=cms.string("%s"),connect=cms.untracked.string("%s")))'%(rcd,tag,connect))
def ConfigBuilder::ConfigBuilder::addCustomise | ( | self | ) |
Include the customise code
Definition at line 481 of file ConfigBuilder.py.
00482 : 00483 """Include the customise code """ 00484 00485 custFiles=self._options.customisation_file.split(",") 00486 for i in range(len(custFiles)): 00487 custFiles[i]=custFiles[i].replace('.py','') 00488 custFcn=self._options.cust_function.split(",") 00489 00490 #do a check 00491 if len(custFiles)!=len(custFcn) or self._options.cust_function=="": 00492 custFcn=[] 00493 custFilesNew=[] 00494 #try to do something smart 00495 for spec in custFiles: 00496 spl=spec.split(".") 00497 if len(spl)==2: 00498 custFilesNew.append(spl[0]) 00499 custFcn.append(spl[1]) 00500 else: 00501 custFilesNew.append(spl[0]) 00502 custFcn.append("customise") 00503 custFiles=custFilesNew 00504 00505 if custFcn.count("customise")>=2: 00506 raise Exception("more than one customise function specified with name customise") 00507 00508 if len(custFiles)==0: 00509 final_snippet='\n' 00510 else: 00511 final_snippet='\n# customisation of the process\n' 00512 00513 for test in custFcn: 00514 if custFcn.count(test)!=1: 00515 raise Exception("cannot specify twice "+test+" as a customisation method") 00516 00517 for i,(f,fcn) in enumerate(zip(custFiles,custFcn)): 00518 print "customising the process with",fcn,"from",f 00519 # let python search for that package and do syntax checking at the same time 00520 packageName = f.replace(".py","").replace("/",".") 00521 __import__(packageName) 00522 package = sys.modules[packageName] 00523 00524 if not hasattr(package,fcn): 00525 #bound to fail at run time 00526 raise Exception("config "+f+" has no function "+fcn) 00527 00528 # now ask the package for its definition and pick .py instead of .pyc 00529 customiseFile = re.sub(r'\.pyc$', '.py', package.__file__) 00530 00531 final_snippet+='\n\n# Automatic addition of the customisation function from '+packageName+'\n' 00532 for line in file(customiseFile,'r'): 00533 if "import FWCore.ParameterSet.Config" in line: 00534 continue 00535 final_snippet += line 00536 final_snippet += "\n\nprocess = %s(process)\n"%(fcn,) 00537 00538 final_snippet += '\n\n# End of customisation functions\n' 00539 00540 return final_snippet
def ConfigBuilder::ConfigBuilder::addExtraStream | ( | self, | |
name, | |||
stream, | |||
workflow = 'full' |
|||
) |
Definition at line 714 of file ConfigBuilder.py.
00715 : 00716 # define output module and go from there 00717 output = cms.OutputModule("PoolOutputModule") 00718 if stream.selectEvents.parameters_().__len__()!=0: 00719 output.SelectEvents = stream.selectEvents 00720 else: 00721 output.SelectEvents = cms.untracked.PSet() 00722 output.SelectEvents.SelectEvents=cms.vstring() 00723 if isinstance(stream.paths,tuple): 00724 for path in stream.paths: 00725 output.SelectEvents.SelectEvents.append(path.label()) 00726 else: 00727 output.SelectEvents.SelectEvents.append(stream.paths.label()) 00728 00729 00730 00731 if isinstance(stream.content,str): 00732 output.outputCommands = getattr(self.process,stream.content) 00733 if not self._options.inlineEventContent: 00734 def doNotInlineEventContent(instance,label = "process."+stream.content+".outputCommands"): 00735 return label 00736 output.outputCommands.__dict__["dumpPython"] = doNotInlineEventContent 00737 else: 00738 output.outputCommands = stream.content 00739 00740 00741 output.fileName = cms.untracked.string(self._options.dirout+stream.name+'.root') 00742 00743 output.dataset = cms.untracked.PSet( dataTier = stream.dataTier, 00744 filterName = cms.untracked.string(stream.name)) 00745 00746 if self._options.filtername: 00747 output.dataset.filterName= cms.untracked.string(self._options.filtername+"_"+stream.name) 00748 00749 if workflow in ("producers,full"): 00750 if isinstance(stream.paths,tuple): 00751 for path in stream.paths: 00752 self.schedule.append(path) 00753 else: 00754 self.schedule.append(stream.paths) 00755 00756 # in case of relvals we don't want to have additional outputs 00757 if (not self._options.relval) and workflow in ("full","output"): 00758 self.additionalOutputs[name] = output 00759 setattr(self.process,name,output) 00760 if workflow == 'output': 00761 # adjust the select events to the proper trigger results from previous process 00762 filterList = output.SelectEvents.SelectEvents 00763 for i, filter in enumerate(filterList): 00764 filterList[i] = filter+":"+self._options.triggerResultsProcess 00765
def ConfigBuilder::ConfigBuilder::addMaxEvents | ( | self | ) |
Here we decide how many evts will be processed
Definition at line 154 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::addOutput | ( | self | ) |
Add output module to the process
Definition at line 224 of file ConfigBuilder.py.
00225 : 00226 """ Add output module to the process """ 00227 result="" 00228 streamTypes=self.eventcontent.split(',') 00229 tiers=self._options.datatier.split(',') 00230 if not self._options.outputDefinition and len(streamTypes)!=len(tiers): 00231 raise Exception("number of event content arguments does not match number of datatier arguments") 00232 if self._options.outputDefinition: 00233 if self._options.datatier: 00234 print "--datatier & --eventcontent options ignored" 00235 00236 def anyOf(listOfKeys,dict,opt=None): 00237 for k in listOfKeys: 00238 if k in dict: 00239 toReturn=dict[k] 00240 dict.pop(k) 00241 return toReturn 00242 if opt!=None: 00243 return opt 00244 else: 00245 raise Exception("any of "+','.join(listOfKeys)+" are mandatory entries of --output options") 00246 00247 #new output convention with a list of dict 00248 outList = eval(self._options.outputDefinition) 00249 for outDefDict in outList: 00250 outDefDictStr=outDefDict.__str__() 00251 if not isinstance(outDefDict,dict): 00252 raise Exception("--output needs to be passed a list of dict"+self._options.outputDefinition+" is invalid") 00253 #requires option: tier 00254 theTier=anyOf(['t','tier','dataTier'],outDefDict) 00255 #optional option: eventcontent, filtername, selectEvents, moduleLabel, filename 00256 ## event content 00257 theStreamType=anyOf(['e','ec','eventContent','streamType'],outDefDict,theTier) 00258 theFilterName=anyOf(['f','ftN','filterName'],outDefDict,'') 00259 theSelectEvent=anyOf(['s','sE','selectEvents'],outDefDict,'') 00260 theModuleLabel=anyOf(['l','mL','moduleLabel'],outDefDict,'') 00261 theExtraOutputCommands=anyOf(['o','oC','outputCommands'],outDefDict,'') 00262 # module label has a particular role 00263 if not theModuleLabel: 00264 tryNames=[theStreamType.replace(theTier.replace('-',''),'')+theTier.replace('-','')+'output', 00265 theStreamType.replace(theTier.replace('-',''),'')+theTier.replace('-','')+theFilterName+'output', 00266 theStreamType.replace(theTier.replace('-',''),'')+theTier.replace('-','')+theFilterName+theSelectEvent.split(',')[0].replace(':','for').replace(' ','')+'output' 00267 ] 00268 for name in tryNames: 00269 if not hasattr(self.process,name): 00270 theModuleLabel=name 00271 break 00272 if not theModuleLabel: 00273 raise Exception("cannot find a module label for specification: "+outDefDictStr) 00274 00275 theFileName=self._options.dirout+anyOf(['fn','fileName'],outDefDict,theModuleLabel+'.root') 00276 if not theFileName.endswith('.root'): 00277 theFileName+='.root' 00278 if len(outDefDict.keys()): 00279 raise Exception("unused keys from --output options: "+','.join(outDefDict.keys())) 00280 if theStreamType=='ALL': 00281 theEventContent = cms.PSet(outputCommands = cms.untracked.vstring('keep *')) 00282 else: 00283 theEventContent = getattr(self.process, theStreamType+"EventContent") 00284 00285 if theStreamType=='ALCARECO' and not theFilterName: 00286 theFilterName='StreamALCACombined' 00287 output = cms.OutputModule("PoolOutputModule", 00288 theEventContent.clone(), 00289 fileName = cms.untracked.string(theFileName), 00290 dataset = cms.untracked.PSet( 00291 dataTier = cms.untracked.string(theTier), 00292 filterName = cms.untracked.string(theFilterName)) 00293 ) 00294 if not theSelectEvent and hasattr(self.process,'generation_step'): 00295 output.SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring('generation_step')) 00296 if theSelectEvent: 00297 output.SelectEvents =cms.untracked.PSet(SelectEvents = cms.vstring(theSelectEvent)) 00298 00299 if hasattr(self.process,theModuleLabel): 00300 raise Exception("the current process already has a module "+theModuleLabel+" defined") 00301 #print "creating output module ",theModuleLabel 00302 setattr(self.process,theModuleLabel,output) 00303 outputModule=getattr(self.process,theModuleLabel) 00304 setattr(self.process,theModuleLabel+'_step',cms.EndPath(outputModule)) 00305 path=getattr(self.process,theModuleLabel+'_step') 00306 self.schedule.append(path) 00307 00308 if not self._options.inlineEventContent and hasattr(self.process,theStreamType+"EventContent"): 00309 def doNotInlineEventContent(instance,label = "cms.untracked.vstring(process."+theStreamType+"EventContent.outputCommands)"): 00310 return label 00311 outputModule.outputCommands.__dict__["dumpPython"] = doNotInlineEventContent 00312 if theExtraOutputCommands: 00313 if not isinstance(theExtraOutputCommands,list): 00314 raise Exception("extra ouput command in --option must be a list of strings") 00315 if hasattr(self.process,theStreamType+"EventContent"): 00316 self.executeAndRemember('process.%s.outputCommands.extend(%s)'%(theModuleLabel,theExtraOutputCommands)) 00317 else: 00318 outputModule.outputCommands.extend(theExtraOutputCommands) 00319 00320 result+="\nprocess."+theModuleLabel+" = "+outputModule.dumpPython() 00321 00322 ##ends the --output options model 00323 return result 00324 00325 # if the only step is alca we don't need to put in an output 00326 if self._options.step.split(',')[0].split(':')[0] == 'ALCA': 00327 return "\n" 00328 00329 for i,(streamType,tier) in enumerate(zip(streamTypes,tiers)): 00330 if streamType=='': continue 00331 theEventContent = getattr(self.process, streamType+"EventContent") 00332 if i==0: 00333 theFileName=self._options.outfile_name 00334 theFilterName=self._options.filtername 00335 else: 00336 theFileName=self._options.outfile_name.replace('.root','_in'+streamType+'.root') 00337 theFilterName=self._options.filtername 00338 00339 output = cms.OutputModule("PoolOutputModule", 00340 theEventContent, 00341 fileName = cms.untracked.string(theFileName), 00342 dataset = cms.untracked.PSet(dataTier = cms.untracked.string(tier), 00343 filterName = cms.untracked.string(theFilterName) 00344 ) 00345 ) 00346 if hasattr(self.process,"generation_step"): 00347 output.SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring('generation_step')) 00348 00349 if streamType=='ALCARECO': 00350 output.dataset.filterName = cms.untracked.string('StreamALCACombined') 00351 00352 outputModuleName=streamType+'output' 00353 setattr(self.process,outputModuleName,output) 00354 outputModule=getattr(self.process,outputModuleName) 00355 setattr(self.process,outputModuleName+'_step',cms.EndPath(outputModule)) 00356 path=getattr(self.process,outputModuleName+'_step') 00357 self.schedule.append(path) 00358 00359 if not self._options.inlineEventContent: 00360 def doNotInlineEventContent(instance,label = "process."+streamType+"EventContent.outputCommands"): 00361 return label 00362 outputModule.outputCommands.__dict__["dumpPython"] = doNotInlineEventContent 00363 00364 result+="\nprocess."+outputModuleName+" = "+outputModule.dumpPython() 00365 00366 return result
def ConfigBuilder::ConfigBuilder::addSource | ( | self | ) |
Here the source is built. Priority: file, generator
Definition at line 159 of file ConfigBuilder.py.
00160 : 00161 """Here the source is built. Priority: file, generator""" 00162 self.addedObjects.append(("Input source","source")) 00163 if self._options.filein: 00164 if self._options.filetype == "EDM": 00165 self.process.source=cms.Source("PoolSource", 00166 fileNames = cms.untracked.vstring(self._options.filein)) 00167 if self._options.secondfilein: 00168 self.process.source.secondaryFileNames = cms.untracked.vstring(self._options.secondfilein) 00169 00170 elif self._options.filetype == "LHE": 00171 self.process.source=cms.Source("LHESource", fileNames = cms.untracked.vstring()) 00172 00173 #provided by article number 00174 if self._options.filein.startswith("lhe:"): 00175 print 'LHE input from article',self._options.filein 00176 #list the article directory automatically 00177 args=self._options.filein.split(':') 00178 article=args[1] 00179 location='/store/lhe/' 00180 import os 00181 textOfFiles=os.popen('cmsLHEtoEOSManager.py -l '+article) 00182 for line in textOfFiles: 00183 for fileName in [x for x in line.split() if '.lhe' in x]: 00184 self.process.source.fileNames.append(location+article+'/'+fileName) 00185 if len(args)>2: 00186 self.process.source.skipEvents = cms.untracked.uint32(int(args[2])) 00187 else: 00188 self.process.source.fileNames=cms.untracked.vstring(self._options.filein) 00189 00190 00191 if 'HARVESTING' in self.stepMap.keys() or 'ALCAHARVEST' in self.stepMap.keys(): 00192 self.process.source.processingMode = cms.untracked.string("RunsAndLumis") 00193 00194 if self._options.dbsquery!='': 00195 self.process.source=cms.Source("PoolSource", fileNames = cms.untracked.vstring(),secondaryFileNames = cms.untracked.vstring()) 00196 import os 00197 print "the query is",self._options.dbsquery 00198 for line in os.popen('dbs search --query "%s"'%(self._options.dbsquery,)): 00199 if line.count(".root")>=2: 00200 #two files solution... 00201 entries=line.replace("\n","").split() 00202 self.process.source.fileNames.append(entries[0]) 00203 self.process.source.secondaryFileNames.append(entries[1]) 00204 elif (line.find(".root")!=-1): 00205 self.process.source.fileNames.append(line.replace("\n","")) 00206 print "found files: ",self.process.source.fileNames.value() 00207 if self.process.source.secondaryFileNames.__len__()!=0: 00208 print "found parent files:",self.process.source.secondaryFileNames.value() 00209 00210 if self._options.inputCommands: 00211 self.process.source.inputCommands = cms.untracked.vstring() 00212 for command in self._options.inputCommands.split(','): 00213 self.process.source.inputCommands.append(command) 00214 00215 if 'GEN' in self.stepMap.keys() or (not self._options.filein and hasattr(self._options, "evt_type")): 00216 if self.process.source is None: 00217 self.process.source=cms.Source("EmptySource") 00218 # if option himix is active, drop possibly duplicate DIGI-RAW info: 00219 if self._options.himix==True: 00220 self.process.source.inputCommands = cms.untracked.vstring('drop *','keep *_generator_*_*','keep *_g4SimHits_*_*') 00221 self.process.source.dropDescendantsOfDroppedBranches=cms.untracked.bool(False) 00222 00223 return
def ConfigBuilder::ConfigBuilder::addStandardSequences | ( | self | ) |
Add selected standard sequences to the process
Definition at line 367 of file ConfigBuilder.py.
00368 : 00369 """ 00370 Add selected standard sequences to the process 00371 """ 00372 # load the pile up file 00373 if self._options.pileup: 00374 pileupSpec=self._options.pileup.split(',')[0] 00375 from Configuration.StandardSequences.Mixing import Mixing,defineMixing 00376 if not pileupSpec in Mixing and '.' not in pileupSpec: 00377 raise Exception(pileupSpec+' is not a know mixing scenario:\n available are: '+'\n'.join(Mixing.keys())) 00378 if '.' in pileupSpec: 00379 mixingDict={'file':pileupSpec} 00380 else: 00381 mixingDict=Mixing[pileupSpec] 00382 if len(self._options.pileup.split(','))>1: 00383 mixingDict.update(eval(self._options.pileup[self._options.pileup.find(',')+1:])) 00384 self.loadAndRemember(mixingDict['file']) 00385 mixingDict.pop('file') 00386 specialization=defineMixing(mixingDict,'FASTSIM' in self.stepMap) 00387 for command in specialization: 00388 self.executeAndRemember(command) 00389 if len(mixingDict)!=0: 00390 raise Exception('unused mixing specification: '+mixingDict.keys().__str__()) 00391 00392 00393 # load the geometry file 00394 try: 00395 self.loadAndRemember(self.GeometryCFF) 00396 except ImportError: 00397 print "Geometry option",self._options.geometry,"unknown." 00398 raise 00399 00400 self.loadAndRemember(self.magFieldCFF) 00401 00402 00403 # what steps are provided by this class? 00404 stepList = [re.sub(r'^prepare_', '', methodName) for methodName in ConfigBuilder.__dict__ if methodName.startswith('prepare_')] 00405 00406 ### Benedikt can we add here a check that assure that we are going to generate a correct config file? 00407 ### i.e. the harvesting do not have to include other step...... 00408 00409 # look which steps are requested and invoke the corresponding method 00410 for step in self._options.step.split(","): 00411 if step == "": 00412 continue 00413 print step 00414 stepParts = step.split(":") # for format STEP:alternativeSequence 00415 stepName = stepParts[0] 00416 if stepName not in stepList: 00417 raise ValueError("Step "+stepName+" unknown") 00418 if len(stepParts)==1: 00419 getattr(self,"prepare_"+step)(sequence = getattr(self,step+"DefaultSeq")) 00420 elif len(stepParts)==2: 00421 getattr(self,"prepare_"+stepName)(sequence = stepParts[1]) 00422 elif len(stepParts)==3: 00423 getattr(self,"prepare_"+stepName)(sequence = stepParts[1]+','+stepParts[2]) 00424 00425 else: 00426 raise ValueError("Step definition "+step+" invalid")
def ConfigBuilder::ConfigBuilder::build_production_info | ( | self, | |
evt_type, | |||
evtnumber | |||
) |
Add useful info for the production.
Definition at line 1355 of file ConfigBuilder.py.
01356 : 01357 """ Add useful info for the production. """ 01358 self.process.configurationMetadata=cms.untracked.PSet\ 01359 (version=cms.untracked.string("$Revision: 1.284.2.5 $"), 01360 name=cms.untracked.string("PyReleaseValidation"), 01361 annotation=cms.untracked.string(evt_type+ " nevts:"+str(evtnumber)) 01362 ) 01363 01364 self.addedObjects.append(("Production Info","configurationMetadata")) 01365
def ConfigBuilder::ConfigBuilder::define_Configs | ( | self | ) |
Definition at line 545 of file ConfigBuilder.py.
00546 : 00547 if ( self._options.scenario not in defaultOptions.scenarioOptions): 00548 print 'Invalid scenario provided. Options are:' 00549 print defaultOptions.scenarioOptions 00550 sys.exit(-1) 00551 00552 self.loadAndRemember('Configuration/StandardSequences/Services_cff') 00553 if self._options.particleTable not in defaultOptions.particleTableList: 00554 print 'Invalid particle table provided. Options are:' 00555 print defaultOptions.particleTable 00556 sys.exit(-1) 00557 else: 00558 self.loadAndRemember('SimGeneral.HepPDTESSource.'+self._options.particleTable+'_cfi') 00559 00560 self.loadAndRemember('FWCore/MessageService/MessageLogger_cfi') 00561 00562 self.ALCADefaultCFF="Configuration/StandardSequences/AlCaRecoStreams_cff" 00563 self.GENDefaultCFF="Configuration/StandardSequences/Generator_cff" 00564 self.SIMDefaultCFF="Configuration/StandardSequences/Sim_cff" 00565 self.DIGIDefaultCFF="Configuration/StandardSequences/Digi_cff" 00566 self.DIGI2RAWDefaultCFF="Configuration/StandardSequences/DigiToRaw_cff" 00567 self.L1EMDefaultCFF='Configuration/StandardSequences/SimL1Emulator_cff' 00568 self.L1MENUDefaultCFF="Configuration/StandardSequences/L1TriggerDefaultMenu_cff" 00569 self.HLTDefaultCFF="Configuration/StandardSequences/HLTtable_cff" 00570 self.RAW2DIGIDefaultCFF="Configuration/StandardSequences/RawToDigi_Data_cff" 00571 self.L1RecoDefaultCFF="Configuration/StandardSequences/L1Reco_cff" 00572 self.RECODefaultCFF="Configuration/StandardSequences/Reconstruction_cff" 00573 self.SKIMDefaultCFF="Configuration/StandardSequences/Skims_cff" 00574 self.POSTRECODefaultCFF="Configuration/StandardSequences/PostRecoGenerator_cff" 00575 self.VALIDATIONDefaultCFF="Configuration/StandardSequences/Validation_cff" 00576 self.L1HwValDefaultCFF = "Configuration/StandardSequences/L1HwVal_cff" 00577 self.DQMOFFLINEDefaultCFF="DQMOffline/Configuration/DQMOffline_cff" 00578 self.HARVESTINGDefaultCFF="Configuration/StandardSequences/Harvesting_cff" 00579 self.ALCAHARVESTDefaultCFF="Configuration/StandardSequences/AlCaHarvesting_cff" 00580 self.ENDJOBDefaultCFF="Configuration/StandardSequences/EndOfProcess_cff" 00581 self.ConditionsDefaultCFF = "Configuration/StandardSequences/FrontierConditions_GlobalTag_cff" 00582 self.CFWRITERDefaultCFF = "Configuration/StandardSequences/CrossingFrameWriter_cff" 00583 self.REPACKDefaultCFF="Configuration/StandardSequences/DigiToRaw_Repack_cff" 00584 00585 # synchronize the geometry configuration and the FullSimulation sequence to be used 00586 if self._options.geometry not in defaultOptions.geometryExtendedOptions: 00587 self.SIMDefaultCFF="Configuration/StandardSequences/SimIdeal_cff" 00588 00589 if "DATAMIX" in self.stepMap.keys(): 00590 self.DATAMIXDefaultCFF="Configuration/StandardSequences/DataMixer"+self._options.datamix+"_cff" 00591 self.DIGIDefaultCFF="Configuration/StandardSequences/DigiDM_cff" 00592 self.DIGI2RAWDefaultCFF="Configuration/StandardSequences/DigiToRawDM_cff" 00593 self.L1EMDefaultCFF='Configuration/StandardSequences/SimL1EmulatorDM_cff' 00594 00595 self.ALCADefaultSeq=None 00596 self.SIMDefaultSeq=None 00597 self.GENDefaultSeq='pgen' 00598 self.DIGIDefaultSeq='pdigi' 00599 self.DATAMIXDefaultSeq=None 00600 self.DIGI2RAWDefaultSeq='DigiToRaw' 00601 self.HLTDefaultSeq='GRun' 00602 self.L1DefaultSeq=None 00603 self.HARVESTINGDefaultSeq=None 00604 self.ALCAHARVESTDefaultSeq=None 00605 self.CFWRITERDefaultSeq=None 00606 self.RAW2DIGIDefaultSeq='RawToDigi' 00607 self.L1RecoDefaultSeq='L1Reco' 00608 if 'RAW2DIGI' in self.stepMap and 'RECO' in self.stepMap: 00609 self.RECODefaultSeq='reconstruction' 00610 else: 00611 self.RECODefaultSeq='reconstruction_fromRECO' 00612 00613 self.POSTRECODefaultSeq=None 00614 self.L1HwValDefaultSeq='L1HwVal' 00615 self.DQMDefaultSeq='DQMOffline' 00616 self.FASTSIMDefaultSeq='all' 00617 self.VALIDATIONDefaultSeq='' 00618 self.PATLayer0DefaultSeq='all' 00619 self.ENDJOBDefaultSeq='endOfProcess' 00620 self.REPACKDefaultSeq='DigiToRawRepack' 00621 00622 self.EVTCONTDefaultCFF="Configuration/EventContent/EventContent_cff" 00623 00624 # if fastsim switch event content 00625 if "FASTSIM" in self.stepMap.keys(): 00626 self.GENDefaultSeq='pgen_genonly' 00627 self.EVTCONTDefaultCFF = "FastSimulation/Configuration/EventContent_cff" 00628 self.VALIDATIONDefaultCFF = "FastSimulation.Configuration.Validation_cff" 00629 00630 # if its MC then change the raw2digi 00631 if self._options.isMC==True: 00632 self.RAW2DIGIDefaultCFF="Configuration/StandardSequences/RawToDigi_cff" 00633 self.DQMOFFLINEDefaultCFF="DQMOffline/Configuration/DQMOfflineMC_cff" 00634 self.ALCADefaultCFF="Configuration/StandardSequences/AlCaRecoStreamsMC_cff" 00635 00636 if hasattr(self._options,"isRepacked") and self._options.isRepacked: 00637 self.RAW2DIGIDefaultCFF="Configuration/StandardSequences/RawToDigi_Repacked_cff" 00638 00639 # now for #%#$#! different scenarios 00640 00641 if self._options.scenario=='nocoll' or self._options.scenario=='cosmics': 00642 self.SIMDefaultCFF="Configuration/StandardSequences/SimNOBEAM_cff" 00643 self._options.beamspot='NoSmear' 00644 00645 if self._options.scenario=='cosmics': 00646 self.DIGIDefaultCFF="Configuration/StandardSequences/DigiCosmics_cff" 00647 self.RECODefaultCFF="Configuration/StandardSequences/ReconstructionCosmics_cff" 00648 self.SKIMDefaultCFF="Configuration/StandardSequences/SkimsCosmics_cff" 00649 self.EVTCONTDefaultCFF="Configuration/EventContent/EventContentCosmics_cff" 00650 self.DQMOFFLINEDefaultCFF="DQMOffline/Configuration/DQMOfflineCosmics_cff" 00651 if self._options.isMC==True: 00652 self.DQMOFFLINEDefaultCFF="DQMOffline/Configuration/DQMOfflineCosmicsMC_cff" 00653 self.HARVESTINGDefaultCFF="Configuration/StandardSequences/HarvestingCosmics_cff" 00654 self.RECODefaultSeq='reconstructionCosmics' 00655 self.DQMDefaultSeq='DQMOfflineCosmics' 00656 self.eventcontent='FEVT' 00657 00658 if self._options.himix: 00659 print "From the presence of the himix option, we have determined that this is heavy ions and will use '--scenario HeavyIons'." 00660 self._options.scenario='HeavyIons' 00661 00662 if self._options.scenario=='HeavyIons': 00663 self.HLTDefaultSeq = 'HIon' 00664 if not self._options.himix: 00665 self.GENDefaultSeq='pgen_hi' 00666 else: 00667 self.GENDefaultSeq='pgen_himix' 00668 self.VALIDATIONDefaultCFF="Configuration/StandardSequences/ValidationHeavyIons_cff" 00669 self.VALIDATIONDefaultSeq='' 00670 self.EVTCONTDefaultCFF="Configuration/EventContent/EventContentHeavyIons_cff" 00671 self.RECODefaultCFF="Configuration/StandardSequences/ReconstructionHeavyIons_cff" 00672 self.RECODefaultSeq='reconstructionHeavyIons' 00673 self.ALCADefaultCFF = "Configuration/StandardSequences/AlCaRecoStreamsHeavyIons_cff" 00674 self.DQMOFFLINEDefaultCFF="DQMOffline/Configuration/DQMOfflineHeavyIons_cff" 00675 self.DQMDefaultSeq='DQMOfflineHeavyIons' 00676 self.SKIMDefaultCFF="Configuration/StandardSequences/SkimsHeavyIons_cff" 00677 self.HARVESTINGDefaultCFF="Configuration/StandardSequences/HarvestingHeavyIons_cff" 00678 if self._options.isMC==True: 00679 self.DQMOFFLINEDefaultCFF="DQMOffline/Configuration/DQMOfflineHeavyIonsMC_cff" 00680 00681 00682 self.RAW2RECODefaultSeq=','.join([self.RAW2DIGIDefaultSeq,self.RECODefaultSeq]) 00683 00684 00685 # the magnetic field 00686 self.magFieldCFF = 'Configuration/StandardSequences/MagneticField_'+self._options.magField.replace('.','')+'_cff' 00687 self.magFieldCFF = self.magFieldCFF.replace("__",'_') 00688 00689 # the geometry 00690 if 'FASTSIM' in self.stepMap: 00691 if 'start' in self._options.conditions.lower(): 00692 self.GeometryCFF='FastSimulation/Configuration/Geometries_START_cff' 00693 else: 00694 self.GeometryCFF='FastSimulation/Configuration/Geometries_MC_cff' 00695 else: 00696 if self._options.gflash==True: 00697 self.GeometryCFF='Configuration/StandardSequences/Geometry'+self._options.geometry+'GFlash_cff' 00698 else: 00699 self.GeometryCFF='Configuration/StandardSequences/Geometry'+self._options.geometry+'_cff' 00700 00701 # Mixing 00702 #not driven by a default cff anymore 00703 if self._options.isData: 00704 self._options.pileup=None 00705 if self._options.isMC==True and self._options.himix==False: 00706 if 'FASTSIM' in self.stepMap: 00707 self._options.pileup='FS_'+self._options.pileup 00708 elif self._options.isMC==True and self._options.himix==True: 00709 self._options.pileup='HiMix' 00710 00711 if self._options.eventcontent != None: 00712 self.eventcontent=self._options.eventcontent
def ConfigBuilder::ConfigBuilder::executeAndRemember | ( | self, | |
command | |||
) |
helper routine to remember replace statements
Definition at line 128 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::finalizeFastSimHLT | ( | self | ) |
Definition at line 1307 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::loadAndRemember | ( | self, | |
includeFile | |||
) |
helper routine to load am memorize imports
Definition at line 119 of file ConfigBuilder.py.
00120 : 00121 """helper routine to load am memorize imports""" 00122 # we could make the imports a on-the-fly data method of the process instance itself 00123 # not sure if the latter is a good idea 00124 includeFile = includeFile.replace('/','.') 00125 self.imports.append(includeFile) 00126 self.process.load(includeFile) 00127 return sys.modules[includeFile]
def ConfigBuilder::ConfigBuilder::loadDefaultOrSpecifiedCFF | ( | self, | |
sequence, | |||
defaultCFF | |||
) |
Definition at line 777 of file ConfigBuilder.py.
00778 : 00779 if ( len(sequence.split('.'))==1 ): 00780 l=self.loadAndRemember(defaultCFF) 00781 elif ( len(sequence.split('.'))==2 ): 00782 l=self.loadAndRemember(sequence.split('.')[0]) 00783 sequence=sequence.split('.')[1] 00784 else: 00785 print "sub sequence configuration must be of the form dir/subdir/cff.a+b+c or cff.a" 00786 print sequence,"not recognized" 00787 raise 00788 return l
def ConfigBuilder::ConfigBuilder::prepare | ( | self, | |
doChecking = False |
|||
) |
Prepare the configuration string and add missing pieces.
Definition at line 1366 of file ConfigBuilder.py.
01367 : 01368 """ Prepare the configuration string and add missing pieces.""" 01369 01370 self.addMaxEvents() 01371 if self.with_input: 01372 self.addSource() 01373 self.addStandardSequences() 01374 self.addConditions() 01375 self.loadAndRemember(self.EVTCONTDefaultCFF) #load the event contents regardless 01376 01377 outputModuleCfgCode="" 01378 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: 01379 outputModuleCfgCode=self.addOutput() 01380 01381 self.addCommon() 01382 01383 self.pythonCfgCode = "# Auto generated configuration file\n" 01384 self.pythonCfgCode += "# using: \n# "+__version__[1:-1]+"\n# "+__source__[1:-1]+'\n' 01385 self.pythonCfgCode += "# with command line options: "+self._options.arguments+'\n' 01386 self.pythonCfgCode += "import FWCore.ParameterSet.Config as cms\n\n" 01387 self.pythonCfgCode += "process = cms.Process('"+self._options.name+"')\n\n" 01388 01389 self.pythonCfgCode += "# import of standard configurations\n" 01390 for module in self.imports: 01391 self.pythonCfgCode += ("process.load('"+module+"')\n") 01392 01393 # production info 01394 if not hasattr(self.process,"configurationMetadata"): 01395 self.build_production_info(self._options.evt_type, self._options.number) 01396 else: 01397 #the PSet was added via a load 01398 self.addedObjects.append(("Production Info","configurationMetadata")) 01399 01400 self.pythonCfgCode +="\n" 01401 for comment,object in self.addedObjects: 01402 if comment!="": 01403 self.pythonCfgCode += "\n# "+comment+"\n" 01404 self.pythonCfgCode += dumpPython(self.process,object) 01405 01406 # dump the output definition 01407 self.pythonCfgCode += "\n# Output definition\n" 01408 self.pythonCfgCode += outputModuleCfgCode 01409 01410 # dump all additional outputs (e.g. alca or skim streams) 01411 self.pythonCfgCode += "\n# Additional output definition\n" 01412 #I do not understand why the keys are not normally ordered. 01413 nl=self.additionalOutputs.keys() 01414 nl.sort() 01415 for name in nl: 01416 output = self.additionalOutputs[name] 01417 self.pythonCfgCode += "process.%s = %s" %(name, output.dumpPython()) 01418 tmpOut = cms.EndPath(output) 01419 setattr(self.process,name+'OutPath',tmpOut) 01420 self.schedule.append(tmpOut) 01421 01422 # dump all additional commands 01423 self.pythonCfgCode += "\n# Other statements\n" 01424 for command in self.additionalCommands: 01425 self.pythonCfgCode += command + "\n" 01426 01427 #comma separated list of objects that deserve to be inlined in the configuration (typically from a modified config deep down) 01428 for object in self._options.inlineObjets.split(','): 01429 if not object: 01430 continue 01431 if not hasattr(self.process,object): 01432 print 'cannot inline -'+object+'- : not known' 01433 else: 01434 self.pythonCfgCode +='\n' 01435 self.pythonCfgCode +=dumpPython(self.process,object) 01436 01437 # dump all paths 01438 self.pythonCfgCode += "\n# Path and EndPath definitions\n" 01439 for path in self.process.paths: 01440 if getattr(self.process,path) not in self.blacklist_paths: 01441 self.pythonCfgCode += dumpPython(self.process,path) 01442 for endpath in self.process.endpaths: 01443 if getattr(self.process,endpath) not in self.blacklist_paths: 01444 self.pythonCfgCode += dumpPython(self.process,endpath) 01445 01446 # dump the schedule 01447 self.pythonCfgCode += "\n# Schedule definition\n" 01448 result = "process.schedule = cms.Schedule(" 01449 01450 # handling of the schedule 01451 self.process.schedule = cms.Schedule() 01452 for item in self.schedule: 01453 if not isinstance(item, cms.Schedule): 01454 self.process.schedule.append(item) 01455 else: 01456 self.process.schedule.extend(item) 01457 01458 if hasattr(self.process,"HLTSchedule"): 01459 beforeHLT = self.schedule[:self.schedule.index(self.process.HLTSchedule)] 01460 afterHLT = self.schedule[self.schedule.index(self.process.HLTSchedule)+1:] 01461 pathNames = ['process.'+p.label_() for p in beforeHLT] 01462 result += ','.join(pathNames)+')\n' 01463 result += 'process.schedule.extend(process.HLTSchedule)\n' 01464 pathNames = ['process.'+p.label_() for p in afterHLT] 01465 result += 'process.schedule.extend(['+','.join(pathNames)+'])\n' 01466 else: 01467 pathNames = ['process.'+p.label_() for p in self.schedule] 01468 result ='process.schedule = cms.Schedule('+','.join(pathNames)+')\n' 01469 01470 self.pythonCfgCode += result 01471 01472 # special treatment in case of production filter sequence 2/2 01473 if self.productionFilterSequence: 01474 self.pythonCfgCode +='# filter all path with the production filter sequence\n' 01475 self.pythonCfgCode +='for path in process.paths:\n' 01476 self.pythonCfgCode +='\tgetattr(process,path)._seq = process.%s * getattr(process,path)._seq \n'%(self.productionFilterSequence,) 01477 01478 # dump customise fragment 01479 if self._options.customisation_file: 01480 self.pythonCfgCode += self.addCustomise() 01481 return 01482
def ConfigBuilder::ConfigBuilder::prepare_ALCA | ( | self, | |
sequence = None , |
|||
workflow = 'full' |
|||
) |
Enrich the process with alca streams
Definition at line 789 of file ConfigBuilder.py.
00790 : 00791 """ Enrich the process with alca streams """ 00792 alcaConfig=self.loadDefaultOrSpecifiedCFF(sequence,self.ALCADefaultCFF) 00793 sequence = sequence.split('.')[-1] 00794 00795 # decide which ALCA paths to use 00796 alcaList = [] 00797 for specifiedCommand in sequence.split("+"): 00798 if specifiedCommand[0]=="@": 00799 from Configuration.PyReleaseValidation.autoAlca import autoAlca 00800 location=specifiedCommand[1:] 00801 alcaSequence = autoAlca[location] 00802 alcaList.extend(alcaSequence.split('+')) 00803 else: 00804 alcaList.append(specifiedCommand) 00805 00806 for name in alcaConfig.__dict__: 00807 alcastream = getattr(alcaConfig,name) 00808 shortName = name.replace('ALCARECOStream','') 00809 if shortName in alcaList and isinstance(alcastream,cms.FilteredStream): 00810 self.addExtraStream(name,alcastream, workflow = workflow) 00811 #rename the HLT process name in the alca modules 00812 if self._options.hltProcess: 00813 if isinstance(alcastream.paths,tuple): 00814 for path in alcastream.paths: 00815 self.renameHLTprocessInSequence(path.label(),self._options.hltProcess) 00816 else: 00817 self.renameHLTprocessInSequence(alcastream.paths.label(),self._options.hltProcess) 00818 for i in range(alcaList.count(shortName)): 00819 alcaList.remove(shortName) 00820 00821 # DQM needs a special handling 00822 elif name == 'pathALCARECODQM' and 'DQM' in alcaList: 00823 path = getattr(alcaConfig,name) 00824 self.schedule.append(path) 00825 alcaList.remove('DQM') 00826 00827 if isinstance(alcastream,cms.Path): 00828 #black list the alca path so that they do not appear in the cfg 00829 self.blacklist_paths.append(alcastream) 00830 00831 00832 if len(alcaList) != 0: 00833 available=[] 00834 for name in alcaConfig.__dict__: 00835 alcastream = getattr(alcaConfig,name) 00836 if isinstance(alcastream,cms.FilteredStream): 00837 available.append(name.replace('ALCARECOStream','')) 00838 print "The following alcas could not be found "+str(alcaList) 00839 print "available ",available 00840 #print "verify your configuration, ignoring for now" 00841 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 1281 of file ConfigBuilder.py.
01282 : 01283 """ Enrich the process with AlCaHarvesting step """ 01284 harvestingConfig = self.loadAndRemember(self.ALCAHARVESTDefaultCFF) 01285 sequence=sequence.split(".")[-1] 01286 01287 # decide which AlcaHARVESTING paths to use 01288 harvestingList = sequence.split("+") 01289 for name in harvestingConfig.__dict__: 01290 harvestingstream = getattr(harvestingConfig,name) 01291 if name in harvestingList and isinstance(harvestingstream,cms.Path): 01292 self.schedule.append(harvestingstream) 01293 self.executeAndRemember("process.PoolDBOutputService.toPut.append(process.ALCAHARVEST" + name + "_dbOutput)") 01294 harvestingList.remove(name) 01295 01296 if len(harvestingList) != 0 and 'dummyHarvesting' not in harvestingList : 01297 print "The following harvesting could not be found : ", harvestingList 01298 raise 01299 01300
def ConfigBuilder::ConfigBuilder::prepare_ALCAOUTPUT | ( | self, | |
sequence = None |
|||
) |
Definition at line 774 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_ALCAPRODUCER | ( | self, | |
sequence = None |
|||
) |
Definition at line 771 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_CFWRITER | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the crossing frame writer step
Definition at line 941 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_DATAMIX | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the digitisation step
Definition at line 949 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_DIGI | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the digitisation step
Definition at line 927 of file ConfigBuilder.py.
00928 : 00929 """ Enrich the schedule with the digitisation step""" 00930 self.loadDefaultOrSpecifiedCFF(sequence,self.DIGIDefaultCFF) 00931 00932 if self._options.gflash==True: 00933 self.loadAndRemember("Configuration/StandardSequences/GFlashDIGI_cff") 00934 00935 if self._options.himix==True: 00936 self.loadAndRemember("SimGeneral/MixingModule/himixDIGI_cff") 00937 00938 self.process.digitisation_step = cms.Path(getattr(self.process,sequence.split('.')[-1])) 00939 self.schedule.append(self.process.digitisation_step) 00940 return
def ConfigBuilder::ConfigBuilder::prepare_DIGI2RAW | ( | self, | |
sequence = None |
|||
) |
Definition at line 956 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_DQM | ( | self, | |
sequence = 'DQMOffline' |
|||
) |
Definition at line 1222 of file ConfigBuilder.py.
01223 : 01224 # this one needs replacement 01225 01226 self.loadDefaultOrSpecifiedCFF(sequence,self.DQMOFFLINEDefaultCFF) 01227 sequence=sequence.split('.')[-1] 01228 01229 if self._options.hltProcess: 01230 # if specified, change the process name used to acess the HLT results in the [HLT]DQM sequence 01231 self.renameHLTprocessInSequence(sequence, self._options.hltProcess) 01232 elif 'HLT' in self.stepMap.keys(): 01233 # otherwise, if both HLT and DQM are run in the same process, change the DQM process name to the current process name 01234 self.renameHLTprocessInSequence(sequence, self.process.name_()) 01235 01236 # if both HLT and DQM are run in the same process, schedule [HLT]DQM in an EndPath 01237 if 'HLT' in self.stepMap.keys(): 01238 # need to put [HLT]DQM in an EndPath, to access the HLT trigger results 01239 self.process.dqmoffline_step = cms.EndPath( getattr(self.process, sequence ) ) 01240 else: 01241 # schedule DQM as a standard Path 01242 self.process.dqmoffline_step = cms.Path( getattr(self.process, sequence) ) 01243 self.schedule.append(self.process.dqmoffline_step)
def ConfigBuilder::ConfigBuilder::prepare_ENDJOB | ( | self, | |
sequence = 'endOfProcess' |
|||
) |
Definition at line 1301 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_FASTSIM | ( | self, | |
sequence = "all" |
|||
) |
Enrich the schedule with fastsim
Definition at line 1311 of file ConfigBuilder.py.
01312 : 01313 """Enrich the schedule with fastsim""" 01314 self.loadAndRemember("FastSimulation/Configuration/FamosSequences_cff") 01315 01316 if sequence in ('all','allWithHLTFiltering',''): 01317 if not 'HLT' in self.stepMap.keys(): 01318 self.prepare_HLT(sequence=None) 01319 01320 self.executeAndRemember("process.famosSimHits.SimulateCalorimetry = True") 01321 self.executeAndRemember("process.famosSimHits.SimulateTracking = True") 01322 01323 self.executeAndRemember("process.simulation = cms.Sequence(process.simulationWithFamos)") 01324 self.executeAndRemember("process.HLTEndSequence = cms.Sequence(process.reconstructionWithFamos)") 01325 01326 # since we have HLT here, the process should be called HLT 01327 self._options.name = "HLT" 01328 01329 # if we don't want to filter after HLT but simulate everything regardless of what HLT tells, we have to add reconstruction explicitly 01330 if sequence == 'all' and not 'HLT' in self.stepMap.keys(): #(a) 01331 self.finalizeFastSimHLT() 01332 elif sequence == 'famosWithEverything': 01333 self.process.fastsim_step = cms.Path( getattr(self.process, "famosWithEverything") ) 01334 self.schedule.append(self.process.fastsim_step) 01335 01336 # now the additional commands we need to make the config work 01337 self.executeAndRemember("process.VolumeBasedMagneticFieldESProducer.useParametrizedTrackerField = True") 01338 else: 01339 print "FastSim setting", sequence, "unknown." 01340 raise ValueError 01341 01342 if 'Flat' in self._options.beamspot: 01343 beamspotType = 'Flat' 01344 elif 'Gauss' in self._options.beamspot: 01345 beamspotType = 'Gaussian' 01346 else: 01347 beamspotType = 'BetaFunc' 01348 self.loadAndRemember('IOMC.EventVertexGenerators.VtxSmearedParameters_cfi') 01349 beamspotName = 'process.%sVtxSmearingParameters' %(self._options.beamspot) 01350 self.executeAndRemember(beamspotName+'.type = cms.string("%s")'%(beamspotType)) 01351 self.executeAndRemember('process.famosSimHits.VertexGenerator = '+beamspotName) 01352 self.executeAndRemember('process.famosPileUp.VertexGenerator = '+beamspotName) 01353 01354
def ConfigBuilder::ConfigBuilder::prepare_GEN | ( | self, | |
sequence = None |
|||
) |
load the fragment of generator configuration
Definition at line 842 of file ConfigBuilder.py.
00843 : 00844 """ load the fragment of generator configuration """ 00845 loadFailure=False 00846 #remove trailing .py 00847 #support old style .cfi by changing into something.cfi into something_cfi 00848 #remove python/ from the name 00849 loadFragment = self._options.evt_type.replace('.py','',).replace('.','_').replace('python/','') 00850 #standard location of fragments 00851 if not '/' in loadFragment: 00852 loadFragment='Configuration.Generator.'+loadFragment 00853 else: 00854 loadFragment=loadFragment.replace('/','.') 00855 try: 00856 __import__(loadFragment) 00857 except: 00858 loadFailure=True 00859 if self.process.source and self.process.source.type_()=='EmptySource': 00860 raise Exception("Neither gen fragment of input files provided: this is an inconsistent GEN step configuration") 00861 00862 if not loadFailure: 00863 generatorModule=sys.modules[loadFragment] 00864 genModules=generatorModule.__dict__ 00865 if self._options.hideGen: 00866 self.loadAndRemember(loadFragment) 00867 else: 00868 self.process.load(loadFragment) 00869 # expose the objects from that fragment to the configuration 00870 import FWCore.ParameterSet.Modules as cmstypes 00871 for name in genModules: 00872 theObject = getattr(generatorModule,name) 00873 if isinstance(theObject, cmstypes._Module): 00874 self._options.inlineObjets=name+','+self._options.inlineObjets 00875 elif isinstance(theObject, cms.Sequence) or isinstance(theObject, cmstypes.ESProducer): 00876 self._options.inlineObjets+=','+name 00877 00878 if sequence == self.GENDefaultSeq or sequence == 'pgen_genonly': 00879 if 'ProductionFilterSequence' in genModules and ('generator' in genModules or 'hiSignal' in genModules): 00880 self.productionFilterSequence = 'ProductionFilterSequence' 00881 elif 'generator' in genModules: 00882 self.productionFilterSequence = 'generator' 00883 00884 """ Enrich the schedule with the rest of the generation step """ 00885 self.loadDefaultOrSpecifiedCFF(sequence,self.GENDefaultCFF) 00886 genSeqName=sequence.split('.')[-1] 00887 00888 if not 'FASTSIM' in self.stepMap: 00889 try: 00890 from Configuration.StandardSequences.VtxSmeared import VtxSmeared 00891 self.loadAndRemember(VtxSmeared[self._options.beamspot]) 00892 except ImportError: 00893 raise Exception("VertexSmearing type or beamspot "+self._options.beamspot+" unknown.") 00894 00895 if self._options.scenario == 'HeavyIons' and self._options.himix: 00896 self.loadAndRemember("SimGeneral/MixingModule/himixGEN_cff") 00897 00898 self.process.generation_step = cms.Path( getattr(self.process,genSeqName) ) 00899 self.schedule.append(self.process.generation_step) 00900 00901 """ Enrich the schedule with the summary of the filter step """ 00902 #the gen filter in the endpath 00903 self.loadAndRemember("GeneratorInterface/Core/genFilterSummary_cff") 00904 self.process.genfiltersummary_step = cms.EndPath( self.process.genFilterSummary ) 00905 self.schedule.append(self.process.genfiltersummary_step) 00906 00907 return
def ConfigBuilder::ConfigBuilder::prepare_HARVESTING | ( | self, | |
sequence = None |
|||
) |
Enrich the process with harvesting step
Definition at line 1244 of file ConfigBuilder.py.
01245 : 01246 """ Enrich the process with harvesting step """ 01247 self.EDMtoMECFF='Configuration/StandardSequences/EDMtoME'+self._options.harvesting+'_cff' 01248 self.loadAndRemember(self.EDMtoMECFF) 01249 self.process.edmtome_step = cms.Path(self.process.EDMtoME) 01250 self.schedule.append(self.process.edmtome_step) 01251 01252 harvestingConfig = self.loadDefaultOrSpecifiedCFF(sequence,self.HARVESTINGDefaultCFF) 01253 sequence = sequence.split('.')[-1] 01254 01255 # decide which HARVESTING paths to use 01256 harvestingList = sequence.split("+") 01257 for name in harvestingConfig.__dict__: 01258 harvestingstream = getattr(harvestingConfig,name) 01259 if name in harvestingList and isinstance(harvestingstream,cms.Path): 01260 self.schedule.append(harvestingstream) 01261 harvestingList.remove(name) 01262 if name in harvestingList and isinstance(harvestingstream,cms.Sequence): 01263 setattr(self.process,name+"_step",cms.Path(harvestingstream)) 01264 self.schedule.append(getattr(self.process,name+"_step")) 01265 harvestingList.remove(name) 01266 if isinstance(harvestingstream,cms.Path): 01267 self.blacklist_paths.append(harvestingstream) 01268 01269 01270 # This if statment must disappears once some config happens in the alca harvesting step 01271 if 'alcaHarvesting' in harvestingList: 01272 harvestingList.remove('alcaHarvesting') 01273 01274 if len(harvestingList) != 0 and 'dummyHarvesting' not in harvestingList : 01275 print "The following harvesting could not be found : ", harvestingList 01276 raise 01277 01278 self.process.dqmsave_step = cms.Path(self.process.DQMSaver) 01279 self.schedule.append(self.process.dqmsave_step) 01280
def ConfigBuilder::ConfigBuilder::prepare_HLT | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the HLT simulation step
Definition at line 981 of file ConfigBuilder.py.
00982 : 00983 """ Enrich the schedule with the HLT simulation step""" 00984 loadDir='HLTrigger' 00985 fastSim=False 00986 if 'FASTSIM' in self.stepMap.keys(): 00987 fastSim=True 00988 loadDir='FastSimulation' 00989 if not sequence: 00990 print "no specification of the hlt menu has been given, should never happen" 00991 raise Exception('no HLT sequence provided') 00992 else: 00993 if ',' in sequence: 00994 #case where HLT:something:something was provided 00995 self.executeAndRemember('import HLTrigger.Configuration.Utilities') 00996 optionsForHLT = {} 00997 optionsForHLT['data'] = self._options.isData 00998 optionsForHLT['type'] = 'GRun' 00999 if self._options.scenario == 'HeavyIons': optionsForHLT['type'] = 'HIon' 01000 optionsForHLTConfig = ', '.join('%s=%s' % (key, repr(val)) for (key, val) in optionsForHLT.iteritems()) 01001 self.executeAndRemember('process.loadHltConfiguration("%s",%s)'%(sequence.replace(',',':'),optionsForHLTConfig)) 01002 else: 01003 dataSpec='' 01004 if self._options.isData: 01005 dataSpec='_data' 01006 self.loadAndRemember('%s/Configuration/HLT_%s%s_cff'%(loadDir,sequence,dataSpec)) 01007 01008 self.schedule.append(self.process.HLTSchedule) 01009 [self.blacklist_paths.append(path) for path in self.process.HLTSchedule if isinstance(path,(cms.Path,cms.EndPath))] 01010 if (fastSim and 'HLT' in self.stepMap.keys()): 01011 self.finalizeFastSimHLT() 01012
def ConfigBuilder::ConfigBuilder::prepare_L1 | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the L1 simulation step
Definition at line 968 of file ConfigBuilder.py.
00969 : 00970 """ Enrich the schedule with the L1 simulation step""" 00971 if not sequence: 00972 self.loadAndRemember(self.L1EMDefaultCFF) 00973 else: 00974 # let the L1 package decide for the scenarios available 00975 from L1Trigger.Configuration.ConfigBuilder import getConfigsForScenario 00976 listOfImports = getConfigsForScenario(sequence) 00977 for file in listOfImports: 00978 self.loadAndRemember(file) 00979 self.process.L1simulation_step = cms.Path(self.process.SimL1Emulator) 00980 self.schedule.append(self.process.L1simulation_step)
def ConfigBuilder::ConfigBuilder::prepare_L1HwVal | ( | self, | |
sequence = 'L1HwVal' |
|||
) |
Enrich the schedule with L1 HW validation
Definition at line 1035 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_L1Reco | ( | self, | |
sequence = "L1Reco" |
|||
) |
Enrich the schedule with L1 reconstruction
Definition at line 1042 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_POSTRECO | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the postreco step
Definition at line 1106 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_RAW2DIGI | ( | self, | |
sequence = "RawToDigi" |
|||
) |
Definition at line 1029 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_RAW2RECO | ( | self, | |
sequence = None |
|||
) |
Definition at line 1013 of file ConfigBuilder.py.
01014 : 01015 if ','in sequence: 01016 seqReco=sequence.split(',')[1] 01017 seqDigi=sequence.split(',')[0] 01018 else: 01019 print "RAW2RECO requires two specifications",sequence,"insufficient" 01020 01021 self.loadDefaultOrSpecifiedCFF(seqDigi,self.RAW2DIGIDefaultCFF) 01022 self.process.raw2digi_step = cms.Path( getattr(self.process, seqDigi.split('.')[-1]) ) 01023 self.schedule.append(self.process.raw2digi_step) 01024 01025 self.loadDefaultOrSpecifiedCFF(seqReco,self.RECODefaultCFF) 01026 self.process.reconstruction_step = cms.Path( getattr(self.process, seqReco.split('.')[-1]) ) 01027 self.schedule.append(self.process.reconstruction_step) 01028 return
def ConfigBuilder::ConfigBuilder::prepare_RECO | ( | self, | |
sequence = "reconstruction" |
|||
) |
Enrich the schedule with reconstruction
Definition at line 1049 of file ConfigBuilder.py.
01050 : 01051 ''' Enrich the schedule with reconstruction ''' 01052 self.loadDefaultOrSpecifiedCFF(sequence,self.RECODefaultCFF) 01053 self.process.reconstruction_step = cms.Path( getattr(self.process, sequence.split('.')[-1]) ) 01054 self.schedule.append(self.process.reconstruction_step) 01055 return
def ConfigBuilder::ConfigBuilder::prepare_REPACK | ( | self, | |
sequence = None |
|||
) |
Definition at line 962 of file ConfigBuilder.py.
def ConfigBuilder::ConfigBuilder::prepare_SIM | ( | self, | |
sequence = None |
|||
) |
Enrich the schedule with the simulation step
Definition at line 908 of file ConfigBuilder.py.
00909 : 00910 """ Enrich the schedule with the simulation step""" 00911 self.loadAndRemember(self.SIMDefaultCFF) 00912 if self._options.gflash==True: 00913 self.loadAndRemember("Configuration/StandardSequences/GFlashSIM_cff") 00914 00915 if self._options.magField=='0T': 00916 self.executeAndRemember("process.g4SimHits.UseMagneticField = cms.bool(False)") 00917 00918 if self._options.himix==True: 00919 if self._options.geometry in defaultOptions.geometryExtendedOptions: 00920 self.loadAndRemember("SimGeneral/MixingModule/himixSIMExtended_cff") 00921 else: 00922 self.loadAndRemember("SimGeneral/MixingModule/himixSIMIdeal_cff") 00923 00924 self.process.simulation_step = cms.Path( self.process.psim ) 00925 self.schedule.append(self.process.simulation_step) 00926 return
def ConfigBuilder::ConfigBuilder::prepare_SKIM | ( | self, | |
sequence = "all" |
|||
) |
Enrich the schedule with skimming fragments
Definition at line 1056 of file ConfigBuilder.py.
01057 : 01058 ''' Enrich the schedule with skimming fragments''' 01059 skimConfig = self.loadDefaultOrSpecifiedCFF(sequence,self.SKIMDefaultCFF) 01060 sequence = sequence.split('.')[-1] 01061 01062 skimlist=[] 01063 ## support @Mu+DiJet+@Electron configuration via autoSkim.py 01064 for specifiedCommand in sequence.split('+'): 01065 if specifiedCommand[0]=="@": 01066 from Configuration.Skimming.autoSkim import autoSkim 01067 location=specifiedCommand[1:] 01068 skimSequence = autoSkim[location] 01069 skimlist.extend(skimSequence.split('+')) 01070 else: 01071 skimlist.append(specifiedCommand) 01072 01073 #print "dictionnary for skims:",skimConfig.__dict__ 01074 for skim in skimConfig.__dict__: 01075 skimstream = getattr(skimConfig,skim) 01076 if isinstance(skimstream,cms.Path): 01077 #black list the alca path so that they do not appear in the cfg 01078 self.blacklist_paths.append(skimstream) 01079 if (not isinstance(skimstream,cms.FilteredStream)): 01080 continue 01081 shortname = skim.replace('SKIMStream','') 01082 if (sequence=="all"): 01083 self.addExtraStream(skim,skimstream) 01084 elif (shortname in skimlist): 01085 self.addExtraStream(skim,skimstream) 01086 #add a DQM eventcontent for this guy 01087 if self._options.datatier!="": 01088 self.process.load(self.EVTCONTDefaultCFF) 01089 skimstreamDQM = cms.FilteredStream( 01090 responsible = skimstream.responsible, 01091 name = skimstream.name+'DQM', 01092 paths = skimstream.paths, 01093 selectEvents = skimstream.selectEvents, 01094 content = self._options.datatier+'EventContent', 01095 dataTier = cms.untracked.string(self._options.datatier) 01096 ) 01097 self.addExtraStream(skim+'DQM',skimstreamDQM) 01098 for i in range(skimlist.count(shortname)): 01099 skimlist.remove(shortname) 01100 01101 01102 01103 if (skimlist.__len__()!=0 and sequence!="all"): 01104 print 'WARNING, possible typo with SKIM:'+'+'.join(skimlist) 01105 raise Exception('WARNING, possible typo with SKIM:'+'+'.join(skimlist))
def ConfigBuilder::ConfigBuilder::prepare_VALIDATION | ( | self, | |
sequence = 'validation' |
|||
) |
Definition at line 1114 of file ConfigBuilder.py.
01115 : 01116 self.loadDefaultOrSpecifiedCFF(sequence,self.VALIDATIONDefaultCFF) 01117 #in case VALIDATION:something:somethingelse -> something,somethingelse 01118 sequence=sequence.split('.')[-1] 01119 if sequence.find(',')!=-1: 01120 prevalSeqName=sequence.split(',')[0] 01121 valSeqName=sequence.split(',')[1] 01122 else: 01123 postfix='' 01124 if sequence: 01125 postfix='_'+sequence 01126 prevalSeqName='prevalidation'+postfix 01127 valSeqName='validation'+postfix 01128 if not hasattr(self.process,valSeqName): 01129 prevalSeqName='' 01130 valSeqName=sequence 01131 01132 if not 'DIGI' in self.stepMap and not 'FASTSIM' in self.stepMap: 01133 self.loadAndRemember('Configuration.StandardSequences.ReMixingSeeds_cff') 01134 #rename the HLT process in validation steps 01135 if 'HLT' in self.stepMap and not 'FASTSIM' in self.stepMap: 01136 toProcess=self.process.name_() 01137 if self._options.hltProcess: 01138 toProcess=self._options.hltProcess 01139 self.renameHLTprocessInSequence(valSeqName, toProcess) 01140 if prevalSeqName: 01141 self.renameHLTprocessInSequence(prevalSeqName, toProcess) 01142 01143 if prevalSeqName: 01144 self.process.prevalidation_step = cms.Path( getattr(self.process, prevalSeqName ) ) 01145 self.schedule.append(self.process.prevalidation_step) 01146 if valSeqName.startswith('genvalid'): 01147 self.loadAndRemember("IOMC.RandomEngine.IOMC_cff") 01148 self.process.validation_step = cms.Path( getattr(self.process,valSeqName ) ) 01149 else: 01150 self.process.validation_step = cms.EndPath( getattr(self.process,valSeqName ) ) 01151 self.schedule.append(self.process.validation_step) 01152 01153 01154 if not 'DIGI' in self.stepMap: 01155 self.executeAndRemember("process.mix.playback = True") 01156 return 01157
def ConfigBuilder::ConfigBuilder::renameHLTprocessInSequence | ( | self, | |
sequence, | |||
proc, | |||
HLTprocess = 'HLT' |
|||
) |
Definition at line 1213 of file ConfigBuilder.py.
01214 : 01215 # look up all module in dqm sequence 01216 print "replacing %s process name - sequence %s will use '%s'" % (HLTprocess,sequence, proc) 01217 getattr(self.process,sequence).visit(ConfigBuilder.MassSearchReplaceProcessNameVisitor(HLTprocess,proc,whitelist = ("subSystemFolder",))) 01218 if 'from Configuration.PyReleaseValidation.ConfigBuilder import ConfigBuilder' not in self.additionalCommands: 01219 self.additionalCommands.append('from Configuration.PyReleaseValidation.ConfigBuilder import ConfigBuilder') 01220 self.additionalCommands.append('process.%s.visit(ConfigBuilder.MassSearchReplaceProcessNameVisitor("%s", "%s", whitelist = ("subSystemFolder",)))'% (sequence,HLTprocess, proc)) 01221
ConfigBuilder::ConfigBuilder::_options [private] |
Definition at line 62 of file ConfigBuilder.py.
Definition at line 62 of file ConfigBuilder.py.
Definition at line 62 of file ConfigBuilder.py.
Definition at line 62 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 62 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 1244 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 62 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 62 of file ConfigBuilder.py.
Definition at line 62 of file ConfigBuilder.py.
Definition at line 1366 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 62 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 62 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 545 of file ConfigBuilder.py.
Definition at line 62 of file ConfigBuilder.py.
Definition at line 62 of file ConfigBuilder.py.