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