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. | |
~TGeoMCBranchArrayContainer ()=default | |
Destructor. | |
void | FreeGeoState (const TGeoBranchArray *geoState) |
Free the index of this geo state such that it can be re-used. | |
void | FreeGeoState (UInt_t userIndex) |
Free the index of this geo state such that it can be re-used. | |
void | FreeGeoStates () |
Free all geo states at once but keep the container size. | |
const TGeoBranchArray * | GetGeoState (UInt_t userIndex) |
Get a TGeoBranchArray to read the current state from. | |
TGeoBranchArray * | GetNewGeoState (UInt_t &userIndex) |
Get a TGeoBranchArray to set to current geo state. | |
void | Initialize (UInt_t maxlevels=100, UInt_t size=8) |
Initialize manually specifying initial number of internal TGeoBranchArray objects. | |
void | InitializeFromGeoManager (TGeoManager *man, UInt_t size=8) |
Initialize from TGeoManager to extract maxlevels. | |
void | ResetCache () |
Clear the internal cache. | |
Private Member Functions | |
TGeoMCBranchArrayContainer (const TGeoMCBranchArrayContainer &) | |
Copying kept private. | |
void | ExtendCache (UInt_t targetSize=1) |
Resize the cache. | |
TGeoMCBranchArrayContainer & | operator= (const TGeoMCBranchArrayContainer &) |
Assignement kept private. | |
Private Attributes | |
std::vector< std::unique_ptr< TGeoBranchArray > > | fCache |
Cache states via TGeoBranchArray. | |
std::vector< UInt_t > | fFreeIndices |
Provide indices in fCachedStates which are already popped and can be re-populated again. | |
Bool_t | fIsInitialized = kFALSE |
Flag if initialized. | |
UInt_t | fMaxLevels = 100 |
Maximum level of node array inside a chached state. | |
#include <TGeoMCBranchArrayContainer.h>
|
default |
Default constructor.
|
default |
Destructor.
|
private |
Copying kept private.
Resize the cache.
Definition at line 111 of file TGeoMCBranchArrayContainer.cxx.
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.
Free the index of this geo state such that it can be re-used.
Definition at line 83 of file TGeoMCBranchArrayContainer.cxx.
void TGeoMCBranchArrayContainer::FreeGeoStates | ( | ) |
Free all geo states at once but keep the container size.
Definition at line 102 of file TGeoMCBranchArrayContainer.cxx.
const TGeoBranchArray * TGeoMCBranchArrayContainer::GetGeoState | ( | UInt_t | userIndex | ) |
Get a TGeoBranchArray to read the current state from.
Definition at line 65 of file TGeoMCBranchArrayContainer.cxx.
TGeoBranchArray * TGeoMCBranchArrayContainer::GetNewGeoState | ( | UInt_t & | userIndex | ) |
Get a TGeoBranchArray to set to current geo state.
Definition at line 51 of file TGeoMCBranchArrayContainer.cxx.
Initialize manually specifying initial number of internal TGeoBranchArray objects.
Definition at line 29 of file TGeoMCBranchArrayContainer.cxx.
void TGeoMCBranchArrayContainer::InitializeFromGeoManager | ( | TGeoManager * | man, |
UInt_t | size = 8 |
||
) |
Initialize from TGeoManager to extract maxlevels.
Definition at line 39 of file TGeoMCBranchArrayContainer.cxx.
|
private |
Assignement kept private.
void TGeoMCBranchArrayContainer::ResetCache | ( | ) |
Clear the internal cache.
Definition at line 44 of file TGeoMCBranchArrayContainer.cxx.
|
private |
Cache states via TGeoBranchArray.
Definition at line 64 of file TGeoMCBranchArrayContainer.h.
|
private |
Provide indices in fCachedStates which are already popped and can be re-populated again.
Definition at line 69 of file TGeoMCBranchArrayContainer.h.
Flag if initialized.
Definition at line 71 of file TGeoMCBranchArrayContainer.h.
|
private |
Maximum level of node array inside a chached state.
Definition at line 66 of file TGeoMCBranchArrayContainer.h.