ROOT  6.06/09
Reference Guide
TVolumePosition.h
Go to the documentation of this file.
1 // @(#)root/table:$Id$
2 // Author: Valery Fine(fine@bnl.gov) 25/12/98
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 //////////////////////////////////////////////////////////////////////////
13 // //
14 // TVolumePosition //
15 // //
16 // Description of parameters to position a 3-D geometry object //
17 // //
18 //////////////////////////////////////////////////////////////////////////
19 
20 #ifndef ROOT_TVolumePosition
21 #define ROOT_TVolumePosition
22 
23 #include "TVolume.h"
24 
25 class TBrowser;
26 class TRotMatrix;
27 
28 class TVolumePosition : public TObject {
29 protected:
30  Double_t fX[3]; //X offset with respect to parent object
31  TRotMatrix *fMatrix; //Pointer to rotation matrix
32  TVolume *fNode; //Refs pointer to the node defined
33  UInt_t fId; // Unique ID of this position
34 
35 protected:
36  void DeleteOwnMatrix();
37 
38 public:
40  kIsOwn = BIT(23) // if the TVolumePoistion doesn't own the TRotMatrix object
41  };
42  TVolumePosition(TVolume *node=0,Double_t x=0, Double_t y=0, Double_t z=0, TRotMatrix *matrix=0);
43  TVolumePosition(TVolume *node,Double_t x, Double_t y, Double_t z, const char *matrixname);
44  TVolumePosition(const TVolumePosition* oldPosition, const TVolumePosition* curPosition);
46  virtual ~TVolumePosition();
47  virtual void Browse(TBrowser *b);
48  virtual Float_t *Errmx2Local (const Float_t *masterError, Float_t *localError ) const;
49  virtual Double_t *Errmx2Local (const Double_t *masterError, Double_t *localError) const;
50  virtual Float_t *Errmx2Master(const Float_t *localError, Float_t *masterError ) const;
51  virtual Double_t *Errmx2Master(const Double_t *localError, Double_t *masterError) const;
52  virtual Double_t *Cormx2Local (const Double_t *masterCorr, Double_t *localCorr ) const;
53  virtual Float_t *Cormx2Local (const Float_t *masterCorr, Float_t *localCorr ) const;
54  virtual Double_t *Cormx2Master(const Double_t *localCorr, Double_t *masterCorr ) const;
55  virtual Float_t *Cormx2Master(const Float_t *localCorr, Float_t *masterCorr ) const;
56  virtual Double_t *Master2Local(const Double_t *master, Double_t *local,Int_t nPoints=1) const;
57  virtual Float_t *Master2Local(const Float_t *master, Float_t *local,Int_t nPoints=1) const;
58 
59  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
60  virtual TDataSet *DefineSet();
61  virtual void Draw(Option_t *depth="3"); // *MENU*
62  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
63  virtual TVolume *GetNode() const {return fNode;}
64  virtual char *GetObjectInfo(Int_t px, Int_t py) const;
65  const Option_t *GetOption() const { return GetNode()?GetNode()->GetOption():0;}
66  virtual const Char_t *GetName() const;
67  const TRotMatrix *GetMatrix() const;
69 
70  Int_t GetVisibility() const {return GetNode()?GetNode()->GetVisibility():0;}
71  virtual Double_t GetX(Int_t indx=0) const {return fX[indx];}
72  virtual const Double_t *GetXYZ() const {return fX;}
73  virtual Double_t GetY() const {return fX[1];}
74  virtual Double_t GetZ() const {return fX[2];}
75  virtual UInt_t GetId() const {return fId;}
76  Bool_t IsMatrixOwner() const;
77  Bool_t SetMatrixOwner(Bool_t ownerShips=kTRUE);
78  Bool_t IsFolder() const {return GetNode()?kTRUE:kFALSE;}
79  virtual Bool_t Is3D() const {return kTRUE;}
80  virtual Double_t *Local2Master(const Double_t *local, Double_t *master,Int_t nPoints=1) const;
81  virtual Float_t *Local2Master(const Float_t *local, Float_t *master,Int_t nPoints=1) const;
82  virtual TVolumePosition &Mult(const TVolumePosition &position);
83  virtual void Paint(Option_t *option="");
84  virtual void Print(Option_t *option="") const;
85  virtual void UpdatePosition(Option_t *option="");
86  virtual TVolumePosition *Reset(TVolume *node=0,Double_t x=0, Double_t y=0, Double_t z=0, TRotMatrix *matrix=0);
87  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
88  virtual void SetLineAttributes(); // *MENU*
89  virtual void SetMatrix(TRotMatrix *matrix=0);
90  virtual void SetNode(TVolume *node){ fNode = node;}
91  virtual void SetPosition( Double_t x=0, Double_t y=0, Double_t z=0) {fX[0]=x; fX[1]=y; fX[2]=z;}
92  virtual void SetVisibility(Int_t vis=1); // *MENU*
93  virtual void SetX(Double_t x){ fX[0] = x;}
94  virtual void SetY(Double_t y){ fX[1] = y;}
95  virtual void SetZ(Double_t z){ fX[2] = z;}
96  virtual void SetXYZ(Double_t *xyz = 0);
97  virtual void SetId(UInt_t id){fId = id;}
99  ClassDef(TVolumePosition,2) //Description of parameters to position a 3-D geometry object
100 };
101 
102 //______________________________________________________________________________
104 //______________________________________________________________________________
106 {
107  if (IsMatrixOwner()) {
108  TRotMatrix *erasing = fMatrix;
109  fMatrix = 0;
110  delete erasing;
111  }
112 }
113 //______________________________________________________________________________
115 { return fMatrix; }
116 //______________________________________________________________________________
118 { return fMatrix; }
119 //______________________________________________________________________________
121 {
122  Bool_t currentOwner = IsMatrixOwner();
123  SetBit(kIsOwn,ownerShips);
124  return currentOwner;
125 }
126 //______________________________________________________________________________
128 {
129  // Check whether this object owns the TRotMatrix (to be deleted for example)
130  // Note: This method is to be caleed from dtor.
131  // It is dangerous to make it virtual
132  return TestBit(kIsOwn);
133 }
134 //______________________________________________________________________________
136  if (this != &rhs) {
137  for (int i = 0; i < 3; i++) fX[i] = rhs.fX[i];
138  fMatrix = rhs.fMatrix;
139  fNode = rhs.fNode;
140  fId = rhs.fId;
141  }
142  return *this;
143 }
144 //______________________________________________________________________________
145 std::ostream& operator<<(std::ostream& s,const TVolumePosition &target);
146 #endif
Int_t GetVisibility() const
virtual const Double_t * GetXYZ() const
TRotMatrix * fMatrix
virtual void SetPosition(Double_t x=0, Double_t y=0, Double_t z=0)
virtual void Browse(TBrowser *b)
to be documented
Bool_t SetMatrixOwner(Bool_t ownerShips=kTRUE)
virtual TDataSet * DefineSet()
virtual void SetZ(Double_t z)
virtual Double_t GetY() const
virtual TVolume * GetNode() const
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
virtual void Draw(Option_t *depth="3")
*-*-*-*-*-*-*-*-*-*-*-*Draw Referenced node with current parameters*-*-*-* *-* ======================...
virtual UInt_t GetId() const
#define BIT(n)
Definition: Rtypes.h:120
virtual Double_t * Cormx2Master(const Double_t *localCorr, Double_t *masterCorr) const
to be documented
virtual Float_t * Errmx2Master(const Float_t *localError, Float_t *masterError) const
to be documented
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
*-*-*-*-*-*-*-*-*-*-*Compute distance from point px,py to a Node*-*-*-*-*-* *-* =====================...
const Option_t * GetOption() const
Definition: TVolume.h:84
Bool_t IsMatrixOwner() const
virtual Double_t GetZ() const
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
std::ostream & operator<<(std::ostream &s, const TVolumePosition &target)
to be documented
virtual void SetX(Double_t x)
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:732
Double_t fX[3]
virtual TVolumePosition & Mult(const TVolumePosition &position)
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
TVolumePosition & operator=(const TVolumePosition &rhs)
virtual void SetXYZ(Double_t *xyz=0)
to be documented
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
to be documented
virtual void SetY(Double_t y)
virtual Double_t * Local2Master(const Double_t *local, Double_t *master, Int_t nPoints=1) const
*-*-*-*-*Convert one point from local system to master reference system*-*-* *-* ====================...
const TRotMatrix * GetMatrix() const
virtual ~TVolumePosition()
to be documented
XFontStruct * id
Definition: TGX11.cxx:108
virtual void SetVisibility(Int_t vis=1)
to be documented
Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects)...
virtual Double_t * Cormx2Local(const Double_t *masterCorr, Double_t *localCorr) const
to be documented
char * out
Definition: TBase64.cxx:29
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:41
virtual char * GetObjectInfo(Int_t px, Int_t py) const
to be documented
virtual void SetLineAttributes()
to be documented
Manages a detector rotation matrix.
Definition: TRotMatrix.h:30
virtual void SetMatrix(TRotMatrix *matrix=0)
to be documented
TVolumePosition(TVolume *node=0, Double_t x=0, Double_t y=0, Double_t z=0, TRotMatrix *matrix=0)
*-*-*-*-*-*-*-*-*-*-*Node normal constructor*-*-*-*-*-*-*-*-*-*-* *-* ===============================...
virtual void UpdatePosition(Option_t *option="")
to be documented
unsigned int UInt_t
Definition: RtypesCore.h:42
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:173
const Option_t * GetOption() const
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
*-*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-* *-* ===========================...
virtual void SetNode(TVolume *node)
virtual Double_t GetX(Int_t indx=0) const
virtual TVolumePosition * Reset(TVolume *node=0, Double_t x=0, Double_t y=0, Double_t z=0, TRotMatrix *matrix=0)
*-*-*-*-*-*-*-*-*-*-*-*-*-*-* Reset this position *-*-*-*-*-*-*-*-*-*-* *-* =================== *-* x...
virtual Double_t * Master2Local(const Double_t *master, Double_t *local, Int_t nPoints=1) const
*-*-*-*-*Convert one point from master system to local reference system*-*-* *-* ====================...
virtual void SetId(UInt_t id)
virtual ENodeSEEN GetVisibility() const
Definition: TVolume.h:88
double Double_t
Definition: RtypesCore.h:55
Double_t y[n]
Definition: legend1.C:17
virtual Bool_t Is3D() const
Mother of all ROOT objects.
Definition: TObject.h:58
char Char_t
Definition: RtypesCore.h:29
virtual Float_t * Errmx2Local(const Float_t *masterError, Float_t *localError) const
to be documented
virtual void Print(Option_t *option="") const
to be documented
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void Paint(Option_t *option="")
*-*-*-*-*-*-*-*-*-*-*-*Paint Referenced node with current parameters*-*-*-* *-* =====================...
virtual const Char_t * GetName() const
return VolumePosition name