ATLAS Offline Software
Loading...
Searching...
No Matches
JetMonitoringConfig.ToolSpec Class Reference
Inheritance diagram for JetMonitoringConfig.ToolSpec:
Collaboration diagram for JetMonitoringConfig.ToolSpec:

Public Member Functions

 __init__ (self, klass, name, **args)
 toTool (self)
 clone (self, newname, **args)
 defineHisto (self, parentAlg, monhelper, path)
 __getattr__ (self, attr)
 __setattr__ (self, attr, value)
 __setitem__ (self, attr, value)
 dump (self, out=None)

Public Attributes

 name = name
 klass = klass

Protected Member Functions

 _dump (self, writeFunc)

Detailed Description

A dictionary specialized for containing the specification of a Athena tool.    

Definition at line 158 of file JetMonitoringConfig.py.

Constructor & Destructor Documentation

◆ __init__()

JetMonitoringConfig.ToolSpec.__init__ ( self,
klass,
name,
** args )

Definition at line 161 of file JetMonitoringConfig.py.

161 def __init__(self, klass, name, **args):
162 self.name = name
163 self.klass = klass
164 ConfigDict.__init__(self, **args)
165
166

Member Function Documentation

◆ __getattr__()

JetMonitoringConfig.ConfigDict.__getattr__ ( self,
attr )
inherited

Definition at line 47 of file JetMonitoringConfig.py.

47 def __getattr__(self, attr):
48 try:
49 return self[attr]
50 except KeyError:
51 dict.__getattribute__(self,attr)
52 #raise AttributeError(attr)
53

◆ __setattr__()

JetMonitoringConfig.ConfigDict.__setattr__ ( self,
attr,
value )
inherited

Definition at line 54 of file JetMonitoringConfig.py.

54 def __setattr__(self, attr, value):
55 if attr in ['keys', 'clear', 'update', 'pop', 'iteritems', 'values','setdefault','get','has_key','copy']:
56 print('ConfigDict ERROR can not assign attribute ', attr)
57 return
58 dict.__setitem__(self, attr, value)
59 dict.__setattr__(self, attr, value)
void print(char *figname, TCanvas *c1)

◆ __setitem__()

JetMonitoringConfig.ConfigDict.__setitem__ ( self,
attr,
value )
inherited

Definition at line 60 of file JetMonitoringConfig.py.

60 def __setitem__(self, attr, value):
61 if attr in ['keys', 'clear', 'update', 'pop', 'iteritems', 'values','setdefault','get','has_key','copy']:
62 print('ConfigDict ERROR can not assign attribute ', attr)
63 return
64 dict.__setitem__(self, attr, value)
65 dict.__setattr__(self, attr, value)
66
67

◆ _dump()

JetMonitoringConfig.ConfigDict._dump ( self,
writeFunc )
protectedinherited

Reimplemented in JetMonitoringConfig.HistoSpec, JetMonitoringConfig.JetMonAlgSpec, JetMonitoringConfig.SelectSpec, and JetMonitoringConfig.VarSpec.

Definition at line 85 of file JetMonitoringConfig.py.

85 def _dump(self, writeFunc):
86 def write(s, e='\n'): writeFunc(' '+s,e)
87 writeFunc(self.__class__.__name__+'(')
88 for k,v in sorted(self.items()):
89 if isinstance(v, ConfigDict):
90 write(k+' = ','')
91 v._dump(write)
92 else:
93 write(k+' = '+str(v))
94 writeFunc(')')
95
96
97
98
99# **********************************************************
100# **********************************************************
101# Helper functions
102# **********************************************************
103
104

◆ clone()

JetMonitoringConfig.ToolSpec.clone ( self,
newname,
** args )

Reimplemented from JetMonitoringConfig.ConfigDict.

Reimplemented in JetMonitoringConfig.HistoSpec.

Definition at line 192 of file JetMonitoringConfig.py.

192 def clone(self, newname,**args):
193 return ConfigDict.clone(self, name=newname, **args)
194

◆ defineHisto()

JetMonitoringConfig.ToolSpec.defineHisto ( self,
parentAlg,
monhelper,
path )

Reimplemented in JetMonitoringConfig.EventHistoSpec, JetMonitoringConfig.HistoSpec, and JetMonitoringConfig.SelectSpec.

Definition at line 195 of file JetMonitoringConfig.py.

195 def defineHisto(self, parentAlg, monhelper , path):
196 # Assume a helper function was given :
197 defineHistoFunc = self.defineHistoFunc
198 # call it :
199 defineHistoFunc(self, parentAlg, monhelper , path)
200
201
202

◆ dump()

JetMonitoringConfig.ConfigDict.dump ( self,
out = None )
inherited
prints the content of this dict on stdout (default) or in the file 'out' 

Definition at line 76 of file JetMonitoringConfig.py.

76 def dump(self, out=None):
77 """ prints the content of this dict on stdout (default) or in the file 'out' """
78 if out is None :
79 from sys import stdout
80 out = stdout
81 _write = out.write
82 def write(s, e='\n'): _write(s+e)
83 self._dump(write)
84
-event-from-file

◆ toTool()

JetMonitoringConfig.ToolSpec.toTool ( self)

Reimplemented in JetMonitoringConfig.EventHistoSpec, JetMonitoringConfig.HistoSpec, JetMonitoringConfig.SelectSpec, and JetMonitoringConfig.VarSpec.

Definition at line 167 of file JetMonitoringConfig.py.

167 def toTool(self):
168 from AthenaConfiguration.ComponentFactory import CompFactory
169 conf = self.clone(self.name)
170 klass = getattr(CompFactory,conf.pop('klass')) # remove 'klass'
171 conf.pop('name')
172 conf.pop('topLevelDir',None)
173 conf.pop('bottomLevelDir',None)
174 conf.pop('defineHistoFunc',None) # not used here.
175 for k, v in conf.items():
176 if isinstance(v,ToolSpec):
177 v.topLevelDir = self.topLevelDir
178 v.bottomLevelDir = self.bottomLevelDir
179 conf[k] = v.toTool()
180 if isinstance(v,list):
181 if v == []: continue
182 if isinstance(v[0],ToolSpec):
183 # assume we have k is a ToolHandleArray
184 toolInstances = []
185 for toolSpec in v:
186 toolSpec.topLevelDir=self.topLevelDir
187 toolSpec.bottomLevelDir=self.bottomLevelDir
188 toolInstances.append( toolSpec.toTool() )
189 conf[k] = toolInstances
190 return klass(**conf)
191

Member Data Documentation

◆ klass

JetMonitoringConfig.ToolSpec.klass = klass

Definition at line 163 of file JetMonitoringConfig.py.

◆ name

JetMonitoringConfig.ToolSpec.name = name

Definition at line 162 of file JetMonitoringConfig.py.


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