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
SimpleCut & operator= (SimpleCut &&)=default
SimpleCut & operator= (const SimpleCut &cut)=default
 SimpleCut (std::vector< std::string > vars, std::function< bool(std::vector< double > &)> lambda, std::string title="")
 SimpleCut (const std::vector< Variable > &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
void SetTitle (const std::string &title)
const std::string & GetTitle () 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.
size_t hash_

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="")
SimpleCut OpenCut (const std::string &branchName)
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

◆ 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

◆ OpenCut

SimpleCut OpenCut ( const std::string & branchName)
friend

Constructor for a cut which is always passed (needed for keeping generality of the user's code, when a set of cuts is iterated and an iteration with no-cut is needed)

Parameters
branchNamename of the branch, which is present in other cuts

◆ 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: