Belle II Software  release-06-02-00
Algorithm Class Reference

Public Member Functions

def __init__ (self, algorithm, data_input=None, pre_algorithm=None)
 
def default_inputdata_setup (self, input_file_paths)
 

Public Attributes

 algorithm
 CalibrationAlgorithm instance (assumed to be true since the Calibration class checks)
 
 name
 The name of the algorithm, default is the Algorithm class name.
 
 data_input
 Function called before the pre_algorithm method to setup the input data that the CalibrationAlgorithm uses. More...
 
 pre_algorithm
 Function called after data_input but before algorithm.execute to do any remaining setup. More...
 
 strategy
 The algorithm stratgey that will be used when running over the collected data. More...
 
 params
 Parameters that could be used in the execution of the algorithm strategy/runner to modify behaviour. More...
 

Detailed Description

Parameters:
    algorithm: The CalibrationAlgorithm instance that we want to execute.
Keyword Arguments:
    data_input (types.FunctionType): An optional function that sets the input files of the algorithm.
    pre_algorithm (types.FunctionType): An optional function that runs just prior to execution of the algorithm.
        Useful for set up e.g. module initialisation

This is a simple wrapper class around the C++ CalibrationAlgorithm class.
It helps to add functionality to algorithms for use by the Calibration and CAF classes rather
than separating the logic into those classes directly.

This is **not** currently a class that a user should interact with much during `CAF`
setup (unless you're doing something advanced).
The `Calibration` class should be doing the most of the creation of the defaults for these objects.

Setting the `data_input` function might be necessary if you have set the `Calibration.output_patterns`.
Also, setting the `pre_algorithm` to a function that should execute prior to each `strategies.AlgorithmStrategy`
is often useful i.e. by calling for the Geometry module to initialise.

Definition at line 1094 of file framework.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  algorithm,
  data_input = None,
  pre_algorithm = None 
)
 

Definition at line 1116 of file framework.py.

Member Function Documentation

◆ default_inputdata_setup()

def default_inputdata_setup (   self,
  input_file_paths 
)
Simple setup to set the input file names to the algorithm. Applied to the data_input attribute
by default. This simply takes all files returned from the `Calibration.output_patterns` and filters
for only the CollectorOutput.root files. Then it sets them as input files to the CalibrationAlgorithm class.

Definition at line 1144 of file framework.py.

Member Data Documentation

◆ data_input

data_input

Function called before the pre_algorithm method to setup the input data that the CalibrationAlgorithm uses.

The list of files matching the Calibration.output_patterns from the collector output directories will be passed to it

Definition at line 1127 of file framework.py.

◆ params

params

Parameters that could be used in the execution of the algorithm strategy/runner to modify behaviour.

By default this is empty and not used by the default :py:class:caf.strategies.SingleIOV class. But more complex strategies, or your own custom ones, could use it to configure behaviour. Note that if you modify this inside a subprocess the modification won't persist outside, you would have to change it in the parent process (or dump values to a file and read it in next time).

Definition at line 1142 of file framework.py.

◆ pre_algorithm

pre_algorithm

Function called after data_input but before algorithm.execute to do any remaining setup.

It must have the form pre_algorithm(algorithm, iteration) where algorithm can be assumed to be the CalibrationAlgorithm instance about to be executed, and iteration is an int e.g. 0, 1, 2...

Definition at line 1133 of file framework.py.

◆ strategy

strategy

The algorithm stratgey that will be used when running over the collected data.

you can set this here, or from the Calibration.strategies attribute.

Definition at line 1136 of file framework.py.


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