Crombie Tools
crombie::LoadTree::Tree Class Reference

Class that holds a loaded tree from a file. More...

#include <LoadTree.h>

Public Member Functions

template<typename... Args>
 Tree (const std::string &infile, Args... args)
 Constructor of a loaded tree. More...
 
 ~Tree ()
 
template<typename C >
C * get (const std::string &name)
 Get a bare pointer to a TObject inside of this file. More...
 
bool next ()
 Loads the next event into memory and evaluates all of the formulas. More...
 
double & result (const std::string &expr)
 Get a reference to the result for a given formula. More...
 

Private Attributes

TFile * file
 The TFile that is being read. More...
 
Formulas forms
 Holds formulas initialized with. More...
 
long long ientry {0}
 Which entry are we on. More...
 
long long nentries
 Total number of events in the tree. More...
 
TTree * tree
 Holds the pointer to the tree. More...
 

Detailed Description

Class that holds a loaded tree from a file.

The tree name is given in the environment variable tree, and defaults to "events".

Definition at line 71 of file LoadTree.h.

Constructor & Destructor Documentation

§ Tree()

template<typename... Args>
crombie::LoadTree::Tree::Tree ( const std::string &  infile,
Args...  args 
)

Constructor of a loaded tree.

Note that copy and move constructors won't work because of the TFile member.

Parameters
infileis the name of the input file to read
argsis a variable number of arguments that can be of type std::string or crombie::Types::strings>.

Definition at line 137 of file LoadTree.h.

References crombie::LoadTree::Formulas::add(), crombie::Misc::env(), file, forms, nentries, crombie::LoadTree::rootlock, and tree.

§ ~Tree()

crombie::LoadTree::Tree::~Tree ( )
inline

Definition at line 79 of file LoadTree.h.

References sushi::file.

Member Function Documentation

§ get()

template<typename C >
C * crombie::LoadTree::Tree::get ( const std::string &  name)

Get a bare pointer to a TObject inside of this file.

Parameters
Cis the type of pointer you would like to get
nameis the name of the object, searched for with TFile::Get

Definition at line 164 of file LoadTree.h.

References file.

§ next()

bool crombie::LoadTree::Tree::next ( )

Loads the next event into memory and evaluates all of the formulas.

Definition at line 156 of file LoadTree.h.

References crombie::LoadTree::Formulas::eval(), forms, ientry, nentries, and tree.

§ result()

double& crombie::LoadTree::Tree::result ( const std::string &  expr)
inline

Get a reference to the result for a given formula.

Definition at line 85 of file LoadTree.h.

References crombie::LoadTree::Formulas::forms.

Referenced by crombie::EventDump::SingleFile().

Member Data Documentation

§ file

TFile* crombie::LoadTree::Tree::file
private

The TFile that is being read.

Definition at line 95 of file LoadTree.h.

Referenced by get(), and Tree().

§ forms

Formulas crombie::LoadTree::Tree::forms
private

Holds formulas initialized with.

Definition at line 99 of file LoadTree.h.

Referenced by next(), and Tree().

§ ientry

long long crombie::LoadTree::Tree::ientry {0}
private

Which entry are we on.

Definition at line 98 of file LoadTree.h.

Referenced by next().

§ nentries

long long crombie::LoadTree::Tree::nentries
private

Total number of events in the tree.

Definition at line 97 of file LoadTree.h.

Referenced by next(), and Tree().

§ tree

TTree* crombie::LoadTree::Tree::tree
private

Holds the pointer to the tree.

Definition at line 96 of file LoadTree.h.

Referenced by next(), and Tree().


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