Logo ROOT  
Reference Guide
No Matches
Go to the documentation of this file.
1// @(#)root/geom:$Id$
2// Author: Andrei Gheata 24/10/01
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 *************************************************************************/
12#ifndef ROOT_TGeoNode
13#define ROOT_TGeoNode
15#include "TGeoAtt.h"
17#include "TNamed.h"
19#include "TGeoVolume.h"
21#include "TGeoPatternFinder.h"
23// forward declarations
24class TString;
25class TGeoVolume;
26class TGeoShape;
27class TGeoMedium;
28class TGeoMatrix;
29class TGeoHMatrix;
30class TGeoExtension;
33// //
34// TGeoNode - base class for logical nodes. They represent volumes //
35// positioned inside a mother volume //
36// //
39class TGeoNode : public TNamed,
40 public TGeoAtt
43 TGeoVolume *fVolume = nullptr; // volume associated with this
44 TGeoVolume *fMother = nullptr; // mother volume
45 Int_t fNumber = 0; // copy number
46 Int_t fNovlp = 0; // number of overlaps
47 Int_t *fOverlaps = nullptr; //[fNovlp] list of indices for overlapping brothers
48 TGeoExtension *fUserExtension = nullptr; //! Transient user-defined extension to volumes
49 TGeoExtension *fFWExtension = nullptr; //! Transient framework-defined extension to volumes
51 void CopyOverlaps(Int_t *ovlp, Int_t novlp);
54 TGeoNode(const TGeoNode&) = delete;
55 TGeoNode& operator=(const TGeoNode&) = delete;
58 enum {
64 };
66 // constructors
67 TGeoNode();
68 TGeoNode(const TGeoVolume *vol);
69 // destructor
70 virtual ~TGeoNode();
72 void Browse(TBrowser *b);
73 virtual void cd() const {;}
74 void CheckOverlaps(Double_t ovlp=0.1, Option_t *option=""); // *MENU*
75 void CheckShapes();
76 Int_t CountDaughters(Bool_t unique_volumes=kFALSE);
77 virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
78 void Draw(Option_t *option="");
79 void DrawOnly(Option_t *option="");
80 void DrawOverlaps();
81 virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
82 void FillIdArray(Int_t &ifree, Int_t &nodeid, Int_t *array) const;
83 Int_t FindNode(const TGeoNode *node, Int_t level);
84 virtual Int_t GetByteCount() const {return 44;}
85 TGeoNode *GetDaughter(Int_t ind) const {return fVolume->GetNode(ind);}
86 virtual TGeoMatrix *GetMatrix() const = 0;
88 Int_t GetColour() const {return fVolume->GetLineColor();}
89 virtual Int_t GetIndex() const {return 0;}
90 virtual TGeoPatternFinder *GetFinder() const {return 0;}
91 TGeoMedium *GetMedium() const {return fVolume->GetMedium();}
94 TObjArray *GetNodes() const {return fVolume->GetNodes();}
95 Int_t GetNumber() const {return fNumber;}
96 Int_t *GetOverlaps(Int_t &novlp) const {novlp=fNovlp; return fOverlaps;}
97 TGeoVolume *GetVolume() const {return fVolume;}
98 virtual char *GetObjectInfo(Int_t px, Int_t py) const;
99 virtual Int_t GetOptimalVoxels() const {return 0;}
100 void InspectNode() const; // *MENU*
102 virtual Bool_t IsFolder() const {return (GetNdaughters()?kTRUE:kFALSE);}
104 Bool_t IsOnScreen() const; // *MENU*
109 Bool_t MayOverlap(Int_t iother) const;
111 virtual TGeoNode *MakeCopyNode() const {return 0;}
112 Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const;
113 void SaveAttributes(std::ostream &out);
115 void SetVolume(TGeoVolume *volume) {fVolume = volume;}
116 void SetNumber(Int_t number) {fNumber=number;}
120 void SetVisibility(Bool_t vis=kTRUE); // *MENU*
121 void SetInvisible() {SetVisibility(kFALSE);} // *MENU*
123 void SetMotherVolume(TGeoVolume *mother) {fMother = mother;}
124 void SetOverlaps(Int_t *ovlp, Int_t novlp);
126 void SetFWExtension(TGeoExtension *ext);
132 virtual void MasterToLocal(const Double_t *master, Double_t *local) const;
133 virtual void MasterToLocalVect(const Double_t *master, Double_t *local) const;
134 virtual void LocalToMaster(const Double_t *local, Double_t *master) const;
135 virtual void LocalToMasterVect(const Double_t *local, Double_t *master) const;
137 virtual void ls(Option_t *option = "") const;
138 virtual void Paint(Option_t *option = "");
139 void PrintCandidates() const; // *MENU*
140 void PrintOverlaps() const; // *MENU*
141 void VisibleDaughters(Bool_t vis=kTRUE); // *MENU*
143 ClassDef(TGeoNode, 2) // base class for all geometry nodes
147// //
148// TGeoNodeMatrix - node containing a general transformation //
149// //
155 TGeoMatrix *fMatrix = nullptr; // transf. matrix of fNode in fMother system
157 TGeoNodeMatrix(const TGeoNodeMatrix& gnm) = delete;
161 // constructors
163 TGeoNodeMatrix(const TGeoVolume *vol, const TGeoMatrix *matrix);
164 // destructor
165 virtual ~TGeoNodeMatrix();
167 virtual Int_t GetByteCount() const;
168 virtual Int_t GetOptimalVoxels() const;
169 virtual Bool_t IsFolder() const {return kTRUE;}
170 virtual TGeoMatrix *GetMatrix() const {return fMatrix;}
171 virtual TGeoNode *MakeCopyNode() const;
172 void SetMatrix(const TGeoMatrix *matrix);
174 ClassDef(TGeoNodeMatrix, 1) // a geometry node in the general case
178// //
179// TGeoNodeOffset - node containing only an translation offset //
180// //
186 Double_t fOffset = 0.; // X offset for this node with respect to its mother
187 Int_t fIndex = 0; // index of this node in the division
188 TGeoPatternFinder *fFinder = nullptr; // finder for this node
194 // constructors
196 TGeoNodeOffset(const TGeoVolume *vol, Int_t index, Double_t offset);
197 // destructor
198 virtual ~TGeoNodeOffset();
200 virtual void cd() const {fFinder->cd(fIndex);}
201 Double_t GetOffset() const {return fOffset;}
202 virtual Int_t GetIndex() const;
203 virtual TGeoPatternFinder *GetFinder() const {return fFinder;}
204 virtual TGeoMatrix *GetMatrix() const {cd(); return fFinder->GetMatrix();}
205 virtual TGeoNode *MakeCopyNode() const;
206 void SetFinder(TGeoPatternFinder *finder) {fFinder = finder;}
208 ClassDef(TGeoNodeOffset, 1) // a geometry node with just an offset
212// //
213// TGeoIteratorPlugin - Plugin for a TGeoIterator providing the method //
214// ProcessNode each time Next is called. //
215// //
218class TGeoIterator;
223 const TGeoIterator *fIterator = nullptr; // Caller iterator
225 // No copy
232 virtual void ProcessNode() = 0;
233 void SetIterator(const TGeoIterator *iter) {fIterator = iter;}
235 ClassDef(TGeoIteratorPlugin, 0) // ABC for user plugins connecter to a geometry iterator.
239// //
240// TGeoIterator - iterator for the node tree //
241// //
247 TGeoVolume *fTop = nullptr; // Top volume of the iterated branch
248 Bool_t fMustResume = kFALSE; // Private flag to resume from current node.
249 Bool_t fMustStop = kFALSE; // Private flag to signal that the iterator has finished.
250 Int_t fLevel = 0; // Current level in the tree
251 Int_t fType = 0; // Type of iteration
252 Int_t *fArray = nullptr; // Array of node indices for the current path
253 TGeoHMatrix *fMatrix = nullptr; // Current global matrix
254 TString fTopName; // User name for top
256 *fPlugin = nullptr; // User iterator plugin
257 Bool_t fPluginAutoexec = kFALSE; // Plugin automatically executed during next()
259 void IncreaseArray();
266 TGeoIterator(const TGeoIterator &iter);
267 virtual ~TGeoIterator();
269 TGeoIterator &operator=(const TGeoIterator &iter);
271 TGeoNode *Next();
272 void Up() { if (fLevel > 0) fLevel--; }
274 const TGeoMatrix *GetCurrentMatrix() const;
275 Int_t GetIndex(Int_t i) const {return ((i<=fLevel)?fArray[i]:-1);}
276 Int_t GetLevel() const {return fLevel;}
277 TGeoNode *GetNode(Int_t level) const;
278 void GetPath(TString &path) const;
280 *GetUserPlugin() const {return fPlugin;}
282 TGeoVolume *GetTopVolume() const {return fTop;}
283 Int_t GetType() const {return fType;}
284 void Reset(TGeoVolume *top=0);
285 void SetUserPlugin(TGeoIteratorPlugin *plugin);
288 void SetTopName(const char* name);
289 void Skip();
291 ClassDef(TGeoIterator,0) //Iterator for geometry.
#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
const Bool_t kTRUE
Definition RtypesCore.h:91
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
#define BIT(n)
Definition Rtypes.h:85
char name[80]
Definition TGX11.cxx:110
int type
Definition TGX11.cxx:121
virtual Color_t GetLineColor() const
Return the line color.
Definition TAttLine.h:33
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
Visualization and tracking attributes for volumes and nodes.
Definition TGeoAtt.h:18
Bool_t IsVisible() const
Definition TGeoAtt.h:88
Bool_t IsVisDaughters() const
Definition TGeoAtt.h:89
ABC for user objects attached to TGeoVolume or TGeoNode.
Matrix class used for computing global transformations Should NOT be used for node definition.
Definition TGeoMatrix.h:421
TGeoIteratorPlugin & operator=(const TGeoIteratorPlugin &)
virtual ~TGeoIteratorPlugin()
Definition TGeoNode.h:230
void SetIterator(const TGeoIterator *iter)
Definition TGeoNode.h:233
TGeoIteratorPlugin(const TGeoIteratorPlugin &)
const TGeoIterator * fIterator
Definition TGeoNode.h:223
virtual void ProcessNode()=0
A geometry iterator.
Definition TGeoNode.h:245
Int_t GetType() const
Definition TGeoNode.h:283
TGeoIterator & operator=(const TGeoIterator &iter)
Definition TGeoNode.cxx:974
TGeoIteratorPlugin * fPlugin
Definition TGeoNode.h:256
virtual ~TGeoIterator()
Definition TGeoNode.cxx:965
const TGeoMatrix * GetCurrentMatrix() const
Returns global matrix for current node.
void SetType(Int_t type)
Definition TGeoNode.h:287
Bool_t fMustStop
Definition TGeoNode.h:249
void SetTopName(const char *name)
Set the top name for path.
Bool_t fMustResume
Definition TGeoNode.h:248
Int_t fLevel
Definition TGeoNode.h:250
Bool_t fPluginAutoexec
Definition TGeoNode.h:257
Int_t fType
Definition TGeoNode.h:251
void SetPluginAutoexec(Bool_t mode)
Definition TGeoNode.h:286
void Reset(TGeoVolume *top=0)
Resets the iterator for volume TOP.
Int_t GetLevel() const
Definition TGeoNode.h:276
void GetPath(TString &path) const
Returns the path for the current node.
void Up()
Definition TGeoNode.h:272
void IncreaseArray()
Increase by 30 the size of the array.
TGeoNode * GetNode(Int_t level) const
Returns current node at a given level.
TGeoNode * operator()()
Returns next node.
TGeoHMatrix * fMatrix
Definition TGeoNode.h:253
Int_t GetIndex(Int_t i) const
Definition TGeoNode.h:275
TGeoVolume * fTop
Definition TGeoNode.h:247
TGeoNode * Next()
Returns next node.
Definition TGeoNode.cxx:996
void SetUserPlugin(TGeoIteratorPlugin *plugin)
Set a plugin.
void Skip()
Stop iterating the current branch.
TGeoIteratorPlugin * GetUserPlugin() const
Definition TGeoNode.h:280
Int_t * fArray
Definition TGeoNode.h:252
TString fTopName
Definition TGeoNode.h:254
TGeoVolume * GetTopVolume() const
Definition TGeoNode.h:282
Geometrical transformation package.
Definition TGeoMatrix.h:41
Media are used to store properties related to tracking and which are useful only when using geometry ...
Definition TGeoMedium.h:24
A node containing local transformation.
Definition TGeoNode.h:153
virtual Int_t GetOptimalVoxels() const
Returns type of optimal voxelization for this node.
Definition TGeoNode.cxx:728
void SetMatrix(const TGeoMatrix *matrix)
Matrix setter.
Definition TGeoNode.cxx:767
virtual ~TGeoNodeMatrix()
Definition TGeoNode.cxx:709
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Definition TGeoNode.h:169
virtual Int_t GetByteCount() const
return the total size in bytes of this node
Definition TGeoNode.cxx:716
Default constructor.
Definition TGeoNode.cxx:691
TGeoNodeMatrix & operator=(const TGeoNodeMatrix &gnm)=delete
TGeoMatrix * fMatrix
Definition TGeoNode.h:155
virtual TGeoNode * MakeCopyNode() const
Make a copy of this node.
Definition TGeoNode.cxx:742
virtual TGeoMatrix * GetMatrix() const
Definition TGeoNode.h:170
TGeoNodeMatrix(const TGeoNodeMatrix &gnm)=delete
Node containing an offset.
Definition TGeoNode.h:184
Double_t fOffset
Definition TGeoNode.h:186
void SetFinder(TGeoPatternFinder *finder)
Definition TGeoNode.h:206
TGeoPatternFinder * fFinder
Definition TGeoNode.h:188
virtual TGeoNode * MakeCopyNode() const
Make a copy of this node.
Definition TGeoNode.cxx:821
virtual TGeoMatrix * GetMatrix() const
Definition TGeoNode.h:204
TGeoNodeOffset & operator=(const TGeoNodeOffset &)=delete
virtual ~TGeoNodeOffset()
Definition TGeoNode.cxx:806
Default constructor.
Definition TGeoNode.cxx:783
virtual TGeoPatternFinder * GetFinder() const
Definition TGeoNode.h:203
TGeoNodeOffset(const TGeoNodeOffset &)=delete
Double_t GetOffset() const
Definition TGeoNode.h:201
virtual void cd() const
Definition TGeoNode.h:200
virtual Int_t GetIndex() const
Get the index of this offset.
Definition TGeoNode.cxx:813
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition TGeoNode.h:41
TGeoMedium * GetMedium() const
Definition TGeoNode.h:91
Bool_t IsOverlapping() const
Definition TGeoNode.h:105
void SetFWExtension(TGeoExtension *ext)
Connect framework defined extension to the node.
Definition TGeoNode.cxx:476
Bool_t IsVisDaughters() const
Definition TGeoNode.h:108
Bool_t IsOnScreen() const
check if this node is drawn. Assumes that this node is current
Definition TGeoNode.cxx:273
@ kGeoNodeCloned
Definition TGeoNode.h:63
@ kGeoNodeOverlap
Definition TGeoNode.h:62
@ kGeoNodeMatrix
Definition TGeoNode.h:59
@ kGeoNodeOffset
Definition TGeoNode.h:60
@ kGeoNodeVC
Definition TGeoNode.h:61
TGeoVolume * GetVolume() const
Definition TGeoNode.h:97
void SaveAttributes(std::ostream &out)
save attributes for this node
Definition TGeoNode.cxx:404
void SetVolume(TGeoVolume *volume)
Definition TGeoNode.h:115
TGeoVolume * fVolume
Definition TGeoNode.h:43
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute mouse actions on this volume.
Definition TGeoNode.cxx:251
virtual void Paint(Option_t *option="")
Paint this node and its content according to visualization settings.
Definition TGeoNode.cxx:557
void SetAllInvisible()
Definition TGeoNode.h:122
Bool_t IsOffset() const
Definition TGeoNode.h:103
void CheckShapes()
check for wrong parameters in shapes
Definition TGeoNode.cxx:303
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Definition TGeoNode.h:102
void PrintOverlaps() const
print possible overlapping nodes
Definition TGeoNode.cxx:616
TGeoExtension * fFWExtension
Transient user-defined extension to volumes.
Definition TGeoNode.h:49
TGeoExtension * GetUserExtension() const
Definition TGeoNode.h:127
Default constructor.
Definition TGeoNode.cxx:95
TGeoExtension * fUserExtension
Definition TGeoNode.h:48
virtual Int_t GetByteCount() const
Definition TGeoNode.h:84
Int_t * fOverlaps
Definition TGeoNode.h:47
Int_t fNovlp
Definition TGeoNode.h:46
void SetOverlapping(Bool_t flag=kTRUE)
Definition TGeoNode.h:118
TGeoExtension * GrabFWExtension() const
Get a copy of the framework extension pointer.
Definition TGeoNode.cxx:499
void SetOverlaps(Int_t *ovlp, Int_t novlp)
set the list of overlaps for this node (ovlp must be created with operator new)
Definition TGeoNode.cxx:653
void PrintCandidates() const
print daughters candidates for containing current point
Definition TGeoNode.cxx:567
void SetInvisible()
Definition TGeoNode.h:121
Int_t GetNdaughters() const
Definition TGeoNode.h:93
TGeoNode * GetDaughter(Int_t ind) const
Definition TGeoNode.h:85
void SetCurrentPoint(Double_t x, Double_t y, Double_t z)
Definition TGeoNode.h:114
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
compute the closest distance of approach from point px,py to this node
Definition TGeoNode.cxx:237
virtual Int_t GetOptimalVoxels() const
Definition TGeoNode.h:99
virtual TGeoMatrix * GetMatrix() const =0
Bool_t IsCloned() const
Definition TGeoNode.h:101
TGeoNode(const TGeoNode &)=delete
Bool_t MayOverlap(Int_t iother) const
Check the overlab between the bounding box of the node overlaps with the one the brother with index I...
Definition TGeoNode.cxx:508
Bool_t IsVisible() const
Definition TGeoNode.h:107
void CopyOverlaps(Int_t *ovlp, Int_t novlp)
Transient framework-defined extension to volumes.
Definition TGeoNode.cxx:640
TGeoNode & operator=(const TGeoNode &)=delete
void SetMotherVolume(TGeoVolume *mother)
Definition TGeoNode.h:123
virtual void cd() const
Definition TGeoNode.h:73
void SetUserExtension(TGeoExtension *ext)
Connect user-defined extension to the node.
Definition TGeoNode.cxx:461
virtual void LocalToMasterVect(const Double_t *local, Double_t *master) const
Convert a vector from local reference system to mother reference.
Definition TGeoNode.cxx:542
Int_t GetColour() const
Definition TGeoNode.h:88
void DrawOverlaps()
Method drawing the overlap candidates with this node.
Definition TGeoNode.cxx:335
virtual void LocalToMaster(const Double_t *local, Double_t *master) const
Convert the point coordinates from local reference system to mother reference.
Definition TGeoNode.cxx:534
Int_t CountDaughters(Bool_t unique_volumes=kFALSE)
Returns the number of daughters.
Definition TGeoNode.cxx:155
virtual TGeoNode * MakeCopyNode() const
Definition TGeoNode.h:111
void DrawOnly(Option_t *option="")
draw only this node independently of its vis options
Definition TGeoNode.cxx:314
TGeoVolume * GetMotherVolume() const
Definition TGeoNode.h:92
void SetVisibility(Bool_t vis=kTRUE)
Set visibility of the node (obsolete).
Definition TGeoNode.cxx:663
Int_t * GetOverlaps(Int_t &novlp) const
Definition TGeoNode.h:96
void SetVirtual()
Definition TGeoNode.h:119
Int_t GetNumber() const
Definition TGeoNode.h:95
void SetNumber(Int_t number)
Definition TGeoNode.h:116
virtual void MasterToLocal(const Double_t *master, Double_t *local) const
Convert the point coordinates from mother reference to local reference system.
Definition TGeoNode.cxx:518
virtual Int_t GetIndex() const
Definition TGeoNode.h:89
TGeoExtension * GrabUserExtension() const
Get a copy of the user extension pointer.
Definition TGeoNode.cxx:488
Int_t FindNode(const TGeoNode *node, Int_t level)
Search for a node within the branch of this one.
Definition TGeoNode.cxx:377
void VisibleDaughters(Bool_t vis=kTRUE)
Set visibility of the daughters (obsolete).
Definition TGeoNode.cxx:674
void FillIdArray(Int_t &ifree, Int_t &nodeid, Int_t *array) const
Fill array with node id. Recursive on node branch.
Definition TGeoNode.cxx:358
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Get node info for the browser.
Definition TGeoNode.cxx:262
virtual ~TGeoNode()
Definition TGeoNode.cxx:129
TGeoExtension * GetFWExtension() const
Definition TGeoNode.h:128
Int_t fNumber
Definition TGeoNode.h:45
virtual TGeoPatternFinder * GetFinder() const
Definition TGeoNode.h:90
virtual void MasterToLocalVect(const Double_t *master, Double_t *local) const
Convert a vector from mother reference to local reference system.
Definition TGeoNode.cxx:526
virtual void ls(Option_t *option="") const
Print the path (A/B/C/...) to this node on stdout.
Definition TGeoNode.cxx:550
Bool_t IsVirtual() const
Definition TGeoNode.h:106
void SetCloned(Bool_t flag=kTRUE)
Definition TGeoNode.h:117
TObjArray * GetNodes() const
Definition TGeoNode.h:94
void CheckOverlaps(Double_t ovlp=0.1, Option_t *option="")
Check overlaps bigger than OVLP hierarchically, starting with this node.
Definition TGeoNode.cxx:179
void Browse(TBrowser *b)
How-to-browse for a node.
Definition TGeoNode.cxx:139
void InspectNode() const
Inspect this node.
Definition TGeoNode.cxx:282
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const
computes the closest distance from given point to this shape
Definition TGeoNode.cxx:630
TGeoVolume * fMother
Definition TGeoNode.h:44
Base finder class for patterns.
virtual void cd(Int_t)
virtual TGeoMatrix * GetMatrix()
Return current matrix.
Base abstract class for all shapes.
Definition TGeoShape.h:26
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:49
TGeoMedium * GetMedium() const
Definition TGeoVolume.h:174
void SetCurrentPoint(Double_t x, Double_t y, Double_t z)
Set the current tracking point.
Int_t GetNdaughters() const
Definition TGeoVolume.h:351
TObjArray * GetNodes()
Definition TGeoVolume.h:168
TGeoNode * GetNode(const char *name) const
get the pointer to a daughter node
virtual Bool_t IsVisible() const
Definition TGeoVolume.h:154
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
An array of TObjects.
Definition TObjArray.h:37
Mother of all ROOT objects.
Definition TObject.h:37
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:187
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:696
Basic string class.
Definition TString.h:136
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
th1 Draw()