ATLAS Offline Software
Public Member Functions | Public Attributes | Properties | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
python.PyAthenaComps.AthFilterAlgorithm Class Reference
Inheritance diagram for python.PyAthenaComps.AthFilterAlgorithm:
Collaboration diagram for python.PyAthenaComps.AthFilterAlgorithm:

Public Member Functions

def __init__ (self, name=None, **kw)
 
def cutFlowSvc (self)
 
def setFilterDescription (self, descr)
 
def sysInitialize (self)
 
def setFilterPassed (self, state)
 
def evtStore (self)
 
def detStore (self)
 
def condStore (self)
 
def initialize (self)
 
def sysReinitialize (self)
 
def reinitialize (self)
 
def sysExecute (self, cppcontext)
 
def execute (self)
 
def sysFinalize (self)
 
def finalize (self)
 
def sysStart (self)
 
def start (self)
 
def sysStop (self)
 
def stop (self)
 
def filterPassed (self)
 
def resetExecuted (self)
 
def setExecuted (self, state)
 
def isExecuted (self)
 
def getContext (self)
 

Public Attributes

 cutID
 
 name
 

Properties

 FilterDescription
 

Private Member Functions

def _get_filter_descr (self)
 
def _set_filter_descr (self, descr)
 

Private Attributes

 _filter_descr
 init base class More...
 
 _cutflowsvc
 
 _pyath_evtstore
 init base class More...
 
 _pyath_detstore
 
 _pyath_condstore
 
 _ctx
 
 __component_type__
 

Static Private Attributes

string _dflt_FilterDescription = 'N/A'
 

Detailed Description

base class for a filter algorithm, making use of the cutflow-svc.

instances of this class (and its derived class) shall have:
 - a `cutID` attribute of type `CutIdentifier*` from `initialize`
   (included) and onwards,
 - a `cutFlowSvc()` method from `initialize` (included) and onwards.

The `cutID` attribute is the CutIdentifier returned by the `ICutFlowSvc`
when `self` registered itself with the `ICutFlowSvc`.

Definition at line 349 of file PyAthenaComps.py.

Constructor & Destructor Documentation

◆ __init__()

def python.PyAthenaComps.AthFilterAlgorithm.__init__ (   self,
  name = None,
**  kw 
)

Reimplemented from python.PyAthenaComps.Alg.

Definition at line 362 of file PyAthenaComps.py.

362  def __init__(self, name = None, **kw):
363  if name is None:
364  name = kw.get('name', self.__class__.__name__)
365  kw['name'] = name
366  kw.setdefault('OutputLevel', 3) #INFO
367 
368 
369  super(AthFilterAlgorithm, self).__init__(**kw)
370 
371  # properties
372  self._filter_descr = kw.get('FilterDescription',
373  AthFilterAlgorithm._dflt_FilterDescription)
374  '''describes to the cutflowsvc what this filter does.'''
375  return
376 

Member Function Documentation

◆ _get_filter_descr()

def python.PyAthenaComps.AthFilterAlgorithm._get_filter_descr (   self)
private

Definition at line 377 of file PyAthenaComps.py.

377  def _get_filter_descr(self):
378  return self._filter_descr

◆ _set_filter_descr()

def python.PyAthenaComps.AthFilterAlgorithm._set_filter_descr (   self,
  descr 
)
private

Definition at line 379 of file PyAthenaComps.py.

379  def _set_filter_descr(self, descr):
380  self._filter_descr = descr
381 

◆ condStore()

def python.PyAthenaComps.Alg.condStore (   self)
inherited

Definition at line 101 of file PyAthenaComps.py.

101  def condStore(self):
102  if not self._pyath_condstore:
103  import AthenaPython.PyAthena as PyAthena
104  self._pyath_condstore = PyAthena.py_svc('StoreGateSvc/ConditionStore')
105  return self._pyath_condstore
106 

◆ cutFlowSvc()

def python.PyAthenaComps.AthFilterAlgorithm.cutFlowSvc (   self)

Definition at line 386 of file PyAthenaComps.py.

386  def cutFlowSvc(self):
387  if not hasattr(self, '_cutflowsvc'):
388  import AthenaPython.PyAthena as PyAthena
389  self._cutflowsvc = PyAthena.py_svc('CutFlowSvc',
390  iface='ICutFlowSvc')
391  return self._cutflowsvc
392 

◆ detStore()

def python.PyAthenaComps.Alg.detStore (   self)
inherited

Definition at line 94 of file PyAthenaComps.py.

94  def detStore(self):
95  if not self._pyath_detstore:
96  import AthenaPython.PyAthena as PyAthena
97  self._pyath_detstore = PyAthena.py_svc('StoreGateSvc/DetectorStore')
98  return self._pyath_detstore
99 

◆ evtStore()

def python.PyAthenaComps.Alg.evtStore (   self)
inherited

Definition at line 87 of file PyAthenaComps.py.

87  def evtStore(self):
88  if not self._pyath_evtstore:
89  import AthenaPython.PyAthena as PyAthena
90  self._pyath_evtstore = PyAthena.py_svc('StoreGateSvc/StoreGateSvc')
91  return self._pyath_evtstore
92 

◆ execute()

def python.PyAthenaComps.Alg.execute (   self)
inherited

Definition at line 136 of file PyAthenaComps.py.

136  def execute(self):
137  return StatusCode.Success
138 

◆ filterPassed()

def python.PyAthenaComps.Alg.filterPassed (   self)
inherited
Did this algorithm pass or fail its filter criterion for the last event?

Definition at line 157 of file PyAthenaComps.py.

157  def filterPassed(self):
158  """Did this algorithm pass or fail its filter criterion for the last event?"""
159  return self._cppHandle.filterPassed()
160 

◆ finalize()

def python.PyAthenaComps.Alg.finalize (   self)
inherited

Definition at line 142 of file PyAthenaComps.py.

142  def finalize(self):
143  return StatusCode.Success
144 

◆ getContext()

def python.PyAthenaComps.Alg.getContext (   self)
inherited

Definition at line 175 of file PyAthenaComps.py.

175  def getContext(self):
176  return self._ctx
177 

◆ initialize()

def python.PyAthenaComps.Alg.initialize (   self)
inherited

Definition at line 114 of file PyAthenaComps.py.

114  def initialize(self):
115  return StatusCode.Success
116 

◆ isExecuted()

def python.PyAthenaComps.Alg.isExecuted (   self)
inherited

Definition at line 172 of file PyAthenaComps.py.

172  def isExecuted(self):
173  return self._cppHandle.isExecuted()
174 

◆ reinitialize()

def python.PyAthenaComps.Alg.reinitialize (   self)
inherited

Definition at line 124 of file PyAthenaComps.py.

124  def reinitialize(self):
125  return StatusCode.Success
126 

◆ resetExecuted()

def python.PyAthenaComps.Alg.resetExecuted (   self)
inherited

Definition at line 165 of file PyAthenaComps.py.

165  def resetExecuted(self):
166  self.setExecuted(False)
167  return StatusCode.Success
168 

◆ setExecuted()

def python.PyAthenaComps.Alg.setExecuted (   self,
  state 
)
inherited

Definition at line 169 of file PyAthenaComps.py.

169  def setExecuted(self,state):
170  return self._cppHandle.setExecuted(state)
171 

◆ setFilterDescription()

def python.PyAthenaComps.AthFilterAlgorithm.setFilterDescription (   self,
  descr 
)
This function updates self's CutFlow description if (and only if)
it has not been explicitely set during the python-level configuration

Definition at line 393 of file PyAthenaComps.py.

393  def setFilterDescription(self,descr):
394  """This function updates self's CutFlow description if (and only if)
395  it has not been explicitely set during the python-level configuration
396  """
397  if hasattr(self,'cutID'):
398  if self.FilterDescription==AthFilterAlgorithm._dflt_FilterDescription:
399  self.cutFlowSvc().setFilterDescription(self.cutID,descr)
400  else:
401  self.msg.error("AthFilterAlg has no self.cutID: could not set filter description.")
402  return
403 

◆ setFilterPassed()

def python.PyAthenaComps.AthFilterAlgorithm.setFilterPassed (   self,
  state 
)
Set the filter passed flag to the specified state

Reimplemented from python.PyAthenaComps.Alg.

Definition at line 417 of file PyAthenaComps.py.

417  def setFilterPassed(self, state):
418  """Set the filter passed flag to the specified state"""
419  o = super(AthFilterAlgorithm, self).setFilterPassed(state)
420  if state:
421  # TODO: we should read a proper weight
422  self.cutFlowSvc().addEvent(self.cutID, 1)
423  return o
424 

◆ start()

def python.PyAthenaComps.Alg.start (   self)
inherited

Definition at line 148 of file PyAthenaComps.py.

148  def start(self):
149  return StatusCode.Success
150 

◆ stop()

def python.PyAthenaComps.Alg.stop (   self)
inherited

Definition at line 154 of file PyAthenaComps.py.

154  def stop(self):
155  return StatusCode.Success
156 

◆ sysExecute()

def python.PyAthenaComps.Alg.sysExecute (   self,
  cppcontext 
)
inherited

Definition at line 127 of file PyAthenaComps.py.

127  def sysExecute(self, cppcontext):
128  import cppyy
129  self._ctx = cppyy.bind_object(cppcontext, "EventContext")
130  try:
131  ret = self.execute()
132  finally:
133  self._ctx = None
134  return ret
135 

◆ sysFinalize()

def python.PyAthenaComps.Alg.sysFinalize (   self)
inherited

Definition at line 139 of file PyAthenaComps.py.

139  def sysFinalize(self):
140  return self.finalize()
141 

◆ sysInitialize()

def python.PyAthenaComps.AthFilterAlgorithm.sysInitialize (   self)

Reimplemented from python.PyAthenaComps.Alg.

Definition at line 404 of file PyAthenaComps.py.

404  def sysInitialize(self):
405  if hasattr(self, 'OutputLevel'):
406  self.msg.setLevel(self.OutputLevel)
407  else:
408  self.msg.setLevel(_get_prop_value(self,'OutputLevel'))
409  myName=self.name() if callable(self.name) else self.name
410  self.cutID = self.cutFlowSvc().registerFilter(myName, self._filter_descr, True)
411  if not self.cutID:
412  self.msg.error("could not register filter-cut with cutflowsvc")
413  return StatusCode.Failure
414 
415  return super(AthFilterAlgorithm, self).sysInitialize()
416 

◆ sysReinitialize()

def python.PyAthenaComps.Alg.sysReinitialize (   self)
inherited

Definition at line 117 of file PyAthenaComps.py.

117  def sysReinitialize(self):
118  if hasattr(self, 'OutputLevel'):
119  self.msg.setLevel(self.OutputLevel)
120  else:
121  self.msg.setLevel(_get_prop_value(self,'OutputLevel'))
122  return self.reinitialize()
123 

◆ sysStart()

def python.PyAthenaComps.Alg.sysStart (   self)
inherited

Definition at line 145 of file PyAthenaComps.py.

145  def sysStart(self):
146  return self.start()
147 

◆ sysStop()

def python.PyAthenaComps.Alg.sysStop (   self)
inherited

Definition at line 151 of file PyAthenaComps.py.

151  def sysStop(self):
152  return self.stop()
153 

Member Data Documentation

◆ __component_type__

python.PyAthenaComps.Alg.__component_type__
privateinherited

Definition at line 82 of file PyAthenaComps.py.

◆ _ctx

python.PyAthenaComps.Alg._ctx
privateinherited

Definition at line 81 of file PyAthenaComps.py.

◆ _cutflowsvc

python.PyAthenaComps.AthFilterAlgorithm._cutflowsvc
private

Definition at line 389 of file PyAthenaComps.py.

◆ _dflt_FilterDescription

string python.PyAthenaComps.AthFilterAlgorithm._dflt_FilterDescription = 'N/A'
staticprivate

Definition at line 360 of file PyAthenaComps.py.

◆ _filter_descr

python.PyAthenaComps.AthFilterAlgorithm._filter_descr
private

init base class

Definition at line 372 of file PyAthenaComps.py.

◆ _pyath_condstore

python.PyAthenaComps.Alg._pyath_condstore
privateinherited

Definition at line 80 of file PyAthenaComps.py.

◆ _pyath_detstore

python.PyAthenaComps.Alg._pyath_detstore
privateinherited

Definition at line 79 of file PyAthenaComps.py.

◆ _pyath_evtstore

python.PyAthenaComps.Alg._pyath_evtstore
privateinherited

init base class

Definition at line 78 of file PyAthenaComps.py.

◆ cutID

python.PyAthenaComps.AthFilterAlgorithm.cutID

Definition at line 410 of file PyAthenaComps.py.

◆ name

python.PyAthenaComps.Alg.name
inherited

Definition at line 83 of file PyAthenaComps.py.

Property Documentation

◆ FilterDescription

python.PyAthenaComps.AthFilterAlgorithm.FilterDescription
static
Initial value:
= property(_get_filter_descr,
_set_filter_descr,
doc='describes to the cutflowsvc what this filter does.')

Definition at line 382 of file PyAthenaComps.py.


The documentation for this class was generated from the following file:
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:53
initialize
void initialize()
Definition: run_EoverP.cxx:894
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
PixelModuleFeMask_create_db.stop
int stop
Definition: PixelModuleFeMask_create_db.py:76
LArG4FSStartPointFilterLegacy.execute
execute
Definition: LArG4FSStartPointFilterLegacy.py:20
pool::DbPrintLvl::setLevel
void setLevel(MsgLevel l)
Definition: DbPrint.h:32
python.PyAthenaComps._get_prop_value
def _get_prop_value(pycomp, propname)
helper methods ---------------------------------------------------------—
Definition: PyAthenaComps.py:50
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
test_pyathena.filterPassed
filterPassed
now, add a sequencer: it will only execute seqalg1 and 2 and never 3
Definition: test_pyathena.py:38
error
Definition: IImpactPoint3dEstimator.h:70