]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCModelTrack.cxx
cleanup (Gaute)
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCModelTrack.cxx
CommitLineData
a6c02c85 1// @(#) $Id$
4aa41877 2// Original: AliHLTModelTrack.cxx,v 1.18 2005/02/14 11:50:11 hristov
a6c02c85 3// Author: Anders Vestbo <mailto:vestbo$fi.uib.no>
4//*-- Copyright &copy ALICE HLT Group
5//_____________________________________________________________
6// AliHLTTPCModelTrack
7//
8//
9
10
a6c02c85 11#include "AliHLTTPCLogging.h"
12#include "AliHLTTPCTransform.h"
13#include "AliHLTTPCVertex.h"
14#include "AliHLTTPCDataCompressorHelper.h"
15
16#include "AliHLTTPCModelTrack.h"
17
18#if __GNUC__ >= 3
19using namespace std;
20#endif
21
22ClassImp(AliHLTTPCModelTrack)
23
e419b223 24AliHLTTPCModelTrack::AliHLTTPCModelTrack()
25 :
26 fClusterCharge(0),
27 fClusters(0),
28 fTrackModel(0),
29 fNClusters(0),
30 fMaxOverlaps(0),
31 fNoverlaps(0),
32 fOverlap(0),
33 fParSigmaY2(0),
34 fParSigmaZ2(0),
35 fCrossingAngle(0),
36 fPatch(0),
37 fArraysCreated(kFALSE),
38 fPad(0),
39 fTime(0)
a6c02c85 40{
41 // default constructor
a6c02c85 42}
43
e419b223 44AliHLTTPCModelTrack::AliHLTTPCModelTrack(const AliHLTTPCModelTrack&)
45 :
46 fClusterCharge(0),
47 fClusters(0),
48 fTrackModel(0),
49 fNClusters(0),
50 fMaxOverlaps(0),
51 fNoverlaps(0),
52 fOverlap(0),
53 fParSigmaY2(0),
54 fParSigmaZ2(0),
55 fCrossingAngle(0),
56 fPatch(0),
57 fArraysCreated(kFALSE),
58 fPad(0),
59 fTime(0)
60{
61 // dummy copy constructor
62}
a6c02c85 63
64AliHLTTPCModelTrack::~AliHLTTPCModelTrack()
65{
66 // destructor
67 DeleteArrays();
68}
69
70void AliHLTTPCModelTrack::DeleteArrays()
71{
72 // deletes all arrays
73 if(fClusters)
74 delete [] fClusters;
75 if(fPad)
76 delete [] fPad;
77 if(fTime)
78 delete [] fTime;
79 if(fCrossingAngle)
80 delete [] fCrossingAngle;
81 if(fParSigmaY2)
82 delete [] fParSigmaY2;
83 if(fParSigmaZ2)
84 delete [] fParSigmaZ2;
85 if(fTrackModel)
86 delete fTrackModel;
87 if(fNoverlaps)
88 delete [] fNoverlaps;
89 if(fOverlap)
90 {
91 for(Int_t i=0; i<AliHLTTPCTransform::GetNRows(fPatch); i++)
92 delete [] fOverlap[i];
93 delete [] fOverlap;
94 }
95 fArraysCreated=kFALSE;
96}
97
98void AliHLTTPCModelTrack::Init(Int_t /*slice*/,Int_t patch)
99{
100 // Initialization
101 if(fArraysCreated)
102 {
103 DeleteArrays();
104 }
105 fNClusters=AliHLTTPCTransform::GetNRows(patch);
106 fPatch=patch;
107 Int_t nrows = AliHLTTPCTransform::GetNRows(fPatch);
108 fClusters = new AliHLTTPCClusterModel[nrows];
109 fPad = new Float_t[nrows];
110 fTime = new Float_t[nrows];
111 fCrossingAngle = new Float_t[nrows];
112 fParSigmaY2 = new Float_t[nrows];
113 fParSigmaZ2 = new Float_t[nrows];
114 fTrackModel = new AliHLTTPCTrackModel;
115
116 fOverlap = new Int_t*[nrows];
117 fNoverlaps = new Int_t[nrows];
118 fMaxOverlaps = 5;
119
120 memset(fNoverlaps,0,nrows*sizeof(Int_t));
121 memset(fClusters,0,nrows*sizeof(AliHLTTPCClusterModel));
122 memset(fPad,0,nrows*sizeof(Float_t));
123 memset(fTime,0,nrows*sizeof(Float_t));
124 memset(fCrossingAngle,0,nrows*sizeof(Float_t));
125 memset(fParSigmaY2,0,nrows*sizeof(Float_t));
126 memset(fParSigmaZ2,0,nrows*sizeof(Float_t));
127 memset(fTrackModel,0,sizeof(AliHLTTPCTrackModel));
128 for(Int_t i=0; i<nrows; i++)
129 {
130 fOverlap[i] = new Int_t[fMaxOverlaps];
131 for(Int_t j=0; j<fMaxOverlaps; j++)
132 fOverlap[i][j]=-1;
133 fClusters[i].fSlice = -1;
134 }
135 fArraysCreated=kTRUE;
136}
137
138
139
140void AliHLTTPCModelTrack::CalculateClusterWidths(Int_t row,Bool_t parametrize)
141{
142 //Cluster widths
143
144 Float_t xyz[3];
145 Int_t sr,lr;
146 Int_t index = row - AliHLTTPCTransform::GetFirstRow(fPatch);
147 if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
148 {
149 cerr<<"AliHLTTPCModelTrack::CalculcateClusterWidths : Wrond index "<<index<<" row "<<row<<endl;
150 return;
151 }
152 Int_t patch = AliHLTTPCTransform::GetPatch(row);
153 AliHLTTPCTransform::Slice2Sector(0,row,sr,lr);
154 AliHLTTPCTransform::Raw2Local(xyz,sr,lr,GetPadHit(row),GetTimeHit(row));
155 fParSigmaY2[index] = AliHLTTPCTransform::GetParSigmaY2(row,xyz[2],GetCrossingAngleLUT(row));
156 fParSigmaZ2[index] = AliHLTTPCTransform::GetParSigmaZ2(row,xyz[2],GetTgl());
157
158 if(parametrize)
159 {
160 fParSigmaY2[index] = (fParSigmaY2[index] + (1./12)*pow(AliHLTTPCTransform::GetPadPitchWidth(patch),2) );
161 fParSigmaY2[index] *= 0.108;
162 if(patch<2)
163 fParSigmaY2[index] *= 2.07;
164
165 fParSigmaZ2[index] = (fParSigmaZ2[index] + (1./12)*pow(AliHLTTPCTransform::GetZWidth(),2) );
166 fParSigmaZ2[index] *= 0.169;
167 if(patch<2)
168 fParSigmaZ2[index] *= 1.77;
169 }
170
171 //convert to raw coordinates:
172 fParSigmaY2[index] /= pow(AliHLTTPCTransform::GetPadPitchWidth(patch),2);
173 fParSigmaZ2[index] /= pow(AliHLTTPCTransform::GetZWidth(),2);
174}
175
176void AliHLTTPCModelTrack::SetCluster(Int_t row,Float_t fpad,Float_t ftime,Float_t charge,
177 Float_t sigmaY2,Float_t sigmaZ2,Int_t npads)
178{
179 AliHLTTPCClusterModel *cl = GetClusterModel(row);
180
181 //First bit: Cluster is present or not
182 //Second bit: Cluster was set, meaning an fit attempt was done (if true)
183
184 cl->fPresent |= 0x2; //set second bit to true, because a fit attempt has been made
185
186 Int_t patch = AliHLTTPCTransform::GetPatch(row);
187 if(!charge || npads == 1)
188 {
189 cl->fPresent &= ~0x1; //set first bit to false
190 }
191 else
192 {
193 cl->fPresent|=0x1;//set first bit to true
194 cl->fDPad = (fpad - GetPadHit(row))/(AliHLTTPCDataCompressorHelper::GetXYResidualStep(row)/AliHLTTPCTransform::GetPadPitchWidth(patch));
195 cl->fDTime = (ftime - GetTimeHit(row))/(AliHLTTPCDataCompressorHelper::GetZResidualStep(row)/AliHLTTPCTransform::GetZWidth());
196 cl->fDCharge = charge;
197 if(sigmaY2==0 && sigmaZ2==0)
198 {
199 cl->fDSigmaY=0;//if width is zero, shape is not supposed to be written
200 cl->fDSigmaZ=0;
201 }
202 else
203 {
204 //cl->fDSigmaY2 = (sigmaY2 - GetParSigmaY2(row))/(pow(AliHLTTPCDataCompressorHelper::GetXYWidthStep(),2)/pow(AliHLTTPCTransform::GetPadPitchWidth(patch),2));
205 //cl->fDSigmaZ2 = (sigmaZ2 - GetParSigmaZ2(row))/(pow(AliHLTTPCDataCompressorHelper::GetZWidthStep(),2)/pow(AliHLTTPCTransform::GetZWidth(),2));
206 cl->fDSigmaY = (sqrt(sigmaY2) - sqrt(GetParSigmaY2(row)))/(AliHLTTPCDataCompressorHelper::GetXYWidthStep()/AliHLTTPCTransform::GetPadPitchWidth(patch));
207 cl->fDSigmaZ = (sqrt(sigmaZ2) - sqrt(GetParSigmaZ2(row)))/(AliHLTTPCDataCompressorHelper::GetZWidthStep()/AliHLTTPCTransform::GetZWidth());
208 }
209 cl->fNPads = npads;
210 }
211}
212
213
214void AliHLTTPCModelTrack::Set(AliHLTTPCTrack *tpt)
215{
216 // Sets track and does initialization
217 AliHLTTPCModelTrack *tr = (AliHLTTPCModelTrack*)tpt;
218 SetRowRange(tr->GetFirstRow(),tr->GetLastRow());
219 SetPhi0(tr->GetPhi0());
220 SetKappa(tr->GetKappa());
221 SetFirstPoint(tr->GetFirstPointX(),tr->GetFirstPointY(),tr->GetFirstPointZ());
222 SetLastPoint(tr->GetLastPointX(),tr->GetLastPointY(),tr->GetLastPointZ());
223 SetPt(tr->GetPt());
224 SetPsi(tr->GetPsi());
225 SetTgl(tr->GetTgl());
226 SetCharge(tr->GetCharge());
227
228 if(fClusters)
229 {
230 cerr<<"AliHLTTPCModelTrack::Set : Init has already been called for this object!"<<endl;
231 return;
232 }
233
234 //Init(tr->fSlice,tr->fPatch);
235 Init(0,tr->fPatch);
236 memcpy(fClusters,tr->fClusters,AliHLTTPCTransform::GetNRows(fPatch)*sizeof(AliHLTTPCClusterModel));
237 memcpy(fPad,tr->fPad,AliHLTTPCTransform::GetNRows(fPatch)*sizeof(Float_t));
238 memcpy(fTime,tr->fTime,AliHLTTPCTransform::GetNRows(fPatch)*sizeof(Float_t));
239 memcpy(fParSigmaY2,tr->fParSigmaY2,AliHLTTPCTransform::GetNRows(fPatch)*sizeof(Float_t));
240 memcpy(fParSigmaZ2,tr->fParSigmaZ2,AliHLTTPCTransform::GetNRows(fPatch)*sizeof(Float_t));
241 memcpy(fCrossingAngle,tr->fCrossingAngle,AliHLTTPCTransform::GetNRows(fPatch)*sizeof(Float_t));
242 memcpy(fTrackModel,tr->fTrackModel,sizeof(AliHLTTPCTrackModel));
243
244}
245
246Int_t AliHLTTPCModelTrack::GetNPresentClusters()
247{
248 //Return the number of assigned clusters to the track.
249 //Differs from fNClusters, which should be equal to the
250 //number of padrows in the present patch.
251
252 Int_t count=0;
253
254 for(Int_t i=AliHLTTPCTransform::GetFirstRow(fPatch); i<=AliHLTTPCTransform::GetLastRow(fPatch); i++)
255 if(IsPresent(i))
256 count++;
257
258 return count;
259}
260
261void AliHLTTPCModelTrack::FillModel()
262{
263 //Fill the track structure
264
265 if(fNClusters != AliHLTTPCTransform::GetNRows(fPatch))
266 {
267 cout<<"AliHLTTPCModelTrack::FillModel : fNClusters != nrows; beware, this could be caused by a bug!!!"<<endl;
268 fNClusters = AliHLTTPCTransform::GetNRows(fPatch);
269 }
270
271 if(!fTrackModel)
272 {
273 cerr<<"AliHLTTPCModelTrack::FillModel() : No trackmodel "<<endl;
274 return;
275 }
276 Double_t impact[3];
277 AliHLTTPCVertex vertex;
278 CalculateHelix();
279 GetClosestPoint(&vertex,impact[0],impact[1],impact[2]);
280 fTrackModel->fKappa = GetKappa();
281 fTrackModel->fPhi = atan2(impact[1],impact[0]);
282 fTrackModel->fD = sqrt(impact[0]*impact[0] + impact[1]*impact[1]);
283 fTrackModel->fZ0 = impact[2];
284 fTrackModel->fTgl = GetTgl();
285
286 //We have to check on which of the vertex the track fit is lying
287 //This we need to encode the azimuthal angle coordinate of the center of curvature.
288 if(GetRadius() < sqrt(GetCenterX()*GetCenterX()+GetCenterY()*GetCenterY()))
289 fTrackModel->fD *=-1;
290
291}
292
293void AliHLTTPCModelTrack::FillTrack()
294{
295 //Fill the track parameters from the structure.
296
297 if(!fTrackModel)
298 {
299 cerr<<"AliHLTTPCModelTrack::FillTrack() : No data!!"<<endl;
300 return;
301 }
302 SetKappa(fTrackModel->fKappa);
303 Double_t impact[3],psi;
304 Float_t trackPhi0 = fTrackModel->fPhi;
305 if(fTrackModel->fD < 0)
306 trackPhi0 += AliHLTTPCTransform::Pi();
307 Int_t charge = -1*(Int_t)copysign(1.,GetKappa());
308 impact[0] = fabs(fTrackModel->fD)*cos(fTrackModel->fPhi);
309 impact[1] = fabs(fTrackModel->fD)*sin(fTrackModel->fPhi);
310 impact[2] = fTrackModel->fZ0;
311
312 psi = trackPhi0 - charge*0.5*AliHLTTPCTransform::Pi();
313 if(psi < 0)
314 psi += 2*AliHLTTPCTransform::Pi();
315
316 SetCharge(charge);
317 SetFirstPoint(impact[0],impact[1],impact[2]);
318 SetPsi(psi);
319 SetTgl(fTrackModel->fTgl);
320 SetPt((AliHLTTPCTransform::GetBFact()*AliHLTTPCTransform::GetBField())/fabs(GetKappa()));
321 fNClusters = AliHLTTPCTransform::GetNRows(fPatch);
322 CalculateHelix();
323
324 for(Int_t i=AliHLTTPCTransform::GetFirstRow(fPatch); i<=AliHLTTPCTransform::GetLastRow(fPatch); i++)
325 {
326 AliHLTTPCClusterModel *cl = GetClusterModel(i);
327 if(!cl) continue;
328
329 if(cl->fSlice == -1)
330 {
331 SetPadHit(i,-1);
332 SetTimeHit(i,-1);
333 continue;
334 }
335 if(cl->fSlice < 0 || cl->fSlice > 35)
336 {
337 cerr<<"AliHLTTPCModelTrack::FillTrack : Slice out of range "<<cl->fSlice<<" on row "<<i<<endl;
338 exit(5);
339 }
340
341 Float_t angle = 0;
342
343 AliHLTTPCTransform::Local2GlobalAngle(&angle,cl->fSlice);
344 if(!CalculateReferencePoint(angle,AliHLTTPCTransform::Row2X(i)))
345 {
346 if(IsPresent(i))
347 {
348 cerr<<"AliHLTTPCModelTrack::FillTrack : Track does not cross slice "<<cl->fSlice<<" row "<<i<<" Points "
349 <<GetPointX()<<" "<<GetPointY()<<" "<<GetPointZ()<<endl;
350 Print();
351 exit(5);
352 }
353 SetPadHit(i,-1);
354 SetTimeHit(i,-1);
355 continue;
356 }
357 Float_t hit[3] = {GetPointX(),GetPointY(),GetPointZ()};
358 Int_t sector,row;
359 AliHLTTPCTransform::Slice2Sector(cl->fSlice,i,sector,row);
360 AliHLTTPCTransform::Global2Raw(hit,sector,row);
361
362 SetPadHit(i,hit[1]);
363 SetTimeHit(i,hit[2]);
364
365 Float_t crossingangle = GetCrossingAngle(i,cl->fSlice);
366
367 SetCrossingAngleLUT(i,crossingangle);
368 CalculateClusterWidths(i,kTRUE);
369
370 }
371}
372
373void AliHLTTPCModelTrack::SetPadHit(Int_t row,Float_t pad)
374{
375 // sets pad hit
376 Int_t index = row-AliHLTTPCTransform::GetFirstRow(fPatch);
377 if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
378 {
379 cerr<<"AliHLTTPCModelTrack::SetPadHit() : Wrong index: "<<index<<endl;
380 return;
381 }
382 fPad[index]=pad;
383}
384
385void AliHLTTPCModelTrack::SetTimeHit(Int_t row,Float_t time)
386{
387 // sets time hit
388 Int_t index = row-AliHLTTPCTransform::GetFirstRow(fPatch);
389 if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
390 {
391 cerr<<"AliHLTTPCModelTrack::SetTimeHit() : Wrong index: "<<index<<endl;
392 return;
393 }
394 fTime[index]=time;
395}
396
397void AliHLTTPCModelTrack::SetCrossingAngleLUT(Int_t row,Float_t angle)
398{
399 // sets LUT for crossing angle
400 Int_t index = row-AliHLTTPCTransform::GetFirstRow(fPatch);
401 if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
402 {
403 cerr<<"AliHLTTPCModelTrack::SetCrossingAngle() : Wrong index: "<<index<<endl;
404 return;
405 }
406 fCrossingAngle[index]=angle;
407}
408
409void AliHLTTPCModelTrack::SetOverlap(Int_t row,Int_t id)
410{
411 // sets overlap
412 Int_t index = row-AliHLTTPCTransform::GetFirstRow(fPatch);
413 if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
414 {
415 cerr<<"AliHLTTPCModelTrack::SetOverlap() : Wrong index: "<<index<<endl;
416 return;
417 }
418 if(fNoverlaps[index] >= fMaxOverlaps) return;
419 fOverlap[index][fNoverlaps[index]++] = id;
420}
421
422Bool_t AliHLTTPCModelTrack::IsPresent(Int_t row)
423{
424 AliHLTTPCClusterModel *cl = GetClusterModel(row);
425 return (Bool_t)(cl->fPresent & 0x1);
426}
427
428Bool_t AliHLTTPCModelTrack::IsSet(Int_t row)
429{
430 // checks if row was set
431 AliHLTTPCClusterModel *cl = GetClusterModel(row);
432 return (Bool_t)(cl->fPresent & 0x2);
433}
434
435Int_t AliHLTTPCModelTrack::GetNPads(Int_t row)
436{
437 // gets number of pads
438 AliHLTTPCClusterModel *cl = GetClusterModel(row);
439 return cl->fNPads;
440}
441
442Bool_t AliHLTTPCModelTrack::GetPad(Int_t row,Float_t &pad)
443{
444 // gets pad
445 //(fpad - GetPadHit(row))/(AliHLTTPCDataCompressorHelper::GetXYResidualStep(row)/AliHLTTPCTransform::GetPadPitchWidth(patch));
446 AliHLTTPCClusterModel *cl = GetClusterModel(row);
447 Int_t patch = AliHLTTPCTransform::GetPatch(row);
448 pad = cl->fDPad*(AliHLTTPCDataCompressorHelper::GetXYResidualStep(row)/AliHLTTPCTransform::GetPadPitchWidth(patch)) + GetPadHit(row);
449 return IsPresent(row);
450}
451
452Bool_t AliHLTTPCModelTrack::GetTime(Int_t row,Float_t &time)
453{
454 // gets time
455 AliHLTTPCClusterModel *cl = GetClusterModel(row);
456 time = cl->fDTime*(AliHLTTPCDataCompressorHelper::GetZResidualStep(row)/AliHLTTPCTransform::GetZWidth()) + GetTimeHit(row);
457 return IsPresent(row);
458}
459
460Bool_t AliHLTTPCModelTrack::GetClusterCharge(Int_t row,Int_t &charge)
461{
462 // gets cluster's charge
463 AliHLTTPCClusterModel *cl = GetClusterModel(row);
464 charge = (Int_t)cl->fDCharge;// + AliHLTTPCDataCompressorHelperHelper::GetClusterCharge();
465 return IsPresent(row);
466}
467
468Bool_t AliHLTTPCModelTrack::GetSigmaY2(Int_t row,Float_t &sigma2)
469{
470 // gets SigmaY2
471 //cl->fDSigmaY = (sqrt(sigmaY2) - sqrt(GetParSigmaY2(row)))/(AliHLTTPCDataCompressorHelper::GetXYWidthStep()/AliHLTTPCTransform::GetPadPitchWidth(patch));
472 AliHLTTPCClusterModel *cl = GetClusterModel(row);
473 Int_t patch = AliHLTTPCTransform::GetPatch(row);
474 Float_t sigma = cl->fDSigmaY*(AliHLTTPCDataCompressorHelper::GetXYWidthStep()/AliHLTTPCTransform::GetPadPitchWidth(patch)) + sqrt(GetParSigmaY2(row));
475 sigma2 = sigma*sigma;
476 return IsPresent(row);
477}
478
479Bool_t AliHLTTPCModelTrack::GetSigmaZ2(Int_t row,Float_t &sigma2)
480{
481 // gets SigmaZ2
482 //cl->fDSigmaZ = (sqrt(sigmaZ2) - sqrt(GetParSigmaZ2(row)))/(AliHLTTPCDataCompressorHelper::GetZWidthStep()/AliHLTTPCTransform::GetZWidth());
483 AliHLTTPCClusterModel *cl = GetClusterModel(row);
484 Float_t sigma = cl->fDSigmaZ*(AliHLTTPCDataCompressorHelper::GetZWidthStep()/AliHLTTPCTransform::GetZWidth()) + sqrt(GetParSigmaZ2(row));
485 sigma2 = sigma*sigma;
486 return IsPresent(row);
487}
488
489Bool_t AliHLTTPCModelTrack::GetPadResidual(Int_t row,Float_t &res)
490{
491 // gets pad residual
492 AliHLTTPCClusterModel *cl = GetClusterModel(row);
493 Int_t patch = AliHLTTPCTransform::GetPatch(row);
494 res = cl->fDPad*(AliHLTTPCDataCompressorHelper::GetXYResidualStep(row)/AliHLTTPCTransform::GetPadPitchWidth(patch));
495 return IsPresent(row);
496}
497
498Bool_t AliHLTTPCModelTrack::GetTimeResidual(Int_t row,Float_t &res)
499{
500 // gets time residual
501 AliHLTTPCClusterModel *cl = GetClusterModel(row);
502 res = cl->fDTime*(AliHLTTPCDataCompressorHelper::GetZResidualStep(row)/AliHLTTPCTransform::GetZWidth());
503 return IsPresent(row);
504}
505
506Bool_t AliHLTTPCModelTrack::GetSigmaYResidual(Int_t row,Float_t &res)
507{
508 // gets SigmaY residual (?)
509 AliHLTTPCClusterModel *cl = GetClusterModel(row);
510 Int_t patch = AliHLTTPCTransform::GetPatch(row);
511 res = cl->fDSigmaY*(AliHLTTPCDataCompressorHelper::GetXYWidthStep()/AliHLTTPCTransform::GetPadPitchWidth(patch));
512 return IsPresent(row);
513}
514
515Bool_t AliHLTTPCModelTrack::GetSigmaZResidual(Int_t row,Float_t &res)
516{
517 // gets SigmaZ resigual (?)
518 AliHLTTPCClusterModel *cl = GetClusterModel(row);
519 res = cl->fDSigmaZ*(AliHLTTPCDataCompressorHelper::GetZWidthStep()/AliHLTTPCTransform::GetZWidth());
520 return IsPresent(row);
521}
522
523Int_t AliHLTTPCModelTrack::GetSlice(Int_t row)
524{
525 // Gets slice
526 AliHLTTPCClusterModel *cl = GetClusterModel(row);
527 return cl->fSlice;
528}
529
530Float_t AliHLTTPCModelTrack::GetPadHit(Int_t row)
531{
532 // Gets pad hit
533 Int_t index = row-AliHLTTPCTransform::GetFirstRow(fPatch);
534 if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
535 {
536 cerr<<"AliHLTTPCModelTrack::GetPadHit() : Wrong index: "<<index<<" row "<<row<<endl;
537 return 0;
538 }
539 return fPad[index];
540}
541
542Float_t AliHLTTPCModelTrack::GetTimeHit(Int_t row)
543{
544 // Gets time hit
545 Int_t index = row-AliHLTTPCTransform::GetFirstRow(fPatch);
546 if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
547 {
548 cerr<<"AliHLTTPCModelTrack::GetTimeHit() : Wrong index: "<<index<<" row "<<row<<endl;
549 return 0;
550 }
551 return fTime[index];
552}
553
554Float_t AliHLTTPCModelTrack::GetCrossingAngleLUT(Int_t row)
555{
556 // gets LUT for crossing angle
557 Int_t index = row-AliHLTTPCTransform::GetFirstRow(fPatch);
558 if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
559 {
560 cerr<<"AliHLTTPCModelTrack::GetCrossingAngleLUT() : Wrong index: "<<index<<" row "<<row<<endl;
561 return 0;
562 }
563 return fCrossingAngle[index];
564}
565
566Float_t AliHLTTPCModelTrack::GetParSigmaY2(Int_t row)
567{
568 // gets par SigmaY2 (?)
569 Int_t index = row-AliHLTTPCTransform::GetFirstRow(fPatch);
570 if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
571 {
572 cerr<<"AliHLTTPCModelTrack::GetParSigmaY2() : Wrong index: "<<index<<" row "<<row<<endl;
573 return 0;
574 }
575 return fParSigmaY2[index];
576}
577
578Float_t AliHLTTPCModelTrack::GetParSigmaZ2(Int_t row)
579{
580 // gets par SigmaZ2 (?)
581 Int_t index = row-AliHLTTPCTransform::GetFirstRow(fPatch);
582 if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
583 {
584 cerr<<"AliHLTTPCModelTrack::GetParSigmaZ2() : Wrong index: "<<index<<" row "<<row<<endl;
585 return 0;
586 }
587 return fParSigmaZ2[index];
588}
589
590Int_t AliHLTTPCModelTrack::GetNOverlaps(Int_t row)
591{
592 // gets number of overlaps
593 Int_t index = row - AliHLTTPCTransform::GetFirstRow(fPatch);
594 if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
595 {
596 cerr<<"AliHLTTPCModelTrack::GetOverlap() : Wrong index: "<<index<<endl;
597 return 0;
598 }
599 return fNoverlaps[index];
600}
601
602Int_t *AliHLTTPCModelTrack::GetOverlaps(Int_t row)
603{
604 // gets overlaps
605 Int_t index = row - AliHLTTPCTransform::GetFirstRow(fPatch);
606 if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
607 {
608 cerr<<"AliHLTTPCModelTrack::GetOverlap() : Wrong index: "<<index<<endl;
609 return 0;
610 }
611 return fOverlap[index];
612}
613
614AliHLTTPCClusterModel *AliHLTTPCModelTrack::GetClusterModel(Int_t row)
615{
616 // gets cluster model
617 if(!fClusters) return 0;
618 Int_t index = row-AliHLTTPCTransform::GetFirstRow(fPatch);
619 if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
620 {
621 cerr<<"AliHLTTPCModelTrack::GetClusterModel() : Wrong index: "<<index<<endl;
622 return 0;
623 }
624 return &fClusters[index];
625}
626
627void AliHLTTPCModelTrack::Print(Bool_t everything)
628{
629 //Print info
630
631 cout<<"First point "<<GetFirstPointX()<<" "<<GetFirstPointY()<<" "<<GetFirstPointZ()<<endl;
632 cout<<"Last point "<<GetLastPointX()<<" "<<GetLastPointY()<<" "<<GetLastPointZ()<<endl;
633 cout<<"Pt "<<GetPt()<<" kappa "<<GetKappa()<<" tgl "<<GetTgl()<<" psi "<<GetPsi()<<" charge "<<GetCharge()<<endl;
634 cout<<"Center "<<GetCenterX()<<" "<<GetCenterY()<<endl<<endl;
635 if(!everything)
636 return;
637 cout<<"NHits "<<GetNClusters()<<endl;
638
639 cout<<"Clusters:"<<endl;
640 Int_t origslice=-1,counter=0;
641 Float_t fpad,ftime,sigmaY2,sigmaZ2;
642 for(Int_t i=AliHLTTPCTransform::GetFirstRow(fPatch); i<=AliHLTTPCTransform::GetLastRow(fPatch); i++)
643 {
644 AliHLTTPCClusterModel *cl = GetClusterModel(i);
645
646 if(!IsPresent(i))
647 {
648 cout<<i<<" Empty"<<" Slice "<<cl->fSlice<<" Padcrossing "<<GetPadHit(i)<<" Timecrossing "<<GetTimeHit(i)<<" ";
649 //AliHLTTPCTransform::RawHLT2Global(xyz,cl->fSlice,i,GetPadHit(i),GetTimeHit(i));
650 //cout<<i<<" slice "<<cl->fSlice<<" x "<<xyz[0]<<" y "<<xyz[1]<<" z "<<xyz[2];
651 }
652 else
653 {
654 GetPad(i,fpad);
655 GetTime(i,ftime);
656 GetSigmaY2(i,sigmaY2);
657 GetSigmaZ2(i,sigmaZ2);
658 if(counter==0)
659 origslice=cl->fSlice;
660 else if(cl->fSlice != origslice)
661 cout<<"Change in slice "<<cl->fSlice<<" "<<origslice<<endl;
662 cout<<i<<" Slice "<<cl->fSlice<<" Dpad "<<cl->fDPad<<" Dtime "<<cl->fDTime<<" Dcharge "<<cl->fDCharge;
663 cout<<" sigmaY2 "<<sigmaY2<<" sigmaZ2 "<<sigmaZ2;
664 cout<<" parsigmaY2 "<<GetParSigmaY2(i)<<" parsigmaZ2 "<<GetParSigmaZ2(i);
665 cout<<" Pad "<<fpad<<" padhit "<<GetPadHit(i)<<" Time "<<ftime<<" timehit "<<GetTimeHit(i)<<" ";
666 counter++;
667 }
668 cout<<endl;
669 }
670}
671
672#ifdef do_mc
673void AliHLTTPCModelTrack::SetClusterLabel(Int_t row,Int_t *trackID)
674{
675 // sets cluster label
676 AliHLTTPCClusterModel *cl = GetClusterModel(row);
677 cl->fTrackID[0] = trackID[0];
678 cl->fTrackID[1] = trackID[1];
679 cl->fTrackID[2] = trackID[2];
680#else
681 void AliHLTTPCModelTrack::SetClusterLabel(Int_t /*row*/,Int_t */*trackID*/)
682{
683 // Does nothing if do_mc undefined
684 return;
685#endif
686}
687
688#ifdef do_mc
689void AliHLTTPCModelTrack::GetClusterLabel(Int_t row,Int_t *trackID)
690{
691 // gets cluster label
692 AliHLTTPCClusterModel *cl = GetClusterModel(row);
693 trackID[0] = cl->fTrackID[0];
694 trackID[1] = cl->fTrackID[1];
695 trackID[2] = cl->fTrackID[2];
696#else
697 void AliHLTTPCModelTrack::GetClusterLabel(Int_t /*row*/,Int_t */*trackID*/)
698{
699 // Does nothing if do_mc undefined
700 return;
701#endif
702}
703