Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGeoPhysicalNode.h
Go to the documentation of this file.
1// @(#)root/geom:$Id$
2// Author: Andrei Gheata 17/02/04
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_TGeoPhysicalNode
13#define ROOT_TGeoPhysicalNode
14
15#include "TNamed.h"
16
17#include "TAttLine.h"
18
19// forward declarations
20class TGeoHMatrix;
21class TGeoMatrix;
22class TGeoVolume;
23class TGeoNode;
24class TGeoShape;
25class TGeoNavigator;
26class TObjArray;
27
28//////////////////////////////////////////////////////////////////////////////
29// //
30// TGeoPhysicalNode - class representing an unique object associated with a //
31// path. //
32// //
33//////////////////////////////////////////////////////////////////////////////
34
35class TGeoPhysicalNode : public TNamed, public TAttLine {
36protected:
37 Int_t fLevel; // depth in the geometry tree
38 TObjArray *fMatrices; // global transformation matrices
39 TObjArray *fNodes; // branch of nodes
40 TGeoHMatrix *fMatrixOrig; // original local matrix of the last node in the path
41
44
46 Bool_t SetPath(const char *path);
47 void SetBranchAsState();
48
49public:
50 enum {
51 kGeoPNodeFull = BIT(10), // full branch is visible (default only last node)
52 kGeoPNodeVisible = BIT(11), // this node is visible (default)
53 kGeoPNodeVolAtt = BIT(12), // preserve volume attributes (default)
54 kGeoPNodeAligned = BIT(13) // alignment bit
55 };
56
57 // constructors
59 TGeoPhysicalNode(const char *path);
60 // destructor
61 ~TGeoPhysicalNode() override;
62
63 Bool_t
64 Align(TGeoMatrix *newmat = nullptr, TGeoShape *newshape = nullptr, Bool_t check = kFALSE, Double_t ovlp = 0.001);
65 void cd() const;
66 void Draw(Option_t *option = "") override;
67 Int_t GetLevel() const { return fLevel; }
68 TGeoHMatrix *GetMatrix(Int_t level = -1) const;
70 TGeoNode *GetMother(Int_t levup = 1) const;
71 TGeoNode *GetNode(Int_t level = -1) const;
72 TGeoShape *GetShape(Int_t level = -1) const;
73 TGeoVolume *GetVolume(Int_t level = -1) const;
74
80
81 void Print(Option_t *option = "") const override;
82 void Refresh();
83
84 void SetMatrixOrig(const TGeoMatrix *local);
88 void Paint(Option_t *option = "") override;
89
90 ClassDefOverride(TGeoPhysicalNode, 1) // base class for physical nodes
91};
92
93///////////////////////////////////////////////////////////////////////////////
94// //
95// TGeoPNEntry - class representing physical node entry having a unique name //
96// associated to a path. //
97// //
98///////////////////////////////////////////////////////////////////////////////
99
100class TGeoPNEntry : public TNamed {
101private:
103 TGeoPhysicalNode *fNode; // Physical node to which this applies
104 const TGeoHMatrix *fMatrix; // Additional matrix
105 TGeoHMatrix *fGlobalOrig; // Original global matrix for the linked physical node
106
107protected:
108 TGeoPNEntry(const TGeoPNEntry &pne) : TNamed(pne), fNode(pne.fNode), fMatrix(nullptr), fGlobalOrig(nullptr) {}
110 {
111 if (this != &pne) {
113 fNode = pne.fNode;
114 fMatrix = pne.fMatrix;
115 }
116 return *this;
117 }
118
119public:
120 TGeoPNEntry();
121 TGeoPNEntry(const char *unique_name, const char *path);
122 ~TGeoPNEntry() override;
123
124 inline const char *GetPath() const { return GetTitle(); }
125 const TGeoHMatrix *GetMatrix() const { return fMatrix; }
127 {
128 if (fNode)
129 return fNode->GetOriginalMatrix();
130 else
131 return nullptr;
132 };
135 void SetMatrix(const TGeoHMatrix *matrix);
137
138 ClassDefOverride(TGeoPNEntry, 4) // a physical node entry with unique name
139};
140
141#endif
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
const char Option_t
Definition RtypesCore.h:66
#define BIT(n)
Definition Rtypes.h:90
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
Option_t Option_t option
Line Attributes class.
Definition TAttLine.h:18
Matrix class used for computing global transformations Should NOT be used for node definition.
Definition TGeoMatrix.h:458
Geometrical transformation package.
Definition TGeoMatrix.h:38
Class providing navigation API for TGeo geometries.
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition TGeoNode.h:39
The knowledge of the path to the objects that need to be misaligned is essential since there is no ot...
const TGeoHMatrix * GetMatrix() const
const TGeoHMatrix * fMatrix
TGeoPhysicalNode * GetPhysicalNode() const
TGeoHMatrix * GetGlobalOrig() const
~TGeoPNEntry() override
Destructor.
void SetPhysicalNode(TGeoPhysicalNode *node)
Setter for the corresponding physical node.
TGeoPhysicalNode * fNode
TGeoHMatrix * fGlobalOrig
TGeoPNEntry()
Default constructor.
TGeoHMatrix * GetMatrixOrig() const
TGeoPNEntry(const TGeoPNEntry &pne)
TGeoPNEntry & operator=(const TGeoPNEntry &pne)
void SetMatrix(const TGeoHMatrix *matrix)
Set the additional matrix for this node entry.
const char * GetPath() const
Physical nodes are the actual 'touchable' objects in the geometry, representing a path of positioned ...
void SetBranchAsState()
Set node branch according to current state.
Bool_t IsAligned() const
TGeoNode * GetMother(Int_t levup=1) const
Return parent at LEVUP generation.
Int_t GetLevel() const
TGeoNode * GetNode(Int_t level=-1) const
Return node in branch at LEVEL. If not specified, return last leaf.
void Refresh()
Refresh this physical node.
Bool_t SetPath(const char *path)
Specify the path for this node.
Bool_t IsVisible() const
void SetVisibility(Bool_t flag=kTRUE)
TGeoPhysicalNode()
Default constructor.
void SetAligned(Bool_t flag=kTRUE)
TGeoHMatrix * GetOriginalMatrix() const
void Paint(Option_t *option="") override
Paint this node and its content according to visualization settings.
void Print(Option_t *option="") const override
Print info about this node.
~TGeoPhysicalNode() override
Destructor.
void SetVisibleFull(Bool_t flag=kTRUE)
Bool_t IsVisibleFull() const
Bool_t IsMatchingState(TGeoNavigator *nav) const
Checks if a given navigator state matches this physical node.
void SetMatrixOrig(const TGeoMatrix *local)
Allows PN entries (or users) to preset the local original matrix for the last node pointed by the pat...
TGeoPhysicalNode & operator=(const TGeoPhysicalNode &)=delete
TGeoHMatrix * GetMatrix(Int_t level=-1) const
Return global matrix for node at LEVEL.
TGeoHMatrix * fMatrixOrig
Bool_t IsVolAttributes() const
Bool_t Align(TGeoMatrix *newmat=nullptr, TGeoShape *newshape=nullptr, Bool_t check=kFALSE, Double_t ovlp=0.001)
Align a physical node with a new relative matrix/shape.
TGeoPhysicalNode(const TGeoPhysicalNode &)=delete
TGeoVolume * GetVolume(Int_t level=-1) const
Return volume associated with node at LEVEL in the branch.
void SetIsVolAtt(Bool_t flag=kTRUE)
TGeoShape * GetShape(Int_t level=-1) const
Return shape associated with volume.
TObjArray * fMatrices
Base abstract class for all shapes.
Definition TGeoShape.h:25
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:43
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:48
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Definition TNamed.cxx:51
An array of TObjects.
Definition TObjArray.h:31
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:199
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:798
th1 Draw()