Belle II Software  release-08-01-10
IfModule Class Reference
Inheritance diagram for IfModule:
Collaboration diagram for IfModule:

Public Member Functions

def __init__ (self, module, condition=None)
 
def condition (self)
 
def event (self)
 
def wrapper_name (self)
 
def param (self)
 
def available_params (self)
 
def compose_wrapped_module_name (self, module)
 
def get_name (self)
 
def initialize (self)
 
def beginRun (self)
 
def endRun (self)
 
def terminate (self)
 

Public Attributes

 condition
 Condition function called at each event to determine if wrapped module should be executed.
 
 module
 The wrapped module.
 

Detailed Description

Wrapper module to conditionally execute module and continue with the normal path afterwards.

There are two ways to specify the condition.
One way is to override the condtion(self) method in a subclass.
The second way is to give a function as the second argument to the module constructor,
which is called each event.

Attributes:
  module (basf2.Module): The module executed, if the condition is met.

  condition (function() -> bool, optional): Function executed at each event to determine,
    if the given module shall be executed.
    If None call the condition method instead, which can be overridden by subclasses.

Definition at line 167 of file metamodules.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  module,
  condition = None 
)
Initialisation method taking the module instance to be wrapped.

Args:
  module (basf2.Module): The module executed, if the condition is met.
  condition  (function() -> bool, optional): Function executed at each event to determine,
    if the given module shall be executed.
    If None call the condition method instead, which can be overridden by subclasses.

Definition at line 185 of file metamodules.py.

Member Function Documentation

◆ available_params()

def available_params (   self)
inherited
Forwards the avaiilable parameters

Definition at line 79 of file metamodules.py.

◆ beginRun()

def beginRun (   self)
inherited
Begin run method of the module

Definition at line 96 of file metamodules.py.

◆ compose_wrapped_module_name()

def compose_wrapped_module_name (   self,
  module 
)
inherited
Compose a name that indicates the wrapped module.

Definition at line 83 of file metamodules.py.

◆ condition()

def condition (   self)
Condition method called if not given a condition function during construction.

Can be overridden by a concrete subclass to specify
under which condition the wrapped module should be executed.
It can also be shadowed by a condition function given to the constructor of this module.

Returns:
  bool: The indication if the wrapped module should be executed.
    Always True in the base implementation

Reimplemented in IfStoreArrayNotPresentModule, and IfStoreArrayPresentModule.

Definition at line 201 of file metamodules.py.

◆ endRun()

def endRun (   self)
inherited
End run method of the module

Definition at line 104 of file metamodules.py.

◆ event()

def event (   self)
Event method of the module

Evaluates the condition and sets the return value of this module
to trigger the execution of the wrapped module.

Reimplemented from WrapperModule.

Definition at line 214 of file metamodules.py.

◆ get_name()

def get_name (   self)
inherited
Forwards the name().

Definition at line 88 of file metamodules.py.

◆ initialize()

def initialize (   self)
inherited
Initialize method of the module

Reimplemented in IfStoreArrayPresentModule, and PyProfilingModule.

Definition at line 92 of file metamodules.py.

◆ param()

def param (   self)
inherited
Forwards the parameters

Definition at line 74 of file metamodules.py.

◆ terminate()

def terminate (   self)
inherited
Terminate method of the module

Reimplemented in PyProfilingModule.

Definition at line 108 of file metamodules.py.

◆ wrapper_name()

def wrapper_name (   self)
inherited
Name of the wrapper class.

Definition at line 69 of file metamodules.py.


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