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