60 userIndex = internalIndex + 1;
61 fCache[internalIndex]->SetUniqueID(userIndex);
62 return fCache[internalIndex].get();
70 if (userIndex >
fCache.size()) {
71 ::Fatal(
"TGeoMCBranchArrayContainer::GetGeoState",
72 "ID %u is not an index referring to TGeoBranchArray "
73 "managed by this TGeoMCBranchArrayContainer",
76 if (
fCache[userIndex - 1]->GetUniqueID() == 0) {
77 ::Fatal(
"TGeoMCBranchArrayContainer::GetGeoState",
"Passed index %u refers to an empty/unused geo state",
80 return fCache[userIndex - 1].get();
85 if (userIndex >
fCache.size() || userIndex == 0) {
89 if (
fCache[userIndex - 1]->GetUniqueID() > 0) {
91 fCache[userIndex - 1]->SetUniqueID(0);
113 if (targetSize <=
fCache.size()) {
114 targetSize = 2 *
fCache.size();
117 fCache.reserve(targetSize);
120 fCache.back()->SetUniqueID(0);
void Fatal(const char *location, const char *msgfmt,...)
An array of daughter indices making a geometry path.
static TGeoBranchArray * MakeInstance(size_t maxlevel)
Make an instance of the class which allocates the node array.
void ExtendCache(UInt_t targetSize=1)
Resize the cache.
UInt_t fMaxLevels
Maximum level of node array inside a chached state.
void Initialize(UInt_t maxlevels=100, UInt_t size=8)
Initialize manually specifying initial number of internal TGeoBranchArray objects.
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.
std::vector< UInt_t > fFreeIndices
Provide indices in fCachedStates which are already popped and can be re-populated again.
void InitializeFromGeoManager(TGeoManager *man, UInt_t size=8)
Initialize from TGeoManager to extract maxlevels.
Bool_t fIsInitialized
Flag if initialized.
void ResetCache()
Clear the internal cache.
void FreeGeoStates()
Free all geo states at once but keep the container size.
void FreeGeoState(UInt_t userIndex)
Free the index of this geo state such that it can be re-used.
std::vector< std::unique_ptr< TGeoBranchArray > > fCache
Cache states via TGeoBranchArray.
The manager class for any TGeo geometry.
static Int_t GetMaxLevels()
Return maximum number of levels used in the geometry.
virtual UInt_t GetUniqueID() const
Return the unique object id.