CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions | Variables
ConfigBuilder Namespace Reference

Classes

class  ConfigBuilder
 
class  Options
 

Functions

def addALCAPaths
 
def addOutputModule
 
def dumpPython
 
def filesFromDASQuery
 
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.28 $"
 
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 2116 of file ConfigBuilder.py.

2117 def addALCAPaths(process, listOfALCANames, definitionFile = "Configuration/StandardSequences/AlCaRecoStreams_cff"):
2118  """
2119  _addALCAPaths_
2120 
2121  Function to add alignment&calibration sequences to an existing process
2122  """
2123  __import__(definitionFile)
2124  definitionModule = sys.modules[definitionFile]
2125  process.extend(definitionModule)
2126 
2127  for alca in listOfALCANames:
2128  streamName = "ALCARECOStream%s" % alca
2129  stream = getattr(definitionModule, streamName)
2130  for path in stream.paths:
2131  schedule.append(path)
2132 
2133  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 2087 of file ConfigBuilder.py.

2088 def addOutputModule(process, tier, content):
2089  """
2090  _addOutputModule_
2091 
2092  Function to add an output module to a given process with given data tier and event content
2093  """
2094  print "WARNING. this method will not be supported any more SOON, please use --eventcontent --datatier field to drive the output module definitions"
2095 
2096  moduleName = "output%s%s" % (tier, content)
2097  pathName = "%sPath" % moduleName
2098  contentName = "%sEventContent" % content
2099  contentAttr = getattr(process, contentName)
2100  setattr(process, moduleName,
2101  cms.OutputModule("PoolOutputModule",
2102  contentAttr,
2103  fileName = cms.untracked.string('%s.root' % moduleName),
2104  dataset = cms.untracked.PSet(
2105  dataTier = cms.untracked.string(tier),
2106  ),
2107  )
2108  )
2109  print getattr(process,moduleName)
2110  # put it in an EndPath and put the EndPath into the schedule
2111  setattr(process, pathName, cms.EndPath(getattr(process,moduleName)) )
2112  process.schedule.append(getattr(process, pathName))
2113 
2114  return
2115 
def ConfigBuilder.dumpPython (   process,
  name 
)

Definition at line 74 of file ConfigBuilder.py.

Referenced by EnablePSetHistory.new_recurseDumpModifications_(), and SequenceTypes.TestModuleCommand.testCopyAndExclude().

74 
75 def dumpPython(process,name):
76  theObject = getattr(process,name)
77  if isinstance(theObject,cms.Path) or isinstance(theObject,cms.EndPath) or isinstance(theObject,cms.Sequence):
78  return "process."+name+" = " + theObject.dumpPython("process")
79  elif isinstance(theObject,_Module) or isinstance(theObject,cms.ESProducer):
80  return "process."+name+" = " + theObject.dumpPython()+"\n"
81  else:
return "process."+name+" = " + theObject.dumpPython()+"\n"
def ConfigBuilder.filesFromDASQuery (   query,
  s = None 
)

Definition at line 114 of file ConfigBuilder.py.

References split.

Referenced by ConfigBuilder.ConfigBuilder.filesFromOption().

115 def filesFromDASQuery(query,s=None):
116  import os
117  import FWCore.ParameterSet.Config as cms
118  prim=[]
119  sec=[]
120  print "the query is",query
121  for line in os.popen('das_client.py --query "%s"'%(query)):
122  if line.count(".root")>=2:
123  #two files solution...
124  entries=line.replace("\n","").split()
125  if not entries[0] in prim:
126  prim.append(entries[0])
127  if not entries[1] in sec:
128  sec.append(entries[1])
129  elif (line.find(".root")!=-1):
130  entry=line.replace("\n","")
131  if not entry in prim:
132  prim.append(entry)
133  if s:
134  if not hasattr(s,"fileNames"):
135  s.fileNames=cms.untracked.vstring(prim)
136  else:
137  s.fileNames.extend(prim)
138  if len(sec)!=0:
139  if not hasattr(s,"secondaryFileNames"):
140  s.secondaryFileNames=cms.untracked.vstring(sec)
141  else:
142  s.secondaryFileNames.extend(sec)
143  print "found files: ",prim
144  if len(sec)!=0:
145  print "found parent files:",sec
146  return (prim,sec)
double split
Definition: MVATrainer.cc:139
def ConfigBuilder.filesFromList (   fileName,
  s = None 
)

Definition at line 82 of file ConfigBuilder.py.

References split.

Referenced by ConfigBuilder.ConfigBuilder.filesFromOption().

82 
83 def filesFromList(fileName,s=None):
84  import os
85  import FWCore.ParameterSet.Config as cms
86  prim=[]
87  sec=[]
88  for line in open(fileName,'r'):
89  if line.count(".root")>=2:
90  #two files solution...
91  entries=line.replace("\n","").split()
92  if not entries[0] in prim:
93  prim.append(entries[0])
94  if not entries[1] in sec:
95  sec.append(entries[1])
96  elif (line.find(".root")!=-1):
97  entry=line.replace("\n","")
98  if not entry in prim:
99  prim.append(entry)
100  if s:
101  if not hasattr(s,"fileNames"):
102  s.fileNames=cms.untracked.vstring(prim)
103  else:
104  s.fileNames.extend(prim)
105  if len(sec)!=0:
106  if not hasattr(s,"secondaryFileNames"):
107  s.secondaryFileNames=cms.untracked.vstring(sec)
108  else:
109  s.secondaryFileNames.extend(sec)
110  print "found files: ",prim
111  if len(sec)!=0:
112  print "found parent files:",sec
113  return (prim,sec)
double split
Definition: MVATrainer.cc:139
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.

Referenced by ConfigBuilder.ConfigBuilder.prepare_L1().

38 
39 def getConfigsForScenario(sequence = None):
40  """
41  Retrieves the list of files needed to run a given trigger menu.
42  If no trigger or an invalid trigger is given, use the default one.
43  """
44 
45  if not sequence:
46  # no trigger was specified, use the default one
47  trigger = __default
48  else:
49  # check if the specified trigger is valid
50  trigger = sequence
51  if trigger not in __triggerTable:
52  print 'An unsupported trigger has been requested: %s' % sequence
53  print 'The default one will be used instead: %s' % __default
54  print 'The supported triggers are:'
55  for key in __triggerTable.iterkeys():
56  print '\t%s' % key
57  print
58  trigger = __default
59 
60  return __triggerTable[trigger]
61 
def getConfigsForScenario
def ConfigBuilder.getDefaultTrigger ( )
Retrieves the default trigger name

Definition at line 24 of file ConfigBuilder.py.

24 
25 def getDefaultTrigger():
26  """
27  Retrieves the default trigger name
28  """
29  return __default
30 
def ConfigBuilder.getHelp ( )
Retrieves the list of available triggers

Definition at line 31 of file ConfigBuilder.py.

31 
32 def getHelp():
33  """
34  Retrieves the list of available triggers
35  """
36  return __triggerTable.iterkeys()
37 
def ConfigBuilder.installFilteredStream (   process,
  schedule,
  streamName,
  definitionFile = "Configuration/StandardSequences/AlCaRecoStreams_cff" 
)

Definition at line 2042 of file ConfigBuilder.py.

2043 def installFilteredStream(process, schedule, streamName, definitionFile = "Configuration/StandardSequences/AlCaRecoStreams_cff" ):
2044 
2045  __import__(definitionFile)
2046  definitionModule = sys.modules[definitionFile]
2047  process.extend(definitionModule)
2048  stream = getattr(definitionModule,streamName)
2049  output = cms.OutputModule("PoolOutputModule")
2050  output.SelectEvents = stream.selectEvents
2051  output.outputCommands = stream.content
2052  output.dataset = cms.untracked.PSet( dataTier = stream.dataTier)
2053  setattr(process,streamName,output)
2054  for path in stream.paths:
2055  schedule.append(path)
2056 
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 2057 of file ConfigBuilder.py.

2058 def installPromptReco(process, recoOutputModule, aodOutputModule = None):
2059  """
2060  _promptReco_
2061 
2062  Method to install the standard PromptReco configuration into
2063  a basic process containing source and output modules.
2064 
2065  process is the CMS Process instance to be populated
2066 
2067  recoOutputModule is the output module used to write the
2068  RECO data tier
2069 
2070  aodOutputModule is the output module used to write
2071  the AOD data tier, if this is not none, any AOD sequences
2072  should be added.
2073  """
2074  cb = ConfigBuilder(defaultOptions, process = process)
2075  cb._options.step = 'RAW2DIGI,RECO'
2076  cb.addStandardSequences()
2077  cb.addConditions()
2078  process.load(cb.EVTCONTDefault)
2079  recoOutputModule.eventContent = process.RECOEventContent
2080  if aodOutputModule != None:
2081  aodOutputModule.eventContent = process.AODEventContent
2082  return process
2083 
def ConfigBuilder.MassReplaceInputTag (   aProcess,
  oldT = "rawDataCollector",
  newT = "rawDataRepacker" 
)

Definition at line 147 of file ConfigBuilder.py.

References relativeConstraints.keys, and helpers.massSearchReplaceAnyInputTag().

148 def MassReplaceInputTag(aProcess,oldT="rawDataCollector",newT="rawDataRepacker"):
149  from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag
150  for s in aProcess.paths_().keys():
151  massSearchReplaceAnyInputTag(getattr(aProcess,s),oldT,newT)
152 
def massSearchReplaceAnyInputTag
Definition: helpers.py:218

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.

dictionary ConfigBuilder.__triggerTable
Initial value:
1 = {
2 
3  # HLT trigger table for the 2009 STARTUP 8E29 menu
4  '8E29': (
5  'FastSimulation/Configuration/HLT_8E29_cff',
6  ),
7 
8  # HLT trigger table for the 2009 Global Run menu
9  'GRun': (
10  'FastSimulation/Configuration/HLT_GRun_cff',
11  ),
12 
13  # HLT trigger table for the 2009 STARTUP 1E31 menu
14  '1E31': (
15  'FastSimulation/Configuration/HLT_1E31_cff',
16  )
17 }

Definition at line 2 of file ConfigBuilder.py.

string ConfigBuilder.__version__ = "$Revision: 1.381.2.28 $"

Definition at line 3 of file ConfigBuilder.py.

tuple ConfigBuilder.defaultOptions = Options()

Definition at line 15 of file ConfigBuilder.py.

ConfigBuilder.promptReco = installPromptReco

Definition at line 2084 of file ConfigBuilder.py.