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.14 $"
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 116 of file ConfigBuilder.py.

00117                                    :
00118         import os
00119         import FWCore.ParameterSet.Config as cms
00120         prim=[]
00121         sec=[]
00122         print "the query is",query
00123         for line in os.popen('dbs search --query "%s"'%(query)):
00124                 if line.count(".root")>=2:
00125                         #two files solution...
00126                         entries=line.replace("\n","").split()
00127                         if not entries[0] in prim:
00128                                 prim.append(entries[0])
00129                         if not entries[1] in sec:
00130                                 sec.append(entries[1])
00131                 elif (line.find(".root")!=-1):
00132                         entry=line.replace("\n","")
00133                         if not entry in prim:
00134                                 prim.append(entry)
00135         if s:
00136                 if not hasattr(s,"fileNames"):
00137                         s.fileNames=cms.untracked.vstring(prim)
00138                 else:
00139                         s.fileNames.extend(prim)
00140                 if len(sec)!=0:
00141                         if not hasattr(s,"secondaryFileNames"):
00142                                 s.secondaryFileNames=cms.untracked.vstring(sec)
00143                         else:
00144                                 s.secondaryFileNames.extend(sec)
00145         print "found files: ",prim
00146         if len(sec)!=0:
00147                 print "found parent files:",sec
00148         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(prim)==0:
00112                 raise Exception("There are not files in input from the file list")
00113         if len(sec)!=0:
00114                 print "found parent files:",sec
00115         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 149 of file ConfigBuilder.py.

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


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

Definition at line 3 of file ConfigBuilder.py.

Definition at line 15 of file ConfigBuilder.py.