]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITStrackerSA.cxx
misalignment-aware reconstruction. Standalone tracker (AliITStrackerSA) updated
[u/mrichter/AliRoot.git] / ITS / AliITStrackerSA.cxx
CommitLineData
13918578 1/**************************************************************************
2 * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
bf6adc12 16/* $Id$ */
17
13918578 18////////////////////////////////////////////////////
19// Stand alone tracker class //
20// Origin: Elisabetta Crescio //
21// e-mail: crescio@to.infn.it //
22// tracks are saved as AliITStrackV2 objects //
23////////////////////////////////////////////////////
24
aa4b78e1 25#include <stdlib.h>
bf6adc12 26
27#include <TArrayI.h>
13918578 28#include <TBranch.h>
13918578 29#include <TObjArray.h>
30#include <TTree.h>
bf6adc12 31
32#include "AliESD.h"
33#include "AliESDVertex.h"
34#include "AliESDtrack.h"
bf6adc12 35#include "AliITSVertexer.h"
13918578 36#include "AliITSclusterTable.h"
00a7cc50 37#include "AliITSRecPoint.h"
cc088660 38#include "AliITSgeomTGeo.h"
13918578 39#include "AliITStrackSA.h"
bf6adc12 40#include "AliITStrackerSA.h"
41#include "AliRun.h"
13918578 42
43ClassImp(AliITStrackerSA)
44
45//____________________________________________________________________________
e399f961 46AliITStrackerSA::AliITStrackerSA():AliITStrackerMI(),
47fPhiEstimate(0),
48fLambdac(0),
49fPhic(0),
50fCoef1(0),
51fCoef2(0),
52fCoef3(0),
53fNloop(0),
54fPhiWin(0),
55fLambdaWin(0),
56fVert(0),
57fVertexer(0),
e399f961 58fListOfTracks(0),
59fITSclusters(0),
60fSixPoints(0),
61fCluLayer(0),
62fCluCoord(0){
13918578 63 // Default constructor
64 Init();
627b6db6 65
13918578 66}
2257f27e 67//____________________________________________________________________________
cc088660 68AliITStrackerSA::AliITStrackerSA(const Char_t *geom):AliITStrackerMI(0),
e399f961 69fPhiEstimate(0),
70fLambdac(0),
71fPhic(0),
72fCoef1(0),
73fCoef2(0),
74fCoef3(0),
75fNloop(0),
76fPhiWin(0),
77fLambdaWin(0),
78fVert(0),
79fVertexer(0),
e399f961 80fListOfTracks(0),
81fITSclusters(0),
82fSixPoints(0),
83fCluLayer(0),
84fCluCoord(0)
2257f27e 85{
86 // Standard constructor (Vertex is known and passed to this obj.)
cc088660 87 if (geom) {
88 AliWarning("\"geom\" is actually a dummy argument !");
89 }
90
2257f27e 91 Init();
92 fVert = 0;
627b6db6 93
2257f27e 94}
95
13918578 96//____________________________________________________________________________
cc088660 97AliITStrackerSA::AliITStrackerSA(const Char_t *geom, AliESDVertex *vert):AliITStrackerMI(0),
e399f961 98fPhiEstimate(0),
99fLambdac(0),
100fPhic(0),
101fCoef1(0),
102fCoef2(0),
103fCoef3(0),
104fNloop(0),
105fPhiWin(0),
106fLambdaWin(0),
107fVert(vert),
108fVertexer(0),
e399f961 109fListOfTracks(0),
110fITSclusters(0),
111fSixPoints(0),
112fCluLayer(0),
113fCluCoord(0)
13918578 114{
115 // Standard constructor (Vertex is known and passed to this obj.)
cc088660 116 if (geom) {
117 AliWarning("\"geom\" is actually a dummy argument !");
118 }
13918578 119 Init();
627b6db6 120
13918578 121}
122
13918578 123//____________________________________________________________________________
cc088660 124AliITStrackerSA::AliITStrackerSA(const Char_t *geom, AliITSVertexer *vertexer):AliITStrackerMI(0),
e399f961 125fPhiEstimate(0),
126fLambdac(0),
127fPhic(0),
128fCoef1(0),
129fCoef2(0),
130fCoef3(0),
131fNloop(0),
132fPhiWin(0),
133fLambdaWin(0),
134fVert(),
135fVertexer(vertexer),
e399f961 136fListOfTracks(0),
137fITSclusters(0),
138fSixPoints(0),
139fCluLayer(0),
140fCluCoord(0)
13918578 141{
142 // Standard constructor (Vertex is unknown - vertexer is passed to this obj)
cc088660 143 if (geom) {
144 AliWarning("\"geom\" is actually a dummy argument !");
145 }
13918578 146 Init();
147 fVertexer = vertexer;
627b6db6 148
13918578 149}
150
151//____________________________________________________________________________
e399f961 152AliITStrackerSA::AliITStrackerSA(const AliITStrackerSA& tracker):AliITStrackerMI(),
153fPhiEstimate(tracker.fPhiEstimate),
154fLambdac(tracker.fLambdac),
155fPhic(tracker.fPhic),
156fCoef1(tracker.fCoef1),
157fCoef2(tracker.fCoef2),
158fCoef3(tracker.fCoef3),
159fNloop(tracker.fNloop),
160fPhiWin(tracker.fPhiWin),
161fLambdaWin(tracker.fLambdaWin),
162fVert(tracker.fVert),
163fVertexer(tracker.fVertexer),
e399f961 164fListOfTracks(tracker.fListOfTracks),
165fITSclusters(tracker.fITSclusters),
166fSixPoints(tracker.fSixPoints),
167fCluLayer(tracker.fCluLayer),
168fCluCoord(tracker.fCluCoord) {
13918578 169 // Copy constructor
13918578 170 for(Int_t i=0;i<2;i++){
171 fPoint1[i]=tracker.fPoint1[i];
172 fPoint2[i]=tracker.fPoint2[i];
173 fPoint3[i]=tracker.fPoint3[i];
174 fPointc[i]=tracker.fPointc[i];
175 }
13918578 176 if(tracker.fVertexer && tracker.fVert){
d681bb2d 177 fVert = new AliESDVertex(*tracker.fVert);
13918578 178 }
179 else {
180 fVert = tracker.fVert;
181 }
cc088660 182 for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++){
7e5bf5af 183 fCluLayer[i] = tracker.fCluLayer[i];
184 fCluCoord[i] = tracker.fCluCoord[i];
185 }
13918578 186}
7d62fb64 187//______________________________________________________________________
e399f961 188AliITStrackerSA& AliITStrackerSA::operator=(const AliITStrackerSA& source){
189 // Assignment operator.
190 this->~AliITStrackerSA();
191 new(this) AliITStrackerSA(source);
192 return *this;
193
7d62fb64 194}
13918578 195
196//____________________________________________________________________________
197AliITStrackerSA::~AliITStrackerSA(){
198 // destructor
d681bb2d 199 // if fVertexer is not null, the AliESDVertex obj. is owned by this class
13918578 200 // and is deleted here
201 if(fVertexer){
202 if(fVert)delete fVert;
203 }
204 fVert = 0;
205 fVertexer = 0;
7e5bf5af 206
13918578 207 if(fPhiWin)delete []fPhiWin;
208 if(fLambdaWin)delete []fLambdaWin;
4e05ab9a 209 fListOfTracks->Delete();
7e5bf5af 210 if(fCluLayer){
cc088660 211 for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++){
7e5bf5af 212 if(fCluLayer[i]){
213 fCluLayer[i]->Delete();
214 delete fCluLayer[i];
215 }
216 }
217 delete [] fCluLayer;
218 }
219 if(fCluCoord){
cc088660 220 for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++){
7e5bf5af 221 if(fCluCoord[i]){
222 fCluCoord[i]->Delete();
223 delete fCluCoord[i];
224 }
225 }
226 delete [] fCluCoord;
627b6db6 227 }
7e5bf5af 228
7e5bf5af 229}
13918578 230
231//____________________________________________________________________________
232void AliITStrackerSA::Init(){
233 // Reset all data members
234 fPhiEstimate=0;
235 for(Int_t i=0;i<3;i++){fPoint1[i]=0;fPoint2[i]=0;fPoint3[i]=0;}
236 fLambdac=0;
237 fPhic=0;
238 fCoef1=0;
239 fCoef2=0;
240 fCoef3=0;
241 fPointc[0]=0;
242 fPointc[1]=0;
243 fVert = 0;
244 fVertexer = 0;
13918578 245 SetWindowSizes();
2257f27e 246 fITSclusters = 0;
247 SetSixPoints();
4e05ab9a 248 fListOfTracks=new TObjArray(0,0);
7e5bf5af 249 fCluLayer = 0;
250 fCluCoord = 0;
627b6db6 251 }
13918578 252//_______________________________________________________________________
253void AliITStrackerSA::ResetForFinding(){
254 // Reset data members used in all loops during track finding
255 fPhiEstimate=0;
256 for(Int_t i=0;i<3;i++){fPoint1[i]=0;fPoint2[i]=0;fPoint3[i]=0;}
257 fLambdac=0;
258 fPhic=0;
259 fCoef1=0;
260 fCoef2=0;
261 fCoef3=0;
262 fPointc[0]=0;
263 fPointc[1]=0;
4e05ab9a 264 fListOfTracks->Delete();
13918578 265}
bef31448 266
7e5bf5af 267
2257f27e 268
bef31448 269//______________________________________________________________________
2257f27e 270Int_t AliITStrackerSA::FindTracks(AliESD* event){
bef31448 271
7e5bf5af 272// Track finder using the ESD object
273
2257f27e 274
7e5bf5af 275 //controllare numero cluster sui layer1 e 2 (morti?)
276 //non trova tracce...controllare..
4e05ab9a 277
2257f27e 278 if(!fITSclusters){
279 Fatal("FindTracks","ITS cluster tree is not accessed - Abort!!!\n Please use method SetClusterTree to pass the pointer to the tree\n");
280 return -1;
bef31448 281 }
7e5bf5af 282
283
284 //Reads event and mark clusters of traks already found, with flag kITSin
285 Int_t nentr=event->GetNumberOfTracks();
286 while (nentr--) {
287 AliESDtrack *track=event->GetTrack(nentr);
288 if (track->GetStatus()&AliESDtrack::kITSin==AliESDtrack::kITSin){
ef7253ac 289 Int_t idx[12];
7e5bf5af 290 Int_t ncl = track->GetITSclusters(idx);
291 for(Int_t k=0;k<ncl;k++){
00a7cc50 292 AliITSRecPoint* cll = (AliITSRecPoint*)GetCluster(idx[k]);
7e5bf5af 293 cll->SetBit(kSAflag);
294 }
295 }
296 }
297
298 Double_t primaryVertex[3];
299 event->GetVertex()->GetXYZ(primaryVertex);
300 //Creates TClonesArray with clusters for each layer. The clusters already used
301 //by AliITStrackerMI are not considered
302
303 Int_t nclusters[6]={0,0,0,0,0,0};
304 Int_t dmar[6]={0,0,0,0,0,0};
cc088660 305 fCluLayer = new TClonesArray*[AliITSgeomTGeo::GetNLayers()];
306 fCluCoord = new TClonesArray*[AliITSgeomTGeo::GetNLayers()];
7e5bf5af 307
cc088660 308 for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++){
7e5bf5af 309 AliITSlayer &layer=fgLayers[i];
310 for(Int_t cli=0;cli<layer.GetNumberOfClusters();cli++){
00a7cc50 311 AliITSRecPoint* cls = (AliITSRecPoint*)layer.GetCluster(cli);
7e5bf5af 312 if(cls->TestBit(kSAflag)==kTRUE) continue; //clusters used by TPC prol.
313 if(cls->GetQ()==0) continue; //fake clusters dead zones
314 nclusters[i]++;
315 }
316 dmar[i]=0;
00a7cc50 317 fCluLayer[i] = new TClonesArray("AliITSRecPoint",nclusters[i]);
7e5bf5af 318 fCluCoord[i] = new TClonesArray("AliITSclusterTable",nclusters[i]);
319 }
320
321
cc088660 322 Int_t * firstmod = new Int_t[AliITSgeomTGeo::GetNLayers()];
323 for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++){
324 firstmod[i]=AliITSgeomTGeo::GetModuleIndex(i+1,1,1);
7e5bf5af 325 }
326
cc088660 327 for(Int_t ilay=0;ilay<AliITSgeomTGeo::GetNLayers();ilay++){
7e5bf5af 328 TClonesArray &clulay = *fCluLayer[ilay];
329 TClonesArray &clucoo = *fCluCoord[ilay];
330 AliITSlayer &layer=fgLayers[ilay];
331 for(Int_t cli=0;cli<layer.GetNumberOfClusters();cli++){
00a7cc50 332 AliITSRecPoint* cls = (AliITSRecPoint*)layer.GetCluster(cli);
7e5bf5af 333 if(cls->TestBit(kSAflag)==kTRUE) continue;
334 if(cls->GetQ()==0) continue;
335 Double_t phi=0;Double_t lambda=0;
336 Float_t x=0;Float_t y=0;Float_t z=0;
337 Float_t sx=0;Float_t sy=0;Float_t sz=0;
cc088660 338 GetCoorAngles(cls,phi,lambda,x,y,z,primaryVertex);
339 GetCoorErrors(cls,sx,sy,sz);
00a7cc50 340 new (clulay[dmar[ilay]]) AliITSRecPoint(*cls);
7e5bf5af 341 new (clucoo[dmar[ilay]]) AliITSclusterTable(x,y,z,sx,sy,sz,phi,lambda,cli);
342 dmar[ilay]++;
343 }
344 }
345
2257f27e 346
347 //Get primary vertex
7e5bf5af 348
349 Int_t ntrack=0;
350 //loop on the different windows
351 for(Int_t nloop=0;nloop<fNloop;nloop++){
352 for(Int_t ncl=0;ncl<fCluLayer[0]->GetEntries();ncl++){ //loop starting from layer 0
353
354 ResetForFinding();
355 Int_t pflag=0;
356
00a7cc50 357 AliITSRecPoint* cl = (AliITSRecPoint*)fCluLayer[0]->At(ncl);
7e5bf5af 358
359 if(!cl) continue;
360
361
362 if (cl->GetQ()<=0) continue;
363
364 AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(0,ncl);
365 fPhic = arr->GetPhi();
366 fLambdac = arr->GetLambda();
367 if (TMath::Abs(fLambdac)>0.26*TMath::Pi()) continue;
368 fPhiEstimate = fPhic;
369 AliITStrackSA* trs = new AliITStrackSA();
370 fPoint1[0]=primaryVertex[0];
371 fPoint1[1]=primaryVertex[1];
372
373
374 fPoint2[0]=arr->GetX();
375 fPoint2[1]=arr->GetY();
cc088660 376 Int_t * nn = new Int_t[AliITSgeomTGeo::GetNLayers()];//counter for clusters on each layer
377 for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++){ nn[i]=0;}
7e5bf5af 378 nn[0] = SearchClusters(0,fPhiWin[nloop],fLambdaWin[nloop],trs,primaryVertex[2],pflag);
379
380 nn[1] = SearchClusters(1,fPhiWin[nloop],fLambdaWin[nloop],trs,primaryVertex[2],pflag);
bef31448 381 if(nn[1]>0){
382 pflag=1;
383 fPoint3[0] = fPointc[0];
384 fPoint3[1] = fPointc[1];
385 }
cfe729e0 386 nn[2] = SearchClusters(2,fPhiWin[nloop],fLambdaWin[nloop],trs,primaryVertex[2],pflag);
bef31448 387 if(nn[1]==0 && nn[2]==0) pflag=0;
388 if(nn[2]!=0 && nn[1]!=0){ pflag=1; UpdatePoints();}
389 if(nn[2]!=0 && nn[1]==0){
390 pflag=1;
391 fPoint3[0]=fPointc[0];
392 fPoint3[1]=fPointc[1];
393 }
13918578 394
cfe729e0 395 nn[3] = SearchClusters(3,fPhiWin[nloop],fLambdaWin[nloop],trs,primaryVertex[2],pflag);
bef31448 396 pflag=1;
397 if(nn[3]!=0) UpdatePoints();
cfe729e0 398 nn[4] = SearchClusters(4,fPhiWin[nloop],fLambdaWin[nloop],trs,primaryVertex[2],pflag);
bef31448 399 pflag=1;
400 if(nn[4]!=0) UpdatePoints();
cfe729e0 401 nn[5] = SearchClusters(5,fPhiWin[nloop],fLambdaWin[nloop],trs,primaryVertex[2],pflag);
bef31448 402
403
404 Int_t layOK=0;
405 Int_t numberofpoints;
2257f27e 406 if(fSixPoints) numberofpoints=6; //check of the candidate track
bef31448 407 else numberofpoints=5; //if track is good (with the required number
cc088660 408 for(Int_t nnp=0;nnp<AliITSgeomTGeo::GetNLayers();nnp++){ //of points) it is written on file
bef31448 409 if(nn[nnp]!=0) layOK+=1;
410 }
411 if(layOK>=numberofpoints){
7e5bf5af 412
413 AliITStrackV2* tr2 = FitTrack(trs,primaryVertex);
bef31448 414
7e5bf5af 415 if(tr2==0) continue;
416
bef31448 417 AliESDtrack outtrack;
418 outtrack.UpdateTrackParams(tr2,AliESDtrack::kITSin);
419 event->AddTrack(&outtrack);
bef31448 420 ntrack++;
7e5bf5af 421
bef31448 422 }
7e5bf5af 423
424
bef31448 425 delete trs;
2257f27e 426 delete[] nn;
627b6db6 427
7e5bf5af 428 }//end loop on clusters of layer1
627b6db6 429
7e5bf5af 430 //end loop2
431 }
bef31448 432
7e5bf5af 433 //if 5/6 points are required, second loop starting
434 //from second layer, to find tracks with point of
435 //layer 1 missing
bef31448 436
7e5bf5af 437 if(!fSixPoints){
438 // counter for clusters on each layer
cc088660 439 Int_t * nn = new Int_t[AliITSgeomTGeo::GetNLayers()-1];
7e5bf5af 440 for(Int_t nloop=0;nloop<fNloop;nloop++){
441 Int_t ncl2=fCluLayer[1]->GetEntries();
442 while(ncl2--){ //loop starting from layer 2
443 ResetForFinding();
444 Int_t pflag=0;
00a7cc50 445 AliITSRecPoint* cl = (AliITSRecPoint*)fCluLayer[1]->At(ncl2);
7e5bf5af 446
447 if(!cl) continue;
448 AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(1,ncl2);
449 fPhic = arr->GetPhi();
450 fLambdac = arr->GetLambda();
451 fPhiEstimate = fPhic;
452
453 AliITStrackSA* trs = new AliITStrackSA();
454 fPoint1[0]=primaryVertex[0];
455 fPoint1[1]=primaryVertex[1];
456
457 fPoint2[0]=arr->GetX();
458 fPoint2[1]=arr->GetY();
cc088660 459 for(Int_t kk=0;kk<AliITSgeomTGeo::GetNLayers()-1;kk++)nn[kk] = 0;
7e5bf5af 460 nn[0] = SearchClusters(1,fPhiWin[nloop],fLambdaWin[nloop],
461 trs,primaryVertex[2],pflag);
462 nn[1] = SearchClusters(2,fPhiWin[nloop],fLambdaWin[nloop],
463 trs,primaryVertex[2],pflag);
464 if(nn[1]!=0){
465 pflag=1;
466 fPoint3[0]=fPointc[0];
467 fPoint3[1]=fPointc[1];
468 }
469 nn[2]= SearchClusters(3,fPhiWin[nloop],fLambdaWin[nloop],
470 trs,primaryVertex[2],pflag);
471 if(nn[2]!=0){
472 pflag=1;
473 UpdatePoints();
474 }
475 nn[3]= SearchClusters(4,fPhiWin[nloop],fLambdaWin[nloop],
476 trs,primaryVertex[2],pflag);
477 if(nn[3]!=0){
478 pflag=1;
479 UpdatePoints();
480 }
481 nn[4]=SearchClusters(5,fPhiWin[nloop],fLambdaWin[nloop],
482 trs,primaryVertex[2],pflag);
483
484 Int_t fl=0;
cc088660 485 for(Int_t nnp=0;nnp<AliITSgeomTGeo::GetNLayers()-1;nnp++){
7e5bf5af 486 if(nn[nnp]!=0) fl+=1;
487 }
488 if(fl>=5){ // 5/6
489 AliITStrackV2* tr2 = FitTrack(trs,primaryVertex);
490 if(tr2==0){
491 continue;
492 }
493
494 AliESDtrack outtrack;
495 outtrack.UpdateTrackParams(tr2,AliESDtrack::kITSin);
496 event->AddTrack(&outtrack);
497 ntrack++;
498
499 }
500
501
bef31448 502 delete trs;
503 }//end loop on clusters of layer2
7e5bf5af 504 }
505
bef31448 506 delete [] nn;
507 } //end opt="5/6"
7e5bf5af 508
bef31448 509 delete [] firstmod;
bef31448 510 Info("FindTracks","Number of found tracks: %d",event->GetNumberOfTracks());
2257f27e 511 return 0;
bef31448 512
513}
7e5bf5af 514
515
516
2257f27e 517
518
13918578 519//________________________________________________________________________
520
7e5bf5af 521AliITStrackV2* AliITStrackerSA::FitTrack(AliITStrackSA* tr,Double_t *primaryVertex){
13918578 522 //fit of the found track
523
13918578 524
cc088660 525 Int_t * firstmod = new Int_t[AliITSgeomTGeo::GetNLayers()];
526 for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++){
527 firstmod[i]=AliITSgeomTGeo::GetModuleIndex(i+1,1,1);
13918578 528 }
15dd636f 529
13918578 530 Int_t nclusters = tr->GetNumberOfClustersSA();
cc088660 531 TObjArray** listlayer = new TObjArray*[AliITSgeomTGeo::GetNLayers()];
532 for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++){
13918578 533 listlayer[i] = new TObjArray(0,0);
534 }
535
536 TArrayI clind0(20);
537 TArrayI clind1(20);
538 TArrayI clind2(20);
539 TArrayI clind3(20);
540 TArrayI clind4(20);
541 TArrayI clind5(20);
542
7e5bf5af 543 TArrayI mark0(20);
544 TArrayI mark1(20);
545 TArrayI mark2(20);
546 TArrayI mark3(20);
547 TArrayI mark4(20);
548 TArrayI mark5(20);
549
550
cc088660 551 Int_t * nnn = new Int_t[AliITSgeomTGeo::GetNLayers()];
552 Int_t * kkk = new Int_t[AliITSgeomTGeo::GetNLayers()];
553 for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++) {nnn[i]=0;kkk[i]=0;}
13918578 554
555 for(Int_t ncl=0;ncl<nclusters;ncl++){
7e5bf5af 556 Int_t index = tr->GetClusterIndexSA(ncl);
00a7cc50 557 AliITSRecPoint* cl = (AliITSRecPoint*)GetCluster(index);
627b6db6 558 if(cl->TestBit(kSAflag)==kTRUE) cl->ResetBit(kSAflag);
13918578 559 Int_t lay = (index & 0xf0000000) >> 28;
560 if(lay==0) { listlayer[0]->AddLast(cl); clind0[nnn[0]]=index;nnn[0]++;}
561 if(lay==1) { listlayer[1]->AddLast(cl); clind1[nnn[1]]=index;nnn[1]++;}
562 if(lay==2) { listlayer[2]->AddLast(cl); clind2[nnn[2]]=index;nnn[2]++;}
563 if(lay==3) { listlayer[3]->AddLast(cl); clind3[nnn[3]]=index;nnn[3]++;}
564 if(lay==4) { listlayer[4]->AddLast(cl); clind4[nnn[4]]=index;nnn[4]++;}
565 if(lay==5) { listlayer[5]->AddLast(cl); clind5[nnn[5]]=index;nnn[5]++;}
566 }
037efb75 567 delete [] nnn;
13918578 568
cc088660 569 for(Int_t nlay=0;nlay<AliITSgeomTGeo::GetNLayers();nlay++){
7e5bf5af 570 for(Int_t ncl=0;ncl<tr->GetNumberOfMarked(nlay);ncl++){
571 Int_t mark = tr->GetClusterMark(nlay,ncl);
572 if(nlay==0) { mark0[kkk[0]]=mark;kkk[0]++;}
573 if(nlay==1) { mark1[kkk[1]]=mark;kkk[1]++;}
574 if(nlay==2) { mark2[kkk[2]]=mark;kkk[2]++;}
575 if(nlay==3) { mark3[kkk[3]]=mark;kkk[3]++;}
576 if(nlay==4) { mark4[kkk[4]]=mark;kkk[4]++;}
577 if(nlay==5) { mark5[kkk[5]]=mark;kkk[5]++;}
578
579 }
580 }
581
582 delete [] kkk;
583
13918578 584
cc088660 585 Int_t * end = new Int_t[AliITSgeomTGeo::GetNLayers()];
586 for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++){
13918578 587 if(listlayer[i]->GetEntries()==0) end[i]=1;
588 else end[i]=listlayer[i]->GetEntries();
589 }
590
7e5bf5af 591 TClonesArray* listSA = new TClonesArray("AliITStrackSA");
592 TClonesArray &tri = *listSA;
593 Int_t nlist=0;
594
595 if(end[0]==0) end[0]=1; //for tracks with cluster on layer 0 missing
13918578 596 for(Int_t l1=0;l1<end[0];l1++){//loop on layer 1
00a7cc50 597 AliITSRecPoint* cl0 = (AliITSRecPoint*)listlayer[0]->At(l1);
13918578 598 Double_t x1,y1,z1,sx1,sy1,sz1;
599 Double_t x2,y2,z2,sx2,sy2,sz2;
00a7cc50 600 AliITSRecPoint* p1=0;
601 AliITSRecPoint* p2=0;
bef31448 602 Int_t index1=clind0[l1];
603 Int_t index2=0;
7e5bf5af 604 Int_t mrk1 = mark0[l1];
605 Int_t mrk2 = 0;
606 Int_t lay1=0;
607 Int_t lay2=1;
608 Int_t module1=-1;
13918578 609 for(Int_t l2=0;l2<end[1];l2++){//loop on layer 2
00a7cc50 610 AliITSRecPoint* cl1 = (AliITSRecPoint*)listlayer[1]->At(l2);
bef31448 611 index2=clind1[l2];
7e5bf5af 612 mrk2 = mark1[l2];
13918578 613 for(Int_t l3=0;l3<end[2];l3++){ //loop on layer 3
00a7cc50 614 AliITSRecPoint* cl2 = (AliITSRecPoint*)listlayer[2]->At(l3);
bef31448 615
616 if(cl0==0 && cl1!=0) {
7e5bf5af 617 p2 = cl2;index1=clind2[l3];mrk1=mark2[l3];lay1=2;
bef31448 618 p1=cl1;
7e5bf5af 619 module1 = p1->GetDetectorIndex()+firstmod[1];
bef31448 620 }
621 if(cl0!=0 && cl1==0){
622 p1=cl0;
7e5bf5af 623 p2=cl2;index2=clind2[l3];mrk2=mark2[l3];lay2=2;
624 module1 = p1->GetDetectorIndex()+firstmod[0];
bef31448 625 }
626 if(cl0!=0 && cl1!=0){
627 p1=cl0;
628 p2=cl1;
7e5bf5af 629 module1 = p1->GetDetectorIndex()+firstmod[0];
bef31448 630 }
7e5bf5af 631
632 Int_t cln1=mrk1;
633 Int_t cln2=mrk2;
634 AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(lay1,cln1);
635 AliITSclusterTable* arr1= (AliITSclusterTable*)GetClusterCoord(lay2,cln2);
636 x1 = arr->GetX();
637 x2 = arr1->GetX();
638 y1 = arr->GetY();
639 y2 = arr1->GetY();
640 z1 = arr->GetZ();
641 z2 = arr1->GetZ();
642 sx1 = arr->GetSx();
643 sx2 = arr1->GetSx();
644 sy1 = arr->GetSy();
645 sy2 = arr1->GetSy();
646 sz1 = arr->GetSz();
647 sz2 = arr1->GetSz();
648
13918578 649 Int_t layer,ladder,detector;
cc088660 650 AliITSgeomTGeo::GetModuleId(module1,layer,ladder,detector);
bef31448 651 Float_t yclu1 = p1->GetY();
652 Float_t zclu1 = p1->GetZ();
653 Double_t cv=Curvature(primaryVertex[0],primaryVertex[1],x1,y1,x2,y2);
7e5bf5af 654
655 Double_t tgl2 = (z2-z1)/TMath::Sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
656 Double_t phi2 = TMath::ATan2((y2-y1),(x2-x1));
657
bef31448 658 for(Int_t l4=0;l4<end[3];l4++){ //loop on layer 4
00a7cc50 659 AliITSRecPoint* cl3 = (AliITSRecPoint*)listlayer[3]->At(l4);
bef31448 660 for(Int_t l5=0;l5<end[4];l5++){ //loop on layer 5
00a7cc50 661 AliITSRecPoint* cl4 = (AliITSRecPoint*)listlayer[4]->At(l5);
bef31448 662 for(Int_t l6=0;l6<end[5];l6++){ //loop on layer 6
00a7cc50 663 AliITSRecPoint* cl5 = (AliITSRecPoint*)listlayer[5]->At(l6);
cc088660 664 AliITStrackSA* trac = new AliITStrackSA(layer,ladder,detector,yclu1,zclu1,phi2,tgl2,cv,1);
bef31448 665
7e5bf5af 666 if(cl5!=0) {
667 trac->AddClusterV2(5,(clind5[l6] & 0x0fffffff)>>0);
668 trac->AddClusterMark(5,mark5[l6]);
669 }
670 if(cl4!=0){
671 trac->AddClusterV2(4,(clind4[l5] & 0x0fffffff)>>0);
672 trac->AddClusterMark(4,mark4[l5]);
673 }
674 if(cl3!=0){
675 trac->AddClusterV2(3,(clind3[l4] & 0x0fffffff)>>0);
676 trac->AddClusterMark(3,mark3[l4]);
677 }
678 if(cl2!=0){
679 trac->AddClusterV2(2,(clind2[l3] & 0x0fffffff)>>0);
680 trac->AddClusterMark(2,mark2[l3]);
681 }
682 if(cl1!=0){
683 trac->AddClusterV2(1,(clind1[l2] & 0x0fffffff)>>0);
684 trac->AddClusterMark(1,mark1[l2]);
685 }
686 if(cl0!=0){
687 trac->AddClusterV2(0,(clind0[l1] & 0x0fffffff)>>0);
688 trac->AddClusterMark(0,mark0[l1]);
689 }
e43c066c 690 //fit with Kalman filter using AliITStrackerMI::RefitAt()
bef31448 691
7e5bf5af 692
15dd636f 693 AliITStrackMI* ot = new AliITStrackSA(*trac);
bef31448 694
6c94f330 695 ot->ResetCovariance(10.);
bef31448 696 ot->ResetClusters();
697
698 if(RefitAt(49.,ot,trac)){ //fit from layer 1 to layer 6
15dd636f 699 AliITStrackMI *otrack2 = new AliITStrackMI(*ot);
6c94f330 700 otrack2->ResetCovariance(10.);
bef31448 701 otrack2->ResetClusters();
702 //fit from layer 6 to layer 1
73f446a0 703 if(RefitAt(3.7,otrack2,ot)) {
704 fListOfTracks->AddLast(otrack2);
7e5bf5af 705 new (tri[nlist]) AliITStrackSA(*trac);
706 nlist++;
73f446a0 707 } else {
708 delete otrack2;
709 }
bef31448 710
711 }
712
713 delete ot;
714 delete trac;
715 }//end loop layer 6
716 }//end loop layer 5
717 }//end loop layer 4
718
13918578 719 }//end loop layer 3
bef31448 720 }//end loop layer 2
13918578 721 }//end loop layer 1
722
037efb75 723 delete [] end;
724
7e5bf5af 725
726
4e05ab9a 727 Int_t dim=fListOfTracks->GetEntries();
13918578 728 if(dim==0){
cc088660 729 for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++){
13918578 730 delete listlayer[i];
731 }
c09cece6 732 delete [] listlayer;
00a7cc50 733 listSA->Delete();
734 delete listSA;
73f446a0 735 delete [] firstmod;
13918578 736 return 0;
737 }
738
7e5bf5af 739 Int_t lowchi2 = FindTrackLowChiSquare(fListOfTracks,dim);
740 AliITStrackV2* otrack =(AliITStrackV2*)fListOfTracks->At(lowchi2);
741 AliITStrackSA* trsa = (AliITStrackSA*)listSA->At(lowchi2);
742
73f446a0 743 if(otrack==0) {
cc088660 744 for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++){
73f446a0 745 delete listlayer[i];
746 }
c09cece6 747 delete [] listlayer;
00a7cc50 748 listSA->Delete();
749 delete listSA;
73f446a0 750 delete [] firstmod;
751 return 0;
752 }
cc088660 753 Int_t * indexc = new Int_t[AliITSgeomTGeo::GetNLayers()];
754 for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++) indexc[i]=0;
13918578 755 for(Int_t nind=0;nind<otrack->GetNumberOfClusters();nind++){
756 indexc[nind] = otrack->GetClusterIndex(nind);
757 }
00a7cc50 758 AliITSRecPoint* cl0 = (AliITSRecPoint*)GetCluster(indexc[0]);
759 AliITSRecPoint* cl1 = (AliITSRecPoint*)GetCluster(indexc[1]);
760 AliITSRecPoint* cl2 = (AliITSRecPoint*)GetCluster(indexc[2]);
761 AliITSRecPoint* cl3 = (AliITSRecPoint*)GetCluster(indexc[3]);
762 AliITSRecPoint* cl4 = (AliITSRecPoint*)GetCluster(indexc[4]);
13918578 763 Int_t labl[3]={-1,-1,-1};
cc088660 764 if(otrack->GetNumberOfClusters()==AliITSgeomTGeo::GetNLayers()){
00a7cc50 765 AliITSRecPoint* cl5 = (AliITSRecPoint*)GetCluster(indexc[5]);
13918578 766 labl[0]=cl5->GetLabel(0);
767 labl[1]=cl5->GetLabel(1);
768 labl[2]=cl5->GetLabel(2);
769 }
037efb75 770 delete [] indexc;
cc088660 771 if(otrack->GetNumberOfClusters()==(AliITSgeomTGeo::GetNLayers()-1)){
13918578 772 labl[0]=-1;
773 labl[1]=-1;
774 labl[2]=-1;
775 }
776 Int_t numberofpoints;
2257f27e 777 if(fSixPoints) numberofpoints=6;
13918578 778 else numberofpoints=5;
e43c066c 779 CookLabel(otrack,0.); //MI change - to see fake ratio
13918578 780 Int_t label = Label(cl0->GetLabel(0),cl1->GetLabel(0),
bef31448 781 cl2->GetLabel(0),cl3->GetLabel(0),
782 cl4->GetLabel(0),labl[0],
783 cl0->GetLabel(1),cl1->GetLabel(1),
784 cl2->GetLabel(1),cl3->GetLabel(1),
785 cl4->GetLabel(1),labl[1],
786 cl0->GetLabel(2),cl1->GetLabel(2),
787 cl2->GetLabel(2),cl3->GetLabel(2),
788 cl4->GetLabel(2),labl[2],numberofpoints);
13918578 789
790 otrack->SetLabel(label);
7e5bf5af 791 //remove clusters of found track
792
cc088660 793 for(Int_t nlay=0;nlay<AliITSgeomTGeo::GetNLayers();nlay++){
7e5bf5af 794 for(Int_t cln=0;cln<trsa->GetNumberOfMarked(nlay);cln++){
795 Int_t index = trsa->GetClusterMark(nlay,cln);
796 fCluLayer[nlay]->RemoveAt(index);
797 RemoveClusterCoord(nlay,index);
798 fCluLayer[nlay]->Compress();
799 }
800 }
801 listSA->Delete();
802 delete listSA;
803
cc088660 804 for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++){
13918578 805 delete listlayer[i];
806 }
c09cece6 807 delete [] listlayer;
037efb75 808 delete [] firstmod;
13918578 809 return otrack;
810
811}
812
bef31448 813
4e05ab9a 814
bef31448 815//_______________________________________________________
7e5bf5af 816Int_t AliITStrackerSA::SearchClusters(Int_t layer,Double_t phiwindow,Double_t lambdawindow, AliITStrackSA* trs,Double_t /*zvertex*/,Int_t pflag){
13918578 817 //function used to to find the clusters associated to the track
818 Int_t nc=0;
819 AliITSlayer &lay = fgLayers[layer];
7e5bf5af 820 Double_t r=lay.GetR();
821 if(pflag==1){
cfe729e0 822 Float_t cx1,cx2,cy1,cy2;
823 FindEquation(fPoint1[0],fPoint1[1],fPoint2[0],fPoint2[1],fPoint3[0],fPoint3[1],fCoef1,fCoef2,fCoef3);
824 if (FindIntersection(fCoef1,fCoef2,fCoef3,-r*r,cx1,cy1,cx2,cy2)==0)
825 return 0;
826 Double_t fi1=TMath::ATan2(cy1,cx1);
827 Double_t fi2=TMath::ATan2(cy2,cx2);
828 fPhiEstimate=ChoosePoint(fi1,fi2,fPhic);
829 }
13918578 830
7e5bf5af 831
832 Int_t ncl = fCluLayer[layer]->GetEntries();
833 for (Int_t index=0; index<ncl; index++) {
00a7cc50 834 AliITSRecPoint *c = (AliITSRecPoint*)fCluLayer[layer]->At(index);
7e5bf5af 835 if (!c) continue;
836 if (c->GetQ()<=0) continue;
837
838 AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(layer,index);
839 Double_t phi = arr->GetPhi();
cfe729e0 840 if (TMath::Abs(phi-fPhiEstimate)>phiwindow) continue;
494fda7c 841
7e5bf5af 842 Double_t lambda = arr->GetLambda();
cfe729e0 843 if (TMath::Abs(lambda-fLambdac)>lambdawindow) continue;
844
7e5bf5af 845 if(trs->GetNumberOfClustersSA()==trs->GetMaxNumberOfClusters()) return 0;
846 if(trs->GetNumberOfMarked(layer)==trs->GetMaxNMarkedPerLayer()) return 0;
847 Int_t orind = arr->GetOrInd();
848 trs->AddClusterSA(layer,orind);
849 trs->AddClusterMark(layer,index);
850
cfe729e0 851 nc++;
852 fLambdac=lambda;
853 fPhiEstimate=phi;
cfe729e0 854
7e5bf5af 855 fPointc[0]=arr->GetX();
856 fPointc[1]=arr->GetY();
857
cfe729e0 858 }
859 return nc;
860}
13918578 861
bef31448 862//________________________________________________________________
863void AliITStrackerSA::UpdatePoints(){
864 //update of points for the estimation of the curvature
13918578 865
bef31448 866 fPoint2[0]=fPoint3[0];
867 fPoint2[1]=fPoint3[1];
868 fPoint3[0]=fPointc[0];
869 fPoint3[1]=fPointc[1];
13918578 870
871
13918578 872}
13918578 873
13918578 874//___________________________________________________________________
875Int_t AliITStrackerSA::FindEquation(Float_t x1, Float_t y1, Float_t x2, Float_t y2, Float_t x3, Float_t y3,Float_t& a, Float_t& b, Float_t& c){
876
877 //given (x,y) of three recpoints (in global coordinates)
878 //returns the parameters a,b,c of circonference x*x + y*y +a*x + b*y +c
879
880 Float_t den = (x3-x1)*(y2-y1)-(x2-x1)*(y3-y1);
881 if(den==0) return 0;
882 a = ((y3-y1)*(x2*x2+y2*y2-x1*x1-y1*y1)-(y2-y1)*(x3*x3+y3*y3-x1*x1-y1*y1))/den;
883 b = -(x2*x2-x1*x1+y2*y2-y1*y1+a*(x2-x1))/(y2-y1);
884 c = -x1*x1-y1*y1-a*x1-b*y1;
885 return 1;
886 }
887//__________________________________________________________________________
888 Int_t AliITStrackerSA::FindIntersection(Float_t a1, Float_t b1, Float_t c1, Float_t c2,Float_t& x1,Float_t& y1, Float_t& x2, Float_t& y2){
889
890 //Finds the intersection between the circonference of the track and the circonference centered in (0,0) represented by one layer
891 //c2 is -rlayer*rlayer
892
893 if(a1==0) return 0;
3a2f227d 894 Double_t m = c2-c1;
895 Double_t aA = (b1*b1)/(a1*a1)+1;
896 Double_t bB = (-2*m*b1/(a1*a1));
897 Double_t cC = c2+(m*m)/(a1*a1);
898 Double_t dD = bB*bB-4*aA*cC;
899 if(dD<0) return 0;
13918578 900
3a2f227d 901 y1 = (-bB+TMath::Sqrt(dD))/(2*aA);
902 y2 = (-bB-TMath::Sqrt(dD))/(2*aA);
13918578 903 x1 = (c2-c1-b1*y1)/a1;
904 x2 = (c2-c1-b1*y2)/a1;
905
906 return 1;
907}
908//____________________________________________________________________
909Double_t AliITStrackerSA::Curvature(Double_t x1,Double_t y1,Double_t
910x2,Double_t y2,Double_t x3,Double_t y3){
911
912 //calculates the curvature of track
913 Double_t den = (x3-x1)*(y2-y1)-(x2-x1)*(y3-y1);
914 if(den==0) return 0;
915 Double_t a = ((y3-y1)*(x2*x2+y2*y2-x1*x1-y1*y1)-(y2-y1)*(x3*x3+y3*y3-x1*x1-y1*y1))/den;
916 Double_t b = -(x2*x2-x1*x1+y2*y2-y1*y1+a*(x2-x1))/(y2-y1);
917 Double_t c = -x1*x1-y1*y1-a*x1-b*y1;
918 Double_t xc=-a/2.;
919
920 if((a*a+b*b-4*c)<0) return 0;
921 Double_t rad = TMath::Sqrt(a*a+b*b-4*c)/2.;
922 if(rad==0) return 0;
923
924 if((x1>0 && y1>0 && x1<xc)) rad*=-1;
925 if((x1<0 && y1>0 && x1<xc)) rad*=-1;
926 // if((x1<0 && y1<0 && x1<xc)) rad*=-1;
927 // if((x1>0 && y1<0 && x1<xc)) rad*=-1;
928
929 return 1/rad;
930
931}
7e5bf5af 932
933
13918578 934//____________________________________________________________________
935Double_t AliITStrackerSA::ChoosePoint(Double_t p1, Double_t p2, Double_t pp){
936
937 //Returns the point closest to pp
938
939 Double_t diff1 = p1-pp;
940 Double_t diff2 = p2-pp;
941
942 if(TMath::Abs(diff1)<TMath::Abs(diff2)) fPhiEstimate=p1;
943 else fPhiEstimate=p2;
944 return fPhiEstimate;
945
946}
947
948
949//_________________________________________________________________
7e5bf5af 950Int_t AliITStrackerSA::FindTrackLowChiSquare(TObjArray* tracklist, Int_t dim) const {
13918578 951 // returns track with lowes chi square
952 if(dim==1){
7e5bf5af 953 //AliITStrackV2* trk = (AliITStrackV2*)tracklist->At(0);
954 //return trk;
955 return 0;
13918578 956 }
7e5bf5af 957 //if(dim==0) return 0;
037efb75 958 Double_t * chi2 = new Double_t[dim];
959 Int_t * index = new Int_t[dim];
13918578 960 for(Int_t i=0;i<dim;i++){
961 AliITStrackV2* trk = (AliITStrackV2*)tracklist->At(i);
962 chi2[i]=trk->GetChi2();
963 index[i]=i;
964 }
965
966 Int_t w=0;Double_t value;
967 Int_t lp;
968 while(w<dim){
969 for(Int_t j=w+1;j<dim;j++){
970 if(chi2[w]<chi2[j]){
bef31448 971 value=chi2[w];
972 chi2[w]=chi2[j];
973 chi2[j]=value;
974 lp=index[w];
975 index[w]=index[j];
976 index[j]=lp;
13918578 977 }
978 }
979 w++;
980 }
981
037efb75 982 delete [] chi2;
983 delete [] index;
7e5bf5af 984 return index[dim-1];
13918578 985}
986
987//__________________________________________________________
988Int_t AliITStrackerSA::FindLabel(Int_t l1, Int_t l2, Int_t l3, Int_t l4, Int_t l5, Int_t l6){
989
990 //function used to determine the track label
991
992 Int_t lb[6] = {l1,l2,l3,l4,l5,l6};
993 Int_t aa[6]={1,1,1,1,1,1};
994 Int_t ff=0;
995 Int_t ll=0;
996 Int_t k=0;Int_t w=0;Int_t num=6;
997 if(lb[5]==-1) num=5;
998
999 while(k<num){
1000
1001 for(Int_t i=k+1;i<num;i++){
1002
1003 if(lb[k]==lb[i] && aa[k]!=0){
1004
1005 aa[k]+=1;
1006 aa[i]=0;
1007 }
1008 }
1009 k++;
1010 }
1011
1012 while(w<num){
1013
1014 for(Int_t j=0;j<6;j++){
1015 if(aa[w]<aa[j]){
1016 ff=aa[w];
1017 aa[w]=aa[j];
1018 aa[j]=ff;
1019 ll=lb[w];
1020 lb[w]=lb[j];
1021 lb[j]=ll;
1022 }
1023 }
1024 w++;
1025 }
1026 if(num==6) return lb[5];
1027 else return lb[4];
1028}
1029
1030//_____________________________________________________________________________
1031Int_t AliITStrackerSA::Label(Int_t gl1, Int_t gl2, Int_t gl3, Int_t gl4, Int_t gl5, Int_t gl6,Int_t gl7, Int_t gl8, Int_t gl9, Int_t gl10,Int_t gl11,
1032Int_t gl12, Int_t gl13, Int_t gl14,Int_t gl15, Int_t gl16, Int_t gl17, Int_t gl18, Int_t numberofpoints){
1033
1034
1035 //function used to assign label to the found track. If track is fake, the label is negative
1036
1037 Int_t lb0[6] = {gl1,gl2,gl3,gl4,gl5,gl6};
1038 Int_t lb1[6] = {gl7,gl8,gl9,gl10,gl11,gl12};
1039 Int_t lb2[6] = {gl13,gl14,gl15,gl16,gl17,gl18};
1040 Int_t ll=FindLabel(lb0[0],lb0[1],lb0[2],lb0[3],lb0[4],lb0[5]);
1041 Int_t lflag=0;Int_t num=6;
1042 if(lb0[5]==-1 && lb1[5]==-1 && lb2[5]==-1) num=5;
1043
1044 for(Int_t i=0;i<num;i++){
1045 if(lb0[i]==ll || lb1[i]==ll || lb2[i]==ll) lflag+=1;
1046 }
1047
1048 if(lflag>=numberofpoints) return ll;
1049 else return -ll;
1050
1051
1052}
1053
1054//_____________________________________________________________________________
1055void AliITStrackerSA::SetWindowSizes(Int_t n, Double_t *phi, Double_t *lam){
1056 // Set sizes of the phi and lambda windows used for track finding
1057 fNloop = n;
1058 if(phi){ // user defined values
1059 fPhiWin = new Double_t[fNloop];
1060 fLambdaWin = new Double_t[fNloop];
1061 for(Int_t k=0;k<fNloop;k++){
1062 fPhiWin[k]=phi[k];
1063 fLambdaWin[k]=lam[k];
1064 }
1065 }
1066 else { // default values
627b6db6 1067
1068 Double_t phid[33] = {0.002,0.003,0.004,0.0045,0.0047,
bef31448 1069 0.005,0.0053,0.0055,
1070 0.006,0.0063,0.0065,0.007,0.0073,0.0075,0.0077,
1071 0.008,0.0083,0.0085,0.0087,0.009,0.0095,0.0097,
627b6db6 1072 0.01,0.0105,0.011,0.0115,0.012,0.0125,0.013,0.0135,0.0140,0.0145};
1073 Double_t lambdad[33] = {0.003,0.004,0.005,0.005,0.005,
1074 0.005,0.005,0.006,
1075 0.006,0.006,0.006,0.007,0.007,0.007,0.007,
1076 0.007,0.007,0.007,0.007,0.007,0.007,0.007,
1077 0.008,0.008,0.008,0.008,0.008,0.008,0.008,0.008,0.008,0.008};
bef31448 1078
627b6db6 1079 if(fNloop!=33){
1080 fNloop = 33;
13918578 1081 }
627b6db6 1082
1083
13918578 1084 fPhiWin = new Double_t[fNloop];
1085 fLambdaWin = new Double_t[fNloop];
1086
1087 for(Int_t k=0;k<fNloop;k++){
1088 fPhiWin[k]=phid[k];
1089 fLambdaWin[k]=lambdad[k];
1090 }
1091
1092 }
1093
1094}
7e5bf5af 1095//_______________________________________________________________________
cc088660 1096void AliITStrackerSA::GetCoorAngles(AliITSRecPoint* cl,Double_t &phi,Double_t &lambda, Float_t &x, Float_t &y,Float_t &z,Double_t* vertex){
7e5bf5af 1097 //Returns values of phi (azimuthal) and lambda angles for a given cluster
cc088660 1098/*
7e5bf5af 1099 Double_t rot[9]; fGeom->GetRotMatrix(module,rot);
1100 Int_t lay,lad,det; fGeom->GetModuleId(module,lay,lad,det);
1101 Float_t tx,ty,tz; fGeom->GetTrans(lay,lad,det,tx,ty,tz);
1102
1103 Double_t alpha=TMath::ATan2(rot[1],rot[0])+TMath::Pi();
1104 Double_t phi1=TMath::Pi()/2+alpha;
1105 if (lay==1) phi1+=TMath::Pi();
1106
1107 Float_t cp=TMath::Cos(phi1), sp=TMath::Sin(phi1);
1108 Float_t r=tx*cp+ty*sp;
1109
cc088660 1110 xyz= r*cp - cl->GetY()*sp;
7e5bf5af 1111 y= r*sp + cl->GetY()*cp;
1112 z=cl->GetZ();
cc088660 1113*/
1114 Float_t xyz[3];
1115 cl->GetGlobalXYZ(xyz);
1116 x=xyz[0];
1117 y=xyz[1];
1118 z=xyz[2];
1119
7e5bf5af 1120 phi=TMath::ATan2(y,x);
1121 lambda=TMath::ATan2(z-vertex[2],TMath::Sqrt((x-vertex[0])*(x-vertex[0])+(y-vertex[1])*(y-vertex[1])));
1122}
13918578 1123
7e5bf5af 1124//________________________________________________________________________
cc088660 1125void AliITStrackerSA::GetCoorErrors(AliITSRecPoint* cl,Float_t &sx,Float_t &sy, Float_t &sz){
7e5bf5af 1126
cc088660 1127 //returns sigmax, y, z of cluster in global coordinates
1128/*
7e5bf5af 1129 Double_t rot[9]; fGeom->GetRotMatrix(module,rot);
cc088660 1130 Int_t lay,lad,det;
1131 AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
7e5bf5af 1132
1133 Double_t alpha=TMath::ATan2(rot[1],rot[0])+TMath::Pi();
1134 Double_t phi=TMath::Pi()/2+alpha;
1135 if (lay==1) phi+=TMath::Pi();
1136
1137 Float_t cp=TMath::Cos(phi), sp=TMath::Sin(phi);
cc088660 1138*/
1139 Float_t covm[6];
1140 cl->GetGlobalCov(covm);
1141 sx=TMath::Sqrt(covm[0]);
1142 sy=TMath::Sqrt(covm[3]);
1143 sz=TMath::Sqrt(covm[5]);
1144/*
7e5bf5af 1145 sx = TMath::Sqrt(sp*sp*cl->GetSigmaY2());
1146 sy = TMath::Sqrt(cp*cp*cl->GetSigmaY2());
1147 sz = TMath::Sqrt(cl->GetSigmaZ2());
cc088660 1148*/
7e5bf5af 1149}
cc088660 1150
1151