Logo ROOT  
Reference Guide
TGeoMCBranchArrayContainer.h
Go to the documentation of this file.
1// @(#)root/vmc:$Id$
2// Authors: Benedikt Volkel 07/03/2019
3
4/*************************************************************************
5 * Copyright (C) 2019, Rene Brun and Fons Rademakers. *
6 * Copyright (C) 2019, ALICE Experiment at CERN. *
7 * All rights reserved. *
8 * *
9 * For the licensing terms see $ROOTSYS/LICENSE. *
10 * For the list of contributors see $ROOTSYS/README/CREDITS. *
11 *************************************************************************/
12
13// Class TGeoMCBranchArrayContainer
14// ---------------------
15// cache for storing TGeoBranchArray objects
16//
17
18#ifndef ROOT_TGeoMCBranchArrayContainer
19#define ROOT_TGeoMCBranchArrayContainer
20
21#include <vector>
22#include <memory>
23
24#include "TGeoBranchArray.h"
25
26class TGeoManager;
27
29public:
30 /// Default constructor
32 /// Destructor
34
35 /// Initialize manually specifying initial number of internal
36 /// TGeoBranchArray objects
37 void Initialize(UInt_t maxlevels = 100, UInt_t size = 8);
38 /// Initialize from TGeoManager to extract maxlevels
39 void InitializeFromGeoManager(TGeoManager *man, UInt_t size = 8);
40 /// Clear the internal cache
41 void ResetCache();
42
43 /// Get a TGeoBranchArray to set to current geo state.
45 /// Get a TGeoBranchArray to read the current state from.
46 const TGeoBranchArray *GetGeoState(UInt_t userIndex);
47 /// Free the index of this geo state such that it can be re-used
48 void FreeGeoState(UInt_t userIndex);
49 /// Free the index of this geo state such that it can be re-used
50 void FreeGeoState(const TGeoBranchArray *geoState);
51 /// Free all geo states at once but keep the container size
52 void FreeGeoStates();
53
54private:
55 /// Copying kept private
57 /// Assignement kept private
59 /// Resize the cache
60 void ExtendCache(UInt_t targetSize = 1);
61
62private:
63 /// Cache states via TGeoBranchArray
64 std::vector<std::unique_ptr<TGeoBranchArray>> fCache;
65 /// Maximum level of node array inside a chached state.
67 /// Provide indices in fCachedStates which are already popped and can be
68 /// re-populated again.
69 std::vector<UInt_t> fFreeIndices;
70 /// Flag if initialized
72
74};
75
76#endif /* ROOT_TGeoMCBranchArrayContainer */
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
#define ClassDefNV(name, id)
Definition: Rtypes.h:334
An array of daughter indices making a geometry path.
Storing and re-using geometry states of the TGeoManager in use by storing them as TGeoBranchArrays.
void ExtendCache(UInt_t targetSize=1)
Resize the cache.
~TGeoMCBranchArrayContainer()=default
Destructor.
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.
TGeoMCBranchArrayContainer(const TGeoMCBranchArrayContainer &)
Copying kept private.
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.
TGeoMCBranchArrayContainer()=default
Default constructor.
TGeoMCBranchArrayContainer & operator=(const TGeoMCBranchArrayContainer &)
Assignement kept private.
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.
Definition: TGeoManager.h:43