Belle II Software development
|
Variable Manager for the software trigger cuts. More...
#include <SoftwareTriggerVariableManager.h>
Classes | |
class | SoftwareTriggerVariable |
Class which represents an abstract variable in the SoftwareTriggerVariableManager. More... | |
Public Types | |
typedef SoftwareTriggerObject | Object |
As an object handed in for every cut to be checked, use a map of variable name -> precompiled value. | |
typedef SoftwareTriggerVariable | Var |
Use a very slim object for the variables: only draw out the corresponding value from the precompiled map of values. | |
typedef std::variant< double, int, bool > | VarVariant |
Typedef for variable return type, can either be double, int or bool in std::variant. | |
Public Member Functions | |
SoftwareTriggerVariable * | getVariable (const std::string &variableName) |
Get the variable with the given name. | |
SoftwareTriggerVariable * | getVariable (const std::string &variableName, const std::vector< std::string > &arguments) |
The GeneralCut parses MetaVariables into its variable name and arguments. | |
Static Public Member Functions | |
static SoftwareTriggerVariableManager & | Instance () |
Make this variable manager a singleton and get the only single instance of the manager. | |
Private Member Functions | |
SoftwareTriggerVariableManager () | |
Make the constructor private: only use this class as a singleton. | |
SoftwareTriggerVariableManager (const SoftwareTriggerVariableManager &)=delete | |
Delete the copy constructor: only use this class as a singleton. | |
SoftwareTriggerVariableManager & | operator= (SoftwareTriggerVariableManager &rhs)=delete |
Delete the assignment operator: only use this class as a singleton. | |
Private Attributes | |
std::map< std::string, std::shared_ptr< SoftwareTriggerVariable > > | m_variableNameToVariable |
Internal storage of the variables with their name. | |
Variable Manager for the software trigger cuts.
This class fulfills all the requirement of a variable manager, as stated in the GeneralCut class and can (and should) therefore be used together with it, which is done in the SoftwareTriggerCut.
The idea behind it is as follows: The SoftwareTriggerVariableManager itself does not know on how to calculate your needed variables, but you as the user of the SoftwareTriggerCut has to know. This gives you the opportunity to calculate them differently before or after the full reconstruction (because you may not have all information at hand at all time) or use temporary shared calculation objects when compiling the numbers. Whenever a SoftwareTriggerCut has a variable it it and the check function asks the variable manager for its value, the variable manager will collect this value from the SoftwareTriggerObject (a map from std::string to double) with the given variable name. So you as the user has to make sure that the needed variables can be found in the SoftwareTriggerObject, that you hand in to the checkPreScaled function of the SoftwareTriggerCut.
Definition at line 37 of file SoftwareTriggerVariableManager.h.
typedef SoftwareTriggerObject Object |
As an object handed in for every cut to be checked, use a map of variable name -> precompiled value.
Definition at line 84 of file SoftwareTriggerVariableManager.h.
typedef SoftwareTriggerVariable Var |
Use a very slim object for the variables: only draw out the corresponding value from the precompiled map of values.
Definition at line 89 of file SoftwareTriggerVariableManager.h.
typedef std::variant<double, int, bool> VarVariant |
Typedef for variable return type, can either be double, int or bool in std::variant.
Definition at line 92 of file SoftwareTriggerVariableManager.h.
|
inlineprivate |
Make the constructor private: only use this class as a singleton.
Definition at line 121 of file SoftwareTriggerVariableManager.h.
SoftwareTriggerVariableManager::SoftwareTriggerVariable * getVariable | ( | const std::string & | variableName | ) |
Get the variable with the given name.
If it is not already present in the internal map of variables, create a new one. Please note, that this function will never mark a variable as undefined, so there is no registration process as in the analysis variable manager. If a variable is defined or not depends only on the SoftwareTriggerObject that is used when checking the cut (and if there is an entry with the same name as the variable in this object).
Definition at line 23 of file SoftwareTriggerVariableManager.cc.
SoftwareTriggerVariableManager::SoftwareTriggerVariable * getVariable | ( | const std::string & | variableName, |
const std::vector< std::string > & | arguments | ||
) |
The GeneralCut parses MetaVariables into its variable name and arguments.
GeneralCut requires any VariableManager to get a variable through this parsed state. This overload combines the variableName and vector of strings to the original Metavariable call using boost::algorithm::join and passes it to getVariable(const std::string& variableName)
Definition at line 34 of file SoftwareTriggerVariableManager.cc.
|
static |
Make this variable manager a singleton and get the only single instance of the manager.
You can still use it multiple times in different modules, as it depends on the map of values you hand in when checking the cut if the variable is defined or not.
Definition at line 17 of file SoftwareTriggerVariableManager.cc.
|
private |
Internal storage of the variables with their name.
Definition at line 130 of file SoftwareTriggerVariableManager.h.