ROOT  6.06/09
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 phisical node entry having a unique name //
106 // associated to a path. //
107 // //
108 ///////////////////////////////////////////////////////////////////////////////
109 
110 class TGeoPNEntry : public TNamed
111 {
112 private:
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;};
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 
void SetPhysicalNode(TGeoPhysicalNode *node)
Setter for the corresponding physical node.
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:52
virtual void Print(Option_t *option="") const
Print info about this node.
An array of TObjects.
Definition: TObjArray.h:39
Bool_t IsVolAttributes() const
const char * GetPath() const
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
TGeoPhysicalNode * fNode
#define BIT(n)
Definition: Rtypes.h:120
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
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:732
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
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)
ClassDef(TAttLine, 2)
Int_t GetLevel() const
virtual ~TGeoPNEntry()
Destructor.
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Definition: TNamed.cxx:40
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
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:173
void Draw(Option_t *option="")
Draw this node.
TGeoNode * GetMother(Int_t levup=1) const
Return parent at LEVUP generation.
TGeoNode * GetNode(Int_t level=-1) const
Return node in branch at LEVEL. If not specified, return last leaf.
TGeoHMatrix * GetGlobalOrig() const
double Double_t
Definition: RtypesCore.h:55
void SetIsVolAtt(Bool_t flag=kTRUE)
TObjArray * fNodes
TGeoHMatrix * GetMatrixOrig() const
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.
void SetVisibleFull(Bool_t flag=kTRUE)
#define NULL
Definition: Rtypes.h:82
const Bool_t kTRUE
Definition: Rtypes.h:91
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.
Line Attributes class.
Definition: TAttLine.h:32
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