]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCConfMapPoint.cxx
added new helper components to libAliHLTUtil (EsdCollector and AliHLTOUTPublisher...
[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{
148 fHitNumber=src.fHitNumber;
149 fTrackNumber=src.fTrackNumber;
150 fNextHitNumber=src.fNextHitNumber;
151 fUsed=src.fUsed;
152 fPadrow=src.fPadrow;
153 fSector=src.fSector;
154 fx=src.fx;
155 fy=src.fy;
156 fz=src.fz;
157 fxerr=src.fxerr;
158 fyerr=src.fyerr;
159 fzerr=src.fzerr;
160 fWxy=src.fWxy;
161 fWz=src.fWz;
162 fs=src.fs;
163 fXt=src.fXt;
164 fYt=src.fYt;
165 fZt=src.fZt;
166 fXterr=src.fXterr;
167 fYterr=src.fYterr;
168 fZterr=src.fZterr;
169 fXprime=src.fXprime;
170 fYprime=src.fYprime;
171 fXprimeerr=src.fXprimeerr;
172 fYprimeerr=src.fYprimeerr;
173 fXv=src.fXv;
174 fYv=src.fYv;
175 fZv=src.fZv;
176 fXverr=src.fXverr;
177 fYverr=src.fYverr;
178 fZverr=src.fZverr;
179 fPhi=src.fPhi;
180 fEta=src.fEta;
181 fNextVolumeHit=src.fNextVolumeHit;
182 fNextRowHit=src.fNextRowHit;
183 fNextTrackHit=src.fNextTrackHit;
184 fPhiIndex=src.fPhiIndex;
185 fEtaIndex=src.fEtaIndex;
186 fXYChi2=src.fXYChi2;
187 fSZChi2=src.fSZChi2;
188 fMCTrackID[0]=src.fMCTrackID[0];
189 fMCTrackID[1]=src.fMCTrackID[1];
190 fMCTrackID[2]=src.fMCTrackID[2];
191
192 return *this;
a6c02c85 193}
194
195AliHLTTPCConfMapPoint::~AliHLTTPCConfMapPoint()
196{
197 // Destructor.
a6c02c85 198}
199
055fed30 200Bool_t AliHLTTPCConfMapPoint::Read(const AliHLTTPCSpacePointData& hit)
a6c02c85 201{
202 //read the hits
055fed30 203 SetHitNumber(hit.fID);
204 SetPadRow(hit.fPadRow);
205 Int_t slice = (hit.fID>>25) & 0x7f;
a6c02c85 206 SetSector(slice);
055fed30 207 SetX(hit.fX);
208 SetY(hit.fY);
209 SetZ(hit.fZ);
210 SetXerr(sqrt(hit.fSigmaY2));
211 SetYerr(sqrt(hit.fSigmaY2));
212 SetZerr(sqrt(hit.fSigmaZ2));
a6c02c85 213 return kTRUE;
214}
215
216void AliHLTTPCConfMapPoint::Reset()
217{
218 //Reset this point.
219 SetUsage(kFALSE);
220 SetS(0);
055fed30 221 fNextRowHit = NULL;
222 fNextVolumeHit=NULL;
223 fNextTrackHit=NULL;
a6c02c85 224}
225
226void AliHLTTPCConfMapPoint::Setup(AliHLTTPCVertex *vertex)
227{
228 //Setup. Sets the vertex, conformal coordinates,
229 //and phi and eta of each hit.
230
231 SetIntPoint(vertex->GetX(), vertex->GetY(), vertex->GetZ(),
232 vertex->GetXErr(), vertex->GetYErr(), vertex->GetZErr());
233 SetShiftedCoord();
234 SetConfCoord();
235 // The angles are set properly if they are set after
236 // the interaction point and the shifted coordinates
237 SetAngles();
238 //SetDist(0., 0.);
239 return;
240}
241
242void AliHLTTPCConfMapPoint::SetIntPoint(Double_t inx, Double_t iny, Double_t inz,
243 Double_t inxerr, Double_t inyerr, Double_t inzerr)
244{
245 // Defines a new interaction point. This point is needed to calculate
246 // the conformal coordinates.
247
248 SetXt(inx);
249 SetYt(iny);
250 SetZt(inz);
251 SetXterr(inxerr);
252 SetYterr(inyerr);
253 SetZterr(inzerr);
254
255 return;
256}
257
258void AliHLTTPCConfMapPoint::SetAllCoord(const AliHLTTPCConfMapPoint *precedinghit)
259{
260 // Sets the interaction point, the shifted coordinates, and the conformal mapping coordinates.
261 // These values are calculated from the interaction point of the given cluster which should be a
262 // already found cluster on the same track.
263
264 if (this == precedinghit) {
265 SetIntPoint(precedinghit->GetX(), precedinghit->GetY(), precedinghit->GetZ(),
266 precedinghit->GetXerr(), precedinghit->GetYerr(), precedinghit->GetZerr());
267 }
268
269 else {
270 SetIntPoint(precedinghit->GetXt(), precedinghit->GetYt(), precedinghit->GetZt(),
271 precedinghit->GetXterr(), precedinghit->GetYterr(), precedinghit->GetZterr());
272 }
273
274 SetShiftedCoord();
275 SetConfCoord();
276
277 return;
278}
279
280void AliHLTTPCConfMapPoint::SetShiftedCoord()
281{
282 // Sets the coordinates with resepct to the given vertex point
283
284 SetXv(GetX() - fXt);
285 SetYv(GetY() - fYt);
286 SetZv(GetZ() - fZt);
287 /*
288 SetXverr(TMath::Sqrt(GetXerr()*GetXerr() + fXterr*fXterr));
289 SetYverr(TMath::Sqrt(GetYerr()*GetYerr() + fYterr*fYterr));
290 SetZverr(TMath::Sqrt(GetZerr()*GetZerr() + fZterr*fZterr));
291 */
292 return;
293}
294
295void AliHLTTPCConfMapPoint::SetConfCoord()
296{
297 // Calculates the conformal coordinates of one cluster.
298 // If the option "vertex_constraint" applies the interaction point is
299 // assumed to be at (0, 0, 0). Otherwise the function will use the
300 // interaction point specified by fXt and fYt.
301
302 if(fgDontMap){
303 fXprime = fx;
304 fYprime = fy;
305 fWxy = 0;
306 fs = 0; //track trajectory
307 fWz = 0;
308 return;
309 }
310
311 Double_t r2;
312 Double_t xyErrorScale = 1;
313 Double_t szErrorScale = 1;
314
315 if ((r2 = fXv*fXv + fYv*fYv))
316 {
317 fXprime = fXv / r2;
318 fYprime = -fYv / r2;
319
320 //set weights:
321 fWxy = r2*r2 / ((xyErrorScale*xyErrorScale)*((fxerr*fxerr)+(fyerr*fyerr)));
322 fs = 0; //track trajectory
323 fWz = (Double_t)(1./(szErrorScale*fzerr*fzerr));
324 } else {
325 fXprime = 0.;
326 fYprime = 0.;
327 fXprimeerr = 0.;
328 fYprimeerr = 0.;
329 fWxy = 0;
330 fWz = 0;
331 fs = 0;
332 }
333
334 return;
335}
336
337void AliHLTTPCConfMapPoint::SetAngles()
338{
339 // Calculates the angle phi and the pseudorapidity eta for each cluster.
340 /*
341 Double_t r = TMath::Sqrt(x*x + y*y);
342
343 fPhi = TMath::ATan2(y,x);
344 if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
345 fEta = 3.*z/(TMath::Abs(z)+2.*r);
346 return;
347 */
348 // Double_t r3dim = TMath::Sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
349 Double_t r3dim = sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
350 //Double_t r2dim = TMath::Sqrt(fXv*fXv + fYv*fYv);
351
352 /*if (r2dim == 0.) {
353 // If r2dim == 0 the pseudorapidity eta cannot be calculated (division by zero)!
354 // This can only happen if the point is lying on the z-axis and this should never be possible.
355 cerr << "The pseudorapidity eta cannot be calculated (division by zero)! Set to 1.e-10." << endl;
356 r2dim = 1.e-10;
357 }
358
359 if (fXv == 0.) {
360 fPhi = (fYv > 0.) ? TMath::Pi() / 2. : - TMath::Pi() / 2.;
361 }
362
363 else {
364 fPhi = (fXv > 0.) ? TMath::ASin(fYv/r2dim) : TMath::Pi() - TMath::ASin(fYv/r2dim);
365 }
366
367 if (fPhi < 0.) {
368 fPhi += 2. * TMath::Pi();
369 }
370 */
371 //fPhi = TMath::ATan2(y,x);
372 fPhi = atan2(fy,fx);
373 //if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
374
375 //fEta = 0.5 * TMath::Log((r3dim + fZv)/(r3dim - fZv));
376 fEta = 0.5 * log((r3dim + fZv)/(r3dim - fZv));
377 return;
378}
379
380/*
381AliHLTTPCConfMapTrack *AliHLTTPCConfMapPoint::GetTrack(TClonesArray *tracks) const
382{
383 // Returns the pointer to the track to which this hit belongs.
384
385 return (AliHLTTPCConfMapTrack*)tracks->At(this->GetTrackNumber());
386}
387*/