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

Public Member Functions

 __init__ (self, selname, selexpr, path=None, **args)
 appendHistos (self, *hfillers)
 toTool (self)
 defineHisto (self, parentAlg, monhelper, path)
 clone (self, newname, **args)
 __getattr__ (self, attr)
 __setattr__ (self, attr, value)
 __setitem__ (self, attr, value)
 dump (self, out=None)

Public Attributes

 path = path
list FillerTools = []
 name = name
 klass = klass

Protected Member Functions

 _dump (self, writeFunc)

Detailed Description

A dictionary specialized to contain a JetHistoSelectSort specification
Invocation is like : spec = SelectSpec( name, , expr, path ) where 
 - name : a string naming the selection being applied
 - expr : s string, defining a selection in the form '0.123<var<4.567' where var is an attribute/variable
 - path : optional string, giving the sub-directory into which histos for this selection will be put. if not set, defaults to name.

Definition at line 426 of file JetMonitoringConfig.py.

Constructor & Destructor Documentation

◆ __init__()

JetMonitoringConfig.SelectSpec.__init__ ( self,
selname,
selexpr,
path = None,
** args )

Definition at line 433 of file JetMonitoringConfig.py.

433 def __init__(self, selname, selexpr, path=None, **args):
434 path = selname if path is None else path
435 if '<' in selexpr:
436 # interpret it as a list of min<v<max
437 cminList , varList , cmaxList = interpretManySelStr(selexpr)
438 specname = '_'.join(varList)
439 if args.setdefault('isEventVariable', False) :
440 VarList = [retrieveEventVarToolConf(v) for v in varList]
441 selProp = 'EventSelector'
442 selSpec = ToolSpec('JetEventSelector', specname+'_sel', Var = VarList, )
443 else:
444 VarList = [retrieveVarToolConf(v) for v in varList]
445 selProp = 'Selector'
446 selSpec = ToolSpec('JetSelectorAttribute', specname+'_sel', Var = VarList, )
447 selSpec['CutMin'] = cminList
448 selSpec['CutMax'] = cmaxList
449 args[selProp] = selSpec
450 elif selexpr != '':
451 from JetMonitoring.JetStandardHistoSpecs import knownSelector
452 # assume it's a known pre-defined jet selector
453 selSpec = knownSelector.get(selexpr, None)
454 if selSpec is None :
455 print("ERROR ", selexpr , " is an unknown JetSelector ")
456 # should raise an exception ??
457 return
458 args['Selector'] = selSpec
459
460 self.name = selname
461 self.path = path
462 ConfigDict.__init__(self, **args)
463 tmpL = self.FillerTools
464 self.FillerTools = []
465 self.appendHistos(*tmpL)
466
void print(char *figname, TCanvas *c1)

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)

◆ __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.SelectSpec._dump ( self,
writeFunc )
protected

Reimplemented from JetMonitoringConfig.ConfigDict.

Definition at line 504 of file JetMonitoringConfig.py.

504 def _dump(self, writeFunc):
505 def write(s,e='\n'): writeFunc(' '+s,e)
506 def write2(s,e='\n'): writeFunc(' '+s,e)
507 writeFunc('SelectSpec("'+self.name+'", path='+self.path+',')
508 if hasattr(self, 'Selector' ):
509 write(' Selector=','')
510 self.Selector._dump( write2)
511 if hasattr(self, 'EventSelector' ):
512 write(' EventSelector=','')
513 self.EventSelector._dump( write2)
514 write('FillerTools= [')
515 for hspec in self.FillerTools:
516 hspec._dump(write2)
517 write(']')
518 writeFunc(')')
519

◆ appendHistos()

JetMonitoringConfig.SelectSpec.appendHistos ( self,
* hfillers )

Definition at line 467 of file JetMonitoringConfig.py.

467 def appendHistos(self, *hfillers):
468 tmpL = [retrieveHistoToolConf(hspec) for hspec in hfillers]
469 self.FillerTools += tmpL
470

◆ clone()

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

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.SelectSpec.defineHisto ( self,
parentAlg,
monhelper,
path )

Reimplemented from JetMonitoringConfig.ToolSpec.

Definition at line 496 of file JetMonitoringConfig.py.

496 def defineHisto(self, parentAlg, monhelper , path):
497 # redefine path for sub-histos if needed :
498 path = path if self.path is None else self.path
499 # define histos for each subtools
500 for tconf in self.FillerTools:
501 tconf.defineHisto(parentAlg, monhelper, path)
502
503

◆ 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.SelectSpec.toTool ( self)

Reimplemented from JetMonitoringConfig.ToolSpec.

Definition at line 471 of file JetMonitoringConfig.py.

471 def toTool(self):
472 from AthenaConfiguration.ComponentFactory import CompFactory
473 # conf = self.clone(self.name)
474 # name = conf.pop('name')
475 selTool = CompFactory.JetHistoSelectSort(self.name, SelectedIndex=self.get('SelectedIndex',-1), InverseJetSel=self.get('InverseJetSel',False))
476 if hasattr(self,'Selector'):
477 self.Selector.topLevelDir = self.topLevelDir
478 self.Selector.bottomLevelDir = self.bottomLevelDir
479 selTool.Selector = self.Selector.toTool()
480 if hasattr(self,'EventSelector'):
481 self.EventSelector.topLevelDir = self.topLevelDir
482 self.EventSelector.bottomLevelDir = self.bottomLevelDir
483 selTool.EventSelector = self.EventSelector.toTool()
484 if hasattr(self, 'SortVariable'):
485 selTool.SortVariable = retrieveVarToolConf(self.SortVariable)
486 suffix = '_'+self.name
487 for i,tconf in enumerate(self.FillerTools):
488 tconf.topLevelDir = self.topLevelDir
489 tconf.bottomLevelDir = self.bottomLevelDir
490 newname = tconf.name if suffix in tconf.name else tconf.name+suffix #prevent duplicating of Selection name when loading external SelectSpecs
491 tconf = tconf.clone(newname=newname)
492 self.FillerTools[i] = tconf # re-assign the modified conf so it's consistently re-used elsewhere
493 selTool.FillerTools += [ tconf.toTool() ] # assign a configured tool to the JetHistoSelectSort instance
494 return selTool
495

Member Data Documentation

◆ FillerTools

JetMonitoringConfig.SelectSpec.FillerTools = []

Definition at line 464 of file JetMonitoringConfig.py.

◆ klass

JetMonitoringConfig.ToolSpec.klass = klass
inherited

Definition at line 163 of file JetMonitoringConfig.py.

◆ name

JetMonitoringConfig.ToolSpec.name = name
inherited

Definition at line 162 of file JetMonitoringConfig.py.

◆ path

JetMonitoringConfig.SelectSpec.path = path

Definition at line 461 of file JetMonitoringConfig.py.


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