11 #include <analysis/DecayDescriptor/DecayDescriptor.h>
122 VarBase(
const std::string& n,
const std::string& d,
const std::string& g)
136 Var(
const std::string& n,
FunctionPtr f,
const std::string& d,
const std::string& g =
"")
168 std::vector<const Belle2::Variable::Manager::Var*>
getVariables(
const std::vector<std::string>& variables);
173 bool addAlias(
const std::string& alias,
const std::string& variable);
183 bool addCollection(
const std::string& collection,
const std::vector<std::string>& variables);
188 std::vector<std::string>
getCollection(
const std::string& collection);
193 std::vector<std::string>
resolveCollections(
const std::vector<std::string>& variables);
209 void deprecateVariable(
const std::string& name,
bool make_fatal,
const std::string& version,
const std::string& description);
227 std::vector<std::string>
getNames()
const;
298 DeprecateProxy(
const std::string& name,
bool make_fatal,
const std::string& version,
const std::string& description)
305 std::function<T> make_function(T* t)
314 #define VARMANAGER_CONCATENATE_DETAIL(x, y) x##y
318 #define VARMANAGER_CONCATENATE(x, y) VARMANAGER_CONCATENATE_DETAIL(x, y)
322 #define VARMANAGER_MAKE_UNIQUE(x) VARMANAGER_CONCATENATE(x, __LINE__)
329 #define REGISTER_VARIABLE(name, function, description) \
330 static Proxy VARMANAGER_MAKE_UNIQUE(_variableproxy)(std::string(name), Belle2::Variable::make_function(function), std::string(description));
337 #define VARIABLE_GROUP(groupName) \
338 static GroupProxy VARMANAGER_MAKE_UNIQUE(_variablegroupproxy)(groupName);
345 #define MAKE_DEPRECATED(name, make_fatal, version, description) \
346 static DeprecateProxy VARMANAGER_MAKE_UNIQUE(_deprecateproxy)(std::string(name), bool(make_fatal), std::string(version), std::string(description));
Class to store reconstructed particles.
Internal class that registers a variable as deprecated.
DeprecateProxy(const std::string &name, bool make_fatal, const std::string &version, const std::string &description)
constructor.
Internal class that registers a variable group with Manager when constructed.
GroupProxy(const std::string &groupName)
constructor.
Global list of available variables.
std::function< double(const Particle *, const std::vector< double > &)> ParameterFunctionPtr
parameter functions stored take a const Particle*, const std::vector<double>& and return double.
Particle Object
Typedef for the cut, that we use Particles as our base objects.
std::vector< const VarBase * > m_variablesInRegistrationOrder
List of variables in registration order.
std::vector< std::string > getAliasNames() const
Return a list of all variable alias names (in reverse order added).
void registerVariable(const std::string &name, const Manager::FunctionPtr &f, const std::string &description)
Register a variable.
std::vector< std::string > resolveCollections(const std::vector< std::string > &variables)
Resolve Collection Returns variable names corresponding to the given collection or if it is not a col...
Manager(const Manager &)
Copy constructor disabled (not defined).
std::string m_currentGroup
Group last set via VARIABLE_GROUP().
const Var * getVariable(std::string name)
Get the variable belonging to the given key.
std::map< std::string, std::string > m_alias
List of registered aliases.
std::map< std::string, std::shared_ptr< Var > > m_variables
List of registered variables.
void deprecateVariable(const std::string &name, bool make_fatal, const std::string &version, const std::string &description)
Make a variable deprecated.
std::map< std::string, std::shared_ptr< ParameterVar > > m_parameter_variables
List of registered parameter variables.
std::vector< const Belle2::Variable::Manager::VarBase * > getVariables() const
Return list of all variables (in order registered).
static Manager & Instance()
get singleton instance.
void printAliases()
Print existing aliases.
std::map< std::string, std::pair< bool, std::string > > m_deprecated
List of deprecated variables.
bool createVariable(const std::string &name)
Creates and registers a concrete variable (Var) from a MetaVar, ParameterVar or numeric constant.
void assertValidName(const std::string &name)
Abort with B2FATAL if name is not a valid name for a variable.
std::function< FunctionPtr(const std::vector< std::string > &)> MetaFunctionPtr
meta functions stored take a const std::vector<std::string>& and return a FunctionPtr.
std::vector< std::string > getNames() const
Return list of all variable names (in order registered).
std::map< std::string, std::vector< std::string > > m_collection
List of registered collections.
std::function< double(const Particle *)> FunctionPtr
NOTE: the python interface is documented manually in analysis/doc/Variables.rst (because we use ROOT ...
void setVariableGroup(const std::string &groupName)
All variables registered after VARIABLE_GROUP(groupName) will be added to this group.
std::vector< std::string > getCollection(const std::string &collection)
Get Collection Returns variable names corresponding to the given collection.
bool addAlias(const std::string &alias, const std::string &variable)
Add alias Return true if the alias was successfully added.
bool addCollection(const std::string &collection, const std::vector< std::string > &variables)
Add collection Return true if the collection was successfully added.
void checkDeprecatedVariable(const std::string &name)
Check if a variable is deprecated.
double evaluate(const std::string &varName, const Particle *p)
evaluate variable 'varName' on given Particle.
std::map< std::string, std::shared_ptr< MetaVar > > m_meta_variables
List of registered meta variables.
Internal class that registers a variable with Manager when constructed.
Proxy(const std::string &name, Manager::MetaFunctionPtr f, const std::string &description)
constructor.
Proxy(const std::string &name, Manager::FunctionPtr f, const std::string &description)
constructor.
Proxy(const std::string &name, Manager::ParameterFunctionPtr f, const std::string &description)
constructor.
Abstract base class for different kinds of events.
A variable taking additional floating-point arguments to influence the behaviour.
ParameterVar(const std::string &n, ParameterFunctionPtr f, const std::string &d, const std::string &g="")
ctor
ParameterFunctionPtr function
Pointer to function.
Base class for information common to all types of variables.
std::string description
Description of what this function does.
void extendDescriptionString(const std::string &d)
function to extend the description of the variable
std::string group
Associated group.
std::string name
Unique identifier of the function, used as key.
VarBase(const std::string &n, const std::string &d, const std::string &g)
ctor
A variable returning a floating-point value for a given Particle.
Var(const std::string &n, FunctionPtr f, const std::string &d, const std::string &g="")
ctor
FunctionPtr function
Pointer to function.