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

References join().

181 def anyOf(listOfKeys,dict,opt=None):
182  for k in listOfKeys:
183  if k in dict:
184  toReturn=dict[k]
185  dict.pop(k)
186  return toReturn
187  if opt!=None:
188  return opt
189  else:
190  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 85 of file ConfigBuilder.py.

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

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

Definition at line 127 of file ConfigBuilder.py.

References split.

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

128 def filesFromDASQuery(query,option="",s=None):
129  import os,time
130  import FWCore.ParameterSet.Config as cms
131  prim=[]
132  sec=[]
133  print "the query is",query
134  eC=5
135  count=0
136  while eC!=0 and count<3:
137  if count!=0:
138  print 'Sleeping, then retrying DAS'
139  time.sleep(100)
140  p = Popen('das_client.py %s --query "%s"'%(option,query), stdout=PIPE,shell=True)
141  pipe=p.stdout.read()
142  tupleP = os.waitpid(p.pid, 0)
143  eC=tupleP[1]
144  count=count+1
145  if eC==0:
146  print "DAS succeeded after",count,"attempts",eC
147  else:
148  print "DAS failed 3 times- I give up"
149  for line in pipe.split('\n'):
150  if line.count(".root")>=2:
151  #two files solution...
152  entries=line.replace("\n","").split()
153  if not entries[0] in prim:
154  prim.append(entries[0])
155  if not entries[1] in sec:
156  sec.append(entries[1])
157  elif (line.find(".root")!=-1):
158  entry=line.replace("\n","")
159  if not entry in prim:
160  prim.append(entry)
161  if s:
162  if not hasattr(s,"fileNames"):
163  s.fileNames=cms.untracked.vstring(prim)
164  else:
165  s.fileNames.extend(prim)
166  if len(sec)!=0:
167  if not hasattr(s,"secondaryFileNames"):
168  s.secondaryFileNames=cms.untracked.vstring(sec)
169  else:
170  s.secondaryFileNames.extend(sec)
171  print "found files: ",prim
172  if len(sec)!=0:
173  print "found parent files:",sec
174  return (prim,sec)
double split
Definition: MVATrainer.cc:139
def ConfigBuilder.filesFromList (   fileName,
  s = None 
)

Definition at line 93 of file ConfigBuilder.py.

References split.

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

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

Definition at line 175 of file ConfigBuilder.py.

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

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

176 def MassReplaceInputTag(aProcess,oldT="rawDataCollector",newT="rawDataRepacker"):
177  from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag
178  for s in aProcess.paths_().keys():
179  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 17 of file ConfigBuilder.py.