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.341.2.2 $"
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 1817 of file ConfigBuilder.py.

01818                                                                                                                   :
01819     """
01820     _addALCAPaths_
01821 
01822     Function to add alignment&calibration sequences to an existing process
01823     """
01824     __import__(definitionFile)
01825     definitionModule = sys.modules[definitionFile]
01826     process.extend(definitionModule)
01827 
01828     for alca in listOfALCANames:
01829        streamName = "ALCARECOStream%s" % alca
01830        stream = getattr(definitionModule, streamName)
01831        for path in stream.paths:
01832             schedule.append(path)
01833 
01834     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 1788 of file ConfigBuilder.py.

01789                                            :
01790     """
01791     _addOutputModule_
01792 
01793     Function to add an output module to a given process with given data tier and event content
01794     """
01795     print "WARNING. this method will not be supported any more SOON, please use --eventcontent --datatier field to drive the output module definitions"
01796 
01797     moduleName = "output%s%s" % (tier, content)
01798     pathName = "%sPath" % moduleName
01799     contentName = "%sEventContent" % content
01800     contentAttr = getattr(process, contentName)
01801     setattr(process, moduleName,
01802             cms.OutputModule("PoolOutputModule",
01803                              contentAttr,
01804                              fileName = cms.untracked.string('%s.root' % moduleName),
01805                              dataset = cms.untracked.PSet(
01806                                dataTier = cms.untracked.string(tier),
01807                                ),
01808                            )
01809             )
01810     print getattr(process,moduleName)
01811     # put it in an EndPath and put the EndPath into the schedule
01812     setattr(process, pathName, cms.EndPath(getattr(process,moduleName)) )
01813     process.schedule.append(getattr(process, pathName))
01814 
01815     return
01816 

def ConfigBuilder::dumpPython (   process,
  name 
)

Definition at line 63 of file ConfigBuilder.py.

00064                             :
00065         theObject = getattr(process,name)
00066         if isinstance(theObject,cms.Path) or isinstance(theObject,cms.EndPath) or isinstance(theObject,cms.Sequence):
00067                 return "process."+name+" = " + theObject.dumpPython("process")
00068         elif isinstance(theObject,_Module) or isinstance(theObject,cms.ESProducer):
00069                 return "process."+name+" = " + theObject.dumpPython()+"\n"
00070         else:
                return "process."+name+" = " + theObject.dumpPython()+"\n"
def ConfigBuilder::filesFromDBSQuery (   query,
  s = None 
)

Definition at line 103 of file ConfigBuilder.py.

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

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

Definition at line 71 of file ConfigBuilder.py.

00072                                   :
00073         import os
00074         import FWCore.ParameterSet.Config as cms
00075         prim=[]
00076         sec=[]
00077         for line in open(fileName,'r'):
00078                 if line.count(".root")>=2:
00079                         #two files solution...
00080                         entries=line.replace("\n","").split()
00081                         if not entries[0] in prim:
00082                                 prim.append(entries[0])
00083                         if not entries[1] in sec:
00084                                 sec.append(entries[1])
00085                 elif (line.find(".root")!=-1):
00086                         entry=line.replace("\n","")
00087                         if not entry in prim:
00088                                 prim.append(entry)
00089         if s:
00090                 if not hasattr(s,"fileNames"):
00091                         s.fileNames=cms.untracked.vstring(prim)
00092                 else:
00093                         s.fileNames.extend(prim)
00094                 if len(sec)!=0:
00095                         if not hasattr(s,"secondaryFileNames"):
00096                                 s.secondaryFileNames=cms.untracked.vstring(sec)
00097                         else:
00098                                 s.secondaryFileNames.extend(sec)
00099         print "found files: ",prim
00100         if len(sec)!=0:
00101                 print "found parent files:",sec
00102         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 1743 of file ConfigBuilder.py.

01744                                                                                                                                  :
01745 
01746     __import__(definitionFile)
01747     definitionModule = sys.modules[definitionFile]
01748     process.extend(definitionModule)
01749     stream = getattr(definitionModule,streamName)
01750     output = cms.OutputModule("PoolOutputModule")
01751     output.SelectEvents = stream.selectEvents
01752     output.outputCommands = stream.content
01753     output.dataset  = cms.untracked.PSet( dataTier = stream.dataTier)
01754     setattr(process,streamName,output)
01755     for path in stream.paths:
01756         schedule.append(path)
01757 

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 1758 of file ConfigBuilder.py.

01759                                                                         :
01760     """
01761     _promptReco_
01762 
01763     Method to install the standard PromptReco configuration into
01764     a basic process containing source and output modules.
01765 
01766     process is the CMS Process instance to be populated
01767 
01768     recoOutputModule is the output module used to write the
01769     RECO data tier
01770 
01771     aodOutputModule is the output module used to write
01772     the AOD data tier, if this is not none, any AOD sequences
01773     should be added.
01774     """
01775     cb = ConfigBuilder(defaultOptions, process = process)
01776     cb._options.step = 'RAW2DIGI,RECO'
01777     cb.addStandardSequences()
01778     cb.addConditions()
01779     process.load(cb.EVTCONTDefault)
01780     recoOutputModule.eventContent = process.RECOEventContent
01781     if aodOutputModule != None:
01782         aodOutputModule.eventContent = process.AODEventContent
01783     return process
01784 

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

Definition at line 136 of file ConfigBuilder.py.

00137                                                                       :
00138         from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag
00139         for s in aProcess.paths_().keys():
00140                 massSearchReplaceAnyInputTag(getattr(aProcess,s),oldT,newT)
00141 


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.341.2.2 $"

Definition at line 3 of file ConfigBuilder.py.

Definition at line 15 of file ConfigBuilder.py.

ConfigBuilder::promptReco = installPromptReco

Definition at line 1785 of file ConfigBuilder.py.