Belle II Software development
LowerBoundedSet< InfType > Class Template Reference

Represents a lower bounded set of arithmetic types. More...

#include <LowerBoundedSet.h>

Public Member Functions

 LowerBoundedSet (InfType inf)
 Constructor.
 
 LowerBoundedSet ()
 Constructor without argument.
 
template<class VariableType >
bool contains (const VariableType &x) const
 Method used by the filter tools to decide on the fate of the pair.
 
void persist (TTree *t, const std::string &branchName, const std::string &variableName)
 Creates and sets the addresses of the leaves to store the inf value.
 
void setBranchAddress (TTree *t, const std::string &branchName, const std::string &)
 Setting the branch address for a filter in a TTree.
 
InfType getInf (void) const
 Accessor to the inf of the set.
 
std::string getNameAndReference (std::vector< std::pair< char, void * > > *pointers=nullptr, const std::string &varname="X")
 generates a "name" and fills the vector with the variable references
 

Private Attributes

InfType m_inf
 infinity value
 

Detailed Description

template<typename InfType>
class Belle2::LowerBoundedSet< InfType >

Represents a lower bounded set of arithmetic types.

LowerBoundedSet is used in conjunction with the SelectionVariable to define one of the building blocks of the Filters

Definition at line 30 of file LowerBoundedSet.h.

Constructor & Destructor Documentation

◆ LowerBoundedSet() [1/2]

LowerBoundedSet ( InfType  inf)
inlineexplicit

Constructor.

Definition at line 35 of file LowerBoundedSet.h.

35: m_inf(inf) {};
InfType m_inf
infinity value

◆ LowerBoundedSet() [2/2]

LowerBoundedSet ( )
inline

Constructor without argument.

Definition at line 38 of file LowerBoundedSet.h.

38: m_inf(0) {};

Member Function Documentation

◆ contains()

bool contains ( const VariableType &  x) const
inline

Method used by the filter tools to decide on the fate of the pair.

Parameters
xis the result of some SelectionVariable applied to a pair of objects. The return value is true if x belongs to the open set ( m_inf, infinity )

Definition at line 46 of file LowerBoundedSet.h.

46{ return m_inf < x ;};

◆ getInf()

InfType getInf ( void  ) const
inline

Accessor to the inf of the set.

Definition at line 79 of file LowerBoundedSet.h.

79{ return m_inf; } ;

◆ getNameAndReference()

std::string getNameAndReference ( std::vector< std::pair< char, void * > > *  pointers = nullptr,
const std::string &  varname = "X" 
)
inline

generates a "name" and fills the vector with the variable references

Parameters
pointerspointer to vector which contains a pair of char which indicates the type object pointed to and the actual pointers to the bounds, if equal to nullptr it will not be filled
varnameoptional name of the filter this range is attached to make the output look nicer

Definition at line 86 of file LowerBoundedSet.h.

87 {
88 std::string minVal = std::to_string(m_inf);
89 // if pointer to vector is provided fill it
90 if (pointers != nullptr) {
91 // use the position in the vector as unique identifier
92 minVal = "#" + std::to_string(pointers->size());
93 (*pointers).push_back({TBranchLeafType(m_inf), &m_inf});
94 }
95 return ("(" + minVal + " < " + varname + ")");
96 }
char TBranchLeafType(const char *)
Overloading TBranchLeafType to be able to get identifier 'C' for type char*.

◆ persist()

void persist ( TTree *  t,
const std::string &  branchName,
const std::string &  variableName 
)
inline

Creates and sets the addresses of the leaves to store the inf value.

Parameters
tthe pointer to the TTree that will contain the TBranch of this range.
branchNamethe name of the TBranch that will host this range.
variableNamethe name of the selection variable this range is applied to.

The leaves will be named as the selection variable name with the "_inf" suffix for the inf value.

Definition at line 57 of file LowerBoundedSet.h.

58 {
59
60 std::string leafList;
61 leafList += variableName;
62 leafList += "_inf/";
63 leafList += TBranchLeafType(m_inf);
64 TBranch* branch = new TBranch(t, branchName.c_str(), & m_inf, leafList.c_str());
65 t->GetListOfBranches()->Add(branch);
66 }

◆ setBranchAddress()

void setBranchAddress ( TTree *  t,
const std::string &  branchName,
const std::string &   
)
inline

Setting the branch address for a filter in a TTree.

Parameters
t: the TTree in which the branch address shall be set
branchName: name of the branch

Definition at line 72 of file LowerBoundedSet.h.

74 {
75 if (t->SetBranchAddress(branchName, & m_inf) < 0) B2FATAL("LowerBoundedSet: branch address not valid");
76 }

Member Data Documentation

◆ m_inf

InfType m_inf
private

infinity value

Definition at line 31 of file LowerBoundedSet.h.


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