ATLAS Offline Software
Loading...
Searching...
No Matches
python.JetAnalysisCommon.ConfNameSpace Class Reference
Collaboration diagram for python.JetAnalysisCommon.ConfNameSpace:

Public Member Functions

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

Public Attributes

str prefix = "" else ""

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 251 of file JetAnalysisCommon.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 259 of file JetAnalysisCommon.py.

259 def __init__(self, name=""):
260 self.prefix=name+"::" if name !="" else ""
261

Member Function Documentation

◆ __getattr__()

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

Definition at line 262 of file JetAnalysisCommon.py.

262 def __getattr__(self, t):
263 return self.getComp(t)
264

◆ addNameSpaces()

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

Definition at line 292 of file JetAnalysisCommon.py.

292 def addNameSpaces(self, *nsList):
293 for ns in nsList:
294 setattr(self, ns, ConfNameSpace(self.prefix+ns))
295
296
297
298# ----------------------------
299# A replacement for CompFactory

◆ getComp()

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 265 of file JetAnalysisCommon.py.

265 def getComp(self, classname):
266 """generates a new Configured class for the C++ class ROOT.classname .
267 This implies there must be a dictionnary for classname.
268 """
269
270 # if we already generated the class, return it :
271 c = self.__dict__.get(classname, None)
272 if c is not None:
273 return c
274
275 # look for the c++ class from ROOT :
276 c=getattr(ROOT, self.prefix+classname, None)
277
278 if c is None:
279 print("JetAnalysisCommon ERROR : ",classname," is not a known C++ tool, alg, or namespace ")
280 raise
281
282 if hasattr(c,'getPropertyMgr'):
283 conf = generateConfigured(classname,c,self.prefix)
284 else:
285 # not a configurable. Must be a namespace
286 conf = ConfNameSpace(self.prefix+classname)
287
288 # save this new class onto self :
289 setattr(self, classname, conf)
290 return conf
291
void print(char *figname, TCanvas *c1)
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130

Member Data Documentation

◆ prefix

str python.JetAnalysisCommon.ConfNameSpace.prefix = "" else ""

Definition at line 260 of file JetAnalysisCommon.py.


The documentation for this class was generated from the following file: