#include <Variables.hpp>
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) | |
| Variables & | operator= (const Variables &other) |
| Variables & | add (const std::string &name) |
| Variables & | add (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. | |
|
|
Definition at line 11 of file Variables.cpp. |
|
|
Definition at line 17 of file Variables.cpp. |
|
|
Definition at line 24 of file Variables.cpp. |
|
||||||||||||
|
Definition at line 31 of file Variables.cpp. References add(). |
|
||||||||||||||||
|
Definition at line 39 of file Variables.cpp. References add(). |
|
||||||||||||||||||||
|
Definition at line 48 of file Variables.cpp. References add(). |
|
|
Definition at line 58 of file Variables.cpp. |
|
|
Definition at line 93 of file Variables.cpp. |
|
|
Definition at line 85 of file Variables.cpp. |
|
|
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(). |
|
|
Definition at line 97 of file Variables.cpp. References _names. Referenced by cafe::EventBase::BranchHolder< T >::getObject(). |
|
||||||||||||||||
|
Definition at line 102 of file Variables.cpp. References _branch, _cookie, _names, and _subbranches. Referenced by cafe::EventBase::BranchHolder< T >::getObject(). |
|
|
Definition at line 66 of file Variables.cpp. References _branch, _cookie, _names, and _subbranches. |
|
|
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=(). |
|
|
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=(). |
|
|
List of variable names.
Definition at line 55 of file Variables.hpp. Referenced by add(), empty(), get(), and operator=(). |
|
|
Cached list of TBranch pointers. Invalidated by a new TTree.
Definition at line 57 of file Variables.hpp. Referenced by get(), and operator=(). |
1.3.4