AnalysisTree
Loading...
Searching...
No Matches
AnalysisTree::Variable Class Reference

Variable is a wrapper object for Field. In contrary to Field Variable is not bound to the data. It could represent a Field itself or, if specified, a result of operation on two or more fields. More...

#include <Variable.hpp>

Collaboration diagram for AnalysisTree::Variable:
Collaboration graph

Public Member Functions

 Variable (const Variable &)=default
 
 Variable (Variable &&)=default
 
Variableoperator= (Variable &&)=default
 
Variableoperator= (const Variable &)=default
 
 Variable (const Field &field)
 
 Variable (std::string name, std::vector< Field > fields, std::function< double(std::vector< double > &)> lambda)
 
 Variable (const std::string &branch, const std::string &field)
 
void Init (const Configuration &conf)
 
ANALYSISTREE_ATTR_NODISCARD const std::string & GetName () const
 
ANALYSISTREE_ATTR_NODISCARD const std::vector< Field > & GetFields () const
 
ANALYSISTREE_ATTR_NODISCARD short GetNumberOfBranches () const
 
ANALYSISTREE_ATTR_NODISCARD std::set< std::string > GetBranches () const
 
ANALYSISTREE_ATTR_NODISCARD std::string GetBranchName () const
 
double GetValue (std::vector< const BranchChannel * > &bch, std::vector< size_t > &id) const
 
double GetValue (const BranchChannel &a, size_t a_id, const BranchChannel &b, size_t b_id) const
 
template<class T >
double GetValue (const T &object) const
 
double GetValue (const BranchChannel &object) const
 
void SetName (std::string name)
 
void Print () const
 
void IfEmptyVariableConvertToOnes (const Variable &var)
 

Static Public Member Functions

static Variable FromString (const std::string &full_name)
 

Protected Member Functions

 ClassDef (Variable, 0)
 

Protected Attributes

std::string name_
 
std::vector< Fieldfields_ {}
 
std::vector< double > vars_ {}
 
std::function< double(std::vector< double > &)> lambda_ {[](std::vector<double>& var) { return var.at(0); }}
 
short n_branches_ {0}
 
bool is_init_ {false}
 

Friends

bool operator== (const Variable &that, const Variable &other)
 
bool operator> (const Variable &that, const Variable &other)
 
bool operator< (const Variable &that, const Variable &other)
 

Detailed Description

Variable is a wrapper object for Field. In contrary to Field Variable is not bound to the data. It could represent a Field itself or, if specified, a result of operation on two or more fields.

Constructor & Destructor Documentation

◆ Variable()

AnalysisTree::Variable::Variable ( std::string name,
std::vector< Field > fields,
std::function< double(std::vector< double > &)> lambda )

Generic constructor for complicated variables

Parameters
fieldsvector of Fields
lambdafunction to calculate variable TODO maybe move to Variable::FromFunction()

Member Function Documentation

◆ FromString()

Variable AnalysisTree::Variable::FromString ( const std::string & full_name)
static
Parameters
full_name
Returns

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