ATLAS Offline Software
Public Member Functions | Public Attributes | Private Member Functions | List of all members
JetMonitoringConfig.SelectSpec Class Reference
Inheritance diagram for JetMonitoringConfig.SelectSpec:
Collaboration diagram for JetMonitoringConfig.SelectSpec:

Public Member Functions

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

Public Attributes

 name
 
 path
 
 FillerTools
 
 klass
 

Private Member Functions

def _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__()

def 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 

Member Function Documentation

◆ __getattr__()

def 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__()

def 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__()

def 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()

def JetMonitoringConfig.SelectSpec._dump (   self,
  writeFunc 
)
private

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()

def 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() [1/2]

def JetMonitoringConfig.ConfigDict.clone (   self,
**  kwargs 
)
inherited

Definition at line 68 of file JetMonitoringConfig.py.

68  def clone(self, **kwargs):
69  from copy import deepcopy
70  c = deepcopy(self)
71  for k,v in kwargs.items():
72  setattr(c,k,v)
73  return c
74 
75 

◆ clone() [2/2]

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

Definition at line 192 of file JetMonitoringConfig.py.

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

◆ defineHisto()

def 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()

def 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 

◆ toTool()

def 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
inherited

Definition at line 163 of file JetMonitoringConfig.py.

◆ name

JetMonitoringConfig.SelectSpec.name

Definition at line 460 of file JetMonitoringConfig.py.

◆ path

JetMonitoringConfig.SelectSpec.path

Definition at line 461 of file JetMonitoringConfig.py.


The documentation for this class was generated from the following file:
JetMonitoringConfig.retrieveEventVarToolConf
def retrieveEventVarToolConf(alias)
Definition: JetMonitoringConfig.py:600
JetMonitoringConfig.interpretManySelStr
def interpretManySelStr(selStr)
Definition: JetMonitoringConfig.py:105
python.TIDAMonTool.defineHisto
def defineHisto(montool, name, **args)
Definition: TIDAMonTool.py:334
python.Utilities.clone
clone
Definition: Utilities.py:134
run_Egamma1_LArStrip_Fex.dump
dump
Definition: run_Egamma1_LArStrip_Fex.py:88
JetMonitoringConfig.retrieveVarToolConf
def retrieveVarToolConf(alias)
Definition: JetMonitoringConfig.py:584
python.ByteStreamConfig.write
def write
Definition: Event/ByteStreamCnvSvc/python/ByteStreamConfig.py:247
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
JetMonitoringConfig.retrieveHistoToolConf
def retrieveHistoToolConf(alias)
Definition: JetMonitoringConfig.py:615
python.Bindings.__setitem__
__setitem__
Definition: Control/AthenaPython/python/Bindings.py:771
python.PyAthenaComps.__setattr__
__setattr__
Definition: PyAthenaComps.py:39