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

References join().

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

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

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

Definition at line 126 of file ConfigBuilder.py.

References list(), and split.

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

127 def filesFromDASQuery(query,option="",s=None):
128  import os,time
129  import FWCore.ParameterSet.Config as cms
130  prim=[]
131  sec=[]
132  print "the query is",query
133  eC=5
134  count=0
135  while eC!=0 and count<3:
136  if count!=0:
137  print 'Sleeping, then retrying DAS'
138  time.sleep(100)
139  p = Popen('dasgoclient %s --query "%s"'%(option,query), stdout=PIPE,shell=True)
140  pipe=p.stdout.read()
141  tupleP = os.waitpid(p.pid, 0)
142  eC=tupleP[1]
143  count=count+1
144  if eC==0:
145  print "DAS succeeded after",count,"attempts",eC
146  else:
147  print "DAS failed 3 times- I give up"
148  for line in pipe.split('\n'):
149  if line.count(".root")>=2:
150  #two files solution...
151  entries=line.replace("\n","").split()
152  prim.append(entries[0])
153  sec.append(entries[1])
154  elif (line.find(".root")!=-1):
155  entry=line.replace("\n","")
156  prim.append(entry)
157  # remove any duplicates
158  prim = sorted(list(set(prim)))
159  sec = sorted(list(set(sec)))
160  if s:
161  if not hasattr(s,"fileNames"):
162  s.fileNames=cms.untracked.vstring(prim)
163  else:
164  s.fileNames.extend(prim)
165  if len(sec)!=0:
166  if not hasattr(s,"secondaryFileNames"):
167  s.secondaryFileNames=cms.untracked.vstring(sec)
168  else:
169  s.secondaryFileNames.extend(sec)
170  print "found files: ",prim
171  if len(sec)!=0:
172  print "found parent files:",sec
173  return (prim,sec)
double split
Definition: MVATrainer.cc:139
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
def ConfigBuilder.filesFromList (   fileName,
  s = None 
)

Definition at line 92 of file ConfigBuilder.py.

References list(), and split.

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

92 
93 def filesFromList(fileName,s=None):
94  import os
95  import FWCore.ParameterSet.Config as cms
96  prim=[]
97  sec=[]
98  for line in open(fileName,'r'):
99  if line.count(".root")>=2:
100  #two files solution...
101  entries=line.replace("\n","").split()
102  prim.append(entries[0])
103  sec.append(entries[1])
104  elif (line.find(".root")!=-1):
105  entry=line.replace("\n","")
106  prim.append(entry)
107  # remove any duplicates
108  prim = sorted(list(set(prim)))
109  sec = sorted(list(set(sec)))
110  if s:
111  if not hasattr(s,"fileNames"):
112  s.fileNames=cms.untracked.vstring(prim)
113  else:
114  s.fileNames.extend(prim)
115  if len(sec)!=0:
116  if not hasattr(s,"secondaryFileNames"):
117  s.secondaryFileNames=cms.untracked.vstring(sec)
118  else:
119  s.secondaryFileNames.extend(sec)
120  print "found files: ",prim
121  if len(prim)==0:
122  raise Exception("There are not files in input from the file list")
123  if len(sec)!=0:
124  print "found parent files:",sec
125  return (prim,sec)
double split
Definition: MVATrainer.cc:139
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
def ConfigBuilder.MassReplaceInputTag (   aProcess,
  oldT = "rawDataCollector",
  newT = "rawDataRepacker" 
)

Definition at line 174 of file ConfigBuilder.py.

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

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

175 def MassReplaceInputTag(aProcess,oldT="rawDataCollector",newT="rawDataRepacker"):
176  from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag
177  for s in aProcess.paths_().keys():
178  massSearchReplaceAnyInputTag(getattr(aProcess,s),oldT,newT)
def massSearchReplaceAnyInputTag
Definition: helpers.py:271

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.