Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGeometry.h
Go to the documentation of this file.
1// @(#)root/g3d:$Id$
2// Author: Rene Brun 22/09/95
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TGeometry
13#define ROOT_TGeometry
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TGeometry //
19// //
20// Structure for Matrices, Shapes and Nodes. //
21// //
22//////////////////////////////////////////////////////////////////////////
23
24#include "TNamed.h"
25#include "THashList.h"
26
27const Int_t kMAXLEVELS = 20;
30
31class TNode;
32class TBrowser;
33class TMaterial;
34class TRotMatrix;
35class TShape;
36class TObjArray;
37
38
39class TGeometry : public TNamed {
40
41private:
42 THashList *fMaterials; //->Collection of materials
43 THashList *fMatrices; //->Collection of rotation matrices
44 THashList *fShapes; //->Collection of shapes
45 TList *fNodes; //->Collection of nodes
46 TRotMatrix *fMatrix; //!Pointers to current rotation matrices
47 TNode *fCurrentNode; //!Pointer to current node
48 TMaterial **fMaterialPointer; //!Pointers to materials
49 TRotMatrix **fMatrixPointer; //!Pointers to rotation matrices
50 TShape **fShapePointer; //!Pointers to shapes
51 Float_t fBomb; //Bomb factor for exploded geometry
54 Double_t fY; //! The global translation of the current node
59
60protected:
61 TGeometry(const TGeometry&);
63
64public:
65 TGeometry();
66 TGeometry(const char *name, const char *title);
67 virtual ~TGeometry();
68 virtual void Browse(TBrowser *b);
69 virtual void cd(const char *path=0);
70 virtual void Draw(Option_t *option="");
71 virtual TObject *FindObject(const char *name) const;
72 virtual TObject *FindObject(const TObject *obj) const;
73 Float_t GetBomb() const {return fBomb;}
74 Int_t GeomLevel() const {return fGeomLevel;}
76 TList *GetListOfNodes() const {return fNodes;}
80 TMaterial *GetMaterial(const char *name) const;
81 TMaterial *GetMaterialByNumber(Int_t number) const;
82 TNode *GetNode(const char *name) const;
83 TShape *GetShape(const char *name) const;
84 TShape *GetShapeByNumber(Int_t number) const;
85 TRotMatrix *GetRotMatrix(const char *name) const;
91 Bool_t IsFolder() const {return kTRUE;}
92 virtual void Local2Master(Double_t *local, Double_t *master);
93 virtual void Local2Master(Float_t *local, Float_t *master);
94 virtual void ls(Option_t *option="rsn2") const;
95 virtual void Master2Local(Double_t *master, Double_t *local);
96 virtual void Master2Local(Float_t *master, Float_t *local);
97 virtual void Node(const char *name, const char *title, const char *shapename, Double_t x=0, Double_t y=0, Double_t z=0
98 , const char *matrixname="", Option_t *option="");
99 virtual Int_t PushLevel(){return fGeomLevel++;}
100 virtual Int_t PopLevel(){return fGeomLevel>0?fGeomLevel--:0;}
101 virtual void RecursiveRemove(TObject *obj);
102 virtual void SetBomb(Float_t bomb=1.4) {fBomb = bomb;}
103 virtual void SetCurrentNode(TNode *node) {fCurrentNode = node;}
104 virtual void SetGeomLevel(Int_t level=0){fGeomLevel=level;}
105 virtual void SetMatrix(TRotMatrix *matrix=0){fMatrix = matrix;}
106 virtual void SetPosition(TRotMatrix *matrix, Double_t x=0,Double_t y=0,Double_t z=0);
107 virtual void SetPosition(TRotMatrix *matrix, Float_t x,Float_t y,Float_t z);
108 virtual void SetPosition(Double_t x,Double_t y,Double_t z);
109 virtual void SetPosition(Float_t x,Float_t y,Float_t z);
110 virtual void UpdateMatrix(TNode *node);
111 virtual void UpdateTempMatrix(Double_t x=0, Double_t y=0, Double_t z=0, TRotMatrix *matrix=0);
112 virtual void UpdateTempMatrix(Double_t x, Double_t y, Double_t z, Double_t *matrix,Bool_t isReflection=kFALSE);
113
114 static TObjArray *Get(const char *name);
115 static void UpdateTempMatrix(Double_t *dx1,Double_t *rmat1,
116 Double_t x, Double_t y, Double_t z, Double_t *matrix,
117 Double_t *dxnew, Double_t *rmatnew);
118
119 ClassDef(TGeometry,2) //Structure for Matrices, Shapes and Nodes
120};
121
122
124{
125 return fMatrix;
126}
128{
129 *x = fX; *y = fY; *z = fZ; return GetCurrentMatrix();
130}
132{
133 *x = Float_t(fX); *y = Float_t(fY); *z = Float_t(fZ); return GetCurrentMatrix();
134}
136{
138}
140{
141 fX = x; fY = y; fZ = z;
142}
144{
145 fX = x; fY = y; fZ = z;
146}
148{
149 SetMatrix(matrix);
150 SetPosition(x,y,z);
151}
153{
154 SetMatrix(matrix);
155 SetPosition(x,y,z);
156}
157
159
160#endif
#define R__EXTERN
Definition DllImport.h:27
#define b(i)
Definition RSha256.hxx:100
int Int_t
Definition RtypesCore.h:45
const Bool_t kFALSE
Definition RtypesCore.h:92
bool Bool_t
Definition RtypesCore.h:63
double Double_t
Definition RtypesCore.h:59
float Float_t
Definition RtypesCore.h:57
const Bool_t kTRUE
Definition RtypesCore.h:91
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
char name[80]
Definition TGX11.cxx:110
const Int_t kVectorSize
Definition TGeometry.h:28
const Int_t kMAXLEVELS
Definition TGeometry.h:27
const Int_t kMatrixSize
Definition TGeometry.h:29
R__EXTERN TGeometry * gGeometry
Definition TGeometry.h:158
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
TGeometry description.
Definition TGeometry.h:39
TShape * GetShapeByNumber(Int_t number) const
Return pointer to Shape with number.
Double_t fZ
The global translation of the current node.
Definition TGeometry.h:55
Double_t fRotMatrix[kMAXLEVELS][kMatrixSize]
Definition TGeometry.h:57
Float_t GetBomb() const
Definition TGeometry.h:73
TMaterial * GetMaterialByNumber(Int_t number) const
Return pointer to Material with number.
TGeometry & operator=(const TGeometry &)
assignment operator
virtual void Local2Master(Double_t *local, Double_t *master)
Convert one point from local system to master reference system.
Int_t GeomLevel() const
Definition TGeometry.h:74
virtual void UpdateTempMatrix(Double_t x=0, Double_t y=0, Double_t z=0, TRotMatrix *matrix=0)
Update temp matrix.
TRotMatrix * fMatrix
Definition TGeometry.h:46
TMaterial ** fMaterialPointer
Pointer to current node.
Definition TGeometry.h:48
TMaterial * GetMaterial(const char *name) const
Return pointer to Material with name.
virtual TObject * FindObject(const char *name) const
Search object identified by name in the geometry tree.
virtual void Master2Local(Double_t *master, Double_t *local)
Convert one point from master system to local reference system.
TNode * GetCurrentNode() const
Definition TGeometry.h:79
TGeometry()
Geometry default constructor.
Definition TGeometry.cxx:96
virtual void SetCurrentNode(TNode *node)
Definition TGeometry.h:103
virtual Int_t PopLevel()
Definition TGeometry.h:100
TRotMatrix * GetCurrentPosition(Double_t *x, Double_t *y, Double_t *z) const
Definition TGeometry.h:127
THashList * fMaterials
Definition TGeometry.h:42
TRotMatrix ** fMatrixPointer
Pointers to materials.
Definition TGeometry.h:49
virtual void SetPosition(TRotMatrix *matrix, Double_t x=0, Double_t y=0, Double_t z=0)
Definition TGeometry.h:147
TShape ** fShapePointer
Pointers to rotation matrices.
Definition TGeometry.h:50
virtual void SetBomb(Float_t bomb=1.4)
Definition TGeometry.h:102
virtual void SetMatrix(TRotMatrix *matrix=0)
Definition TGeometry.h:105
THashList * GetListOfShapes() const
Definition TGeometry.h:75
TRotMatrix * GetRotMatrixByNumber(Int_t number) const
Return pointer to RotMatrix with number.
TList * fNodes
Definition TGeometry.h:45
Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Definition TGeometry.h:91
virtual ~TGeometry()
Geometry default destructor.
TNode * fCurrentNode
Pointers to current rotation matrices.
Definition TGeometry.h:47
Int_t fGeomLevel
Definition TGeometry.h:52
Bool_t fIsReflection[kMAXLEVELS]
Definition TGeometry.h:58
THashList * fMatrices
Definition TGeometry.h:43
virtual void SetGeomLevel(Int_t level=0)
Definition TGeometry.h:104
Double_t fY
Definition TGeometry.h:54
virtual void RecursiveRemove(TObject *obj)
Recursively remove object from a Geometry list.
THashList * fShapes
Definition TGeometry.h:44
THashList * GetListOfMatrices() const
Definition TGeometry.h:78
THashList * GetListOfMaterials() const
Definition TGeometry.h:77
Float_t fBomb
Pointers to shapes.
Definition TGeometry.h:51
static TObjArray * Get(const char *name)
Static function called by TROOT to search name in the geometry.
TRotMatrix * GetRotMatrix(const char *name) const
Return pointer to RotMatrix with name.
virtual void Browse(TBrowser *b)
Browse.
virtual Int_t PushLevel()
Definition TGeometry.h:99
virtual void Node(const char *name, const char *title, const char *shapename, Double_t x=0, Double_t y=0, Double_t z=0, const char *matrixname="", Option_t *option="")
Add a node to the current node in this geometry.
TShape * GetShape(const char *name) const
Return pointer to Shape with name.
TRotMatrix * GetCurrentMatrix() const
Definition TGeometry.h:123
virtual void UpdateMatrix(TNode *node)
Update global rotation matrix/translation vector for this node this function must be called before in...
virtual void cd(const char *path=0)
Change Current Geometry to this.
TList * GetListOfNodes() const
Definition TGeometry.h:76
Double_t fX
Definition TGeometry.h:53
TNode * GetNode(const char *name) const
Return pointer to node with name in the geometry tree.
virtual void ls(Option_t *option="rsn2") const
List this geometry.
Double_t fTranslation[kMAXLEVELS][kVectorSize]
Definition TGeometry.h:56
Bool_t GetCurrentReflection() const
Definition TGeometry.h:135
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition THashList.h:34
A doubly linked list.
Definition TList.h:44
Manages a detector material.
Definition TMaterial.h:28
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
TNode description.
Definition TNode.h:33
An array of TObjects.
Definition TObjArray.h:37
Mother of all ROOT objects.
Definition TObject.h:37
Manages a detector rotation matrix.
Definition TRotMatrix.h:28
This is the base class for all geometry shapes.
Definition TShape.h:35
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
th1 Draw()