VMC Version 2.0
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TGeoMCBranchArrayContainer Class Reference

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

#include <TGeoMCBranchArrayContainer.h>

Public Member Functions

 TGeoMCBranchArrayContainer ()=default
 Default constructor.
 
 ~TGeoMCBranchArrayContainer ()=default
 Destructor.
 
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.
 
TGeoBranchArray * GetNewGeoState (UInt_t &userIndex)
 Get a TGeoBranchArray to set to current geo state.
 
const TGeoBranchArray * GetGeoState (UInt_t userIndex)
 Get a TGeoBranchArray to read the current state from.
 
void FreeGeoState (UInt_t userIndex)
 Free the index of this geo state such that it can be re-used.
 
void FreeGeoState (const TGeoBranchArray *geoState)
 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.
 

Private Member Functions

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

Private Attributes

std::vector< std::unique_ptr< TGeoBranchArray > > fCache
 Cache states via TGeoBranchArray.
 
UInt_t fMaxLevels = 100
 Maximum level of node array inside a chached state.
 
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.
 

Detailed Description

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 35 of file 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

◆ Initialize()

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

Initialize manually specifying initial number of internal TGeoBranchArray objects.

Definition at line 36 of file TGeoMCBranchArrayContainer.cxx.

Referenced by InitializeFromGeoManager().

◆ InitializeFromGeoManager()

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

Initialize from TGeoManager to extract maxlevels.

Definition at line 46 of file TGeoMCBranchArrayContainer.cxx.

Referenced by TMCManager::Init().

◆ ResetCache()

void TGeoMCBranchArrayContainer::ResetCache ( )

Clear the internal cache.

Definition at line 51 of file TGeoMCBranchArrayContainer.cxx.

Referenced by Initialize().

◆ GetNewGeoState()

TGeoBranchArray * TGeoMCBranchArrayContainer::GetNewGeoState ( UInt_t &  userIndex)

Get a TGeoBranchArray to set to current geo state.

Definition at line 58 of file TGeoMCBranchArrayContainer.cxx.

Referenced by TMCManager::TransferTrack().

◆ GetGeoState()

const TGeoBranchArray * TGeoMCBranchArrayContainer::GetGeoState ( UInt_t  userIndex)

Get a TGeoBranchArray to read the current state from.

Definition at line 72 of file TGeoMCBranchArrayContainer.cxx.

Referenced by TMCManagerStack::GetCurrentGeoState(), TMCManagerStack::GetGeoState(), and TMCManager::RestoreGeometryState().

◆ FreeGeoState() [1/2]

void TGeoMCBranchArrayContainer::FreeGeoState ( UInt_t  userIndex)

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

Definition at line 90 of file TGeoMCBranchArrayContainer.cxx.

Referenced by FreeGeoState(), FreeGeoStates(), and TMCManager::RestoreGeometryState().

◆ FreeGeoState() [2/2]

void TGeoMCBranchArrayContainer::FreeGeoState ( const TGeoBranchArray *  geoState)

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

Definition at line 102 of file TGeoMCBranchArrayContainer.cxx.

◆ FreeGeoStates()

void TGeoMCBranchArrayContainer::FreeGeoStates ( )

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

Definition at line 109 of file TGeoMCBranchArrayContainer.cxx.

Referenced by TMCManager::PrepareNewEvent().

◆ operator=()

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

Assignement kept private.

◆ ExtendCache()

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

Resize the cache.

Definition at line 118 of file TGeoMCBranchArrayContainer.cxx.

Referenced by GetNewGeoState(), and Initialize().

Member Data Documentation

◆ fCache

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

Cache states via TGeoBranchArray.

Definition at line 71 of file TGeoMCBranchArrayContainer.h.

Referenced by ExtendCache(), FreeGeoState(), FreeGeoStates(), GetGeoState(), GetNewGeoState(), and ResetCache().

◆ fMaxLevels

UInt_t TGeoMCBranchArrayContainer::fMaxLevels = 100
private

Maximum level of node array inside a chached state.

Definition at line 73 of file TGeoMCBranchArrayContainer.h.

Referenced by ExtendCache(), and Initialize().

◆ 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 76 of file TGeoMCBranchArrayContainer.h.

Referenced by ExtendCache(), FreeGeoState(), GetNewGeoState(), and ResetCache().

◆ fIsInitialized

Bool_t TGeoMCBranchArrayContainer::fIsInitialized = kFALSE
private

Flag if initialized.

Definition at line 78 of file TGeoMCBranchArrayContainer.h.

Referenced by Initialize(), and ResetCache().


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