Warning, file /include/root/TGeometry.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_TGeometry
0013 #define ROOT_TGeometry
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #include "TNamed.h"
0025 #include "THashList.h"
0026
0027 const Int_t kMAXLEVELS = 20;
0028 const Int_t kVectorSize = 3;
0029 const Int_t kMatrixSize = kVectorSize*kVectorSize;
0030
0031 class TNode;
0032 class TBrowser;
0033 class TMaterial;
0034 class TRotMatrix;
0035 class TShape;
0036 class TObjArray;
0037
0038
0039 class TGeometry : public TNamed {
0040
0041 private:
0042 THashList *fMaterials;
0043 THashList *fMatrices;
0044 THashList *fShapes;
0045 TList *fNodes;
0046 TRotMatrix *fMatrix;
0047 TNode *fCurrentNode;
0048 TMaterial **fMaterialPointer;
0049 TRotMatrix **fMatrixPointer;
0050 TShape **fShapePointer;
0051 Float_t fBomb;
0052 Int_t fGeomLevel;
0053 Double_t fX;
0054 Double_t fY;
0055 Double_t fZ;
0056 Double_t fTranslation[kMAXLEVELS][kVectorSize];
0057 Double_t fRotMatrix[kMAXLEVELS][kMatrixSize];
0058 Bool_t fIsReflection[kMAXLEVELS];
0059
0060 protected:
0061 TGeometry(const TGeometry&);
0062 TGeometry& operator=(const TGeometry&);
0063
0064 public:
0065 TGeometry();
0066 TGeometry(const char *name, const char *title);
0067 ~TGeometry() override;
0068 void Browse(TBrowser *b) override;
0069 virtual void cd(const char *path=nullptr);
0070 void Draw(Option_t *option="") override;
0071 TObject *FindObject(const char *name) const override;
0072 TObject *FindObject(const TObject *obj) const override;
0073 Float_t GetBomb() const {return fBomb;}
0074 Int_t GeomLevel() const {return fGeomLevel;}
0075 THashList *GetListOfShapes() const {return fShapes;}
0076 TList *GetListOfNodes() const {return fNodes;}
0077 THashList *GetListOfMaterials() const {return fMaterials;}
0078 THashList *GetListOfMatrices() const {return fMatrices;}
0079 TNode *GetCurrentNode() const {return fCurrentNode;}
0080 TMaterial *GetMaterial(const char *name) const;
0081 TMaterial *GetMaterialByNumber(Int_t number) const;
0082 TNode *GetNode(const char *name) const;
0083 TShape *GetShape(const char *name) const;
0084 TShape *GetShapeByNumber(Int_t number) const;
0085 TRotMatrix *GetRotMatrix(const char *name) const;
0086 TRotMatrix *GetRotMatrixByNumber(Int_t number) const;
0087 TRotMatrix *GetCurrentMatrix() const;
0088 TRotMatrix *GetCurrentPosition(Double_t *x,Double_t *y,Double_t *z) const;
0089 TRotMatrix *GetCurrentPosition(Float_t *x,Float_t *y,Float_t *z) const;
0090 Bool_t GetCurrentReflection() const;
0091 Bool_t IsFolder() const override {return kTRUE;}
0092 virtual void Local2Master(Double_t *local, Double_t *master);
0093 virtual void Local2Master(Float_t *local, Float_t *master);
0094 void ls(Option_t *option="rsn2") const override;
0095 virtual void Master2Local(Double_t *master, Double_t *local);
0096 virtual void Master2Local(Float_t *master, Float_t *local);
0097 virtual void Node(const char *name, const char *title, const char *shapename, Double_t x=0, Double_t y=0, Double_t z=0
0098 , const char *matrixname="", Option_t *option="");
0099 virtual Int_t PushLevel(){return fGeomLevel++;}
0100 virtual Int_t PopLevel(){return fGeomLevel>0?fGeomLevel--:0;}
0101 void RecursiveRemove(TObject *obj) override;
0102 virtual void SetBomb(Float_t bomb=1.4) {fBomb = bomb;}
0103 virtual void SetCurrentNode(TNode *node) {fCurrentNode = node;}
0104 virtual void SetGeomLevel(Int_t level=0){fGeomLevel=level;}
0105 virtual void SetMatrix(TRotMatrix *matrix=nullptr){fMatrix = matrix;}
0106 virtual void SetPosition(TRotMatrix *matrix, Double_t x=0,Double_t y=0,Double_t z=0);
0107 virtual void SetPosition(TRotMatrix *matrix, Float_t x,Float_t y,Float_t z);
0108 virtual void SetPosition(Double_t x,Double_t y,Double_t z);
0109 virtual void SetPosition(Float_t x,Float_t y,Float_t z);
0110 virtual void UpdateMatrix(TNode *node);
0111 virtual void UpdateTempMatrix(Double_t x=0, Double_t y=0, Double_t z=0, TRotMatrix *matrix=nullptr);
0112 virtual void UpdateTempMatrix(Double_t x, Double_t y, Double_t z, Double_t *matrix,Bool_t isReflection=kFALSE);
0113
0114 static TObjArray *Get(const char *name);
0115 static void UpdateTempMatrix(Double_t *dx1,Double_t *rmat1,
0116 Double_t x, Double_t y, Double_t z, Double_t *matrix,
0117 Double_t *dxnew, Double_t *rmatnew);
0118
0119 ClassDefOverride(TGeometry,2)
0120 };
0121
0122
0123 inline TRotMatrix *TGeometry::GetCurrentMatrix() const
0124 {
0125 return fMatrix;
0126 }
0127 inline TRotMatrix *TGeometry::GetCurrentPosition(Double_t *x,Double_t *y,Double_t *z) const
0128 {
0129 *x = fX; *y = fY; *z = fZ; return GetCurrentMatrix();
0130 }
0131 inline TRotMatrix *TGeometry::GetCurrentPosition(Float_t *x,Float_t *y,Float_t *z) const
0132 {
0133 *x = Float_t(fX); *y = Float_t(fY); *z = Float_t(fZ); return GetCurrentMatrix();
0134 }
0135 inline Bool_t TGeometry::GetCurrentReflection() const
0136 {
0137 return fIsReflection[fGeomLevel];
0138 }
0139 inline void TGeometry::SetPosition(Double_t x,Double_t y,Double_t z)
0140 {
0141 fX = x; fY = y; fZ = z;
0142 }
0143 inline void TGeometry::SetPosition(Float_t x,Float_t y,Float_t z)
0144 {
0145 fX = x; fY = y; fZ = z;
0146 }
0147 inline void TGeometry::SetPosition(TRotMatrix *matrix, Double_t x,Double_t y,Double_t z)
0148 {
0149 SetMatrix(matrix);
0150 SetPosition(x,y,z);
0151 }
0152 inline void TGeometry::SetPosition(TRotMatrix *matrix, Float_t x,Float_t y,Float_t z)
0153 {
0154 SetMatrix(matrix);
0155 SetPosition(x,y,z);
0156 }
0157
0158 R__EXTERN TGeometry *gGeometry;
0159
0160 #endif