CMS 3D CMS Logo

Classes | Functions | Variables

ConfigBuilder Namespace Reference

Classes

class  ConfigBuilder
class  Options

Functions

def addALCAPaths
def addOutputModule
def dumpPython
def filesFromDBSQuery
def filesFromList
def getConfigsForScenario
def getDefaultTrigger
def getHelp
def installFilteredStream
def installPromptReco
def MassReplaceInputTag

Variables

string __default = 'GRun'
string __source__ = "$Source: /local/reps/CMSSW/CMSSW/Configuration/PyReleaseValidation/python/ConfigBuilder.py,v $"
dictionary __triggerTable
string __version__ = "$Revision: 1.381.2.27 $"
tuple defaultOptions = Options()
 promptReco = installPromptReco

Function Documentation

def ConfigBuilder::addALCAPaths (   process,
  listOfALCANames,
  definitionFile = "Configuration/StandardSequences/AlCaRecoStreams_cff" 
)
_addALCAPaths_

Function to add alignment&calibration sequences to an existing process

Definition at line 2087 of file ConfigBuilder.py.

02088                                                                                                                   :
02089     """
02090     _addALCAPaths_
02091 
02092     Function to add alignment&calibration sequences to an existing process
02093     """
02094     __import__(definitionFile)
02095     definitionModule = sys.modules[definitionFile]
02096     process.extend(definitionModule)
02097 
02098     for alca in listOfALCANames:
02099        streamName = "ALCARECOStream%s" % alca
02100        stream = getattr(definitionModule, streamName)
02101        for path in stream.paths:
02102             schedule.append(path)
02103 
02104     return
def ConfigBuilder::addOutputModule (   process,
  tier,
  content 
)
_addOutputModule_

Function to add an output module to a given process with given data tier and event content

Definition at line 2058 of file ConfigBuilder.py.

02059                                            :
02060     """
02061     _addOutputModule_
02062 
02063     Function to add an output module to a given process with given data tier and event content
02064     """
02065     print "WARNING. this method will not be supported any more SOON, please use --eventcontent --datatier field to drive the output module definitions"
02066 
02067     moduleName = "output%s%s" % (tier, content)
02068     pathName = "%sPath" % moduleName
02069     contentName = "%sEventContent" % content
02070     contentAttr = getattr(process, contentName)
02071     setattr(process, moduleName,
02072             cms.OutputModule("PoolOutputModule",
02073                              contentAttr,
02074                              fileName = cms.untracked.string('%s.root' % moduleName),
02075                              dataset = cms.untracked.PSet(
02076                                dataTier = cms.untracked.string(tier),
02077                                ),
02078                            )
02079             )
02080     print getattr(process,moduleName)
02081     # put it in an EndPath and put the EndPath into the schedule
02082     setattr(process, pathName, cms.EndPath(getattr(process,moduleName)) )
02083     process.schedule.append(getattr(process, pathName))
02084 
02085     return
02086 

def ConfigBuilder::dumpPython (   process,
  name 
)

Definition at line 72 of file ConfigBuilder.py.

00073                             :
00074         theObject = getattr(process,name)
00075         if isinstance(theObject,cms.Path) or isinstance(theObject,cms.EndPath) or isinstance(theObject,cms.Sequence):
00076                 return "process."+name+" = " + theObject.dumpPython("process")
00077         elif isinstance(theObject,_Module) or isinstance(theObject,cms.ESProducer):
00078                 return "process."+name+" = " + theObject.dumpPython()+"\n"
00079         else:
                return "process."+name+" = " + theObject.dumpPython()+"\n"
def ConfigBuilder::filesFromDBSQuery (   query,
  s = None 
)

Definition at line 112 of file ConfigBuilder.py.

00113                                    :
00114         import os
00115         import FWCore.ParameterSet.Config as cms
00116         prim=[]
00117         sec=[]
00118         print "the query is",query
00119         for line in os.popen('dbs search --query "%s"'%(query)):
00120                 if line.count(".root")>=2:
00121                         #two files solution...
00122                         entries=line.replace("\n","").split()
00123                         if not entries[0] in prim:
00124                                 prim.append(entries[0])
00125                         if not entries[1] in sec:
00126                                 sec.append(entries[1])
00127                 elif (line.find(".root")!=-1):
00128                         entry=line.replace("\n","")
00129                         if not entry in prim:
00130                                 prim.append(entry)
00131         if s:
00132                 if not hasattr(s,"fileNames"):
00133                         s.fileNames=cms.untracked.vstring(prim)
00134                 else:
00135                         s.fileNames.extend(prim)
00136                 if len(sec)!=0:
00137                         if not hasattr(s,"secondaryFileNames"):
00138                                 s.secondaryFileNames=cms.untracked.vstring(sec)
00139                         else:
00140                                 s.secondaryFileNames.extend(sec)
00141         print "found files: ",prim
00142         if len(sec)!=0:
00143                 print "found parent files:",sec
00144         return (prim,sec)

def ConfigBuilder::filesFromList (   fileName,
  s = None 
)

Definition at line 80 of file ConfigBuilder.py.

00081                                   :
00082         import os
00083         import FWCore.ParameterSet.Config as cms
00084         prim=[]
00085         sec=[]
00086         for line in open(fileName,'r'):
00087                 if line.count(".root")>=2:
00088                         #two files solution...
00089                         entries=line.replace("\n","").split()
00090                         if not entries[0] in prim:
00091                                 prim.append(entries[0])
00092                         if not entries[1] in sec:
00093                                 sec.append(entries[1])
00094                 elif (line.find(".root")!=-1):
00095                         entry=line.replace("\n","")
00096                         if not entry in prim:
00097                                 prim.append(entry)
00098         if s:
00099                 if not hasattr(s,"fileNames"):
00100                         s.fileNames=cms.untracked.vstring(prim)
00101                 else:
00102                         s.fileNames.extend(prim)
00103                 if len(sec)!=0:
00104                         if not hasattr(s,"secondaryFileNames"):
00105                                 s.secondaryFileNames=cms.untracked.vstring(sec)
00106                         else:
00107                                 s.secondaryFileNames.extend(sec)
00108         print "found files: ",prim
00109         if len(sec)!=0:
00110                 print "found parent files:",sec
00111         return (prim,sec)
        
def ConfigBuilder::getConfigsForScenario (   sequence = None)
Retrieves the list of files needed to run a given trigger menu.
If no trigger or an invalid trigger is given, use the default one. 

Definition at line 38 of file ConfigBuilder.py.

00039                                           :
00040     """
00041     Retrieves the list of files needed to run a given trigger menu.
00042     If no trigger or an invalid trigger is given, use the default one. 
00043     """
00044 
00045     if not sequence:
00046         # no trigger was specified, use the default one
00047         trigger = __default
00048     else:
00049         # check if the specified trigger is valid
00050         trigger = sequence
00051         if trigger not in __triggerTable:
00052             print 'An unsupported trigger has been requested: %s' % sequence
00053             print 'The default one will be used instead: %s' % __default
00054             print 'The supported triggers are:'
00055             for key in __triggerTable.iterkeys():
00056                 print '\t%s' % key
00057             print
00058             trigger = __default
00059 
00060     return __triggerTable[trigger]
00061 
def ConfigBuilder::getDefaultTrigger ( )
Retrieves the default trigger name

Definition at line 24 of file ConfigBuilder.py.

00025                        :
00026     """
00027     Retrieves the default trigger name
00028     """
00029     return __default
00030     

def ConfigBuilder::getHelp ( )
Retrieves the list of available triggers

Definition at line 31 of file ConfigBuilder.py.

00032              :
00033     """
00034     Retrieves the list of available triggers
00035     """
00036     return __triggerTable.iterkeys()
00037   

def ConfigBuilder::installFilteredStream (   process,
  schedule,
  streamName,
  definitionFile = "Configuration/StandardSequences/AlCaRecoStreams_cff" 
)

Definition at line 2013 of file ConfigBuilder.py.

02014                                                                                                                                  :
02015 
02016     __import__(definitionFile)
02017     definitionModule = sys.modules[definitionFile]
02018     process.extend(definitionModule)
02019     stream = getattr(definitionModule,streamName)
02020     output = cms.OutputModule("PoolOutputModule")
02021     output.SelectEvents = stream.selectEvents
02022     output.outputCommands = stream.content
02023     output.dataset  = cms.untracked.PSet( dataTier = stream.dataTier)
02024     setattr(process,streamName,output)
02025     for path in stream.paths:
02026         schedule.append(path)
02027 

def ConfigBuilder::installPromptReco (   process,
  recoOutputModule,
  aodOutputModule = None 
)
_promptReco_

Method to install the standard PromptReco configuration into
a basic process containing source and output modules.

process is the CMS Process instance to be populated

recoOutputModule is the output module used to write the
RECO data tier

aodOutputModule is the output module used to write
the AOD data tier, if this is not none, any AOD sequences
should be added.

Definition at line 2028 of file ConfigBuilder.py.

02029                                                                         :
02030     """
02031     _promptReco_
02032 
02033     Method to install the standard PromptReco configuration into
02034     a basic process containing source and output modules.
02035 
02036     process is the CMS Process instance to be populated
02037 
02038     recoOutputModule is the output module used to write the
02039     RECO data tier
02040 
02041     aodOutputModule is the output module used to write
02042     the AOD data tier, if this is not none, any AOD sequences
02043     should be added.
02044     """
02045     cb = ConfigBuilder(defaultOptions, process = process)
02046     cb._options.step = 'RAW2DIGI,RECO'
02047     cb.addStandardSequences()
02048     cb.addConditions()
02049     process.load(cb.EVTCONTDefault)
02050     recoOutputModule.eventContent = process.RECOEventContent
02051     if aodOutputModule != None:
02052         aodOutputModule.eventContent = process.AODEventContent
02053     return process
02054 

def ConfigBuilder::MassReplaceInputTag (   aProcess,
  oldT = "rawDataCollector",
  newT = "rawDataRepacker" 
)

Definition at line 145 of file ConfigBuilder.py.

00146                                                                                 :
00147         from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag
00148         for s in aProcess.paths_().keys():
00149                 massSearchReplaceAnyInputTag(getattr(aProcess,s),oldT,newT)
00150 


Variable Documentation

string ConfigBuilder::__default = 'GRun'

Definition at line 21 of file ConfigBuilder.py.

string ConfigBuilder::__source__ = "$Source: /local/reps/CMSSW/CMSSW/Configuration/PyReleaseValidation/python/ConfigBuilder.py,v $"

Definition at line 4 of file ConfigBuilder.py.

Initial value:
00001 {
00002 
00003     # HLT trigger table for the 2009 STARTUP 8E29 menu
00004     '8E29': ( 
00005         'FastSimulation/Configuration/HLT_8E29_cff', 
00006     ),
00007 
00008     # HLT trigger table for the 2009 Global Run menu
00009     'GRun': (
00010         'FastSimulation/Configuration/HLT_GRun_cff',
00011     ),
00012 
00013     # HLT trigger table for the 2009 STARTUP 1E31 menu
00014     '1E31': ( 
00015         'FastSimulation/Configuration/HLT_1E31_cff', 
00016     )
00017 }

Definition at line 2 of file ConfigBuilder.py.

string ConfigBuilder::__version__ = "$Revision: 1.381.2.27 $"

Definition at line 3 of file ConfigBuilder.py.

Definition at line 15 of file ConfigBuilder.py.

ConfigBuilder::promptReco = installPromptReco

Definition at line 2055 of file ConfigBuilder.py.