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 dumpPython
 
def filesFromDASQuery
 
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.19 $"
 
tuple defaultOptions = Options()
 

Function Documentation

def ConfigBuilder.dumpPython (   process,
  name 
)

Definition at line 81 of file ConfigBuilder.py.

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

81 
82 def dumpPython(process,name):
83  theObject = getattr(process,name)
84  if isinstance(theObject,cms.Path) or isinstance(theObject,cms.EndPath) or isinstance(theObject,cms.Sequence):
85  return "process."+name+" = " + theObject.dumpPython("process")
86  elif isinstance(theObject,_Module) or isinstance(theObject,cms.ESProducer):
87  return "process."+name+" = " + theObject.dumpPython()+"\n"
88  else:
return "process."+name+" = " + theObject.dumpPython()+"\n"
def ConfigBuilder.filesFromDASQuery (   query,
  s = None 
)

Definition at line 123 of file ConfigBuilder.py.

References split.

Referenced by ConfigBuilder.ConfigBuilder.filesFromOption(), and ConfigBuilder.ConfigBuilder.prepare_DATAMIX().

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

Definition at line 89 of file ConfigBuilder.py.

References split.

Referenced by ConfigBuilder.ConfigBuilder.filesFromOption(), and ConfigBuilder.ConfigBuilder.prepare_DATAMIX().

89 
90 def filesFromList(fileName,s=None):
91  import os
92  import FWCore.ParameterSet.Config as cms
93  prim=[]
94  sec=[]
95  for line in open(fileName,'r'):
96  if line.count(".root")>=2:
97  #two files solution...
98  entries=line.replace("\n","").split()
99  if not entries[0] in prim:
100  prim.append(entries[0])
101  if not entries[1] in sec:
102  sec.append(entries[1])
103  elif (line.find(".root")!=-1):
104  entry=line.replace("\n","")
105  if not entry in prim:
106  prim.append(entry)
107  if s:
108  if not hasattr(s,"fileNames"):
109  s.fileNames=cms.untracked.vstring(prim)
110  else:
111  s.fileNames.extend(prim)
112  if len(sec)!=0:
113  if not hasattr(s,"secondaryFileNames"):
114  s.secondaryFileNames=cms.untracked.vstring(sec)
115  else:
116  s.secondaryFileNames.extend(sec)
117  print "found files: ",prim
118  if len(prim)==0:
119  raise Exception("There are not files in input from the file list")
120  if len(sec)!=0:
121  print "found parent files:",sec
122  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.MassReplaceInputTag (   aProcess,
  oldT = "rawDataCollector",
  newT = "rawDataRepacker" 
)

Definition at line 156 of file ConfigBuilder.py.

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

157 def MassReplaceInputTag(aProcess,oldT="rawDataCollector",newT="rawDataRepacker"):
158  from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag
159  for s in aProcess.paths_().keys():
160  massSearchReplaceAnyInputTag(getattr(aProcess,s),oldT,newT)
161 
def massSearchReplaceAnyInputTag
Definition: helpers.py:262

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.

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

Definition at line 3 of file ConfigBuilder.py.

tuple ConfigBuilder.defaultOptions = Options()

Definition at line 15 of file ConfigBuilder.py.