Logo ROOT  
Reference Guide
TGeometry.cxx
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#include "TROOT.h"
13#include "TBuffer.h"
14#include "THashList.h"
15#include "TObjArray.h"
16#include "TGeometry.h"
17#include "TNode.h"
18#include "TMaterial.h"
19#include "TBrowser.h"
20#include "TClass.h"
21
23
25
26/** \class TGeometry
27\ingroup g3d
28TGeometry description.
29
30The Geometry class describes the geometry of a detector.
31The current implementation supports the GEANT3 style description.
32A special program provided in the ROOT utilities (toroot) can be used
33to automatically translate a GEANT detector geometry into a ROOT geometry.
34
35a Geometry object is entered into the list of geometries into the
36ROOT main object (see TROOT description) when the TGeometry
37constructor is invoked.
38Several geometries may coexist in memory.
39/
40A Geometry object consist of the following linked lists:
41
42 - the TMaterial list (material definition only).
43 - the TRotmatrix list (Rotation matrices definition only).
44 - the TShape list (volume definition only).
45 - the TNode list assembling all detector elements.
46
47Only the Build and Draw functions for a geometry are currently supported.
48
49The conversion program from Geant to Root has been added in the list
50of utilities in utils directory.(see g2root)
51The executable module of g2root can be found in $ROOTSYS/bin/g2root.
52
53To use this conversion program, type the shell command:
54
55~~~ {.cpp}
56 g2root geant_rzfile macro_name
57~~~
58
59for example
60
61~~~ {.cpp}
62 g2root na49.geom na49.C
63~~~
64
65will convert the GEANT RZ file na49.geom into a ROOT macro na49.C
66
67To generate the Geometry structure within Root, do:
68
69~~~ {.cpp}
70 Root > .x na49.C
71 Root > na49.Draw()
72 Root > wh.x3d() (this invokes the 3-d Root viewer)
73 Root > TFile gna49("na49.root","NEW") //open a new root file
74 Root > na49.Write() //Write the na49 geometry structure
75 Root > gna49.Write() //Write all keys (in this case only one)
76~~~
77
78Note: all keys are also written on closing of the file, gna49.Close or
79when the program exits, Root closes all open files correctly.
80Once this file has been written, in a subsequent session, simply do:
81
82~~~ {.cpp}
83 Root > TFile gna49("na49.root")
84 Root > na49.Draw()
85~~~
86
87The figure below shows the geometry above using the x3d viewer.
88This x3d viewer is invoked by selecting "View x3d" in the View menu
89of a canvas (See example of this tool bar in TCanvas).
90
91\image html g3d_na49.png
92*/
93
94////////////////////////////////////////////////////////////////////////////////
95/// Geometry default constructor.
96
98{
99 fMaterials = new THashList(100,3);
100 fMatrices = new THashList(100,3);
101 fShapes = new THashList(500,3);
102 fNodes = new TList;
103 fCurrentNode = 0;
105 fMatrixPointer = 0;
106 fShapePointer = 0;
107 gGeometry = this;
108 fBomb = 1;
109 fMatrix = 0;
110 fX=fY=fZ =0.0;
111 fGeomLevel =0;
113}
114
115////////////////////////////////////////////////////////////////////////////////
116/// Geometry normal constructor.
117
118TGeometry::TGeometry(const char *name,const char *title ) : TNamed (name, title)
119{
120 fMaterials = new THashList(1000,3);
121 fMatrices = new THashList(1000,3);
122 fShapes = new THashList(5000,3);
123 fNodes = new TList;
124 fCurrentNode = 0;
126 fMatrixPointer = 0;
127 fShapePointer = 0;
128 gGeometry = this;
129 fBomb = 1;
130 fMatrix = 0;
131 fX=fY=fZ =0.0;
132 gROOT->GetListOfGeometries()->Add(this);
133 fGeomLevel =0;
135}
136
137////////////////////////////////////////////////////////////////////////////////
138/// copy constructor
139
141 TNamed(geo),
142 fMaterials(geo.fMaterials),
143 fMatrices(geo.fMatrices),
144 fShapes(geo.fShapes),
145 fNodes(geo.fNodes),
146 fMatrix(geo.fMatrix),
147 fCurrentNode(geo.fCurrentNode),
148 fMaterialPointer(geo.fMaterialPointer),
149 fMatrixPointer(geo.fMatrixPointer),
150 fShapePointer(geo.fShapePointer),
151 fBomb(geo.fBomb),
152 fGeomLevel(geo.fGeomLevel),
153 fX(geo.fX),
154 fY(geo.fY),
155 fZ(geo.fZ)
156{
157 for(Int_t i=0; i<kMAXLEVELS; i++) {
158 for(Int_t j=0; j<kVectorSize; j++)
159 fTranslation[i][j]=geo.fTranslation[i][j];
160 for(Int_t j=0; j<kMatrixSize; j++)
161 fRotMatrix[i][j]=geo.fRotMatrix[i][j];
163 }
164}
165
166////////////////////////////////////////////////////////////////////////////////
167/// assignment operator
168
170{
171 if(this!=&geo) {
175 fShapes=geo.fShapes;
176 fNodes=geo.fNodes;
177 fMatrix=geo.fMatrix;
182 fBomb=geo.fBomb;
184 fX=geo.fX;
185 fY=geo.fY;
186 fZ=geo.fZ;
187 for(Int_t i=0; i<kMAXLEVELS; i++) {
188 for(Int_t j=0; j<kVectorSize; j++)
189 fTranslation[i][j]=geo.fTranslation[i][j];
190 for(Int_t j=0; j<kMatrixSize; j++)
191 fRotMatrix[i][j]=geo.fRotMatrix[i][j];
193 }
194 }
195 return *this;
196}
197
198////////////////////////////////////////////////////////////////////////////////
199/// Geometry default destructor.
200
202{
203 if (!fMaterials) return;
205 fMatrices->Delete();
206 fShapes->Delete();
207 fNodes->Delete();
208 delete fMaterials;
209 delete fMatrices;
210 delete fShapes;
211 delete fNodes;
212 delete [] fMaterialPointer;
213 delete [] fMatrixPointer;
214 delete [] fShapePointer;
215 fMaterials = 0;
216 fMatrices = 0;
217 fShapes = 0;
218 fNodes = 0;
220 fMatrixPointer = 0;
221 fShapePointer = 0;
222
223 if (gGeometry == this) {
224 gGeometry = (TGeometry*) gROOT->GetListOfGeometries()->First();
225 if (gGeometry == this)
226 gGeometry = (TGeometry*) gROOT->GetListOfGeometries()->After(gGeometry);
227 }
228 gROOT->GetListOfGeometries()->Remove(this);
229}
230
231////////////////////////////////////////////////////////////////////////////////
232/// Browse.
233
235{
236 if( b ) {
237 b->Add( fMaterials, "Materials" );
238 b->Add( fMatrices, "Rotation Matrices" );
239 b->Add( fShapes, "Shapes" );
240 b->Add( fNodes, "Nodes" );
241 }
242}
243
244////////////////////////////////////////////////////////////////////////////////
245/// Change Current Geometry to this.
246
247void TGeometry::cd(const char *)
248{
249 gGeometry = this;
250}
251
252////////////////////////////////////////////////////////////////////////////////
253/// Draw this Geometry.
254
256{
257 TNode *node1 = (TNode*)fNodes->First();
258 if (node1) node1->Draw(option);
259
260}
261
262////////////////////////////////////////////////////////////////////////////////
263/// Find object in a geometry node, material, etc
264
266{
267 Error("FindObject","Not yet implemented");
268 return 0;
269}
270
271////////////////////////////////////////////////////////////////////////////////
272/// Search object identified by name in the geometry tree
273
275{
277 if (loc) return loc->At(0);
278 return 0;
279}
280
281////////////////////////////////////////////////////////////////////////////////
282/// Static function called by TROOT to search name in the geometry.
283/// Returns a TObjArray containing a pointer to the found object
284/// and a pointer to the container where the object was found.
285
287{
288 static TObjArray *locs = 0;
289 if (!locs) locs = new TObjArray(2);
290 TObjArray &loc = *locs;
291 loc[0] = 0;
292 loc[1] = 0;
293
294 if (!gGeometry) return &loc;
295
296 TObject *temp;
297 TObject *where;
298
300 where = gGeometry->GetListOfMaterials();
301
302 if (!temp) {
304 where = gGeometry->GetListOfShapes();
305 }
306 if (!temp) {
308 where = gGeometry->GetListOfMatrices();
309 }
310 if (!temp) {
311 temp = gGeometry->GetNode(name);
312 where = gGeometry;
313 }
314 loc[0] = temp;
315 loc[1] = where;
316
317 return &loc;
318}
319
320////////////////////////////////////////////////////////////////////////////////
321/// Return pointer to Material with name.
322
324{
326}
327
328////////////////////////////////////////////////////////////////////////////////
329/// Return pointer to Material with number.
330
332{
333 TMaterial *mat;
334 if (number < 0 || number >= fMaterials->GetSize()) return 0;
335 if (fMaterialPointer) return fMaterialPointer[number];
336 TIter next(fMaterials);
337 while ((mat = (TMaterial*) next())) {
338 if (mat->GetNumber() == number) return mat;
339 }
340 return 0;
341}
342
343////////////////////////////////////////////////////////////////////////////////
344/// Return pointer to node with name in the geometry tree.
345
346TNode *TGeometry::GetNode(const char *name) const
347{
348 TNode *node= (TNode*)GetListOfNodes()->First();
349 if (!node) return 0;
350 if (node->TestBit(kNotDeleted)) return node->GetNode(name);
351 return 0;
352}
353
354////////////////////////////////////////////////////////////////////////////////
355/// Return pointer to RotMatrix with name.
356
358{
360}
361
362////////////////////////////////////////////////////////////////////////////////
363/// Return pointer to RotMatrix with number.
364
366{
367 TRotMatrix *matrix;
368 if (number < 0 || number >= fMatrices->GetSize()) return 0;
369 if (fMatrixPointer) return fMatrixPointer[number];
370 TIter next(fMatrices);
371 while ((matrix = (TRotMatrix*) next())) {
372 if (matrix->GetNumber() == number) return matrix;
373 }
374 return 0;
375}
376
377////////////////////////////////////////////////////////////////////////////////
378/// Return pointer to Shape with name.
379
380TShape *TGeometry::GetShape(const char *name) const
381{
382 return (TShape*)fShapes->FindObject(name);
383}
384
385////////////////////////////////////////////////////////////////////////////////
386/// Return pointer to Shape with number.
387
389{
390 TShape *shape;
391 if (number < 0 || number >= fShapes->GetSize()) return 0;
392 if (fShapePointer) return fShapePointer[number];
393 TIter next(fShapes);
394 while ((shape = (TShape*) next())) {
395 if (shape->GetNumber() == number) return shape;
396 }
397 return 0;
398}
399
400////////////////////////////////////////////////////////////////////////////////
401/// Convert one point from local system to master reference system.
402///
403/// Note that before invoking this function, the global rotation matrix
404/// and translation vector for this node must have been computed.
405/// This is automatically done by the Paint functions.
406/// Otherwise TNode::UpdateMatrix should be called before.
407
409{
410 if (GeomLevel()) {
411 Double_t x,y,z;
412 Double_t bomb = GetBomb();
413 Double_t *matrix = &fRotMatrix[GeomLevel()][0];
414 x = bomb*fX
415 + local[0]*matrix[0]
416 + local[1]*matrix[3]
417 + local[2]*matrix[6];
418
419 y = bomb*fY
420 + local[0]*matrix[1]
421 + local[1]*matrix[4]
422 + local[2]*matrix[7];
423
424 z = bomb*fZ
425 + local[0]*matrix[2]
426 + local[1]*matrix[5]
427 + local[2]*matrix[8];
428 master[0] = x; master[1] = y; master[2] = z;
429 }
430 else
431 for (Int_t i=0;i<3;i++) master[i] = local[i];
432}
433
434////////////////////////////////////////////////////////////////////////////////
435/// Convert one point from local system to master reference system.
436///
437/// Note that before invoking this function, the global rotation matrix
438/// and translation vector for this node must have been computed.
439/// This is automatically done by the Paint functions.
440/// Otherwise TNode::UpdateMatrix should be called before.
441
443{
444 if (GeomLevel()) {
445 Float_t x,y,z;
446 Float_t bomb = GetBomb();
447
448 Double_t *matrix = &fRotMatrix[GeomLevel()][0];
449
450 x = bomb*fX
451 + local[0]*matrix[0]
452 + local[1]*matrix[3]
453 + local[2]*matrix[6];
454
455 y = bomb*fY
456 + local[0]*matrix[1]
457 + local[1]*matrix[4]
458 + local[2]*matrix[7];
459
460 z = bomb*fZ
461 + local[0]*matrix[2]
462 + local[1]*matrix[5]
463 + local[2]*matrix[8];
464
465 master[0] = x; master[1] = y; master[2] = z;
466 }
467 else
468 for (Int_t i=0;i<3;i++) master[i] = local[i];
469}
470
471////////////////////////////////////////////////////////////////////////////////
472/// List this geometry.
473
474void TGeometry::ls(Option_t *option) const
475{
476 TString opt = option;
477 opt.ToLower();
478 if (opt.Contains("m")) {
479 Printf("=================List of Materials================");
480 fMaterials->ls(option);
481 }
482 if (opt.Contains("r")) {
483 Printf("=================List of RotationMatrices================");
484 fMatrices->ls(option);
485 }
486 if (opt.Contains("s")) {
487 Printf("=================List of Shapes==========================");
488 fShapes->ls(option);
489 }
490 if (opt.Contains("n")) {
491 Printf("=================List of Nodes===========================");
492 fNodes->ls(option);
493 }
494}
495
496////////////////////////////////////////////////////////////////////////////////
497/// Convert one point from master system to local reference system.
498///
499/// Note that before invoking this function, the global rotation matrix
500/// and translation vector for this node must have been computed.
501/// This is automatically done by the Paint functions.
502/// Otherwise TNode::UpdateMatrix should be called before.
503
505{
506 if (GeomLevel()) {
507 Double_t x,y,z;
508 Double_t bomb = GetBomb();
509 Double_t *matrix = &fRotMatrix[GeomLevel()][0];
510
511 Double_t xms = master[0] - bomb*fX;
512 Double_t yms = master[1] - bomb*fY;
513 Double_t zms = master[2] - bomb*fZ;
514
515 x = xms*matrix[0] + yms*matrix[1] + zms*matrix[2];
516 y = xms*matrix[3] + yms*matrix[4] + zms*matrix[5];
517 z = xms*matrix[6] + yms*matrix[7] + zms*matrix[8];
518
519 local[0] = x; local[1] = y; local[2] = z;
520 }
521 else
522 memcpy(local,master,sizeof(Double_t)* kVectorSize);
523}
524
525////////////////////////////////////////////////////////////////////////////////
526/// Convert one point from master system to local reference system.
527///
528/// Note that before invoking this function, the global rotation matrix
529/// and translation vector for this node must have been computed.
530/// This is automatically done by the Paint functions.
531/// Otherwise TNode::UpdateMatrix should be called before.
532
534{
535 if (GeomLevel()) {
536 Float_t x,y,z;
537 Float_t bomb = GetBomb();
538
539 Double_t *matrix = &fRotMatrix[GeomLevel()][0];
540
541 Double_t xms = master[0] - bomb*fX;
542 Double_t yms = master[1] - bomb*fY;
543 Double_t zms = master[2] - bomb*fZ;
544
545 x = xms*matrix[0] + yms*matrix[1] + zms*matrix[2];
546 y = xms*matrix[3] + yms*matrix[4] + zms*matrix[5];
547 z = xms*matrix[6] + yms*matrix[7] + zms*matrix[8];
548
549 local[0] = x; local[1] = y; local[2] = z;
550 }
551 else
552 memcpy(local,master,sizeof(Float_t)* kVectorSize);
553}
554
555////////////////////////////////////////////////////////////////////////////////
556/// Add a node to the current node in this geometry.
557
558void TGeometry::Node(const char *name, const char *title, const char *shapename, Double_t x, Double_t y, Double_t z, const char *matrixname, Option_t *option)
559{
560 new TNode(name,title,shapename,x,y,z,matrixname,option);
561}
562
563////////////////////////////////////////////////////////////////////////////////
564/// Recursively remove object from a Geometry list.
565
567{
568 if (fNodes) fNodes->RecursiveRemove(obj);
569}
570
571////////////////////////////////////////////////////////////////////////////////
572/// Stream a class object.
573
574void TGeometry::Streamer(TBuffer &b)
575{
576 if (b.IsReading()) {
577 UInt_t R__s, R__c;
578 Version_t R__v = b.ReadVersion(&R__s, &R__c);
579 if (R__v > 1) {
580 b.ReadClassBuffer(TGeometry::Class(), this, R__v, R__s, R__c);
581 } else {
582 //====process old versions before automatic schema evolution
583 TNamed::Streamer(b);
584 fMaterials->Streamer(b);
585 fMatrices->Streamer(b);
586 fShapes->Streamer(b);
587 fNodes->Streamer(b);
588 b >> fBomb;
589 b.CheckByteCount(R__s, R__c, TGeometry::IsA());
590 //====end of old versions
591 }
592 // Build direct access pointers to individual materials,matrices and shapes
593 Int_t i;
594 TMaterial *onemat;
595 TRotMatrix *onematrix;
596 TShape *oneshape;
597 Int_t nmat = fMaterials->GetSize();
598 if (nmat) fMaterialPointer = new TMaterial* [nmat];
599 TIter nextmat(fMaterials);
600 i = 0;
601 while ((onemat = (TMaterial*) nextmat())) {
602 fMaterialPointer[i] = onemat;
603 i++;
604 }
605
606 Int_t nrot = fMatrices->GetSize();
607 if (nrot) fMatrixPointer = new TRotMatrix* [nrot];
608 TIter nextmatrix(fMatrices);
609 i = 0;
610 while ((onematrix = (TRotMatrix*) nextmatrix())) {
611 fMatrixPointer[i] = onematrix;
612 i++;
613 }
614
615 Int_t nsha = fShapes->GetSize();
616 if (nsha) fShapePointer = new TShape* [nsha];
617 TIter nextshape(fShapes);
618 i = 0;
619 while ((oneshape = (TShape*) nextshape())) {
620 fShapePointer[i] = oneshape;
621 i++;
622 }
623
624 gROOT->GetListOfGeometries()->Add(this);
625
627 } else {
628 b.WriteClassBuffer(TGeometry::Class(),this);
629 }
630}
631
632////////////////////////////////////////////////////////////////////////////////
633/// Update global rotation matrix/translation vector for this node
634/// this function must be called before invoking Local2Master
635
637{
638 TNode *nodes[kMAXLEVELS];
639 for (Int_t i=0;i<kVectorSize;i++) fTranslation[0][i] = 0;
640 for (Int_t i=0;i<kMatrixSize;i++) fRotMatrix[0][i] = 0;
641 fRotMatrix[0][0] = 1; fRotMatrix[0][4] = 1; fRotMatrix[0][8] = 1;
642
643 fGeomLevel = 0;
644 //build array of parent nodes
645 while (node) {
646 nodes[fGeomLevel] = node;
647 node = node->GetParent();
648 fGeomLevel++;
649 }
650 fGeomLevel--;
651 Int_t saveGeomLevel = fGeomLevel;
652 //Update matrices in the hierarchy
653 for (fGeomLevel=1;fGeomLevel<=saveGeomLevel;fGeomLevel++) {
654 node = nodes[fGeomLevel-1];
655 UpdateTempMatrix(node->GetX(),node->GetY(),node->GetZ(),node->GetMatrix());
656 }
657}
658
659////////////////////////////////////////////////////////////////////////////////
660/// Update temp matrix.
661
663{
664 Double_t *matrix = 0;
665 Bool_t isReflection = kFALSE;
666 if (rotMatrix && rotMatrix->GetType()) {
667 matrix = rotMatrix->GetMatrix();
668 isReflection = rotMatrix->IsReflection();
669 }
670 UpdateTempMatrix( x,y,z, matrix,isReflection);
671}
672
673////////////////////////////////////////////////////////////////////////////////
674/// Update temp matrix.
675
677{
678 Int_t i=GeomLevel();
679 if (i) {
680 if(matrix) {
681 UpdateTempMatrix(&(fTranslation[i-1][0]),&fRotMatrix[i-1][0]
682 ,x,y,z,matrix
683 ,&fTranslation[i][0],&fRotMatrix[i][0]);
684 fX = fTranslation[i][0];
685 fY = fTranslation[i][1];
686 fZ = fTranslation[i][2];
687 fIsReflection[i] = fIsReflection[i-1] ^ isReflection;
688 } else {
689 fX = fTranslation[i][0] = fTranslation[i-1][0] + x;
690 fY = fTranslation[i][1] = fTranslation[i-1][1] + y;
691 fZ = fTranslation[i][2] = fTranslation[i-1][2] + z;
692 }
693 } else {
694 fX=fY=fZ=0;
696 for (i=0;i<kVectorSize;i++) fTranslation[0][i] = 0;
697 for (i=0;i<kMatrixSize;i++) fRotMatrix[0][i] = 0;
698 fRotMatrix[0][0] = 1; fRotMatrix[0][4] = 1; fRotMatrix[0][8] = 1;
699 }
700}
701
702////////////////////////////////////////////////////////////////////////////////
703/// Compute new translation vector and global matrix.
704///
705/// - dx old translation vector
706/// - rmat old global matrix
707/// - x,y,z offset of new local system with respect to mother
708/// - dxnew new translation vector
709/// - rmatnew new global rotation matrix
710
712 , Double_t x, Double_t y, Double_t z, Double_t *matrix
713 , Double_t *dxnew, Double_t *rmatnew)
714{
715 dxnew[0] = dx[0] + x*rmat[0] + y*rmat[3] + z*rmat[6];
716 dxnew[1] = dx[1] + x*rmat[1] + y*rmat[4] + z*rmat[7];
717 dxnew[2] = dx[2] + x*rmat[2] + y*rmat[5] + z*rmat[8];
718
719 rmatnew[0] = rmat[0]*matrix[0] + rmat[3]*matrix[1] + rmat[6]*matrix[2];
720 rmatnew[1] = rmat[1]*matrix[0] + rmat[4]*matrix[1] + rmat[7]*matrix[2];
721 rmatnew[2] = rmat[2]*matrix[0] + rmat[5]*matrix[1] + rmat[8]*matrix[2];
722 rmatnew[3] = rmat[0]*matrix[3] + rmat[3]*matrix[4] + rmat[6]*matrix[5];
723 rmatnew[4] = rmat[1]*matrix[3] + rmat[4]*matrix[4] + rmat[7]*matrix[5];
724 rmatnew[5] = rmat[2]*matrix[3] + rmat[5]*matrix[4] + rmat[8]*matrix[5];
725 rmatnew[6] = rmat[0]*matrix[6] + rmat[3]*matrix[7] + rmat[6]*matrix[8];
726 rmatnew[7] = rmat[1]*matrix[6] + rmat[4]*matrix[7] + rmat[7]*matrix[8];
727 rmatnew[8] = rmat[2]*matrix[6] + rmat[5]*matrix[7] + rmat[8]*matrix[8];
728}
void Class()
Definition: Class.C:29
#define b(i)
Definition: RSha256.hxx:100
int Int_t
Definition: RtypesCore.h:43
short Version_t
Definition: RtypesCore.h:63
unsigned int UInt_t
Definition: RtypesCore.h:44
const Bool_t kFALSE
Definition: RtypesCore.h:90
double Double_t
Definition: RtypesCore.h:57
float Float_t
Definition: RtypesCore.h:55
const char Option_t
Definition: RtypesCore.h:64
#define ClassImp(name)
Definition: Rtypes.h:361
char name[80]
Definition: TGX11.cxx:109
TGeometry * gGeometry
Definition: TGeometry.cxx:22
const Int_t kVectorSize
Definition: TGeometry.h:28
const Int_t kMAXLEVELS
Definition: TGeometry.h:27
const Int_t kMatrixSize
Definition: TGeometry.h:29
#define gROOT
Definition: TROOT.h:406
void Printf(const char *fmt,...)
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
Buffer base class used for serializing objects.
Definition: TBuffer.h:42
virtual void ls(Option_t *option="") const
List (ls) all objects in this collection.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
TGeometry description.
Definition: TGeometry.h:39
TShape * GetShapeByNumber(Int_t number) const
Return pointer to Shape with number.
Definition: TGeometry.cxx:388
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.
Definition: TGeometry.cxx:331
TGeometry & operator=(const TGeometry &)
assignment operator
Definition: TGeometry.cxx:169
virtual void Local2Master(Double_t *local, Double_t *master)
Convert one point from local system to master reference system.
Definition: TGeometry.cxx:408
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.
Definition: TGeometry.cxx:662
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.
Definition: TGeometry.cxx:323
virtual TObject * FindObject(const char *name) const
Search object identified by name in the geometry tree.
Definition: TGeometry.cxx:274
virtual void Master2Local(Double_t *master, Double_t *local)
Convert one point from master system to local reference system.
Definition: TGeometry.cxx:504
TGeometry()
Geometry default constructor.
Definition: TGeometry.cxx:97
THashList * fMaterials
Definition: TGeometry.h:42
TRotMatrix ** fMatrixPointer
Pointers to materials.
Definition: TGeometry.h:49
TShape ** fShapePointer
Pointers to rotation matrices.
Definition: TGeometry.h:50
THashList * GetListOfShapes() const
Definition: TGeometry.h:75
TRotMatrix * GetRotMatrixByNumber(Int_t number) const
Return pointer to RotMatrix with number.
Definition: TGeometry.cxx:365
TList * fNodes
Definition: TGeometry.h:45
virtual ~TGeometry()
Geometry default destructor.
Definition: TGeometry.cxx:201
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
Double_t fY
Definition: TGeometry.h:54
virtual void RecursiveRemove(TObject *obj)
Recursively remove object from a Geometry list.
Definition: TGeometry.cxx:566
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.
Definition: TGeometry.cxx:286
TRotMatrix * GetRotMatrix(const char *name) const
Return pointer to RotMatrix with name.
Definition: TGeometry.cxx:357
virtual void Browse(TBrowser *b)
Browse.
Definition: TGeometry.cxx:234
virtual void Draw(Option_t *option="")
Draw this Geometry.
Definition: TGeometry.cxx:255
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.
Definition: TGeometry.cxx:558
TShape * GetShape(const char *name) const
Return pointer to Shape with name.
Definition: TGeometry.cxx:380
virtual void UpdateMatrix(TNode *node)
Update global rotation matrix/translation vector for this node this function must be called before in...
Definition: TGeometry.cxx:636
virtual void cd(const char *path=0)
Change Current Geometry to this.
Definition: TGeometry.cxx:247
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.
Definition: TGeometry.cxx:346
virtual void ls(Option_t *option="rsn2") const
List this geometry.
Definition: TGeometry.cxx:474
Double_t fTranslation[kMAXLEVELS][kVectorSize]
Definition: TGeometry.h:56
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition: THashList.h:34
TObject * FindObject(const char *name) const
Find object using its name.
Definition: THashList.cxx:262
void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: THashList.cxx:207
A doubly linked list.
Definition: TList.h:44
virtual void RecursiveRemove(TObject *obj)
Remove object from this collection and recursively remove the object from all other objects (and coll...
Definition: TList.cxx:763
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: TList.cxx:469
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:658
Manages a detector material.
Definition: TMaterial.h:28
virtual Int_t GetNumber() const
Definition: TMaterial.h:42
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Definition: TNamed.cxx:51
TNode description.
Definition: TNode.h:33
virtual void Draw(Option_t *option="")
Draw Referenced node with current parameters.
Definition: TNode.cxx:324
virtual TNode * GetParent() const
Definition: TNode.h:70
virtual Double_t GetY() const
Definition: TNode.h:74
virtual Double_t GetX() const
Definition: TNode.h:73
virtual TRotMatrix * GetMatrix() const
Definition: TNode.h:66
virtual Double_t GetZ() const
Definition: TNode.h:75
virtual TNode * GetNode(const char *name) const
Return pointer to node with name in the node tree.
Definition: TNode.cxx:379
An array of TObjects.
Definition: TObjArray.h:37
TObject * At(Int_t idx) const
Definition: TObjArray.h:166
Mother of all ROOT objects.
Definition: TObject.h:37
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:187
@ kNotDeleted
object has not been deleted
Definition: TObject.h:78
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:891
Manages a detector rotation matrix.
Definition: TRotMatrix.h:28
virtual Int_t GetType() const
Definition: TRotMatrix.h:56
virtual Int_t GetNumber() const
Definition: TRotMatrix.h:55
virtual Double_t * GetMatrix()
Definition: TRotMatrix.h:54
virtual Bool_t IsReflection() const
Definition: TRotMatrix.h:61
This is the base class for all geometry shapes.
Definition: TShape.h:35
virtual Int_t GetNumber() const
Definition: TShape.h:57
Basic string class.
Definition: TString.h:131
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1125
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:619
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17