RAPIDO
Repeatable Analysis Programming for Interpretability, Durability, and Organization
Loading...
Searching...
No Matches
Arbol Class Reference

#include <arbol.h>

Inheritance diagram for Arbol:
Arbusto

Public Member Functions

 Arbol ()
 
 Arbol (TFile *tfile, TString ttree_name="tree")
 
 Arbol (TString tfile_name, TString ttree_name="tree")
 
 Arbol (HEPCLI &cli)
 
virtual ~Arbol ()
 
template<typename Type >
void newBranch (TString new_branch_name)
 
template<typename Type >
void newBranch (TString new_branch_name, Type new_reset_value)
 
template<typename Type >
void setBranchResetValue (TString branch_name, Type new_reset_value)
 
template<typename Type >
Type getLeaf (TString branch_name)
 
template<typename Type >
void setLeaf (TString branch_name, Type new_value)
 
template<typename Type >
void newVecBranch (TString new_branch_name)
 
template<typename Type >
void newVecBranch (TString new_branch_name, std::vector< Type > new_reset_vector)
 
template<typename Type >
void setVecBranchResetValue (TString branch_name, std::vector< Type > new_reset_vector)
 
template<typename Type >
std::vector< Type > getVecLeaf (TString branch_name)
 
template<typename Type >
void setVecLeaf (TString branch_name, std::vector< Type > new_vector)
 
template<typename Type >
void appendToVecLeaf (TString branch_name, Type new_value)
 
template<typename Type >
void prependToVecLeaf (TString branch_name, Type new_value)
 
template<typename Type >
void insertIntoVecLeaf (TString branch_name, Type new_value, int index)
 
template<typename Type >
void sortVecLeaf (TString branch_name, std::function< bool(Type, Type)> &lambda)
 
void resetBranches ()
 
virtual void fill ()
 
virtual void write (bool close=true)
 

Public Attributes

TTree * ttree
 
TFile * tfile
 

Protected Member Functions

template<typename Type >
Branch< Type > * getBranch (TString branch_name)
 

Protected Attributes

std::map< TString, Utilities::Dynamic * > branches
 
std::map< TString, std::function< void()> > branch_resetters
 

Detailed Description

Wraps TTree object with functionality for making branches dynamically

Constructor & Destructor Documentation

◆ Arbol() [1/4]

Arbol::Arbol ( )

Arbol object constructor

Returns
none

◆ Arbol() [2/4]

Arbol::Arbol ( TFile * tfile,
TString ttree_name = "tree" )

Arbol object overload constructor

Parameters
tfilepointer to an existing TFile
ttree_namename of output TTree (default: 'tree')
Returns
none

◆ Arbol() [3/4]

Arbol::Arbol ( TString tfile_name,
TString ttree_name = "tree" )

Arbol object overload constructor

Parameters
tfile_namename of output TFile
ttree_namename of output TTree (default: 'tree')
Returns
none

◆ Arbol() [4/4]

Arbol::Arbol ( HEPCLI & cli)

Arbol object overload constructor

Parameters
cliHEPCLI object
Returns
none

◆ ~Arbol()

virtual Arbol::~Arbol ( )
virtual

Arbol object destructor

Returns
none

Member Function Documentation

◆ appendToVecLeaf()

template<typename Type >
void Arbol::appendToVecLeaf ( TString branch_name,
Type new_value )

Append given value to leaf (vector)

Template Parameters
Typetype of branch value
Parameters
branch_namebranch name
new_valuenew value to append
Returns
none

◆ fill()

virtual void Arbol::fill ( )
virtual

Fill TTree with all current leaves

Returns
none

◆ getBranch()

template<typename Type >
Branch< Type > * Arbol::getBranch ( TString branch_name)
protected

(PROTECTED) Get pointer to branch object if it exists

Template Parameters
Typetype of branch value
Parameters
branch_namebranch name
Returns
pointer to branch object

◆ getLeaf()

template<typename Type >
Type Arbol::getLeaf ( TString branch_name)

Get current leaf value

Template Parameters
Typetype of branch value
Parameters
branch_namebranch name
Returns
leaf value

◆ getVecLeaf()

template<typename Type >
std::vector< Type > Arbol::getVecLeaf ( TString branch_name)

Calls Arbol::getLeaf, but supplies std::vector<Type> for tparam

See also
Arbol::getLeaf
Template Parameters
Typetype of branch value
Parameters
branch_namebranch name
Returns
leaf vector

◆ insertIntoVecLeaf()

template<typename Type >
void Arbol::insertIntoVecLeaf ( TString branch_name,
Type new_value,
int index )

Insert value into leaf (vector) at a particular index

Template Parameters
Typetype of branch value
Parameters
branch_namebranch name
new_valuenew value to insert
indextarget index
Returns
none

◆ newBranch() [1/2]

template<typename Type >
void Arbol::newBranch ( TString new_branch_name)

Add a new branch to TTree

Template Parameters
Typetype of branch value
Parameters
new_branch_namenew branch name
Returns
none

◆ newBranch() [2/2]

template<typename Type >
void Arbol::newBranch ( TString new_branch_name,
Type new_reset_value )

Add a new branch to TTree and set reset value

Template Parameters
Typetype of branch value
Parameters
new_branch_namenew branch name
new_reset_valuenew branch reset value
Returns
none

◆ newVecBranch() [1/2]

template<typename Type >
void Arbol::newVecBranch ( TString new_branch_name)

Calls Arbol::newBranch, but supplies std::vector<Type> for tparam

See also
Arbol::newBranch
Template Parameters
Typetype of vector branch value
Parameters
new_branch_namebranch name
Returns
none

◆ newVecBranch() [2/2]

template<typename Type >
void Arbol::newVecBranch ( TString new_branch_name,
std::vector< Type > new_reset_vector )

Calls Arbol::newBranch, but supplies std::vector<Type> for tparam

See also
Arbol::newBranch
Template Parameters
Typetype of vector branch value
Parameters
new_branch_namenew branch name
new_reset_vectornew branch reset value (vector)
Returns
none

◆ prependToVecLeaf()

template<typename Type >
void Arbol::prependToVecLeaf ( TString branch_name,
Type new_value )

Prepend given value to leaf (vector)

Template Parameters
Typetype of branch value
Parameters
branch_namebranch name
new_valuenew value to prepend
Returns
none

◆ resetBranches()

void Arbol::resetBranches ( )

Set value of each branch to its respective reset value Uses a map of "resetters" for the same reason as Utilities::Variables.

Returns
none

◆ setBranchResetValue()

template<typename Type >
void Arbol::setBranchResetValue ( TString branch_name,
Type new_reset_value )

Set reset value for the branch

Template Parameters
Typetype of branch value
Parameters
branch_namebranch name
new_reset_valuenew reset value
Returns
none

◆ setLeaf()

template<typename Type >
void Arbol::setLeaf ( TString branch_name,
Type new_value )

Set current leaf value

Template Parameters
Typetype of branch value
Parameters
branch_namebranch name
new_valuenew value
Returns
none

◆ setVecBranchResetValue()

template<typename Type >
void Arbol::setVecBranchResetValue ( TString branch_name,
std::vector< Type > new_reset_vector )

Calls Arbol::setBranchResetValue, but supplies std::vector<Type> for tparam

See also
Arbol::setBranchResetValue
Template Parameters
Typetype of vector branch value
Parameters
branch_namebranch name
new_reset_vectornew branch reset value (vector)
Returns
none

◆ setVecLeaf()

template<typename Type >
void Arbol::setVecLeaf ( TString branch_name,
std::vector< Type > new_vector )

Calls Arbol::setLeaf, but supplies std::vector<Type> for tparam

See also
Arbol::getLeaf
Template Parameters
Typetype of branch value
Parameters
branch_namebranch name
new_vectornew branch value (vector)
Returns
none

◆ sortVecLeaf()

template<typename Type >
void Arbol::sortVecLeaf ( TString branch_name,
std::function< bool(Type, Type)> & lambda )

Sort leaf (vector) using a given lambda function

Template Parameters
Typetype of branch value
Parameters
branch_namebranch name
lambdalambda function to use for sorting
Returns
none

◆ write()

virtual void Arbol::write ( bool close = true)
virtual

Write TTree to TFile

Parameters
closetoggles whether TFile::Close is called after writing (default: true)
Returns
none

Member Data Documentation

◆ branch_resetters

std::map<TString, std::function<void()> > Arbol::branch_resetters
protected

Map of reset function for each dynamically typed TBranch

◆ branches

std::map<TString, Utilities::Dynamic*> Arbol::branches
protected

Map of dynamically typed TBranches

◆ tfile

TFile* Arbol::tfile

Pointer to ROOT TFile object

◆ ttree

TTree* Arbol::ttree

Pointer to ROOT TTree object


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