]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCConfMapPoint.cxx
doxygen warnings removed
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCConfMapPoint.cxx
1 // @(#) $Id$
2 // Original: AliHLTConfMapPoint.cxx,v 1.10 2005/06/23 17:46:55 hristov 
3
4 /**************************************************************************
5  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6  *                                                                        *
7  * Authors: Anders Vestbo                                                 *
8  *          Matthias Richter <Matthias.Richter@ift.uib.no>                *
9  *          for The ALICE Off-line Project.                               *
10  *                                                                        *
11  * Permission to use, copy, modify and distribute this software and its   *
12  * documentation strictly for non-commercial purposes is hereby granted   *
13  * without fee, provided that the above copyright notice appears in all   *
14  * copies and that both the copyright notice and this permission notice   *
15  * appear in the supporting documentation. The authors make no claims     *
16  * about the suitability of this software for any purpose. It is          *
17  * provided "as is" without express or implied warranty.                  *
18  **************************************************************************/
19
20 /** @file   AliHLTTPCConfMapPoint.cxx
21     @author Anders Vestbo, maintained by Matthias Richter
22     @date   
23     @brief  Hit class for conformal mapper
24 */
25
26 #include "AliHLTTPCLogging.h"
27 #include "AliHLTTPCConfMapPoint.h"
28 #include "AliHLTTPCSpacePointData.h"
29 #include "AliHLTTPCVertex.h"
30 #include "AliHLTTPCConfMapTrack.h"
31
32 /**
33 <pre>
34 //_____________________________________________________________
35 // AliHLTTPCConfMapPoint
36 //
37 // Hit class for conformal mapper
38 </pre>
39 */
40
41 /** ROOT macro for the implementation of ROOT specific class methods */
42 ClassImp(AliHLTTPCConfMapPoint);
43
44 Bool_t AliHLTTPCConfMapPoint::fgDontMap=kFALSE;
45
46 AliHLTTPCConfMapPoint::AliHLTTPCConfMapPoint()
47 {
48   //Constructor
49   
50   SetUsage(false);
51   SetHitNumber(-1);
52   SetX(0);
53   SetY(0);
54   SetZ(0);
55   SetXerr(0);
56   SetYerr(0);
57   SetZerr(0);
58
59   SetPhi(0.);
60   SetEta(0.);
61   
62   SetXprime(0.);
63   SetYprime(0.);
64   SetXprimeerr(0.);
65   SetYprimeerr(0.);
66   SetIntPoint(0., 0., 0., 0., 0., 0.);
67   SetShiftedCoord();
68   SetMCTrackID(0,0,0);
69 }
70
71 AliHLTTPCConfMapPoint::AliHLTTPCConfMapPoint(const AliHLTTPCConfMapPoint&)
72 {
73   // dummy copy constructor
74   //HLTFatal("copy constructor untested");
75 }
76
77 AliHLTTPCConfMapPoint& AliHLTTPCConfMapPoint::operator=(const AliHLTTPCConfMapPoint&)
78
79   // dummy assignment operator
80   //HLTFatal("assignment operator untested");
81   return *this;
82 }
83
84 AliHLTTPCConfMapPoint::~AliHLTTPCConfMapPoint()
85 {
86   // Destructor.
87 }
88
89 Bool_t AliHLTTPCConfMapPoint::ReadHits(AliHLTTPCSpacePointData* hits )
90 {
91   //read the hits
92   SetHitNumber(hits->fID);
93   SetPadRow(hits->fPadRow);
94   Int_t slice = (hits->fID>>25) & 0x7f;
95   SetSector(slice);
96   SetX(hits->fX);
97   SetY(hits->fY);
98   SetZ(hits->fZ);
99   SetXerr(sqrt(hits->fSigmaY2));
100   SetYerr(sqrt(hits->fSigmaY2));
101   SetZerr(sqrt(hits->fSigmaZ2));
102   return kTRUE;
103 }
104
105 void AliHLTTPCConfMapPoint::Reset()
106 {
107   //Reset this point.
108   SetUsage(kFALSE);
109   SetS(0);
110   fNextRowHit = 0;
111   fNextVolumeHit=0;
112   fNextTrackHit=0;
113 }
114
115 void AliHLTTPCConfMapPoint::Setup(AliHLTTPCVertex *vertex)
116 {
117   //Setup. Sets the vertex, conformal coordinates, 
118   //and phi and eta of each hit.
119   
120   SetIntPoint(vertex->GetX(),    vertex->GetY(),    vertex->GetZ(),
121               vertex->GetXErr(), vertex->GetYErr(), vertex->GetZErr());
122   SetShiftedCoord();
123   SetConfCoord();
124   // The angles are set properly if they are set after 
125   // the interaction point and the shifted coordinates
126   SetAngles();
127   //SetDist(0., 0.);
128   return;
129 }
130
131 void AliHLTTPCConfMapPoint::SetIntPoint(Double_t inx, Double_t iny, Double_t inz,
132                                     Double_t inxerr, Double_t inyerr, Double_t inzerr)
133 {
134   // Defines a new interaction point. This point is needed to calculate
135   // the conformal coordinates.
136
137   SetXt(inx);
138   SetYt(iny);
139   SetZt(inz);
140   SetXterr(inxerr);
141   SetYterr(inyerr);
142   SetZterr(inzerr);
143
144   return;
145 }
146
147 void AliHLTTPCConfMapPoint::SetAllCoord(const AliHLTTPCConfMapPoint *precedinghit)
148 {
149   // Sets the interaction point, the shifted coordinates, and the conformal mapping coordinates.
150   // These values are calculated from the interaction point of the given cluster which should be a
151   // already found cluster on the same track.
152
153   if (this == precedinghit) {
154     SetIntPoint(precedinghit->GetX(),    precedinghit->GetY(),    precedinghit->GetZ(),
155                 precedinghit->GetXerr(), precedinghit->GetYerr(), precedinghit->GetZerr());
156   }
157
158   else {
159     SetIntPoint(precedinghit->GetXt(),    precedinghit->GetYt(),    precedinghit->GetZt(),
160                 precedinghit->GetXterr(), precedinghit->GetYterr(), precedinghit->GetZterr());
161   }
162
163   SetShiftedCoord();
164   SetConfCoord();
165
166   return;
167 }
168
169 void AliHLTTPCConfMapPoint::SetShiftedCoord()
170 {
171   // Sets the coordinates with resepct to the given vertex point
172
173   SetXv(GetX() - fXt);
174   SetYv(GetY() - fYt);
175   SetZv(GetZ() - fZt);
176   /*
177   SetXverr(TMath::Sqrt(GetXerr()*GetXerr() + fXterr*fXterr));
178   SetYverr(TMath::Sqrt(GetYerr()*GetYerr() + fYterr*fYterr));
179   SetZverr(TMath::Sqrt(GetZerr()*GetZerr() + fZterr*fZterr));
180   */
181   return;
182 }
183
184 void AliHLTTPCConfMapPoint::SetConfCoord()
185 {
186   // Calculates the conformal coordinates of one cluster.
187   // If the option "vertex_constraint" applies the interaction point is
188   // assumed to be at (0, 0, 0). Otherwise the function will use the
189   // interaction point specified by fXt and fYt.
190
191   if(fgDontMap){
192     fXprime = fx;
193     fYprime = fy;
194     fWxy = 0;
195     fs = 0; //track trajectory
196     fWz = 0;
197     return;
198   }
199
200   Double_t r2;
201   Double_t xyErrorScale = 1;
202   Double_t szErrorScale = 1;
203
204   if ((r2 = fXv*fXv + fYv*fYv)) 
205     {
206       fXprime =  fXv / r2;
207       fYprime = -fYv / r2;
208       
209       //set weights:
210       fWxy = r2*r2 / ((xyErrorScale*xyErrorScale)*((fxerr*fxerr)+(fyerr*fyerr)));
211       fs = 0; //track trajectory
212       fWz = (Double_t)(1./(szErrorScale*fzerr*fzerr));
213     } else {
214     fXprime    = 0.;
215     fYprime    = 0.;
216     fXprimeerr = 0.;
217     fYprimeerr = 0.;
218     fWxy = 0;
219     fWz = 0;
220     fs = 0;
221   }
222
223   return;
224 }
225
226 void AliHLTTPCConfMapPoint::SetAngles()
227 {
228   // Calculates the angle phi and the pseudorapidity eta for each cluster.
229   /*
230   Double_t r = TMath::Sqrt(x*x + y*y);
231
232   fPhi = TMath::ATan2(y,x);
233   if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
234   fEta = 3.*z/(TMath::Abs(z)+2.*r);
235   return;
236   */
237   //  Double_t r3dim = TMath::Sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
238   Double_t r3dim = sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
239   //Double_t r2dim = TMath::Sqrt(fXv*fXv + fYv*fYv);
240
241   /*if (r2dim == 0.) {
242   // If r2dim == 0 the pseudorapidity eta cannot be calculated (division by zero)!
243   // This can only happen if the point is lying on the z-axis and this should never be possible.
244     cerr << "The pseudorapidity eta cannot be calculated (division by zero)! Set to 1.e-10." << endl;
245     r2dim = 1.e-10;
246   }
247
248   if (fXv == 0.) {
249     fPhi = (fYv > 0.) ? TMath::Pi() / 2. : - TMath::Pi() / 2.;
250   }
251
252   else {
253     fPhi = (fXv > 0.) ? TMath::ASin(fYv/r2dim) : TMath::Pi() - TMath::ASin(fYv/r2dim);
254   }
255
256   if (fPhi < 0.) {
257     fPhi += 2. * TMath::Pi();
258   }
259   */
260   //fPhi = TMath::ATan2(y,x);
261   fPhi = atan2(fy,fx);
262   //if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
263   
264   //fEta = 0.5 * TMath::Log((r3dim + fZv)/(r3dim - fZv));
265   fEta = 0.5 * log((r3dim + fZv)/(r3dim - fZv));
266   return;
267 }
268
269 /*
270 AliHLTTPCConfMapTrack *AliHLTTPCConfMapPoint::GetTrack(TClonesArray *tracks) const
271 {
272   // Returns the pointer to the track to which this hit belongs.
273   
274   return (AliHLTTPCConfMapTrack*)tracks->At(this->GetTrackNumber());
275 }
276 */