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 anyOf
 
def dumpPython
 
def filesFromDASQuery
 
def filesFromList
 
def MassReplaceInputTag
 

Variables

string __source__ = "$Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v $"
 
string __version__ = "$Revision: 1.19 $"
 
tuple defaultOptions = Options()
 

Function Documentation

def ConfigBuilder.anyOf (   listOfKeys,
  dict,
  opt = None 
)

Definition at line 162 of file ConfigBuilder.py.

References join().

163 def anyOf(listOfKeys,dict,opt=None):
164  for k in listOfKeys:
165  if k in dict:
166  toReturn=dict[k]
167  dict.pop(k)
168  return toReturn
169  if opt!=None:
170  return opt
171  else:
172  raise Exception("any of "+','.join(listOfKeys)+" are mandatory entries of --output options")
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def ConfigBuilder.dumpPython (   process,
  name 
)

Definition at line 82 of file ConfigBuilder.py.

Referenced by MixingModule_Full2Fast.get_VertexGeneratorPSet_PileUpProducer(), EnablePSetHistory.new_recurseDumpModifications_(), ConfigBuilder.ConfigBuilder.prepare(), and SequenceTypes.TestModuleCommand.testCopyAndExclude().

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

Definition at line 124 of file ConfigBuilder.py.

References split.

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

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

Definition at line 90 of file ConfigBuilder.py.

References split.

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

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

Definition at line 157 of file ConfigBuilder.py.

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

Referenced by customizeHLTforALL.customizeHLTforAll(), customizeHLTforMC.customizeHLTforMC(), and ConfigBuilder.ConfigBuilder.prepare().

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

Variable Documentation

string ConfigBuilder.__source__ = "$Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v $"

Definition at line 4 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 16 of file ConfigBuilder.py.