Logo ROOT   6.16/01
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
25class TBrowser;
26class TRotMatrix;
27
28class TVolumePosition : public TObject {
29protected:
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
35protected:
36 void DeleteOwnMatrix();
37
38public:
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;
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//______________________________________________________________________________
145std::ostream& operator<<(std::ostream& s,const TVolumePosition &target);
146#endif
#define b(i)
Definition: RSha256.hxx:100
int Int_t
Definition: RtypesCore.h:41
char Char_t
Definition: RtypesCore.h:29
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
float Float_t
Definition: RtypesCore.h:53
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:324
#define BIT(n)
Definition: Rtypes.h:82
std::ostream & operator<<(std::ostream &s, const TVolumePosition &target)
to be documented
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
Mother of all ROOT objects.
Definition: TObject.h:37
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:694
Manages a detector rotation matrix.
Definition: TRotMatrix.h:28
virtual void UpdatePosition(Option_t *option="")
to be documented
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.
virtual Bool_t Is3D() const
Bool_t IsMatrixOwner() const
virtual Double_t GetZ() const
virtual char * GetObjectInfo(Int_t px, Int_t py) const
to be documented
virtual const Double_t * GetXYZ() const
virtual void SetMatrix(TRotMatrix *matrix=0)
to be documented
virtual void SetLineAttributes()
to be documented
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 ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
virtual const Char_t * GetName() const
return VolumePosition name
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a Node.
virtual TVolume * GetNode() const
virtual Double_t GetY() const
virtual Float_t * Errmx2Local(const Float_t *masterError, Float_t *localError) const
to be documented
virtual void SetX(Double_t x)
Int_t GetVisibility() const
virtual TDataSet * DefineSet()
virtual void Draw(Option_t *depth="3")
Draw Referenced node with current parameters.
virtual void SetPosition(Double_t x=0, Double_t y=0, Double_t z=0)
virtual Double_t GetX(Int_t indx=0) const
virtual void SetXYZ(Double_t *xyz=0)
to be documented
Bool_t SetMatrixOwner(Bool_t ownerShips=kTRUE)
TVolumePosition(TVolume *node=0, Double_t x=0, Double_t y=0, Double_t z=0, TRotMatrix *matrix=0)
Node normal constructor.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
to be documented
virtual void SetZ(Double_t z)
virtual void SetY(Double_t y)
virtual void Paint(Option_t *option="")
Paint Referenced node with current parameters.
virtual void Browse(TBrowser *b)
to be documented
virtual UInt_t GetId() const
Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Double_t fX[3]
virtual Double_t * Cormx2Master(const Double_t *localCorr, Double_t *masterCorr) const
to be documented
virtual TVolumePosition * Reset(TVolume *node=0, Double_t x=0, Double_t y=0, Double_t z=0, TRotMatrix *matrix=0)
Reset this position.
virtual void SetId(UInt_t id)
virtual Double_t * Cormx2Local(const Double_t *masterCorr, Double_t *localCorr) const
to be documented
virtual void Print(Option_t *option="") const
to be documented
virtual void SetNode(TVolume *node)
virtual Float_t * Errmx2Master(const Float_t *localError, Float_t *masterError) const
to be documented
TVolumePosition & operator=(const TVolumePosition &rhs)
const Option_t * GetOption() const
const TRotMatrix * GetMatrix() const
virtual ~TVolumePosition()
to be documented
virtual TVolumePosition & Mult(const TVolumePosition &position)
virtual void SetVisibility(Int_t vis=1)
to be documented
TRotMatrix * fMatrix
const Option_t * GetOption() const
Definition: TVolume.h:78
virtual ENodeSEEN GetVisibility() const
Definition: TVolume.h:82
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
static constexpr double s