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

SimpleCut keeps predicate (lambda function with vector of arguments) and list of Variables. More...

#include <SimpleCut.hpp>

Collaboration diagram for AnalysisTree::SimpleCut:
Collaboration graph

Public Member Functions

 SimpleCut (const SimpleCut &cut)=default
 
 SimpleCut (SimpleCut &&cut)=default
 
SimpleCutoperator= (SimpleCut &&)=default
 
SimpleCutoperator= (const SimpleCut &cut)=default
 
 SimpleCut (std::vector< std::string > vars, std::function< bool(std::vector< double > &)> lambda, std::string title="")
 
template<class T >
bool Apply (const T &object) const
 Evaluates cut.
 
bool Apply (const BranchChannel &object) const
 
bool Apply (std::vector< const BranchChannel * > &bch, std::vector< size_t > &id) const
 
bool Apply (const BranchChannel &a, size_t a_id, const BranchChannel &b, size_t b_id) const
 
void Print () const
 
std::vector< Variable > & Variables ()
 
ANALYSISTREE_ATTR_NODISCARD const std::vector< Variable > & GetVariables () const
 
ANALYSISTREE_ATTR_NODISCARD const std::set< std::string > & GetBranches () const
 

Protected Member Functions

 SimpleCut (const Variable &var, double min, double max, std::string title="")
 
 SimpleCut (const Variable &var, int value, std::string title="")
 
void FillBranchNames ()
 
 ClassDef (SimpleCut, 1)
 

Protected Attributes

std::string title_
 
std::vector< Variablevars_ {}
 
std::set< std::string > branch_names_ {}
 
std::function< bool(std::vector< double > &)> lambda_
 function used to evaluate the cut.
 

Friends

SimpleCut RangeCut (const std::string &variable_name, double lo, double hi, const std::string &title="")
 
SimpleCut EqualsCut (const std::string &variable_name, int value, const std::string &title="")
 
SimpleCut RangeCut (const Variable &var, double lo, double hi, const std::string &title="")
 
SimpleCut EqualsCut (const Variable &var, int value, const std::string &title="")
 
bool operator== (const SimpleCut &that, const SimpleCut &other)
 

Detailed Description

SimpleCut keeps predicate (lambda function with vector of arguments) and list of Variables.

Constructor & Destructor Documentation

◆ SimpleCut()

AnalysisTree::SimpleCut::SimpleCut ( std::vector< std::string > vars,
std::function< bool(std::vector< double > &)> lambda,
std::string title = "" )
inline

Constructor for generic cut: bool f(var1, var2, ..., varn)

Parameters
varsvector of variable NAMES needed for a cut
lambdafunction of fields, returns bool

Member Function Documentation

◆ Apply()

template<class T >
bool AnalysisTree::SimpleCut::Apply ( const T & object) const
inline

Evaluates cut.

Template Parameters
Ttype of data-object associated with TTree
Parameters
object
Returns
result of cut

Friends And Related Symbol Documentation

◆ EqualsCut [1/2]

SimpleCut EqualsCut ( const std::string & variable_name,
int value,
const std::string & title = "" )
friend

Constructor for integers and bool fields for cut: field == value

Parameters
variable_namename of the variable in format "branch.field"
valueonly objects with field == value will be accepted

◆ EqualsCut [2/2]

SimpleCut EqualsCut ( const Variable & var,
int value,
const std::string & title = "" )
friend

Constructor for integers and bool fields for cut: field == value

Parameters
variablename of the pre-defined variable
valueonly objects with field == value will be accepted

◆ RangeCut [1/2]

SimpleCut RangeCut ( const std::string & variable_name,
double lo,
double hi,
const std::string & title = "" )
friend

Constructor for range cut: min <= field <= max

Parameters
variable_namename of the variable in format "branch.field"
minminimal accepted value
maxmaximal accepted value

◆ RangeCut [2/2]

SimpleCut RangeCut ( const Variable & var,
double lo,
double hi,
const std::string & title = "" )
friend

Constructor for range cut: min <= field <= max

Parameters
variablename of the pre-defined variable
minminimal accepted value
maxmaximal accepted value

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