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

2100 def addALCAPaths(process, listOfALCANames, definitionFile = "Configuration/StandardSequences/AlCaRecoStreams_cff"):
2101  """
2102  _addALCAPaths_
2103 
2104  Function to add alignment&calibration sequences to an existing process
2105  """
2106  __import__(definitionFile)
2107  definitionModule = sys.modules[definitionFile]
2108  process.extend(definitionModule)
2109 
2110  for alca in listOfALCANames:
2111  streamName = "ALCARECOStream%s" % alca
2112  stream = getattr(definitionModule, streamName)
2113  for path in stream.paths:
2114  schedule.append(path)
2115 
2116  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 2070 of file ConfigBuilder.py.

2071 def addOutputModule(process, tier, content):
2072  """
2073  _addOutputModule_
2074 
2075  Function to add an output module to a given process with given data tier and event content
2076  """
2077  print "WARNING. this method will not be supported any more SOON, please use --eventcontent --datatier field to drive the output module definitions"
2078 
2079  moduleName = "output%s%s" % (tier, content)
2080  pathName = "%sPath" % moduleName
2081  contentName = "%sEventContent" % content
2082  contentAttr = getattr(process, contentName)
2083  setattr(process, moduleName,
2084  cms.OutputModule("PoolOutputModule",
2085  contentAttr,
2086  fileName = cms.untracked.string('%s.root' % moduleName),
2087  dataset = cms.untracked.PSet(
2088  dataTier = cms.untracked.string(tier),
2089  ),
2090  )
2091  )
2092  print getattr(process,moduleName)
2093  # put it in an EndPath and put the EndPath into the schedule
2094  setattr(process, pathName, cms.EndPath(getattr(process,moduleName)) )
2095  process.schedule.append(getattr(process, pathName))
2096 
2097  return
2098 
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 2025 of file ConfigBuilder.py.

2026 def installFilteredStream(process, schedule, streamName, definitionFile = "Configuration/StandardSequences/AlCaRecoStreams_cff" ):
2027 
2028  __import__(definitionFile)
2029  definitionModule = sys.modules[definitionFile]
2030  process.extend(definitionModule)
2031  stream = getattr(definitionModule,streamName)
2032  output = cms.OutputModule("PoolOutputModule")
2033  output.SelectEvents = stream.selectEvents
2034  output.outputCommands = stream.content
2035  output.dataset = cms.untracked.PSet( dataTier = stream.dataTier)
2036  setattr(process,streamName,output)
2037  for path in stream.paths:
2038  schedule.append(path)
2039 
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 2040 of file ConfigBuilder.py.

2041 def installPromptReco(process, recoOutputModule, aodOutputModule = None):
2042  """
2043  _promptReco_
2044 
2045  Method to install the standard PromptReco configuration into
2046  a basic process containing source and output modules.
2047 
2048  process is the CMS Process instance to be populated
2049 
2050  recoOutputModule is the output module used to write the
2051  RECO data tier
2052 
2053  aodOutputModule is the output module used to write
2054  the AOD data tier, if this is not none, any AOD sequences
2055  should be added.
2056  """
2057  cb = ConfigBuilder(defaultOptions, process = process)
2058  cb._options.step = 'RAW2DIGI,RECO'
2059  cb.addStandardSequences()
2060  cb.addConditions()
2061  process.load(cb.EVTCONTDefault)
2062  recoOutputModule.eventContent = process.RECOEventContent
2063  if aodOutputModule != None:
2064  aodOutputModule.eventContent = process.AODEventContent
2065  return process
2066 
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 2067 of file ConfigBuilder.py.