File indexing completed on 2025-01-18 10:11:50
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef ROOT_TGeoCache
0014 #define ROOT_TGeoCache
0015
0016 #include "TGeoNode.h"
0017
0018 #ifdef R__LESS_INCLUDES
0019 struct TGeoStateInfo;
0020 #else
0021 #include "TGeoStateInfo.h"
0022 #endif
0023
0024
0025 class TGeoManager;
0026 class TGeoHMatrix;
0027
0028 class TGeoCacheState : public TObject {
0029 protected:
0030 Int_t fCapacity;
0031 Int_t fLevel;
0032 Int_t fNmany;
0033 Int_t fStart;
0034 Int_t fIdBranch[30];
0035 Double_t fPoint[3];
0036 Bool_t fOverlapping;
0037
0038 TGeoNode **fNodeBranch;
0039 TGeoHMatrix **fMatrixBranch;
0040 TGeoHMatrix **fMatPtr;
0041
0042 TGeoCacheState(const TGeoCacheState &);
0043 TGeoCacheState &operator=(const TGeoCacheState &);
0044
0045 public:
0046 TGeoCacheState();
0047 TGeoCacheState(Int_t capacity);
0048 ~TGeoCacheState() override;
0049
0050 void SetState(Int_t level, Int_t startlevel, Int_t nmany, Bool_t ovlp, Double_t *point = nullptr);
0051 Bool_t GetState(Int_t &level, Int_t &nmany, Double_t *point) const;
0052
0053 ClassDefOverride(TGeoCacheState, 0)
0054 };
0055
0056 class TGeoNodeCache : public TObject {
0057 private:
0058 Int_t fGeoCacheMaxLevels;
0059 Int_t fGeoCacheStackSize;
0060 Int_t fGeoInfoStackSize;
0061 Int_t fLevel;
0062 Int_t fStackLevel;
0063 Int_t fInfoLevel;
0064 Int_t fCurrentID;
0065 Int_t fIndex;
0066 Int_t fIdBranch[100];
0067 TString fPath;
0068 TGeoNode *fTop;
0069 TGeoNode *fNode;
0070 TGeoHMatrix *fMatrix;
0071 TObjArray *fStack;
0072 TGeoHMatrix **fMatrixBranch;
0073 TGeoHMatrix **fMPB;
0074 TGeoNode **fNodeBranch;
0075 TGeoStateInfo **fInfoBranch;
0076 TGeoStateInfo *fPWInfo;
0077 Int_t *fNodeIdArray;
0078
0079 TGeoNodeCache(const TGeoNodeCache &) = delete;
0080 TGeoNodeCache &operator=(const TGeoNodeCache &) = delete;
0081
0082 public:
0083 TGeoNodeCache();
0084 TGeoNodeCache(TGeoNode *top, Bool_t nodeid = kFALSE, Int_t capacity = 30);
0085 ~TGeoNodeCache() override;
0086
0087 void BuildIdArray();
0088 void BuildInfoBranch();
0089 void CdNode(Int_t nodeid);
0090 Bool_t CdDown(Int_t index);
0091 Bool_t CdDown(TGeoNode *node);
0092 void CdTop()
0093 {
0094 fLevel = 1;
0095 CdUp();
0096 }
0097 void CdUp();
0098 void FillIdBranch(const Int_t *br, Int_t startlevel = 0)
0099 {
0100 memcpy(fIdBranch + startlevel, br, (fLevel + 1 - startlevel) * sizeof(Int_t));
0101 fIndex = fIdBranch[fLevel];
0102 }
0103 const Int_t *GetIdBranch() const { return fIdBranch; }
0104 void *GetBranch() const { return fNodeBranch; }
0105 void GetBranchNames(Int_t *names) const;
0106 void GetBranchNumbers(Int_t *copyNumbers, Int_t *volumeNumbers) const;
0107 void GetBranchOnlys(Int_t *isonly) const;
0108 void *GetMatrices() const { return fMatrixBranch; }
0109 TGeoHMatrix *GetCurrentMatrix() const { return fMatrix; }
0110 Int_t GetCurrentNodeId() const;
0111 TGeoNode *GetMother(Int_t up = 1) const { return ((fLevel - up) >= 0) ? fNodeBranch[fLevel - up] : nullptr; }
0112 TGeoHMatrix *GetMotherMatrix(Int_t up = 1) const
0113 {
0114 return ((fLevel - up) >= 0) ? fMatrixBranch[fLevel - up] : nullptr;
0115 }
0116 TGeoNode *GetNode() const { return fNode; }
0117 TGeoNode *GetTopNode() const { return fTop; }
0118 TGeoStateInfo *GetInfo();
0119 TGeoStateInfo *GetMakePWInfo(Int_t nd);
0120 void ReleaseInfo();
0121 Int_t GetLevel() const { return fLevel; }
0122 const char *GetPath();
0123 Int_t GetStackLevel() const { return fStackLevel; }
0124 Int_t GetNodeId() const;
0125 Bool_t HasIdArray() const { return fNodeIdArray ? kTRUE : kFALSE; }
0126 Bool_t IsDummy() const { return kTRUE; }
0127
0128 void LocalToMaster(const Double_t *local, Double_t *master) const;
0129 void MasterToLocal(const Double_t *master, Double_t *local) const;
0130 void LocalToMasterVect(const Double_t *local, Double_t *master) const;
0131 void MasterToLocalVect(const Double_t *master, Double_t *local) const;
0132 void LocalToMasterBomb(const Double_t *local, Double_t *master) const;
0133 void MasterToLocalBomb(const Double_t *master, Double_t *local) const;
0134 Int_t PushState(Bool_t ovlp, Int_t ntmany = 0, Int_t startlevel = 0, Double_t *point = nullptr);
0135 Bool_t PopState(Int_t &nmany, Double_t *point = nullptr);
0136 Bool_t PopState(Int_t &nmany, Int_t level, Double_t *point = nullptr);
0137 void PopDummy(Int_t ipop = 9999) { fStackLevel = (ipop > fStackLevel) ? (fStackLevel - 1) : (ipop - 1); }
0138 void Refresh()
0139 {
0140 fNode = fNodeBranch[fLevel];
0141 fMatrix = fMatrixBranch[fLevel];
0142 }
0143 Bool_t RestoreState(Int_t &nmany, TGeoCacheState *state, Double_t *point = nullptr);
0144
0145 ClassDefOverride(TGeoNodeCache, 0)
0146 };
0147
0148 #endif