Logo ROOT  
Reference Guide
TGeoMCBranchArrayContainer Class Reference

Storing and re-using geometry states of the TGeoManager in use by storing them as TGeoBranchArrays.

After having initialized a navigator using a stored state, it can be freed to be used again for storing another geometry state. This makes it easy to handle many events with many stored geometry states and the memory used is kept as small as possible.

Definition at line 28 of file TGeoMCBranchArrayContainer.h.

Public Member Functions

 TGeoMCBranchArrayContainer ()=default
 Default constructor. More...
 
 ~TGeoMCBranchArrayContainer ()=default
 Destructor. More...
 
void FreeGeoState (const TGeoBranchArray *geoState)
 Free the index of this geo state such that it can be re-used. More...
 
void FreeGeoState (UInt_t userIndex)
 Free the index of this geo state such that it can be re-used. More...
 
void FreeGeoStates ()
 Free all geo states at once but keep the container size. More...
 
const TGeoBranchArrayGetGeoState (UInt_t userIndex)
 Get a TGeoBranchArray to read the current state from. More...
 
TGeoBranchArrayGetNewGeoState (UInt_t &userIndex)
 Get a TGeoBranchArray to set to current geo state. More...
 
void Initialize (UInt_t maxlevels=100, UInt_t size=8)
 Initialize manually specifying initial number of internal TGeoBranchArray objects. More...
 
void InitializeFromGeoManager (TGeoManager *man, UInt_t size=8)
 Initialize from TGeoManager to extract maxlevels. More...
 
void ResetCache ()
 Clear the internal cache. More...
 

Private Member Functions

 TGeoMCBranchArrayContainer (const TGeoMCBranchArrayContainer &)
 Copying kept private. More...
 
void ExtendCache (UInt_t targetSize=1)
 Resize the cache. More...
 
TGeoMCBranchArrayContaineroperator= (const TGeoMCBranchArrayContainer &)
 Assignement kept private. More...
 

Private Attributes

std::vector< std::unique_ptr< TGeoBranchArray > > fCache
 Cache states via TGeoBranchArray. More...
 
std::vector< UInt_tfFreeIndices
 Provide indices in fCachedStates which are already popped and can be re-populated again. More...
 
Bool_t fIsInitialized = kFALSE
 Flag if initialized. More...
 
UInt_t fMaxLevels = 100
 Maximum level of node array inside a chached state. More...
 

#include <TGeoMCBranchArrayContainer.h>

Constructor & Destructor Documentation

◆ TGeoMCBranchArrayContainer() [1/2]

TGeoMCBranchArrayContainer::TGeoMCBranchArrayContainer ( )
default

Default constructor.

◆ ~TGeoMCBranchArrayContainer()

TGeoMCBranchArrayContainer::~TGeoMCBranchArrayContainer ( )
default

Destructor.

◆ TGeoMCBranchArrayContainer() [2/2]

TGeoMCBranchArrayContainer::TGeoMCBranchArrayContainer ( const TGeoMCBranchArrayContainer )
private

Copying kept private.

Member Function Documentation

◆ ExtendCache()

void TGeoMCBranchArrayContainer::ExtendCache ( UInt_t  targetSize = 1)
private

Resize the cache.

Definition at line 111 of file TGeoMCBranchArrayContainer.cxx.

◆ FreeGeoState() [1/2]

void TGeoMCBranchArrayContainer::FreeGeoState ( const TGeoBranchArray geoState)

Free the index of this geo state such that it can be re-used.

Definition at line 95 of file TGeoMCBranchArrayContainer.cxx.

◆ FreeGeoState() [2/2]

void TGeoMCBranchArrayContainer::FreeGeoState ( UInt_t  userIndex)

Free the index of this geo state such that it can be re-used.

Definition at line 83 of file TGeoMCBranchArrayContainer.cxx.

◆ FreeGeoStates()

void TGeoMCBranchArrayContainer::FreeGeoStates ( )

Free all geo states at once but keep the container size.

Definition at line 102 of file TGeoMCBranchArrayContainer.cxx.

◆ GetGeoState()

const TGeoBranchArray * TGeoMCBranchArrayContainer::GetGeoState ( UInt_t  userIndex)

Get a TGeoBranchArray to read the current state from.

Definition at line 65 of file TGeoMCBranchArrayContainer.cxx.

◆ GetNewGeoState()

TGeoBranchArray * TGeoMCBranchArrayContainer::GetNewGeoState ( UInt_t userIndex)

Get a TGeoBranchArray to set to current geo state.

Definition at line 51 of file TGeoMCBranchArrayContainer.cxx.

◆ Initialize()

void TGeoMCBranchArrayContainer::Initialize ( UInt_t  maxlevels = 100,
UInt_t  size = 8 
)

Initialize manually specifying initial number of internal TGeoBranchArray objects.

Definition at line 29 of file TGeoMCBranchArrayContainer.cxx.

◆ InitializeFromGeoManager()

void TGeoMCBranchArrayContainer::InitializeFromGeoManager ( TGeoManager man,
UInt_t  size = 8 
)

Initialize from TGeoManager to extract maxlevels.

Definition at line 39 of file TGeoMCBranchArrayContainer.cxx.

◆ operator=()

TGeoMCBranchArrayContainer & TGeoMCBranchArrayContainer::operator= ( const TGeoMCBranchArrayContainer )
private

Assignement kept private.

◆ ResetCache()

void TGeoMCBranchArrayContainer::ResetCache ( )

Clear the internal cache.

Definition at line 44 of file TGeoMCBranchArrayContainer.cxx.

Member Data Documentation

◆ fCache

std::vector<std::unique_ptr<TGeoBranchArray> > TGeoMCBranchArrayContainer::fCache
private

Cache states via TGeoBranchArray.

Definition at line 64 of file TGeoMCBranchArrayContainer.h.

◆ fFreeIndices

std::vector<UInt_t> TGeoMCBranchArrayContainer::fFreeIndices
private

Provide indices in fCachedStates which are already popped and can be re-populated again.

Definition at line 69 of file TGeoMCBranchArrayContainer.h.

◆ fIsInitialized

Bool_t TGeoMCBranchArrayContainer::fIsInitialized = kFALSE
private

Flag if initialized.

Definition at line 71 of file TGeoMCBranchArrayContainer.h.

◆ fMaxLevels

UInt_t TGeoMCBranchArrayContainer::fMaxLevels = 100
private

Maximum level of node array inside a chached state.

Definition at line 66 of file TGeoMCBranchArrayContainer.h.

Libraries for TGeoMCBranchArrayContainer:
[legend]

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