Warning, file /include/root/TGeoNavigator.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TGeoNavigator
0013 #define ROOT_TGeoNavigator
0014
0015 #include "TObject.h"
0016
0017 #include "TGeoCache.h"
0018
0019
0020
0021
0022
0023
0024
0025
0026 class TGeoManager;
0027 class TGeoNode;
0028 class TGeoVolume;
0029 class TGeoMatrix;
0030 class TGeoHMatrix;
0031
0032 class TGeoNavigator : public TObject {
0033
0034 protected:
0035 TGeoNavigator(const TGeoNavigator &) = delete;
0036 TGeoNavigator &operator=(const TGeoNavigator &) = delete;
0037 TGeoNode *FindInCluster(Int_t *cluster, Int_t nc);
0038 Int_t GetTouchedCluster(Int_t start, Double_t *point, Int_t *check_list, Int_t ncheck, Int_t *result);
0039 TGeoNode *CrossDivisionCell();
0040 void SafetyOverlaps();
0041
0042 private:
0043 Double_t fStep;
0044 Double_t fSafety;
0045 Double_t fLastSafety;
0046 Double_t fNormal[3];
0047 Double_t fCldir[3];
0048 Double_t fCldirChecked[3];
0049 Double_t fPoint[3];
0050 Double_t fDirection[3];
0051 Double_t fLastPoint[3];
0052 Int_t fThreadId;
0053 Int_t fLevel;
0054 Int_t fNmany;
0055 Int_t fNextDaughterIndex;
0056 Int_t fOverlapSize;
0057 Int_t fOverlapMark;
0058 Int_t *fOverlapClusters;
0059 Bool_t fSearchOverlaps;
0060 Bool_t fCurrentOverlapping;
0061 Bool_t fStartSafe;
0062 Bool_t fIsEntering;
0063 Bool_t fIsExiting;
0064 Bool_t fIsStepEntering;
0065 Bool_t fIsStepExiting;
0066 Bool_t fIsOutside;
0067 Bool_t fIsOnBoundary;
0068 Bool_t fIsSameLocation;
0069 Bool_t fIsNullStep;
0070 TGeoManager *fGeometry;
0071 TGeoNodeCache *fCache;
0072 TGeoVolume *fCurrentVolume;
0073 TGeoNode *fCurrentNode;
0074 TGeoNode *fTopNode;
0075 TGeoNode *fLastNode;
0076 TGeoNode *fNextNode;
0077 TGeoNode *fForcedNode;
0078 TGeoCacheState *fBackupState;
0079 TGeoHMatrix *fCurrentMatrix;
0080 TGeoHMatrix *fGlobalMatrix;
0081 TGeoHMatrix *fDivMatrix;
0082 TString fPath;
0083
0084 public:
0085 TGeoNavigator();
0086 TGeoNavigator(TGeoManager *geom);
0087 ~TGeoNavigator() override;
0088
0089 void BuildCache(Bool_t dummy = kFALSE, Bool_t nodeid = kFALSE);
0090 Bool_t cd(const char *path = "");
0091 Bool_t CheckPath(const char *path) const;
0092 void CdNode(Int_t nodeid);
0093 void CdDown(Int_t index);
0094 void CdDown(TGeoNode *node);
0095 void CdUp();
0096 void CdTop();
0097 void CdNext();
0098 void GetBranchNames(Int_t *names) const;
0099 void GetBranchNumbers(Int_t *copyNumbers, Int_t *volumeNumbers) const;
0100 void GetBranchOnlys(Int_t *isonly) const;
0101 Int_t GetNmany() const { return fNmany; }
0102
0103 TGeoNode *CrossBoundaryAndLocate(Bool_t downwards, TGeoNode *skipnode);
0104 TGeoNode *FindNextBoundary(Double_t stepmax = TGeoShape::Big(), const char *path = "", Bool_t frombdr = kFALSE);
0105 TGeoNode *FindNextDaughterBoundary(Double_t *point, Double_t *dir, Int_t &idaughter, Bool_t compmatrix = kFALSE);
0106 TGeoNode *FindNextBoundaryAndStep(Double_t stepmax = TGeoShape::Big(), Bool_t compsafe = kFALSE);
0107 TGeoNode *FindNode(Bool_t safe_start = kTRUE);
0108 TGeoNode *FindNode(Double_t x, Double_t y, Double_t z);
0109 Double_t *FindNormal(Bool_t forward = kTRUE);
0110 Double_t *FindNormalFast();
0111 TGeoNode *InitTrack(const Double_t *point, const Double_t *dir);
0112 TGeoNode *InitTrack(Double_t x, Double_t y, Double_t z, Double_t nx, Double_t ny, Double_t nz);
0113 void ResetState();
0114 void ResetAll();
0115 Double_t Safety(Bool_t inside = kFALSE);
0116 TGeoNode *SearchNode(Bool_t downwards = kFALSE, const TGeoNode *skipnode = nullptr);
0117 TGeoNode *Step(Bool_t is_geom = kTRUE, Bool_t cross = kTRUE);
0118 const Double_t *GetLastPoint() const { return fLastPoint; }
0119 Int_t GetVirtualLevel();
0120 Bool_t GotoSafeLevel();
0121 Int_t GetSafeLevel() const;
0122 Double_t GetSafeDistance() const { return fSafety; }
0123 Double_t GetLastSafety() const { return fLastSafety; }
0124 Double_t GetStep() const { return fStep; }
0125 Int_t GetThreadId() const { return fThreadId; }
0126 void InspectState() const;
0127 Bool_t IsSafeStep(Double_t proposed, Double_t &newsafety) const;
0128 Bool_t IsSameLocation(Double_t x, Double_t y, Double_t z, Bool_t change = kFALSE);
0129 Bool_t IsSameLocation() const { return fIsSameLocation; }
0130 Bool_t IsSamePoint(Double_t x, Double_t y, Double_t z) const;
0131 Bool_t IsStartSafe() const { return fStartSafe; }
0132 void SetStartSafe(Bool_t flag = kTRUE) { fStartSafe = flag; }
0133 void SetStep(Double_t step) { fStep = step; }
0134 Bool_t IsCheckingOverlaps() const { return fSearchOverlaps; }
0135 Bool_t IsCurrentOverlapping() const { return fCurrentOverlapping; }
0136 Bool_t IsEntering() const { return fIsEntering; }
0137 Bool_t IsExiting() const { return fIsExiting; }
0138 Bool_t IsStepEntering() const { return fIsStepEntering; }
0139 Bool_t IsStepExiting() const { return fIsStepExiting; }
0140 Bool_t IsOutside() const { return fIsOutside; }
0141 Bool_t IsOnBoundary() const { return fIsOnBoundary; }
0142 Bool_t IsNullStep() const { return fIsNullStep; }
0143 void SetCheckingOverlaps(Bool_t flag = kTRUE) { fSearchOverlaps = flag; }
0144 void SetOutside(Bool_t flag = kTRUE) { fIsOutside = flag; }
0145
0146 void DoBackupState();
0147 void DoRestoreState();
0148 Int_t GetNodeId() const { return fCache->GetNodeId(); }
0149 Int_t GetNextDaughterIndex() const { return fNextDaughterIndex; }
0150 TGeoNode *GetNextNode() const { return fNextNode; }
0151 TGeoNode *GetMother(Int_t up = 1) const { return fCache->GetMother(up); }
0152 TGeoHMatrix *GetMotherMatrix(Int_t up = 1) const { return fCache->GetMotherMatrix(up); }
0153 TGeoHMatrix *GetHMatrix();
0154 TGeoHMatrix *GetCurrentMatrix() const { return fCache->GetCurrentMatrix(); }
0155 TGeoNode *GetCurrentNode() const { return fCurrentNode; }
0156 Int_t GetCurrentNodeId() const { return fCache->GetCurrentNodeId(); }
0157 const Double_t *GetCurrentPoint() const { return fPoint; }
0158 const Double_t *GetCurrentDirection() const { return fDirection; }
0159 TGeoVolume *GetCurrentVolume() const { return fCurrentNode->GetVolume(); }
0160 const Double_t *GetCldirChecked() const { return fCldirChecked; }
0161 const Double_t *GetCldir() const { return fCldir; }
0162 TGeoHMatrix *GetDivMatrix() const { return fDivMatrix; }
0163
0164 const Double_t *GetNormal() const { return fNormal; }
0165 Int_t GetLevel() const { return fLevel; }
0166 const char *GetPath() const;
0167 Int_t GetStackLevel() const { return fCache->GetStackLevel(); }
0168 void SetCurrentPoint(const Double_t *point) { memcpy(fPoint, point, 3 * sizeof(Double_t)); }
0169 void SetCurrentPoint(Double_t x, Double_t y, Double_t z)
0170 {
0171 fPoint[0] = x;
0172 fPoint[1] = y;
0173 fPoint[2] = z;
0174 }
0175 void SetLastPoint(Double_t x, Double_t y, Double_t z)
0176 {
0177 fLastPoint[0] = x;
0178 fLastPoint[1] = y;
0179 fLastPoint[2] = z;
0180 }
0181 void SetCurrentDirection(const Double_t *dir) { memcpy(fDirection, dir, 3 * sizeof(Double_t)); }
0182 void SetCurrentDirection(Double_t nx, Double_t ny, Double_t nz)
0183 {
0184 fDirection[0] = nx;
0185 fDirection[1] = ny;
0186 fDirection[2] = nz;
0187 }
0188
0189 void SetCldirChecked(Double_t *dir) { memcpy(fCldirChecked, dir, 3 * sizeof(Double_t)); }
0190 void SetLastSafetyForPoint(Double_t safe, const Double_t *point)
0191 {
0192 fLastSafety = safe;
0193 memcpy(fLastPoint, point, 3 * sizeof(Double_t));
0194 }
0195 void SetLastSafetyForPoint(Double_t safe, Double_t x, Double_t y, Double_t z)
0196 {
0197 fLastSafety = safe;
0198 fLastPoint[0] = x;
0199 fLastPoint[1] = y, fLastPoint[2] = z;
0200 }
0201
0202
0203 void LocalToMaster(const Double_t *local, Double_t *master) const { fCache->LocalToMaster(local, master); }
0204 void LocalToMasterVect(const Double_t *local, Double_t *master) const { fCache->LocalToMasterVect(local, master); }
0205 void LocalToMasterBomb(const Double_t *local, Double_t *master) const { fCache->LocalToMasterBomb(local, master); }
0206 void MasterToLocal(const Double_t *master, Double_t *local) const { fCache->MasterToLocal(master, local); }
0207 void MasterToLocalVect(const Double_t *master, Double_t *local) const { fCache->MasterToLocalVect(master, local); }
0208 void MasterToLocalBomb(const Double_t *master, Double_t *local) const { fCache->MasterToLocalBomb(master, local); }
0209 void MasterToTop(const Double_t *master, Double_t *top) const;
0210 void TopToMaster(const Double_t *top, Double_t *master) const;
0211 TGeoNodeCache *GetCache() const { return fCache; }
0212
0213
0214 Int_t PushPath(Int_t startlevel = 0) { return fCache->PushState(fCurrentOverlapping, startlevel, fNmany); }
0215 Bool_t PopPath()
0216 {
0217 fCurrentOverlapping = fCache->PopState(fNmany);
0218 fCurrentNode = fCache->GetNode();
0219 fLevel = fCache->GetLevel();
0220 fGlobalMatrix = fCache->GetCurrentMatrix();
0221 return fCurrentOverlapping;
0222 }
0223 Bool_t PopPath(Int_t index)
0224 {
0225 fCurrentOverlapping = fCache->PopState(fNmany, index);
0226 fCurrentNode = fCache->GetNode();
0227 fLevel = fCache->GetLevel();
0228 fGlobalMatrix = fCache->GetCurrentMatrix();
0229 return fCurrentOverlapping;
0230 }
0231 Int_t PushPoint(Int_t startlevel = 0) { return fCache->PushState(fCurrentOverlapping, startlevel, fNmany, fPoint); }
0232 Bool_t PopPoint()
0233 {
0234 fCurrentOverlapping = fCache->PopState(fNmany, fPoint);
0235 fCurrentNode = fCache->GetNode();
0236 fLevel = fCache->GetLevel();
0237 fGlobalMatrix = fCache->GetCurrentMatrix();
0238 return fCurrentOverlapping;
0239 }
0240 Bool_t PopPoint(Int_t index)
0241 {
0242 fCurrentOverlapping = fCache->PopState(fNmany, index, fPoint);
0243 fCurrentNode = fCache->GetNode();
0244 fLevel = fCache->GetLevel();
0245 fGlobalMatrix = fCache->GetCurrentMatrix();
0246 return fCurrentOverlapping;
0247 }
0248 void PopDummy(Int_t ipop = 9999) { fCache->PopDummy(ipop); }
0249
0250 ClassDefOverride(TGeoNavigator, 0)
0251 };
0252
0253 #include "TObjArray.h"
0254
0255
0256
0257
0258
0259
0260
0261
0262 class TGeoNavigatorArray : public TObjArray {
0263 private:
0264 TGeoNavigator *fCurrentNavigator;
0265 TGeoManager *fGeoManager;
0266
0267 TGeoNavigatorArray(const TGeoNavigatorArray &) = delete;
0268 TGeoNavigatorArray &operator=(const TGeoNavigatorArray &) = delete;
0269
0270 public:
0271 TGeoNavigatorArray() : TObjArray(), fCurrentNavigator(nullptr), fGeoManager(nullptr) {}
0272 TGeoNavigatorArray(TGeoManager *mgr) : TObjArray(), fCurrentNavigator(nullptr), fGeoManager(mgr) { SetOwner(); }
0273 ~TGeoNavigatorArray() override {}
0274
0275 TGeoNavigator *AddNavigator();
0276 inline TGeoNavigator *GetCurrentNavigator() const { return fCurrentNavigator; }
0277 TGeoNavigator *SetCurrentNavigator(Int_t inav) { return (fCurrentNavigator = (TGeoNavigator *)At(inav)); }
0278
0279 ClassDefOverride(TGeoNavigatorArray, 0)
0280 };
0281 #endif