cafe::Variables Class Reference
[CAF Environment (Cafe)]

#include <Variables.hpp>

List of all members.


Detailed Description

Utility class to access only selected variables in a TBranch.

By default the Event methods return the full object/array. Often only a few variables are used out of a given branch.

This helper class can be used to restrict access to only a subset of the variables in a branch. It should be initialized (either via the constructor or the add() methods) with a list of variable names in the branch. Then the Variables should be passed as a parameter to the Event::getNNN() method. All other variables in the branch are undefined:

Variables vars("_evtno"); const TMBGlobal *global = event.getGlobal(vars); int event_number = global->evtno(); int run_number = global->runno(); // UNDEFINED !!

Definition at line 36 of file Variables.hpp.

Public Member Functions

 Variables ()
 Variables (const std::vector< std::string > &names)
 Variables (const std::string &name1)
 Variables (const std::string &name1, const std::string &name2)
 Variables (const std::string &name1, const std::string &name2, const std::string &name3)
 Variables (const std::string &name1, const std::string &name2, const std::string &name3, const std::string &name4)
 Variables (const Variables &other)
Variablesoperator= (const Variables &other)
Variablesadd (const std::string &name)
Variablesadd (const std::vector< std::string > &name)
 ~Variables ()
bool empty () const
void get (TTree *, TBranch *br, int cookie) const

Private Attributes

std::vector< std::string > _names
 List of variable names.

std::vector< TBranch * > _subbranches
 Cached list of TBranch pointers. Invalidated by a new TTree.

int _cookie
 Used to invalidate a new TTree and re-read the TBranch pointers.

TBranch * _branch
 Used internally to check for user error when using same Variables for different branches.


Constructor & Destructor Documentation

cafe::Variables::Variables  ) 
 

Definition at line 11 of file Variables.cpp.

cafe::Variables::Variables const std::vector< std::string > &  names  )  [explicit]
 

Definition at line 17 of file Variables.cpp.

cafe::Variables::Variables const std::string &  name1  )  [explicit]
 

Definition at line 24 of file Variables.cpp.

cafe::Variables::Variables const std::string &  name1,
const std::string &  name2
 

Definition at line 31 of file Variables.cpp.

References add().

cafe::Variables::Variables const std::string &  name1,
const std::string &  name2,
const std::string &  name3
 

Definition at line 39 of file Variables.cpp.

References add().

cafe::Variables::Variables const std::string &  name1,
const std::string &  name2,
const std::string &  name3,
const std::string &  name4
 

Definition at line 48 of file Variables.cpp.

References add().

cafe::Variables::Variables const Variables other  ) 
 

Definition at line 58 of file Variables.cpp.

cafe::Variables::~Variables  ) 
 

Definition at line 93 of file Variables.cpp.


Member Function Documentation

Variables & cafe::Variables::add const std::vector< std::string > &  name  ) 
 

Definition at line 85 of file Variables.cpp.

References _branch, _cookie, and _names.

Variables & cafe::Variables::add const std::string &  name  ) 
 

Definition at line 77 of file Variables.cpp.

References _branch, _cookie, and _names.

Referenced by cafe::SelectUserObjects< T >::addVariable(), cafe::RandomSelectUserObjects< T >::addVariable(), cafe::BadLBNs::BadLBNs(), cafe::SelectUserObjects< T >::SelectUserObjects(), and Variables().

bool cafe::Variables::empty  )  const
 

Definition at line 97 of file Variables.cpp.

References _names.

Referenced by cafe::EventBase::BranchHolder< T >::getObject().

void cafe::Variables::get TTree *  ,
TBranch *  br,
int  cookie
const
 

Definition at line 102 of file Variables.cpp.

References _branch, _cookie, _names, and _subbranches.

Referenced by cafe::EventBase::BranchHolder< T >::getObject().

Variables & cafe::Variables::operator= const Variables other  ) 
 

Definition at line 66 of file Variables.cpp.

References _branch, _cookie, _names, and _subbranches.


Member Data Documentation

TBranch* cafe::Variables::_branch [mutable, private]
 

Used internally to check for user error when using same Variables for different branches.

Definition at line 62 of file Variables.hpp.

Referenced by add(), get(), and operator=().

int cafe::Variables::_cookie [mutable, private]
 

Used to invalidate a new TTree and re-read the TBranch pointers.

Definition at line 59 of file Variables.hpp.

Referenced by add(), get(), and operator=().

std::vector<std::string> cafe::Variables::_names [private]
 

List of variable names.

Definition at line 55 of file Variables.hpp.

Referenced by add(), empty(), get(), and operator=().

std::vector<TBranch*> cafe::Variables::_subbranches [mutable, private]
 

Cached list of TBranch pointers. Invalidated by a new TTree.

Definition at line 57 of file Variables.hpp.

Referenced by get(), and operator=().


The documentation for this class was generated from the following files:
Generated on Thu Apr 3 04:14:28 2008 for CAF by doxygen 1.3.4