Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

caf_util::TreeHandler Class Reference

This is a helper class for adding and filling branches to a tree. More...

#include <TreeHandler.hpp>

List of all members.

Public Member Functions

 TreeHandler ()
TTree * GetTree ()
TBranch * GetBranch (std::string BranchName)
TClonesArray * GetBranchArray (std::string BranchName)
void InitTree (std::string TreeName, TFile *input_file)
void AddBranch (std::string BranchName, std::string BranchObjType)
void AddBranch (std::string BranchName, int &intref, std::string BranchObjType)
void AddBranch (std::string BranchName, float &floatref, std::string BranchObjType)
void AddBranch (std::string BranchName, double &dbleref, std::string BranchObjType)
template<class T> void AddBranch (std::string BranchName, std::string BranchObjType, T **obj)
template<class T> void FillBranch (std::string BranchName, cafe::Collection< T > result)
void ClearIt ()
 ClassDef (TreeHandler, 1)

Private Attributes

TTree * _tree
TTree * _tmb_tree
std::map< std::string, TClonesArray * > _BranchContent
std::map< std::string, TBranch * > _Branches
std::string _toTree


Detailed Description

This is a helper class for adding and filling branches to a tree.

If the tree doesn't already exist, a new one is created in memory and made friend with the input TMBTree. The tree can be written to file using the default Write processor in cafe.

Usage:

In your processor:

_treehandler = new TreeHandler();

_treehandler->InitTree("TreeName",file); _treehandler->AddBranch("Branch1",... _treehandler->AddBranch("Branch2",...

_treehandler->FillBranch("Branch1",myCollection1) _treehandler->FillBranch("Branch2",myCollection2)

_treehandler->ClearIt();

Author:
Dag Gillberg
Date:
September 2005

Definition at line 59 of file TreeHandler.hpp.


Constructor & Destructor Documentation

caf_util::TreeHandler::TreeHandler  ) 
 

Definition at line 6 of file TreeHandler.cpp.


Member Function Documentation

template<class T>
void caf_util::TreeHandler::AddBranch std::string  BranchName,
std::string  BranchObjType,
T **  obj
[inline]
 

Definition at line 86 of file TreeHandler.hpp.

References _Branches, and _tree.

void caf_util::TreeHandler::AddBranch std::string  BranchName,
double &  dbleref,
std::string  BranchObjType
 

Definition at line 69 of file TreeHandler.cpp.

References _Branches, and _tree.

void caf_util::TreeHandler::AddBranch std::string  BranchName,
float &  floatref,
std::string  BranchObjType
 

Definition at line 58 of file TreeHandler.cpp.

References _Branches, and _tree.

void caf_util::TreeHandler::AddBranch std::string  BranchName,
int &  intref,
std::string  BranchObjType
 

Definition at line 47 of file TreeHandler.cpp.

References _Branches, and _tree.

void caf_util::TreeHandler::AddBranch std::string  BranchName,
std::string  BranchObjType
 

Definition at line 35 of file TreeHandler.cpp.

References _BranchContent, _Branches, and _tree.

caf_util::TreeHandler::ClassDef TreeHandler  ,
 

void caf_util::TreeHandler::ClearIt  ) 
 

Definition at line 80 of file TreeHandler.cpp.

References _BranchContent, _Branches, _tmb_tree, _toTree, and _tree.

template<class T>
void caf_util::TreeHandler::FillBranch std::string  BranchName,
cafe::Collection< T >  result
[inline]
 

Definition at line 96 of file TreeHandler.hpp.

References cafe::Collection< T >::begin(), cafe::Collection< T >::end(), and GetBranchArray().

TBranch* caf_util::TreeHandler::GetBranch std::string  BranchName  )  [inline]
 

Definition at line 74 of file TreeHandler.hpp.

References _Branches.

TClonesArray* caf_util::TreeHandler::GetBranchArray std::string  BranchName  )  [inline]
 

Definition at line 75 of file TreeHandler.hpp.

References _BranchContent.

Referenced by FillBranch().

TTree* caf_util::TreeHandler::GetTree  )  [inline]
 

Definition at line 73 of file TreeHandler.hpp.

References _tree.

void caf_util::TreeHandler::InitTree std::string  TreeName,
TFile *  input_file
 

Definition at line 13 of file TreeHandler.cpp.

References _tmb_tree, _toTree, and _tree.


Member Data Documentation

std::map<std::string,TClonesArray*> caf_util::TreeHandler::_BranchContent [private]
 

Definition at line 65 of file TreeHandler.hpp.

Referenced by AddBranch(), ClearIt(), and GetBranchArray().

std::map<std::string,TBranch*> caf_util::TreeHandler::_Branches [private]
 

Definition at line 66 of file TreeHandler.hpp.

Referenced by AddBranch(), ClearIt(), and GetBranch().

TTree* caf_util::TreeHandler::_tmb_tree [private]
 

Definition at line 64 of file TreeHandler.hpp.

Referenced by ClearIt(), and InitTree().

std::string caf_util::TreeHandler::_toTree [private]
 

Definition at line 67 of file TreeHandler.hpp.

Referenced by ClearIt(), and InitTree().

TTree* caf_util::TreeHandler::_tree [private]
 

Definition at line 63 of file TreeHandler.hpp.

Referenced by AddBranch(), ClearIt(), GetTree(), and InitTree().


The documentation for this class was generated from the following files:
Generated on Tue Mar 28 10:13:10 2006 for CAF by doxygen 1.3.4