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