AliRoot Core  v5-06-30 (35d6c57)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMUONTreeManager Class Reference

Helper class to ease TTree (MUON) branches manipulations. More...

#include <AliMUONTreeManager.h>

Inheritance diagram for AliMUONTreeManager:

Public Member Functions

 AliMUONTreeManager ()
virtual ~AliMUONTreeManager ()
void AddClassName (TTree &tree, const char *pattern, const char *className) const
Bool_t MakeBranch (TTree &tree, const char *storeClassName, const char *branchClassName, const char *branchName, void *address, Int_t bufferSize=4000, Int_t splitLevel=99) const
Bool_t SetAddress (TTree &tree, const char *branchName, void *address) const
TObject * CreateObject (const TTree &tree, const char *detail) const
void UpdateBranchStatuses (TTree &tree, const char *pattern) const
void GetEvent (TTree &tree, Int_t event) const
void ShowStatus (TTree &tree) const
 Debug method to show the tree branch statuses and addresses. More...

Private Member Functions

TString GetClassName (const TTree &tree, const char *pattern, Bool_t makeDefault) const
TString DefaultClassName (const char *treename, const char *pattern) const

Detailed Description

Helper class to ease TTree (MUON) branches manipulations.

Helper class to handle the relationships TTree<->MUON data containers

The general way of dealing with I/O for MUON is a two stage process :

1) first get a TTree pointer using the AliLoader mechanism (this is AliRoot general)

2) connect that TTree to a MUON (virtual) data container using the container's Connect(TTree&) method (this is MUON specific)

This class helps implementing stage 2 in the relevant store implementations

See Also

Basically, the relationship Tree<->Store is possible because the TreeManager, when creating branches, uses the UserInfo part of the TTree to store the relationship branch -> MUON store classname.

Laurent Aphecetche, Subatech

Definition at line 23 of file AliMUONTreeManager.h.

Constructor & Destructor Documentation

AliMUONTreeManager::AliMUONTreeManager ( )

Default ctor

Definition at line 59 of file AliMUONTreeManager.cxx.

AliMUONTreeManager::~AliMUONTreeManager ( )


Definition at line 65 of file AliMUONTreeManager.cxx.

Member Function Documentation

void AliMUONTreeManager::AddClassName ( TTree &  tree,
const char *  pattern,
const char *  className 
) const

Adds a association (pattern,className) to the UserInfo() of tree It is mandatory to use this method in MakeBranches(), as this is the key to get an automatic container creation from a tree.

Definition at line 124 of file AliMUONTreeManager.cxx.

Referenced by MakeBranch().

TObject * AliMUONTreeManager::CreateObject ( const TTree &  tree,
const char *  detail 
) const

Object creation from tree, using the (pattern,className) pairs stored in the UserInfo() of TTree.

Definition at line 174 of file AliMUONTreeManager.cxx.

Referenced by AliMUONVStore::Create().

TString AliMUONTreeManager::DefaultClassName ( const char *  treename,
const char *  pattern 
) const

For backward compatibility only. Decides, based on the tree name and a pattern, which store class should be used.

Definition at line 260 of file AliMUONTreeManager.cxx.

Referenced by GetClassName().

TString AliMUONTreeManager::GetClassName ( const TTree &  tree,
const char *  pattern,
Bool_t  makeDefault 
) const

Find out, using the TTree::UserInfo, the classname corresponding to pattern. If makeDefault=true and we cannot find the pattern in the UserInfo, we return DefaultClassName(pattern)

Definition at line 227 of file AliMUONTreeManager.cxx.

Referenced by AddClassName(), and CreateObject().

void AliMUONTreeManager::GetEvent ( TTree &  tree,
Int_t  event 
) const

Debug method to get an event, but checking beforehand that all selected branches do have a non-zero address set (otherwise we leak memory).

Equivalent to tree.GetEvent(event) is NDEBUG is not defined, otherwise insure that selected branches have a non-zero address (the contrary indicating we'll get a memory leak when reading the tree).

Definition at line 72 of file AliMUONTreeManager.cxx.

Bool_t AliMUONTreeManager::MakeBranch ( TTree &  tree,
const char *  storeClassName,
const char *  branchClassName,
const char *  branchName,
void *  address,
Int_t  bufferSize = 4000,
Int_t  splitLevel = 99 
) const
Bool_t AliMUONTreeManager::SetAddress ( TTree &  tree,
const char *  branchName,
void *  address 
) const
void AliMUONTreeManager::ShowStatus ( TTree &  tree) const

Debug method to show the tree branch statuses and addresses.

Show main branches status and address

Definition at line 107 of file AliMUONTreeManager.cxx.

Referenced by GetEvent().

void AliMUONTreeManager::UpdateBranchStatuses ( TTree &  tree,
const char *  pattern 
) const

Loop over tree branches and set their status if their name matches the pattern :

  • zero if branch address is null and
  • one otherwise This will avoid memory leak, if we set the address to only part of the branches before doing a tree.GetEvent(i)

WARNING : this is a time consuming operation, as we loop over branches at least twice (one here, and the TTree::SetBranchStatus is itself a loop). So use only when necessary.

Definition at line 190 of file AliMUONTreeManager.cxx.

Referenced by AliMUONDigitStoreVImpl::Connect(), AliMUONTriggerTrackStoreV1::Connect(), AliMUONClusterStoreV2::Connect(), AliMUONTrackStoreV1::Connect(), AliMUONDigitStoreV1::Connect(), AliMUONClusterStoreV1::Connect(), and AliMUONTriggerStoreV1::Connect().

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