]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RALICE/AliPosition.cxx
08-feb-2003 NvE Class AliSignal modified such that the maximum number of signal slots is
[u/mrichter/AliRoot.git] / RALICE / AliPosition.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 // $Id$
17
18 ///////////////////////////////////////////////////////////////////////////
19 // Class AliPosition
20 // Handling of positions in various reference frames.
21 //
22 // This class is meant to serve as a base class for ALICE objects
23 // that have a unique position in 3-dimensional space.
24 //
25 // Note :
26 // ------
27 // Positions (r), errors (e) and reference frames (f) are specified via
28 //
29 //    SetPosition(Float_t* r,TString f)
30 //    SetPositionErrors(Float_t* e,TString f)
31 //
32 // under the following conventions :
33 //
34 // f="car" ==> r in Cartesian coordinates   (x,y,z)
35 // f="sph" ==> r in Spherical coordinates   (r,theta,phi)
36 // f="cyl" ==> r in Cylindrical coordinates (rho,phi,z)
37 //
38 // All angles are in radians.
39 //
40 // Example :
41 // ---------
42 //
43 // AliPosition q;
44 // Float_t pos[3]={-1,25,7};
45 // Float_t err[3]={0.08,1.85,0.5};
46 // q.SetPosition(pos,"car");
47 // q.SetPositionErrors(pos,"car");
48 // Float_t loc[3],dloc[3];
49 // q.GetPosition(loc,"sph");
50 // q.GetPositionErrors(dloc,"sph");
51 //
52 //--- Author: Nick van Eijndhoven 06-feb-1999 UU-SAP Utrecht
53 //- Modified: NvE $Date$ UU-SAP Utrecht
54 ///////////////////////////////////////////////////////////////////////////
55
56 #include "AliPosition.h"
57  
58 ClassImp(AliPosition) // Class implementation to enable ROOT I/O
59  
60 AliPosition::AliPosition()
61 {
62 // Creation of an AliPosition object and initialisation of parameters
63 }
64 ///////////////////////////////////////////////////////////////////////////
65 AliPosition::~AliPosition()
66 {
67 // Destructor to delete dynamically allocated memory
68 }
69 ///////////////////////////////////////////////////////////////////////////
70 void AliPosition::SetPosition(Double_t* r,TString f)
71 {
72 // Store position according to reference frame f
73  SetVector(r,f);
74 }
75 ///////////////////////////////////////////////////////////////////////////
76 void AliPosition::GetPosition(Double_t* r,TString f)
77 {
78 // Provide position according to reference frame f
79  GetVector(r,f);
80 }
81 ///////////////////////////////////////////////////////////////////////////
82 void AliPosition::SetPosition(Float_t* r,TString f)
83 {
84 // Store position according to reference frame f
85  SetVector(r,f);
86 }
87 ///////////////////////////////////////////////////////////////////////////
88 void AliPosition::GetPosition(Float_t* r,TString f)
89 {
90 // Provide position according to reference frame f
91  GetVector(r,f);
92 }
93 ///////////////////////////////////////////////////////////////////////////
94 AliPosition& AliPosition::GetPosition()
95 {
96 // Provide position
97  return (*this);
98 }
99 ///////////////////////////////////////////////////////////////////////////
100 void AliPosition::SetPosition(Ali3Vector& r)
101 {
102 // Set position
103  Double_t a[3];
104  r.GetVector(a,"sph");
105  SetVector(a,"sph");
106  r.GetErrors(a,"car");
107  SetErrors(a,"car");
108 }
109 ///////////////////////////////////////////////////////////////////////////
110 void AliPosition::SetPositionErrors(Double_t* r,TString f)
111 {
112 // Store position errors according to reference frame f
113  SetErrors(r,f);
114 }
115 ///////////////////////////////////////////////////////////////////////////
116 void AliPosition::GetPositionErrors(Double_t* r,TString f)
117 {
118 // Provide position errors according to reference frame f
119  GetErrors(r,f);
120 }
121 ///////////////////////////////////////////////////////////////////////////
122 void AliPosition::SetPositionErrors(Float_t* r,TString f)
123 {
124 // Store position errors according to reference frame f
125  SetErrors(r,f);
126 }
127 ///////////////////////////////////////////////////////////////////////////
128 void AliPosition::GetPositionErrors(Float_t* r,TString f)
129 {
130 // Provide position errors according to reference frame f
131  GetErrors(r,f);
132 }
133 ///////////////////////////////////////////////////////////////////////////
134 Double_t AliPosition::GetDistance(AliPosition& p)
135 {
136 // Provide distance to position p.
137 // The error on the result can be obtained as usual by invoking
138 // GetResultError() afterwards. 
139  Ali3Vector d=(Ali3Vector)((*this)-p);
140  Double_t dist=d.GetNorm();
141  fDresult=d.GetResultError();
142  return dist;
143 }
144 ///////////////////////////////////////////////////////////////////////////