 |
Belle II Software
release-05-02-19
|
12 #include <tracking/trackFindingCDC/varsets/BaseVarSet.h>
14 #include <tracking/trackFindingCDC/varsets/FixedSizeNamedFloatTuple.h>
26 namespace TrackFindingCDC {
37 template<
class AVarNames>
38 class VarSet :
public BaseVarSet<typename AVarNames::Object> {
42 using Super = BaseVarSet<typename AVarNames::Object>;
50 static const size_t nVars = AVarNames::nVars;
57 std::vector<Named<Float_t*>>
getNamedVariables(
const std::string& prefix)
override
66 MayBePtr<Float_t>
find(
const std::string& varName)
override
80 constexpr
static int named(
const char* name)
82 return index<nVars>(AVarNames::getName, name);
89 static_assert(I <
nVars,
"Requested variable index exceeds number of variables.");
97 static_assert(I <
nVars,
"Requested variable index exceeds number of variables.");
102 template<
typename AFloat>
103 struct AssignFinite {
120 if (not std::isfinite(value)) {
121 m_value = std::copysign(std::numeric_limits<AFloat>::max(), value);
134 static_assert(I <
nVars,
"Requested variable index exceeds number of variables.");
Float_t get() const
Getter for the ith value. Static index version.
MayBePtr< Float_t > find(const std::string &varName) override
Pointer to the variable with the given name.
Float_t get() const
Getter for the value of the ith variable. Static version.
AssignFinite< Float_t > finitevar()
Reference getter for the value of the ith variable. Transforms non-finite values to finite value.
std::vector< Named< Float_t * > > getNamedVariables(std::string prefix="")
Getter for named references to the variables in this tuple.
AFloat & m_value
Reference to the variable to be assigned.
void operator=(const AFloat value)
Assign value replacing infinite values with the maximum value possible.
FixedSizeNamedFloatTuple< AVarNames > m_variables
Memory for nVars floating point values.
std::vector< Named< Float_t * > > getNamedVariables()
Getter for the named references to the individual variables.
Abstract base class for different kinds of events.
AssignFinite(AFloat &value)
Setup the assignment to a variable.
Helper construct to assign a finite value to float variables.
typename Super::Object Object
Type from which variables should be extracted.
constexpr static int named(const char *name)
Getter for the index from the name.
virtual MayBePtr< Float_t > find(std::string name)
Getter for a pointer to the value with the given name.
Float_t & var()
Reference getter for the value of the ith variable. Static version.
BaseVarSet< typename AVarNames::Object > Super
Type of the super class.
static const size_t nVars
Number of floating point values represented by this class.
AObject Object
Object type from which variables shall be extracted.