excluding deprecated classes from build
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCConfMapPoint.cxx
CommitLineData
a6c02c85 1// @(#) $Id$
4aa41877 2// Original: AliHLTConfMapPoint.cxx,v 1.10 2005/06/23 17:46:55 hristov
a6c02c85 3
2a083ac4 4/**************************************************************************
9be2600f 5 * This file is property of and copyright by the ALICE HLT Project *
6 * ALICE Experiment at CERN, All rights reserved. *
2a083ac4 7 * *
9be2600f 8 * Primary Authors: Anders Vestbo, maintained by *
9 * Matthias Richter <Matthias.Richter@ift.uib.no> *
10 * for The ALICE HLT Project. *
2a083ac4 11 * *
12 * Permission to use, copy, modify and distribute this software and its *
13 * documentation strictly for non-commercial purposes is hereby granted *
14 * without fee, provided that the above copyright notice appears in all *
15 * copies and that both the copyright notice and this permission notice *
16 * appear in the supporting documentation. The authors make no claims *
17 * about the suitability of this software for any purpose. It is *
18 * provided "as is" without express or implied warranty. *
19 **************************************************************************/
20
21/** @file AliHLTTPCConfMapPoint.cxx
22 @author Anders Vestbo, maintained by Matthias Richter
23 @date
24 @brief Hit class for conformal mapper
25*/
a6c02c85 26
055fed30 27#include <cassert>
a6c02c85 28#include "AliHLTTPCLogging.h"
29#include "AliHLTTPCConfMapPoint.h"
30#include "AliHLTTPCSpacePointData.h"
31#include "AliHLTTPCVertex.h"
32#include "AliHLTTPCConfMapTrack.h"
33
34/**
35<pre>
36//_____________________________________________________________
37// AliHLTTPCConfMapPoint
38//
39// Hit class for conformal mapper
86268ca8 40</pre>
a6c02c85 41*/
42
86268ca8 43/** ROOT macro for the implementation of ROOT specific class methods */
44ClassImp(AliHLTTPCConfMapPoint);
a6c02c85 45
46Bool_t AliHLTTPCConfMapPoint::fgDontMap=kFALSE;
47
48AliHLTTPCConfMapPoint::AliHLTTPCConfMapPoint()
e419b223 49 :
50 fHitNumber(-1),
51 fTrackNumber(0),
52 fNextHitNumber(0),
055fed30 53 fUsed(kFALSE),
e419b223 54 fPadrow(0),
55 fSector(0),
56 fx(0),
57 fy(0),
58 fz(0),
59 fxerr(0),
60 fyerr(0),
61 fzerr(0),
62 fWxy(0),
63 fWz(0),
64 fs(0),
65 fXt(0),
66 fYt(0),
67 fZt(0),
68 fXterr(0),
69 fYterr(0),
70 fZterr(0),
71 fXprime(0),
72 fYprime(0),
73 fXprimeerr(0),
74 fYprimeerr(0),
75 fXv(0),
76 fYv(0),
77 fZv(0),
78 fXverr(0),
79 fYverr(0),
80 fZverr(0),
81 fPhi(0),
82 fEta(0),
055fed30 83 fNextVolumeHit(NULL),
84 fNextRowHit(NULL),
85 fNextTrackHit(NULL),
e419b223 86 fPhiIndex(0),
87 fEtaIndex(0),
88 fXYChi2(0),
89 fSZChi2(0)
a6c02c85 90{
91 //Constructor
055fed30 92 fMCTrackID[0]=-1;
93 fMCTrackID[1]=-1;
94 fMCTrackID[2]=-1;
95}
96
97AliHLTTPCConfMapPoint::AliHLTTPCConfMapPoint(const AliHLTTPCConfMapPoint& src)
98 :
99 fHitNumber(src.fHitNumber),
100 fTrackNumber(src.fTrackNumber),
101 fNextHitNumber(src.fNextHitNumber),
102 fUsed(src.fUsed),
103 fPadrow(src.fPadrow),
104 fSector(src.fSector),
105 fx(src.fx),
106 fy(src.fy),
107 fz(src.fz),
108 fxerr(src.fxerr),
109 fyerr(src.fyerr),
110 fzerr(src.fzerr),
111 fWxy(src.fWxy),
112 fWz(src.fWz),
113 fs(src.fs),
114 fXt(src.fXt),
115 fYt(src.fYt),
116 fZt(src.fZt),
117 fXterr(src.fXterr),
118 fYterr(src.fYterr),
119 fZterr(src.fZterr),
120 fXprime(src.fXprime),
121 fYprime(src.fYprime),
122 fXprimeerr(src.fXprimeerr),
123 fYprimeerr(src.fYprimeerr),
124 fXv(src.fXv),
125 fYv(src.fYv),
126 fZv(src.fZv),
127 fXverr(src.fXverr),
128 fYverr(src.fYverr),
129 fZverr(src.fZverr),
130 fPhi(src.fPhi),
131 fEta(src.fEta),
132 fNextVolumeHit(src.fNextVolumeHit),
133 fNextRowHit(src.fNextRowHit),
134 fNextTrackHit(src.fNextTrackHit),
135 fPhiIndex(src.fPhiIndex),
136 fEtaIndex(src.fEtaIndex),
137 fXYChi2(src.fXYChi2),
138 fSZChi2(src.fSZChi2)
139{
140 //Copy Constructor
141 fMCTrackID[0]=src.fMCTrackID[0];
142 fMCTrackID[1]=src.fMCTrackID[1];
143 fMCTrackID[2]=src.fMCTrackID[2];
144}
145
146AliHLTTPCConfMapPoint& AliHLTTPCConfMapPoint::operator=(const AliHLTTPCConfMapPoint& src)
147{
fdd3cdda 148 if( &src ==this ) return *this;
149
055fed30 150 fHitNumber=src.fHitNumber;
151 fTrackNumber=src.fTrackNumber;
152 fNextHitNumber=src.fNextHitNumber;
153 fUsed=src.fUsed;
154 fPadrow=src.fPadrow;
155 fSector=src.fSector;
156 fx=src.fx;
157 fy=src.fy;
158 fz=src.fz;
159 fxerr=src.fxerr;
160 fyerr=src.fyerr;
161 fzerr=src.fzerr;
162 fWxy=src.fWxy;
163 fWz=src.fWz;
164 fs=src.fs;
165 fXt=src.fXt;
166 fYt=src.fYt;
167 fZt=src.fZt;
168 fXterr=src.fXterr;
169 fYterr=src.fYterr;
170 fZterr=src.fZterr;
171 fXprime=src.fXprime;
172 fYprime=src.fYprime;
173 fXprimeerr=src.fXprimeerr;
174 fYprimeerr=src.fYprimeerr;
175 fXv=src.fXv;
176 fYv=src.fYv;
177 fZv=src.fZv;
178 fXverr=src.fXverr;
179 fYverr=src.fYverr;
180 fZverr=src.fZverr;
181 fPhi=src.fPhi;
182 fEta=src.fEta;
183 fNextVolumeHit=src.fNextVolumeHit;
184 fNextRowHit=src.fNextRowHit;
185 fNextTrackHit=src.fNextTrackHit;
186 fPhiIndex=src.fPhiIndex;
187 fEtaIndex=src.fEtaIndex;
188 fXYChi2=src.fXYChi2;
189 fSZChi2=src.fSZChi2;
190 fMCTrackID[0]=src.fMCTrackID[0];
191 fMCTrackID[1]=src.fMCTrackID[1];
192 fMCTrackID[2]=src.fMCTrackID[2];
193
194 return *this;
a6c02c85 195}
196
197AliHLTTPCConfMapPoint::~AliHLTTPCConfMapPoint()
198{
199 // Destructor.
a6c02c85 200}
201
055fed30 202Bool_t AliHLTTPCConfMapPoint::Read(const AliHLTTPCSpacePointData& hit)
a6c02c85 203{
204 //read the hits
055fed30 205 SetHitNumber(hit.fID);
a371a266 206 SetPadRow(hit.fPadRow);
207 SetSector(hit.GetSlice());
055fed30 208 SetX(hit.fX);
209 SetY(hit.fY);
210 SetZ(hit.fZ);
211 SetXerr(sqrt(hit.fSigmaY2));
212 SetYerr(sqrt(hit.fSigmaY2));
213 SetZerr(sqrt(hit.fSigmaZ2));
a6c02c85 214 return kTRUE;
215}
216
217void AliHLTTPCConfMapPoint::Reset()
218{
219 //Reset this point.
220 SetUsage(kFALSE);
221 SetS(0);
055fed30 222 fNextRowHit = NULL;
223 fNextVolumeHit=NULL;
224 fNextTrackHit=NULL;
a6c02c85 225}
226
227void AliHLTTPCConfMapPoint::Setup(AliHLTTPCVertex *vertex)
228{
229 //Setup. Sets the vertex, conformal coordinates,
230 //and phi and eta of each hit.
231
232 SetIntPoint(vertex->GetX(), vertex->GetY(), vertex->GetZ(),
233 vertex->GetXErr(), vertex->GetYErr(), vertex->GetZErr());
234 SetShiftedCoord();
235 SetConfCoord();
236 // The angles are set properly if they are set after
237 // the interaction point and the shifted coordinates
238 SetAngles();
239 //SetDist(0., 0.);
240 return;
241}
242
243void AliHLTTPCConfMapPoint::SetIntPoint(Double_t inx, Double_t iny, Double_t inz,
244 Double_t inxerr, Double_t inyerr, Double_t inzerr)
245{
246 // Defines a new interaction point. This point is needed to calculate
247 // the conformal coordinates.
248
249 SetXt(inx);
250 SetYt(iny);
251 SetZt(inz);
252 SetXterr(inxerr);
253 SetYterr(inyerr);
254 SetZterr(inzerr);
255
256 return;
257}
258
259void AliHLTTPCConfMapPoint::SetAllCoord(const AliHLTTPCConfMapPoint *precedinghit)
260{
261 // Sets the interaction point, the shifted coordinates, and the conformal mapping coordinates.
262 // These values are calculated from the interaction point of the given cluster which should be a
263 // already found cluster on the same track.
264
265 if (this == precedinghit) {
266 SetIntPoint(precedinghit->GetX(), precedinghit->GetY(), precedinghit->GetZ(),
267 precedinghit->GetXerr(), precedinghit->GetYerr(), precedinghit->GetZerr());
268 }
269
270 else {
271 SetIntPoint(precedinghit->GetXt(), precedinghit->GetYt(), precedinghit->GetZt(),
272 precedinghit->GetXterr(), precedinghit->GetYterr(), precedinghit->GetZterr());
273 }
274
275 SetShiftedCoord();
276 SetConfCoord();
277
278 return;
279}
280
281void AliHLTTPCConfMapPoint::SetShiftedCoord()
282{
283 // Sets the coordinates with resepct to the given vertex point
284
285 SetXv(GetX() - fXt);
286 SetYv(GetY() - fYt);
287 SetZv(GetZ() - fZt);
288 /*
289 SetXverr(TMath::Sqrt(GetXerr()*GetXerr() + fXterr*fXterr));
290 SetYverr(TMath::Sqrt(GetYerr()*GetYerr() + fYterr*fYterr));
291 SetZverr(TMath::Sqrt(GetZerr()*GetZerr() + fZterr*fZterr));
292 */
293 return;
294}
295
296void AliHLTTPCConfMapPoint::SetConfCoord()
297{
298 // Calculates the conformal coordinates of one cluster.
299 // If the option "vertex_constraint" applies the interaction point is
300 // assumed to be at (0, 0, 0). Otherwise the function will use the
301 // interaction point specified by fXt and fYt.
302
303 if(fgDontMap){
304 fXprime = fx;
305 fYprime = fy;
306 fWxy = 0;
307 fs = 0; //track trajectory
308 fWz = 0;
309 return;
310 }
311
312 Double_t r2;
313 Double_t xyErrorScale = 1;
314 Double_t szErrorScale = 1;
315
316 if ((r2 = fXv*fXv + fYv*fYv))
317 {
318 fXprime = fXv / r2;
319 fYprime = -fYv / r2;
320
321 //set weights:
322 fWxy = r2*r2 / ((xyErrorScale*xyErrorScale)*((fxerr*fxerr)+(fyerr*fyerr)));
323 fs = 0; //track trajectory
324 fWz = (Double_t)(1./(szErrorScale*fzerr*fzerr));
325 } else {
326 fXprime = 0.;
327 fYprime = 0.;
328 fXprimeerr = 0.;
329 fYprimeerr = 0.;
330 fWxy = 0;
331 fWz = 0;
332 fs = 0;
333 }
334
335 return;
336}
337
338void AliHLTTPCConfMapPoint::SetAngles()
339{
340 // Calculates the angle phi and the pseudorapidity eta for each cluster.
341 /*
342 Double_t r = TMath::Sqrt(x*x + y*y);
343
344 fPhi = TMath::ATan2(y,x);
345 if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
346 fEta = 3.*z/(TMath::Abs(z)+2.*r);
347 return;
348 */
349 // Double_t r3dim = TMath::Sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
350 Double_t r3dim = sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
351 //Double_t r2dim = TMath::Sqrt(fXv*fXv + fYv*fYv);
352
353 /*if (r2dim == 0.) {
354 // If r2dim == 0 the pseudorapidity eta cannot be calculated (division by zero)!
355 // This can only happen if the point is lying on the z-axis and this should never be possible.
356 cerr << "The pseudorapidity eta cannot be calculated (division by zero)! Set to 1.e-10." << endl;
357 r2dim = 1.e-10;
358 }
359
360 if (fXv == 0.) {
361 fPhi = (fYv > 0.) ? TMath::Pi() / 2. : - TMath::Pi() / 2.;
362 }
363
364 else {
365 fPhi = (fXv > 0.) ? TMath::ASin(fYv/r2dim) : TMath::Pi() - TMath::ASin(fYv/r2dim);
366 }
367
368 if (fPhi < 0.) {
369 fPhi += 2. * TMath::Pi();
370 }
371 */
372 //fPhi = TMath::ATan2(y,x);
373 fPhi = atan2(fy,fx);
374 //if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
375
376 //fEta = 0.5 * TMath::Log((r3dim + fZv)/(r3dim - fZv));
377 fEta = 0.5 * log((r3dim + fZv)/(r3dim - fZv));
378 return;
379}
380
381/*
382AliHLTTPCConfMapTrack *AliHLTTPCConfMapPoint::GetTrack(TClonesArray *tracks) const
383{
384 // Returns the pointer to the track to which this hit belongs.
385
386 return (AliHLTTPCConfMapTrack*)tracks->At(this->GetTrackNumber());
387}
388*/