Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Public Attributes | List of all members
python.JetAnalysisCommon.ConfNameSpace Class Reference
Collaboration diagram for python.JetAnalysisCommon.ConfNameSpace:

Public Member Functions

def __init__ (self, name="")
 
def __getattr__ (self, t)
 
def getComp (self, classname)
 
def addNameSpaces (self, *nsList)
 

Public Attributes

 prefix
 

Detailed Description

A namespace able to automatically generate Configured when quering attributes :
Used to replace CompFactory so that expressions like :
  tool = CompFactory.Trk.SomeTrkTool("tname", Prop=2.345) 
  tool = CompFactory.getComp("Trk::SomeTrkTool")("tname", Prop=2.345) 
works. 
In the above 2 examples both CompFactory and Trk are ConfNameSpace

Definition at line 206 of file JetAnalysisCommon.py.

Constructor & Destructor Documentation

◆ __init__()

def python.JetAnalysisCommon.ConfNameSpace.__init__ (   self,
  name = "" 
)

Definition at line 214 of file JetAnalysisCommon.py.

214  def __init__(self, name=""):
215  self.prefix=name+"::" if name !="" else ""
216 

Member Function Documentation

◆ __getattr__()

def python.JetAnalysisCommon.ConfNameSpace.__getattr__ (   self,
  t 
)

Definition at line 217 of file JetAnalysisCommon.py.

217  def __getattr__(self, t):
218  return self.getComp(t)
219 

◆ addNameSpaces()

def python.JetAnalysisCommon.ConfNameSpace.addNameSpaces (   self,
nsList 
)

Definition at line 247 of file JetAnalysisCommon.py.

247  def addNameSpaces(self, *nsList):
248  for ns in nsList:
249  setattr(self, ns, ConfNameSpace(self.prefix+ns))
250 
251 
252 
253 # ----------------------------
254 # A replacement for CompFactory

◆ getComp()

def python.JetAnalysisCommon.ConfNameSpace.getComp (   self,
  classname 
)
generates a new Configured class for the C++ class ROOT.classname .
 This implies there must be a dictionnary for classname.

Definition at line 220 of file JetAnalysisCommon.py.

220  def getComp(self, classname):
221  """generates a new Configured class for the C++ class ROOT.classname .
222  This implies there must be a dictionnary for classname.
223  """
224 
225  # if we already generated the class, return it :
226  c = self.__dict__.get(classname, None)
227  if c is not None:
228  return c
229 
230  # look for the c++ class from ROOT :
231  c=getattr(ROOT, self.prefix+classname, None)
232 
233  if c is None:
234  print("JetAnalysisCommon ERROR : ",classname," is not a known C++ tool, alg, or namespace ")
235  raise
236 
237  if hasattr(c,'getPropertyMgr'):
238  conf = generateConfigured(classname,c,self.prefix)
239  else:
240  # not a configurable. Must be a namespace
241  conf = ConfNameSpace(self.prefix+classname)
242 
243  # save this new class onto self :
244  setattr(self, classname, conf)
245  return conf
246 

Member Data Documentation

◆ prefix

python.JetAnalysisCommon.ConfNameSpace.prefix

Definition at line 215 of file JetAnalysisCommon.py.


The documentation for this class was generated from the following file:
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
python.JetAnalysisCommon.generateConfigured
def generateConfigured(classname, cppclass, prefix="")
Definition: JetAnalysisCommon.py:189