Belle II Software development
SoftwareTriggerVariableManager.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9#include <hlt/softwaretrigger/core/SoftwareTriggerObject.h>
10#include <memory>
11#include <variant>
12#include <vector>
13
14
15namespace Belle2 {
20 namespace SoftwareTrigger {
38 private:
51 public:
57 double function(const SoftwareTriggerObject* mapOfValues) const
58 {
59 return mapOfValues->at(name);
60 }
61
63 std::string name = "";
64
65 private:
67 explicit SoftwareTriggerVariable(const std::string& theName) : name(theName) { }
68
71
74
77
80 };
81
82 public:
84 typedef SoftwareTriggerObject Object;
90
92 typedef std::variant<double, int, bool> VarVariant;
93
100
109 SoftwareTriggerVariable* getVariable(const std::string& variableName);
110
117 SoftwareTriggerVariable* getVariable(const std::string& variableName, const std::vector<std::string>& arguments);
118
119 private:
122
125
128
130 std::map<std::string, std::shared_ptr<SoftwareTriggerVariable>> m_variableNameToVariable;
131 };
132 }
134}
Class which represents an abstract variable in the SoftwareTriggerVariableManager.
SoftwareTriggerVariable & operator=(const SoftwareTriggerVariable &rhs)=delete
Do not copy a variable.
SoftwareTriggerVariable(SoftwareTriggerVariable &&)=default
Make the object move constructable.
double function(const SoftwareTriggerObject *mapOfValues) const
Function wich is called by the SoftwareTriggerCut whenever the value of this variable is needed.
SoftwareTriggerVariable(const SoftwareTriggerVariable &rhs)=delete
Do not copy a variable.
SoftwareTriggerVariable(const std::string &theName)
Private constructor. Should only be called by the SoftwareTriggerVariableManager.
std::variant< double, int, bool > VarVariant
Typedef for variable return type, can either be double, int or bool in std::variant.
std::map< std::string, std::shared_ptr< SoftwareTriggerVariable > > m_variableNameToVariable
Internal storage of the variables with their name.
SoftwareTriggerObject Object
As an object handed in for every cut to be checked, use a map of variable name -> precompiled value.
static SoftwareTriggerVariableManager & Instance()
Make this variable manager a singleton and get the only single instance of the manager.
SoftwareTriggerVariableManager()
Make the constructor private: only use this class as a singleton.
SoftwareTriggerVariableManager & operator=(SoftwareTriggerVariableManager &rhs)=delete
Delete the assignment operator: only use this class as a singleton.
SoftwareTriggerVariableManager(const SoftwareTriggerVariableManager &)=delete
Delete the copy constructor: only use this class as a singleton.
SoftwareTriggerVariable * getVariable(const std::string &variableName)
Get the variable with the given name.
SoftwareTriggerVariable Var
Use a very slim object for the variables: only draw out the corresponding value from the precompiled ...
Abstract base class for different kinds of events.