CMS 3D CMS Logo

Classes | Functions | Variables

ConfigBuilder Namespace Reference

Classes

class  ConfigBuilder
class  Options

Functions

def dumpPython
def filesFromDBSQuery
def filesFromList
def getConfigsForScenario
def getDefaultTrigger
def getHelp
def MassReplaceInputTag

Variables

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

Function Documentation

def ConfigBuilder::dumpPython (   process,
  name 
)

Definition at line 74 of file ConfigBuilder.py.

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

Definition at line 114 of file ConfigBuilder.py.

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

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

Definition at line 82 of file ConfigBuilder.py.

00083                                   :
00084         import os
00085         import FWCore.ParameterSet.Config as cms
00086         prim=[]
00087         sec=[]
00088         for line in open(fileName,'r'):
00089                 if line.count(".root")>=2:
00090                         #two files solution...
00091                         entries=line.replace("\n","").split()
00092                         if not entries[0] in prim:
00093                                 prim.append(entries[0])
00094                         if not entries[1] in sec:
00095                                 sec.append(entries[1])
00096                 elif (line.find(".root")!=-1):
00097                         entry=line.replace("\n","")
00098                         if not entry in prim:
00099                                 prim.append(entry)
00100         if s:
00101                 if not hasattr(s,"fileNames"):
00102                         s.fileNames=cms.untracked.vstring(prim)
00103                 else:
00104                         s.fileNames.extend(prim)
00105                 if len(sec)!=0:
00106                         if not hasattr(s,"secondaryFileNames"):
00107                                 s.secondaryFileNames=cms.untracked.vstring(sec)
00108                         else:
00109                                 s.secondaryFileNames.extend(sec)
00110         print "found files: ",prim
00111         if len(sec)!=0:
00112                 print "found parent files:",sec
00113         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::MassReplaceInputTag (   aProcess,
  oldT = "rawDataCollector",
  newT = "rawDataRepacker" 
)

Definition at line 147 of file ConfigBuilder.py.

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


Variable Documentation

string ConfigBuilder::__default = 'GRun'

Definition at line 21 of file ConfigBuilder.py.

string ConfigBuilder::__source__ = "$Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/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.11 $"

Definition at line 3 of file ConfigBuilder.py.

Definition at line 15 of file ConfigBuilder.py.