Logo ROOT   6.12/06
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 "TObjArray.h"
18 
19 #include "TAttLine.h"
20 
21 // forward declarations
22 class TGeoHMatrix;
23 class TGeoMatrix;
24 class TGeoVolume;
25 class TGeoNode;
26 class TGeoShape;
27 class TGeoNavigator;
28 
29 //////////////////////////////////////////////////////////////////////////////
30 // //
31 // TGeoPhysicalNode - class representing an unique object associated with a //
32 // path. //
33 // //
34 //////////////////////////////////////////////////////////////////////////////
35 
36 class TGeoPhysicalNode : public TNamed,
37  public TAttLine
38 {
39 protected:
40  Int_t fLevel; // depth in the geometry tree
41  TObjArray *fMatrices; // global transformation matrices
42  TObjArray *fNodes; // branch of nodes
43  TGeoHMatrix *fMatrixOrig; // original local matrix of the last node in the path
44 
47 
49  Bool_t SetPath(const char *path);
50  void SetBranchAsState();
51 
52 public:
53  enum {
54  kGeoPNodeFull = BIT(10), // full branch is visible (default only last node)
55  kGeoPNodeVisible = BIT(11), // this node is visible (default)
56  kGeoPNodeVolAtt = BIT(12), // preserve volume attributes (default)
57  kGeoPNodeAligned = BIT(13) // alignment bit
58  };
59 
60  // constructors
62  TGeoPhysicalNode(const char *path);
63  // destructor
64  virtual ~TGeoPhysicalNode();
65 
66  Bool_t Align(TGeoMatrix *newmat=0, TGeoShape *newshape=0, Bool_t check=kFALSE, Double_t ovlp=0.001);
67  void cd() const;
68  void Draw(Option_t *option="");
69  Int_t GetLevel() const {return fLevel;}
70  TGeoHMatrix *GetMatrix(Int_t level=-1) const;
72  TGeoNode *GetMother(Int_t levup=1) const;
73  TGeoNode *GetNode(Int_t level=-1) const;
74  TGeoShape *GetShape(Int_t level=-1) const;
75  TGeoVolume *GetVolume(Int_t level=-1) const;
76 
77 
83 
84  virtual void Print(Option_t *option="") const;
85  void Refresh();
86 
87  void SetMatrixOrig(const TGeoMatrix *local);
91  virtual void Paint(Option_t *option = "");
92 
93 
94  ClassDef(TGeoPhysicalNode, 1) // base class for physical nodes
95 };
96 
97 ///////////////////////////////////////////////////////////////////////////////
98 // //
99 // TGeoPNEntry - class representing physical node entry having a unique name //
100 // associated to a path. //
101 // //
102 ///////////////////////////////////////////////////////////////////////////////
103 
104 class TGeoPNEntry : public TNamed
105 {
106 private:
109  };
110  TGeoPhysicalNode *fNode; // Physical node to which this applies
111  const TGeoHMatrix *fMatrix; // Additional matrix
112  TGeoHMatrix *fGlobalOrig; // Original global matrix for the linked physical node
113 
114 protected:
116  : TNamed(pne), fNode(pne.fNode), fMatrix(NULL), fGlobalOrig(NULL) { }
118  {if(this!=&pne) {TNamed::operator=(pne); fNode=pne.fNode; fMatrix=pne.fMatrix;}
119  return *this;}
120 
121 public:
122  TGeoPNEntry();
123  TGeoPNEntry(const char *unique_name, const char *path);
124  virtual ~TGeoPNEntry();
125 
126  inline const char *GetPath() const {return GetTitle();}
127  const TGeoHMatrix *GetMatrix() const {return fMatrix;}
128  TGeoHMatrix *GetMatrixOrig() const {if (fNode) return fNode->GetOriginalMatrix(); else return NULL;};
131  void SetMatrix(const TGeoHMatrix *matrix);
132  void SetPhysicalNode(TGeoPhysicalNode *node);
133 
134  ClassDef(TGeoPNEntry, 4) // a physical node entry with unique name
135 };
136 
137 #endif
138 
void SetPhysicalNode(TGeoPhysicalNode *node)
Setter for the corresponding physical node.
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual void Print(Option_t *option="") const
Print info about this node.
An array of TObjects.
Definition: TObjArray.h:37
Bool_t IsVolAttributes() const
const char * GetPath() const
TGeoPhysicalNode()
Default constructor.
TGeoPNEntry(const TGeoPNEntry &pne)
void SetAligned(Bool_t flag=kTRUE)
TGeoHMatrix * GetMatrix(Int_t level=-1) const
Return global matrix for node at LEVEL.
TGeoPhysicalNode & operator=(const TGeoPhysicalNode &)
assignment operator
const char Option_t
Definition: RtypesCore.h:62
Geometrical transformation package.
Definition: TGeoMatrix.h:38
TGeoPhysicalNode * fNode
#define BIT(n)
Definition: Rtypes.h:78
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:48
Matrix class used for computing global transformations Should NOT be used for node definition...
Definition: TGeoMatrix.h:408
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TGeoHMatrix * fMatrixOrig
TObjArray * fMatrices
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:694
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:320
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
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)
Int_t GetLevel() const
virtual ~TGeoPNEntry()
Destructor.
The knowledge of the path to the objects that need to be misaligned is essential since there is no ot...
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
Physical nodes are the actual 'touchable' objects in the geometry, representing a path of positioned ...
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Definition: TNamed.cxx:51
Base abstract class for all shapes.
Definition: TGeoShape.h:25
const TGeoHMatrix * GetMatrix() const
void SetMatrix(const TGeoHMatrix *matrix)
Set the additional matrix for this node entry.
Bool_t IsAligned() const
virtual ~TGeoPhysicalNode()
Destructor.
TGeoPhysicalNode * GetPhysicalNode() const
TGeoVolume * GetVolume(Int_t level=-1) const
Return volume associated with node at LEVEL in the branch.
TGeoHMatrix * GetOriginalMatrix() const
void Draw(Option_t *option="")
Draw this node.
TGeoNode * GetMother(Int_t levup=1) const
Return parent at LEVUP generation.
const Bool_t kFALSE
Definition: RtypesCore.h:88
TGeoNode * GetNode(Int_t level=-1) const
Return node in branch at LEVEL. If not specified, return last leaf.
TGeoHMatrix * GetGlobalOrig() const
TGeoPNEntry()
Default constructor.
double Double_t
Definition: RtypesCore.h:55
void SetIsVolAtt(Bool_t flag=kTRUE)
TObjArray * fNodes
TGeoHMatrix * GetMatrixOrig() const
Class providing navigation API for TGeo geometries.
Definition: TGeoNavigator.h:33
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:39
void SetVisibleFull(Bool_t flag=kTRUE)
TGeoShape * GetShape(Int_t level=-1) const
Return shape associated with volume.
Bool_t IsVisible() const
void SetBranchAsState()
Set node branch according to current state.
const Bool_t kTRUE
Definition: RtypesCore.h:87
Line Attributes class.
Definition: TAttLine.h:18
TGeoPNEntry & operator=(const TGeoPNEntry &pne)
Bool_t IsVisibleFull() const
Bool_t IsMatchingState(TGeoNavigator *nav) const
Checks if a given navigator state matches this physical node.
const TGeoHMatrix * fMatrix