AliTPCcalibTimeGain.cxx - Adding the Gamma conversion selected electorns
[u/mrichter/AliRoot.git] / TPC / AliTPCtrackerMI.cxx
CommitLineData
1c53abe2 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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
1c53abe2 16
17//-------------------------------------------------------
18// Implementation of the TPC tracker
19//
20// Origin: Marian Ivanov Marian.Ivanov@cern.ch
21//
34acb742 22// AliTPC parallel tracker
6d493ea0 23//
24// The track fitting is based on Kalaman filtering approach
25
26// The track finding steps:
27// 1. Seeding - with and without vertex constraint
28// - seeding with vertex constain done at first n^2 proble
29// - seeding without vertex constraint n^3 problem
30// 2. Tracking - follow prolongation road - find cluster - update kalman track
31
32// The seeding and tracking is repeated several times, in different seeding region.
33// This approach enables to find the track which cannot be seeded in some region of TPC
34// This can happen because of low momenta (track do not reach outer radius), or track is currently in the ded region between sectors, or the track is for the moment overlapped with other track (seed quality is poor) ...
35
36// With this approach we reach almost 100 % efficiency also for high occupancy events.
37// (If the seeding efficiency in a region is about 90 % than with logical or of several
38// regions we will reach 100% (in theory - supposing independence)
39
40// Repeating several seeding - tracking procedures some of the tracks can be find
41// several times.
42
43// The procedures to remove multi find tacks are impremented:
44// RemoveUsed2 - fast procedure n problem -
45// Algorithm - Sorting tracks according quality
46// remove tracks with some shared fraction
47// Sharing in respect to all tacks
48// Signing clusters in gold region
49// FindSplitted - slower algorithm n^2
50// Sort the tracks according quality
51// Loop over pair of tracks
52// If overlap with other track bigger than threshold - remove track
53//
54// FindCurling - Finds the pair of tracks which are curling
55// - About 10% of tracks can be find with this procedure
56// The combinatorial background is too big to be used in High
57// multiplicity environment
58// - n^2 problem - Slow procedure - currently it is disabled because of
59// low efficiency
60//
61// The number of splitted tracks can be reduced disabling the sharing of the cluster.
62// tpcRecoParam-> SetClusterSharing(kFALSE);
63// IT IS HIGHLY non recomended to use it in high flux enviroonment
64// Even using this switch some tracks can be found more than once
65// (because of multiple seeding and low quality tracks which will not cross full chamber)
66//
67//
68// The tracker itself can be debugged - the information about tracks can be stored in several // phases of the reconstruction
69// To enable storage of the TPC tracks in the ESD friend track
16299eac 70// use AliTPCReconstructor::SetStreamLevel(n);
6d493ea0 71//
72// The debug level - different procedure produce tree for numerical debugging
73// To enable them set AliTPCReconstructor::SetStreamLevel(n); where nis bigger 1
74//
92f513f5 75
76//
77// Adding systematic errors to the covariance:
78//
79// The systematic errors due to the misalignment and miscalibration are added to the covariance matrix
80// of the tracks (not to the clusters as they are dependent):
81// The parameters form AliTPCRecoParam are used AliTPCRecoParam::GetSystematicError
82// The systematic errors are expressed there in RMS - position (cm), angle (rad), curvature (1/cm)
83// The default values are 0.
84//
85// The sytematic errors are added to the covariance matrix in following places:
86//
87// 1. During fisrt itteration - AliTPCtrackerMI::FillESD
88// 2. Second iteration -
89// 2.a ITS->TPC - AliTPCtrackerMI::ReadSeeds
90// 2.b TPC->TRD - AliTPCtrackerMI::PropagateBack
91// 3. Third iteration -
92// 3.a TRD->TPC - AliTPCtrackerMI::ReadSeeds
93// 3.b TPC->ITS - AliTPCtrackerMI::RefitInward
94//
fd065ea2 95// There are several places in the code which can be numerically debuged
96// This code is keeped in order to enable code development and to check the calibration implementtion
97//
16299eac 98// 1. ErrParam stream - dump information about
fd065ea2 99// 1.a) cluster
100// 2.a) cluster error estimate
101// 3.a) cluster shape estimate
102//
103//
16299eac 104// Debug streamer levels:
105//
1c53abe2 106//-------------------------------------------------------
47966a6d 107
108
109/* $Id$ */
110
cc5e9db0 111#include "Riostream.h"
6d171107 112#include <TClonesArray.h>
113#include <TFile.h>
114#include <TObjArray.h>
115#include <TTree.h>
a3232aae 116#include "AliLog.h"
47966a6d 117#include "AliComplexCluster.h"
af885e0f 118#include "AliESDEvent.h"
aad72f45 119#include "AliESDtrack.h"
120#include "AliESDVertex.h"
6c94f330 121#include "AliKink.h"
122#include "AliV0.h"
91162307 123#include "AliHelix.h"
91162307 124#include "AliRunLoader.h"
6d171107 125#include "AliTPCClustersRow.h"
126#include "AliTPCParam.h"
9996a03b 127#include "AliTPCReconstructor.h"
6d171107 128#include "AliTPCpolyTrack.h"
81e97e0d 129#include "AliTPCreco.h"
9350f379 130#include "AliTPCseed.h"
131
132#include "AliTPCtrackerSector.h"
b67e07dc 133#include "AliTPCtrackerMI.h"
6d171107 134#include "TStopwatch.h"
81e97e0d 135#include "AliTPCReconstructor.h"
5d837844 136#include "AliAlignObj.h"
137#include "AliTrackPointArray.h"
6d493ea0 138#include "TRandom.h"
24db6af7 139#include "AliTPCcalibDB.h"
140#include "AliTPCTransform.h"
fd065ea2 141#include "AliTPCClusterParam.h"
19b00333 142
6d171107 143//
c9427e08 144
91162307 145ClassImp(AliTPCtrackerMI)
c9427e08 146
147
002af263 148
b67e07dc 149class AliTPCFastMath {
91162307 150public:
b67e07dc 151 AliTPCFastMath();
91162307 152 static Double_t FastAsin(Double_t x);
153 private:
b67e07dc 154 static Double_t fgFastAsin[20000]; //lookup table for fast asin computation
91162307 155};
c9427e08 156
b67e07dc 157Double_t AliTPCFastMath::fgFastAsin[20000];
2274b54b 158AliTPCFastMath gAliTPCFastMath; // needed to fill the LUT
c9427e08 159
b67e07dc 160AliTPCFastMath::AliTPCFastMath(){
161 //
162 // initialized lookup table;
91162307 163 for (Int_t i=0;i<10000;i++){
164 fgFastAsin[2*i] = TMath::ASin(i/10000.);
165 fgFastAsin[2*i+1] = (TMath::ASin((i+1)/10000.)-fgFastAsin[2*i]);
166 }
c9427e08 167}
168
b67e07dc 169Double_t AliTPCFastMath::FastAsin(Double_t x){
170 //
171 // return asin using lookup table
91162307 172 if (x>0){
173 Int_t index = int(x*10000);
174 return fgFastAsin[2*index]+(x*10000.-index)*fgFastAsin[2*index+1];
175 }
176 x*=-1;
177 Int_t index = int(x*10000);
178 return -(fgFastAsin[2*index]+(x*10000.-index)*fgFastAsin[2*index+1]);
1c53abe2 179}
e046d791 180//__________________________________________________________________
181AliTPCtrackerMI::AliTPCtrackerMI()
182 :AliTracker(),
183 fkNIS(0),
184 fInnerSec(0),
185 fkNOS(0),
186 fOuterSec(0),
187 fN(0),
188 fSectors(0),
189 fInput(0),
190 fOutput(0),
191 fSeedTree(0),
192 fTreeDebug(0),
193 fEvent(0),
194 fDebug(0),
195 fNewIO(kFALSE),
196 fNtracks(0),
197 fSeeds(0),
198 fIteration(0),
47af7ca4 199 fkParam(0),
e046d791 200 fDebugStreamer(0)
201{
202 //
203 // default constructor
204 //
0f923679 205 for (Int_t irow=0; irow<200; irow++){
206 fXRow[irow]=0;
207 fYMax[irow]=0;
208 fPadLength[irow]=0;
209 }
210
e046d791 211}
212//_____________________________________________________________________
1c53abe2 213
214
215
91162307 216Int_t AliTPCtrackerMI::UpdateTrack(AliTPCseed * track, Int_t accept){
b67e07dc 217 //
218 //update track information using current cluster - track->fCurrentCluster
219
1c53abe2 220
b9671574 221 AliTPCclusterMI* c =track->GetCurrentCluster();
222 if (accept>0) track->SetCurrentClusterIndex1(track->GetCurrentClusterIndex1() | 0x8000); //sign not accepted clusters
c9427e08 223
b9671574 224 UInt_t i = track->GetCurrentClusterIndex1();
1c53abe2 225
226 Int_t sec=(i&0xff000000)>>24;
91162307 227 //Int_t row = (i&0x00ff0000)>>16;
b9671574 228 track->SetRow((i&0x00ff0000)>>16);
229 track->SetSector(sec);
1c53abe2 230 // Int_t index = i&0xFFFF;
47af7ca4 231 if (sec>=fkParam->GetNInnerSector()) track->SetRow(track->GetRow()+fkParam->GetNRowLow());
b9671574 232 track->SetClusterIndex2(track->GetRow(), i);
91162307 233 //track->fFirstPoint = row;
234 //if ( track->fLastPoint<row) track->fLastPoint =row;
235 // if (track->fRow<0 || track->fRow>160) {
236 // printf("problem\n");
237 //}
b9671574 238 if (track->GetFirstPoint()>track->GetRow())
239 track->SetFirstPoint(track->GetRow());
240 if (track->GetLastPoint()<track->GetRow())
241 track->SetLastPoint(track->GetRow());
91162307 242
243
b9671574 244 track->SetClusterPointer(track->GetRow(),c);
1c53abe2 245 //
246
3f82c4f2 247 Double_t angle2 = track->GetSnp()*track->GetSnp();
1c53abe2 248 //
249 //SET NEW Track Point
250 //
85e2b57d 251 if (angle2<1) //PH sometimes angle2 is very big. To be investigated...
91162307 252 {
85e2b57d 253 angle2 = TMath::Sqrt(angle2/(1-angle2));
b9671574 254 AliTPCTrackerPoint &point =*(track->GetTrackPoint(track->GetRow()));
1c53abe2 255 //
b9671574 256 point.SetSigmaY(c->GetSigmaY2()/track->GetCurrentSigmaY2());
257 point.SetSigmaZ(c->GetSigmaZ2()/track->GetCurrentSigmaZ2());
258 point.SetErrY(sqrt(track->GetErrorY2()));
259 point.SetErrZ(sqrt(track->GetErrorZ2()));
1c53abe2 260 //
91162307 261 point.SetX(track->GetX());
262 point.SetY(track->GetY());
263 point.SetZ(track->GetZ());
264 point.SetAngleY(angle2);
265 point.SetAngleZ(track->GetTgl());
b9671574 266 if (point.IsShared()){
267 track->SetErrorY2(track->GetErrorY2()*4);
268 track->SetErrorZ2(track->GetErrorZ2()*4);
91162307 269 }
270 }
271
b9671574 272 Double_t chi2 = track->GetPredictedChi2(track->GetCurrentCluster());
91162307 273 //
1d91d749 274// track->SetErrorY2(track->GetErrorY2()*1.3);
275// track->SetErrorY2(track->GetErrorY2()+0.01);
276// track->SetErrorZ2(track->GetErrorZ2()*1.3);
277// track->SetErrorZ2(track->GetErrorZ2()+0.005);
91162307 278 //}
279 if (accept>0) return 0;
280 if (track->GetNumberOfClusters()%20==0){
281 // if (track->fHelixIn){
282 // TClonesArray & larr = *(track->fHelixIn);
283 // Int_t ihelix = larr.GetEntriesFast();
284 // new(larr[ihelix]) AliHelix(*track) ;
285 //}
1c53abe2 286 }
b9671574 287 track->SetNoCluster(0);
91162307 288 return track->Update(c,chi2,i);
289}
290
291
292
00055a22 293Int_t AliTPCtrackerMI::AcceptCluster(AliTPCseed * seed, AliTPCclusterMI * cluster)
91162307 294{
1c53abe2 295 //
91162307 296 // decide according desired precision to accept given
297 // cluster for tracking
6fbe1e5c 298 Double_t yt=0,zt=0;
299 seed->GetProlongation(cluster->GetX(),yt,zt);
00055a22 300 Double_t sy2=ErrY2(seed,cluster);
301 Double_t sz2=ErrZ2(seed,cluster);
1c53abe2 302
91162307 303 Double_t sdistancey2 = sy2+seed->GetSigmaY2();
304 Double_t sdistancez2 = sz2+seed->GetSigmaZ2();
6fbe1e5c 305 Double_t dy=seed->GetCurrentCluster()->GetY()-yt;
f47588e0 306 Double_t dz=seed->GetCurrentCluster()->GetZ()-zt;
6fbe1e5c 307 Double_t rdistancey2 = (seed->GetCurrentCluster()->GetY()-yt)*
308 (seed->GetCurrentCluster()->GetY()-yt)/sdistancey2;
309 Double_t rdistancez2 = (seed->GetCurrentCluster()->GetZ()-zt)*
310 (seed->GetCurrentCluster()->GetZ()-zt)/sdistancez2;
91162307 311
312 Double_t rdistance2 = rdistancey2+rdistancez2;
313 //Int_t accept =0;
314
16299eac 315 if (AliTPCReconstructor::StreamLevel()>2 && seed->GetNumberOfClusters()>20) {
fd065ea2 316 Float_t rmsy2 = seed->GetCurrentSigmaY2();
317 Float_t rmsz2 = seed->GetCurrentSigmaZ2();
e0e13b88 318 Float_t rmsy2p30 = seed->GetCMeanSigmaY2p30();
319 Float_t rmsz2p30 = seed->GetCMeanSigmaZ2p30();
42aec1f1 320 Float_t rmsy2p30R = seed->GetCMeanSigmaY2p30R();
321 Float_t rmsz2p30R = seed->GetCMeanSigmaZ2p30R();
6fbe1e5c 322 AliExternalTrackParam param(*seed);
eea6b724 323 static TVectorD gcl(3),gtr(3);
324 Float_t gclf[3];
325 param.GetXYZ(gcl.GetMatrixArray());
326 cluster->GetGlobalXYZ(gclf);
327 gcl[0]=gclf[0]; gcl[1]=gclf[1]; gcl[2]=gclf[2];
6fbe1e5c 328
b194b32c 329
16299eac 330 if (AliTPCReconstructor::StreamLevel()>2) {
fd065ea2 331 (*fDebugStreamer)<<"ErrParam"<<
e0e13b88 332 "Cl.="<<cluster<<
333 "T.="<<&param<<
6fbe1e5c 334 "dy="<<dy<<
335 "dz="<<dz<<
336 "yt="<<yt<<
337 "zt="<<zt<<
eea6b724 338 "gcl.="<<&gcl<<
339 "gtr.="<<&gtr<<
e0e13b88 340 "erry2="<<sy2<<
341 "errz2="<<sz2<<
342 "rmsy2="<<rmsy2<<
343 "rmsz2="<<rmsz2<<
344 "rmsy2p30="<<rmsy2p30<<
345 "rmsz2p30="<<rmsz2p30<<
42aec1f1 346 "rmsy2p30R="<<rmsy2p30R<<
347 "rmsz2p30R="<<rmsz2p30R<<
f47588e0 348 // normalize distance -
349 "rdisty="<<rdistancey2<<
350 "rdistz="<<rdistancez2<<
351 "rdist="<<rdistance2<< //
e0e13b88 352 "\n";
b194b32c 353 }
fd065ea2 354 }
6fbe1e5c 355 //return 0; // temporary
356 if (rdistance2>32) return 3;
91162307 357
358
00055a22 359 if ((rdistancey2>9. || rdistancez2>9.) && cluster->GetType()==0)
91162307 360 return 2; //suspisiouce - will be changed
361
00055a22 362 if ((rdistancey2>6.25 || rdistancez2>6.25) && cluster->GetType()>0)
91162307 363 // strict cut on overlaped cluster
364 return 2; //suspisiouce - will be changed
1c53abe2 365
00055a22 366 if ( (rdistancey2>1. || rdistancez2>6.25 )
91162307 367 && cluster->GetType()<0){
b9671574 368 seed->SetNFoundable(seed->GetNFoundable()-1);
91162307 369 return 2;
1c53abe2 370 }
91162307 371 return 0;
372}
373
374
1c53abe2 375
1c53abe2 376
1af5da7e 377
1c53abe2 378//_____________________________________________________________________________
f8aae377 379AliTPCtrackerMI::AliTPCtrackerMI(const AliTPCParam *par):
e046d791 380AliTracker(),
381 fkNIS(par->GetNInnerSector()/2),
382 fInnerSec(0),
383 fkNOS(par->GetNOuterSector()/2),
384 fOuterSec(0),
385 fN(0),
386 fSectors(0),
387 fInput(0),
388 fOutput(0),
389 fSeedTree(0),
390 fTreeDebug(0),
391 fEvent(0),
392 fDebug(0),
393 fNewIO(0),
394 fNtracks(0),
395 fSeeds(0),
396 fIteration(0),
47af7ca4 397 fkParam(0),
e046d791 398 fDebugStreamer(0)
1c53abe2 399{
400 //---------------------------------------------------------------------
401 // The main TPC tracker constructor
402 //---------------------------------------------------------------------
9350f379 403 fInnerSec=new AliTPCtrackerSector[fkNIS];
404 fOuterSec=new AliTPCtrackerSector[fkNOS];
91162307 405
1c53abe2 406 Int_t i;
407 for (i=0; i<fkNIS; i++) fInnerSec[i].Setup(par,0);
408 for (i=0; i<fkNOS; i++) fOuterSec[i].Setup(par,1);
409
47af7ca4 410 fkParam = par;
91162307 411 Int_t nrowlow = par->GetNRowLow();
412 Int_t nrowup = par->GetNRowUp();
413
414
77f88633 415 for (i=0;i<nrowlow;i++){
91162307 416 fXRow[i] = par->GetPadRowRadiiLow(i);
417 fPadLength[i]= par->GetPadPitchLength(0,i);
418 fYMax[i] = fXRow[i]*TMath::Tan(0.5*par->GetInnerAngle());
419 }
420
421
77f88633 422 for (i=0;i<nrowup;i++){
91162307 423 fXRow[i+nrowlow] = par->GetPadRowRadiiUp(i);
424 fPadLength[i+nrowlow] = par->GetPadPitchLength(60,i);
425 fYMax[i+nrowlow] = fXRow[i+nrowlow]*TMath::Tan(0.5*par->GetOuterAngle());
426 }
e046d791 427
b194b32c 428 if (AliTPCReconstructor::StreamLevel()>0) {
429 fDebugStreamer = new TTreeSRedirector("TPCdebug.root");
430 }
1c53abe2 431}
2fc0c115 432//________________________________________________________________________
58251ea0 433AliTPCtrackerMI::AliTPCtrackerMI(const AliTPCtrackerMI &t):
434 AliTracker(t),
e046d791 435 fkNIS(t.fkNIS),
436 fInnerSec(0),
437 fkNOS(t.fkNOS),
438 fOuterSec(0),
439 fN(0),
440 fSectors(0),
441 fInput(0),
442 fOutput(0),
443 fSeedTree(0),
444 fTreeDebug(0),
445 fEvent(0),
446 fDebug(0),
447 fNewIO(kFALSE),
448 fNtracks(0),
449 fSeeds(0),
450 fIteration(0),
47af7ca4 451 fkParam(0),
e046d791 452 fDebugStreamer(0)
58251ea0 453{
2fc0c115 454 //------------------------------------
455 // dummy copy constructor
456 //------------------------------------------------------------------
e046d791 457 fOutput=t.fOutput;
2fc0c115 458}
47af7ca4 459AliTPCtrackerMI & AliTPCtrackerMI::operator=(const AliTPCtrackerMI& /*r*/)
460{
2fc0c115 461 //------------------------------
462 // dummy
463 //--------------------------------------------------------------
464 return *this;
465}
1c53abe2 466//_____________________________________________________________________________
467AliTPCtrackerMI::~AliTPCtrackerMI() {
468 //------------------------------------------------------------------
469 // TPC tracker destructor
470 //------------------------------------------------------------------
471 delete[] fInnerSec;
472 delete[] fOuterSec;
473 if (fSeeds) {
474 fSeeds->Delete();
475 delete fSeeds;
476 }
81e97e0d 477 if (fDebugStreamer) delete fDebugStreamer;
1c53abe2 478}
479
1c53abe2 480
47af7ca4 481void AliTPCtrackerMI::FillESD(const TObjArray* arr)
91162307 482{
47966a6d 483 //
484 //
485 //fill esds using updated tracks
ec26e231 486 if (!fEvent) return;
487
91162307 488 // write tracks to the event
489 // store index of the track
d26d9159 490 Int_t nseed=arr->GetEntriesFast();
51ad6848 491 //FindKinks(arr,fEvent);
91162307 492 for (Int_t i=0; i<nseed; i++) {
d26d9159 493 AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i);
91162307 494 if (!pt) continue;
51ad6848 495 pt->UpdatePoints();
92f513f5 496 AddCovariance(pt);
8cecaa87 497 if (AliTPCReconstructor::StreamLevel()>1) {
498 (*fDebugStreamer)<<"Track0"<<
499 "Tr0.="<<pt<<
500 "\n";
501 }
47af7ca4 502 // pt->PropagateTo(fkParam->GetInnerRadiusLow());
eea478d3 503 if (pt->GetKinkIndex(0)<=0){ //don't propagate daughter tracks
47af7ca4 504 pt->PropagateTo(fkParam->GetInnerRadiusLow());
eea478d3 505 }
51ad6848 506
507 if (( pt->GetPoints()[2]- pt->GetPoints()[0])>5 && pt->GetPoints()[3]>0.8){
508 AliESDtrack iotrack;
509 iotrack.UpdateTrackParams(pt,AliESDtrack::kTPCin);
510 iotrack.SetTPCPoints(pt->GetPoints());
511 iotrack.SetKinkIndexes(pt->GetKinkIndexes());
81e97e0d 512 iotrack.SetV0Indexes(pt->GetV0Indexes());
513 // iotrack.SetTPCpid(pt->fTPCr);
51ad6848 514 //iotrack.SetTPCindex(i);
515 fEvent->AddTrack(&iotrack);
516 continue;
517 }
518
b9671574 519 if ( (pt->GetNumberOfClusters()>70)&& (Float_t(pt->GetNumberOfClusters())/Float_t(pt->GetNFoundable()))>0.55) {
d26d9159 520 AliESDtrack iotrack;
51ad6848 521 iotrack.UpdateTrackParams(pt,AliESDtrack::kTPCin);
522 iotrack.SetTPCPoints(pt->GetPoints());
d26d9159 523 //iotrack.SetTPCindex(i);
51ad6848 524 iotrack.SetKinkIndexes(pt->GetKinkIndexes());
81e97e0d 525 iotrack.SetV0Indexes(pt->GetV0Indexes());
526 // iotrack.SetTPCpid(pt->fTPCr);
d26d9159 527 fEvent->AddTrack(&iotrack);
a42a6bae 528 continue;
529 }
51ad6848 530 //
531 // short tracks - maybe decays
532
b9671574 533 if ( (pt->GetNumberOfClusters()>30) && (Float_t(pt->GetNumberOfClusters())/Float_t(pt->GetNFoundable()))>0.70) {
a42a6bae 534 Int_t found,foundable,shared;
535 pt->GetClusterStatistic(0,60,found, foundable,shared,kFALSE);
b9671574 536 if ( (found>20) && (pt->GetNShared()/float(pt->GetNumberOfClusters())<0.2)){
a42a6bae 537 AliESDtrack iotrack;
538 iotrack.UpdateTrackParams(pt,AliESDtrack::kTPCin);
539 //iotrack.SetTPCindex(i);
51ad6848 540 iotrack.SetTPCPoints(pt->GetPoints());
541 iotrack.SetKinkIndexes(pt->GetKinkIndexes());
81e97e0d 542 iotrack.SetV0Indexes(pt->GetV0Indexes());
543 //iotrack.SetTPCpid(pt->fTPCr);
a42a6bae 544 fEvent->AddTrack(&iotrack);
545 continue;
546 }
547 }
548
b9671574 549 if ( (pt->GetNumberOfClusters()>20) && (Float_t(pt->GetNumberOfClusters())/Float_t(pt->GetNFoundable()))>0.8) {
a42a6bae 550 Int_t found,foundable,shared;
551 pt->GetClusterStatistic(0,60,found, foundable,shared,kFALSE);
552 if (found<20) continue;
b9671574 553 if (pt->GetNShared()/float(pt->GetNumberOfClusters())>0.2) continue;
a42a6bae 554 //
555 AliESDtrack iotrack;
556 iotrack.UpdateTrackParams(pt,AliESDtrack::kTPCin);
51ad6848 557 iotrack.SetTPCPoints(pt->GetPoints());
558 iotrack.SetKinkIndexes(pt->GetKinkIndexes());
81e97e0d 559 iotrack.SetV0Indexes(pt->GetV0Indexes());
560 //iotrack.SetTPCpid(pt->fTPCr);
51ad6848 561 //iotrack.SetTPCindex(i);
562 fEvent->AddTrack(&iotrack);
563 continue;
564 }
565 // short tracks - secondaties
566 //
567 if ( (pt->GetNumberOfClusters()>30) ) {
568 Int_t found,foundable,shared;
569 pt->GetClusterStatistic(128,158,found, foundable,shared,kFALSE);
b9671574 570 if ( (found>20) && (pt->GetNShared()/float(pt->GetNumberOfClusters())<0.2) &&float(found)/float(foundable)>0.8){
51ad6848 571 AliESDtrack iotrack;
572 iotrack.UpdateTrackParams(pt,AliESDtrack::kTPCin);
573 iotrack.SetTPCPoints(pt->GetPoints());
574 iotrack.SetKinkIndexes(pt->GetKinkIndexes());
81e97e0d 575 iotrack.SetV0Indexes(pt->GetV0Indexes());
576 //iotrack.SetTPCpid(pt->fTPCr);
51ad6848 577 //iotrack.SetTPCindex(i);
578 fEvent->AddTrack(&iotrack);
579 continue;
580 }
581 }
582
583 if ( (pt->GetNumberOfClusters()>15)) {
584 Int_t found,foundable,shared;
585 pt->GetClusterStatistic(138,158,found, foundable,shared,kFALSE);
586 if (found<15) continue;
e7eb17e4 587 if (foundable<=0) continue;
b9671574 588 if (pt->GetNShared()/float(pt->GetNumberOfClusters())>0.2) continue;
51ad6848 589 if (float(found)/float(foundable)<0.8) continue;
590 //
591 AliESDtrack iotrack;
592 iotrack.UpdateTrackParams(pt,AliESDtrack::kTPCin);
593 iotrack.SetTPCPoints(pt->GetPoints());
594 iotrack.SetKinkIndexes(pt->GetKinkIndexes());
81e97e0d 595 iotrack.SetV0Indexes(pt->GetV0Indexes());
596 // iotrack.SetTPCpid(pt->fTPCr);
a42a6bae 597 //iotrack.SetTPCindex(i);
598 fEvent->AddTrack(&iotrack);
599 continue;
600 }
91162307 601 }
6fbe1e5c 602 // >> account for suppressed tracks in the kink indices (RS)
603 int nESDtracks = fEvent->GetNumberOfTracks();
604 for (int it=nESDtracks;it--;) {
605 AliESDtrack* esdTr = fEvent->GetTrack(it);
606 if (!esdTr || !esdTr->GetKinkIndex(0)) continue;
607 for (int ik=0;ik<3;ik++) {
608 int knkId=0;
609 if (!(knkId=esdTr->GetKinkIndex(ik))) break; // no more kinks for this track
610 AliESDkink* kink = fEvent->GetKink(TMath::Abs(knkId)-1);
611 if (!kink) {
612 AliError(Form("ESDTrack%d refers to non-existing kink %d",it,TMath::Abs(knkId)-1));
613 continue;
614 }
615 kink->SetIndex(it, knkId<0 ? 0:1); // update track index of the kink: mother at 0, daughter at 1
616 }
617 }
ec26e231 618 // << account for suppressed tracks in the kink indices (RS)
619 AliInfo(Form("Number of filled ESDs-\t%d\n",fEvent->GetNumberOfTracks()));
620
d26d9159 621}
622
d26d9159 623
1c53abe2 624
1c53abe2 625
626
47af7ca4 627Double_t AliTPCtrackerMI::ErrY2(AliTPCseed* seed, const AliTPCclusterMI * cl){
91162307 628 //
629 //
fd065ea2 630 // Use calibrated cluster error from OCDB
91162307 631 //
fd065ea2 632 AliTPCClusterParam * clparam = AliTPCcalibDB::Instance()->GetClusterParam();
91162307 633 //
47af7ca4 634 Float_t z = TMath::Abs(fkParam->GetZLength(0)-TMath::Abs(seed->GetZ()));
91162307 635 Int_t ctype = cl->GetType();
fd065ea2 636 Int_t type = (cl->GetRow()<63) ? 0: (cl->GetRow()>126) ? 1:2;
637 Double_t angle = seed->GetSnp()*seed->GetSnp();
e0e13b88 638 angle = TMath::Sqrt(TMath::Abs(angle/(1.-angle)));
fd065ea2 639 Double_t erry2 = clparam->GetError0Par(0,type, z,angle);
640 if (ctype<0) {
641 erry2+=0.5; // edge cluster
642 }
643 erry2*=erry2;
644 seed->SetErrorY2(erry2);
645 //
646 return erry2;
647
648//calculate look-up table at the beginning
649// static Bool_t ginit = kFALSE;
650// static Float_t gnoise1,gnoise2,gnoise3;
651// static Float_t ggg1[10000];
652// static Float_t ggg2[10000];
653// static Float_t ggg3[10000];
654// static Float_t glandau1[10000];
655// static Float_t glandau2[10000];
656// static Float_t glandau3[10000];
657// //
658// static Float_t gcor01[500];
659// static Float_t gcor02[500];
660// static Float_t gcorp[500];
661// //
91162307 662
fd065ea2 663// //
664// if (ginit==kFALSE){
665// for (Int_t i=1;i<500;i++){
666// Float_t rsigma = float(i)/100.;
667// gcor02[i] = TMath::Max(0.78 +TMath::Exp(7.4*(rsigma-1.2)),0.6);
668// gcor01[i] = TMath::Max(0.72 +TMath::Exp(3.36*(rsigma-1.2)),0.6);
669// gcorp[i] = TMath::Max(TMath::Power((rsigma+0.5),1.5),1.2);
670// }
671
672// //
673// for (Int_t i=3;i<10000;i++){
674// //
675// //
676// // inner sector
677// Float_t amp = float(i);
678// Float_t padlength =0.75;
679// gnoise1 = 0.0004/padlength;
680// Float_t nel = 0.268*amp;
681// Float_t nprim = 0.155*amp;
47af7ca4 682// ggg1[i] = fkParam->GetDiffT()*fkParam->GetDiffT()*(2+0.001*nel/(padlength*padlength))/nel;
fd065ea2 683// glandau1[i] = (2.+0.12*nprim)*0.5* (2.+nprim*nprim*0.001/(padlength*padlength))/nprim;
684// if (glandau1[i]>1) glandau1[i]=1;
685// glandau1[i]*=padlength*padlength/12.;
686// //
687// // outer short
688// padlength =1.;
689// gnoise2 = 0.0004/padlength;
690// nel = 0.3*amp;
691// nprim = 0.133*amp;
47af7ca4 692// ggg2[i] = fkParam->GetDiffT()*fkParam->GetDiffT()*(2+0.0008*nel/(padlength*padlength))/nel;
fd065ea2 693// glandau2[i] = (2.+0.12*nprim)*0.5*(2.+nprim*nprim*0.001/(padlength*padlength))/nprim;
694// if (glandau2[i]>1) glandau2[i]=1;
695// glandau2[i]*=padlength*padlength/12.;
696// //
697// //
698// // outer long
699// padlength =1.5;
700// gnoise3 = 0.0004/padlength;
701// nel = 0.3*amp;
702// nprim = 0.133*amp;
47af7ca4 703// ggg3[i] = fkParam->GetDiffT()*fkParam->GetDiffT()*(2+0.0008*nel/(padlength*padlength))/nel;
fd065ea2 704// glandau3[i] = (2.+0.12*nprim)*0.5*(2.+nprim*nprim*0.001/(padlength*padlength))/nprim;
705// if (glandau3[i]>1) glandau3[i]=1;
706// glandau3[i]*=padlength*padlength/12.;
707// //
708// }
709// ginit = kTRUE;
710// }
711// //
712// //
713// //
714// Int_t amp = int(TMath::Abs(cl->GetQ()));
715// if (amp>9999) {
716// seed->SetErrorY2(1.);
717// return 1.;
718// }
719// Float_t snoise2;
47af7ca4 720// Float_t z = TMath::Abs(fkParam->GetZLength(0)-TMath::Abs(seed->GetZ()));
fd065ea2 721// Int_t ctype = cl->GetType();
722// Float_t padlength= GetPadPitchLength(seed->GetRow());
723// Double_t angle2 = seed->GetSnp()*seed->GetSnp();
724// angle2 = angle2/(1-angle2);
725// //
726// //cluster "quality"
727// Int_t rsigmay = int(100.*cl->GetSigmaY2()/(seed->GetCurrentSigmaY2()));
728// Float_t res;
729// //
730// if (fSectors==fInnerSec){
731// snoise2 = gnoise1;
732// res = ggg1[amp]*z+glandau1[amp]*angle2;
733// if (ctype==0) res *= gcor01[rsigmay];
734// if ((ctype>0)){
735// res+=0.002;
736// res*= gcorp[rsigmay];
737// }
738// }
739// else {
740// if (padlength<1.1){
741// snoise2 = gnoise2;
742// res = ggg2[amp]*z+glandau2[amp]*angle2;
743// if (ctype==0) res *= gcor02[rsigmay];
744// if ((ctype>0)){
745// res+=0.002;
746// res*= gcorp[rsigmay];
747// }
748// }
749// else{
750// snoise2 = gnoise3;
751// res = ggg3[amp]*z+glandau3[amp]*angle2;
752// if (ctype==0) res *= gcor02[rsigmay];
753// if ((ctype>0)){
754// res+=0.002;
755// res*= gcorp[rsigmay];
756// }
757// }
758// }
759
760// if (ctype<0){
761// res+=0.005;
762// res*=2.4; // overestimate error 2 times
763// }
764// res+= snoise2;
1c53abe2 765
fd065ea2 766// if (res<2*snoise2)
767// res = 2*snoise2;
91162307 768
fd065ea2 769// seed->SetErrorY2(res);
770// return res;
1c53abe2 771
772
91162307 773}
774
1c53abe2 775
776
47af7ca4 777Double_t AliTPCtrackerMI::ErrZ2(AliTPCseed* seed, const AliTPCclusterMI * cl){
1c53abe2 778 //
779 //
fd065ea2 780 // Use calibrated cluster error from OCDB
91162307 781 //
fd065ea2 782 AliTPCClusterParam * clparam = AliTPCcalibDB::Instance()->GetClusterParam();
91162307 783 //
47af7ca4 784 Float_t z = TMath::Abs(fkParam->GetZLength(0)-TMath::Abs(seed->GetZ()));
91162307 785 Int_t ctype = cl->GetType();
fd065ea2 786 Int_t type = (cl->GetRow()<63) ? 0: (cl->GetRow()>126) ? 1:2;
91162307 787 //
3f82c4f2 788 Double_t angle2 = seed->GetSnp()*seed->GetSnp();
91162307 789 angle2 = seed->GetTgl()*seed->GetTgl()*(1+angle2/(1-angle2));
e0e13b88 790 Double_t angle = TMath::Sqrt(TMath::Abs(angle2));
fd065ea2 791 Double_t errz2 = clparam->GetError0Par(1,type, z,angle);
792 if (ctype<0) {
793 errz2+=0.5; // edge cluster
91162307 794 }
1af5da7e 795 errz2*=errz2;
fd065ea2 796 seed->SetErrorZ2(errz2);
797 //
798 return errz2;
1c53abe2 799
fd065ea2 800
801
802// //seed->SetErrorY2(0.1);
803// //return 0.1;
804// //calculate look-up table at the beginning
805// static Bool_t ginit = kFALSE;
806// static Float_t gnoise1,gnoise2,gnoise3;
807// static Float_t ggg1[10000];
808// static Float_t ggg2[10000];
809// static Float_t ggg3[10000];
810// static Float_t glandau1[10000];
811// static Float_t glandau2[10000];
812// static Float_t glandau3[10000];
813// //
814// static Float_t gcor01[1000];
815// static Float_t gcor02[1000];
816// static Float_t gcorp[1000];
817// //
818
819// //
820// if (ginit==kFALSE){
821// for (Int_t i=1;i<1000;i++){
822// Float_t rsigma = float(i)/100.;
823// gcor02[i] = TMath::Max(0.81 +TMath::Exp(6.8*(rsigma-1.2)),0.6);
824// gcor01[i] = TMath::Max(0.72 +TMath::Exp(2.04*(rsigma-1.2)),0.6);
825// gcorp[i] = TMath::Max(TMath::Power((rsigma+0.5),1.5),1.2);
826// }
827
828// //
829// for (Int_t i=3;i<10000;i++){
830// //
831// //
832// // inner sector
833// Float_t amp = float(i);
834// Float_t padlength =0.75;
835// gnoise1 = 0.0004/padlength;
836// Float_t nel = 0.268*amp;
837// Float_t nprim = 0.155*amp;
47af7ca4 838// ggg1[i] = fkParam->GetDiffT()*fkParam->GetDiffT()*(2+0.001*nel/(padlength*padlength))/nel;
fd065ea2 839// glandau1[i] = (2.+0.12*nprim)*0.5* (2.+nprim*nprim*0.001/(padlength*padlength))/nprim;
840// if (glandau1[i]>1) glandau1[i]=1;
841// glandau1[i]*=padlength*padlength/12.;
842// //
843// // outer short
844// padlength =1.;
845// gnoise2 = 0.0004/padlength;
846// nel = 0.3*amp;
847// nprim = 0.133*amp;
47af7ca4 848// ggg2[i] = fkParam->GetDiffT()*fkParam->GetDiffT()*(2+0.0008*nel/(padlength*padlength))/nel;
fd065ea2 849// glandau2[i] = (2.+0.12*nprim)*0.5*(2.+nprim*nprim*0.001/(padlength*padlength))/nprim;
850// if (glandau2[i]>1) glandau2[i]=1;
851// glandau2[i]*=padlength*padlength/12.;
852// //
853// //
854// // outer long
855// padlength =1.5;
856// gnoise3 = 0.0004/padlength;
857// nel = 0.3*amp;
858// nprim = 0.133*amp;
47af7ca4 859// ggg3[i] = fkParam->GetDiffT()*fkParam->GetDiffT()*(2+0.0008*nel/(padlength*padlength))/nel;
fd065ea2 860// glandau3[i] = (2.+0.12*nprim)*0.5*(2.+nprim*nprim*0.001/(padlength*padlength))/nprim;
861// if (glandau3[i]>1) glandau3[i]=1;
862// glandau3[i]*=padlength*padlength/12.;
863// //
864// }
865// ginit = kTRUE;
866// }
867// //
868// //
869// //
870// Int_t amp = int(TMath::Abs(cl->GetQ()));
871// if (amp>9999) {
872// seed->SetErrorY2(1.);
873// return 1.;
874// }
875// Float_t snoise2;
47af7ca4 876// Float_t z = TMath::Abs(fkParam->GetZLength(0)-TMath::Abs(seed->GetZ()));
fd065ea2 877// Int_t ctype = cl->GetType();
878// Float_t padlength= GetPadPitchLength(seed->GetRow());
879// //
880// Double_t angle2 = seed->GetSnp()*seed->GetSnp();
881// // if (angle2<0.6) angle2 = 0.6;
882// angle2 = seed->GetTgl()*seed->GetTgl()*(1+angle2/(1-angle2));
883// //
884// //cluster "quality"
885// Int_t rsigmaz = int(100.*cl->GetSigmaZ2()/(seed->GetCurrentSigmaZ2()));
886// Float_t res;
887// //
888// if (fSectors==fInnerSec){
889// snoise2 = gnoise1;
890// res = ggg1[amp]*z+glandau1[amp]*angle2;
891// if (ctype==0) res *= gcor01[rsigmaz];
892// if ((ctype>0)){
893// res+=0.002;
894// res*= gcorp[rsigmaz];
895// }
896// }
897// else {
898// if (padlength<1.1){
899// snoise2 = gnoise2;
900// res = ggg2[amp]*z+glandau2[amp]*angle2;
901// if (ctype==0) res *= gcor02[rsigmaz];
902// if ((ctype>0)){
903// res+=0.002;
904// res*= gcorp[rsigmaz];
905// }
906// }
907// else{
908// snoise2 = gnoise3;
909// res = ggg3[amp]*z+glandau3[amp]*angle2;
910// if (ctype==0) res *= gcor02[rsigmaz];
911// if ((ctype>0)){
912// res+=0.002;
913// res*= gcorp[rsigmaz];
914// }
915// }
916// }
917
918// if (ctype<0){
919// res+=0.002;
920// res*=1.3;
921// }
922// if ((ctype<0) &&amp<70){
923// res+=0.002;
924// res*=1.3;
925// }
926// res += snoise2;
927// if (res<2*snoise2)
928// res = 2*snoise2;
929// if (res>3) res =3;
930// seed->SetErrorZ2(res);
931// return res;
91162307 932}
933
934
935
c9427e08 936
1c53abe2 937
c9427e08 938void AliTPCtrackerMI::RotateToLocal(AliTPCseed *seed)
939{
940 //rotate to track "local coordinata
941 Float_t x = seed->GetX();
942 Float_t y = seed->GetY();
943 Float_t ymax = x*TMath::Tan(0.5*fSectors->GetAlpha());
91162307 944
c9427e08 945 if (y > ymax) {
b9671574 946 seed->SetRelativeSector((seed->GetRelativeSector()+1) % fN);
c9427e08 947 if (!seed->Rotate(fSectors->GetAlpha()))
948 return;
949 } else if (y <-ymax) {
b9671574 950 seed->SetRelativeSector((seed->GetRelativeSector()-1+fN) % fN);
c9427e08 951 if (!seed->Rotate(-fSectors->GetAlpha()))
952 return;
953 }
1c53abe2 954
c9427e08 955}
1c53abe2 956
957
958
1c53abe2 959//_____________________________________________________________________________
b67e07dc 960Double_t AliTPCtrackerMI::F1old(Double_t x1,Double_t y1,
1c53abe2 961 Double_t x2,Double_t y2,
47af7ca4 962 Double_t x3,Double_t y3) const
1c53abe2 963{
964 //-----------------------------------------------------------------
965 // Initial approximation of the track curvature
966 //-----------------------------------------------------------------
967 Double_t d=(x2-x1)*(y3-y2)-(x3-x2)*(y2-y1);
968 Double_t a=0.5*((y3-y2)*(y2*y2-y1*y1+x2*x2-x1*x1)-
969 (y2-y1)*(y3*y3-y2*y2+x3*x3-x2*x2));
970 Double_t b=0.5*((x2-x1)*(y3*y3-y2*y2+x3*x3-x2*x2)-
971 (x3-x2)*(y2*y2-y1*y1+x2*x2-x1*x1));
972
973 Double_t xr=TMath::Abs(d/(d*x1-a)), yr=d/(d*y1-b);
91162307 974 if ( xr*xr+yr*yr<=0.00000000000001) return 100;
1c53abe2 975 return -xr*yr/sqrt(xr*xr+yr*yr);
976}
977
978
91162307 979
1c53abe2 980//_____________________________________________________________________________
b67e07dc 981Double_t AliTPCtrackerMI::F1(Double_t x1,Double_t y1,
91162307 982 Double_t x2,Double_t y2,
47af7ca4 983 Double_t x3,Double_t y3) const
91162307 984{
985 //-----------------------------------------------------------------
986 // Initial approximation of the track curvature
987 //-----------------------------------------------------------------
988 x3 -=x1;
989 x2 -=x1;
990 y3 -=y1;
991 y2 -=y1;
992 //
993 Double_t det = x3*y2-x2*y3;
6e23caff 994 if (TMath::Abs(det)<1e-10){
91162307 995 return 100;
996 }
997 //
998 Double_t u = 0.5* (x2*(x2-x3)+y2*(y2-y3))/det;
999 Double_t x0 = x3*0.5-y3*u;
1000 Double_t y0 = y3*0.5+x3*u;
1001 Double_t c2 = 1/TMath::Sqrt(x0*x0+y0*y0);
1002 if (det<0) c2*=-1;
1003 return c2;
1004}
1005
1006
b67e07dc 1007Double_t AliTPCtrackerMI::F2(Double_t x1,Double_t y1,
1c53abe2 1008 Double_t x2,Double_t y2,
47af7ca4 1009 Double_t x3,Double_t y3) const
1c53abe2 1010{
1011 //-----------------------------------------------------------------
91162307 1012 // Initial approximation of the track curvature
1013 //-----------------------------------------------------------------
1014 x3 -=x1;
1015 x2 -=x1;
1016 y3 -=y1;
1017 y2 -=y1;
1018 //
1019 Double_t det = x3*y2-x2*y3;
6e23caff 1020 if (TMath::Abs(det)<1e-10) {
91162307 1021 return 100;
1022 }
1023 //
1024 Double_t u = 0.5* (x2*(x2-x3)+y2*(y2-y3))/det;
1025 Double_t x0 = x3*0.5-y3*u;
1026 Double_t y0 = y3*0.5+x3*u;
1027 Double_t c2 = 1/TMath::Sqrt(x0*x0+y0*y0);
1028 if (det<0) c2*=-1;
1029 x0+=x1;
1030 x0*=c2;
1031 return x0;
1032}
1033
1034
1035
1036//_____________________________________________________________________________
b67e07dc 1037Double_t AliTPCtrackerMI::F2old(Double_t x1,Double_t y1,
91162307 1038 Double_t x2,Double_t y2,
47af7ca4 1039 Double_t x3,Double_t y3) const
91162307 1040{
1041 //-----------------------------------------------------------------
1c53abe2 1042 // Initial approximation of the track curvature times center of curvature
1043 //-----------------------------------------------------------------
1044 Double_t d=(x2-x1)*(y3-y2)-(x3-x2)*(y2-y1);
1045 Double_t a=0.5*((y3-y2)*(y2*y2-y1*y1+x2*x2-x1*x1)-
1046 (y2-y1)*(y3*y3-y2*y2+x3*x3-x2*x2));
1047 Double_t b=0.5*((x2-x1)*(y3*y3-y2*y2+x3*x3-x2*x2)-
1048 (x3-x2)*(y2*y2-y1*y1+x2*x2-x1*x1));
1049
1050 Double_t xr=TMath::Abs(d/(d*x1-a)), yr=d/(d*y1-b);
1051
1052 return -a/(d*y1-b)*xr/sqrt(xr*xr+yr*yr);
1053}
1054
1055//_____________________________________________________________________________
b67e07dc 1056Double_t AliTPCtrackerMI::F3(Double_t x1,Double_t y1,
1c53abe2 1057 Double_t x2,Double_t y2,
47af7ca4 1058 Double_t z1,Double_t z2) const
1c53abe2 1059{
1060 //-----------------------------------------------------------------
1061 // Initial approximation of the tangent of the track dip angle
1062 //-----------------------------------------------------------------
1063 return (z1 - z2)/sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
1064}
1065
1066
b67e07dc 1067Double_t AliTPCtrackerMI::F3n(Double_t x1,Double_t y1,
91162307 1068 Double_t x2,Double_t y2,
47af7ca4 1069 Double_t z1,Double_t z2, Double_t c) const
1c53abe2 1070{
91162307 1071 //-----------------------------------------------------------------
1072 // Initial approximation of the tangent of the track dip angle
1073 //-----------------------------------------------------------------
1074
1075 // Double_t angle1;
1076
1077 //angle1 = (z1-z2)*c/(TMath::ASin(c*x1-ni)-TMath::ASin(c*x2-ni));
1c53abe2 1078 //
91162307 1079 Double_t d = TMath::Sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
1080 if (TMath::Abs(d*c*0.5)>1) return 0;
1081 // Double_t angle2 = TMath::ASin(d*c*0.5);
b67e07dc 1082 // Double_t angle2 = AliTPCFastMath::FastAsin(d*c*0.5);
1083 Double_t angle2 = (d*c*0.5>0.1)? TMath::ASin(d*c*0.5): AliTPCFastMath::FastAsin(d*c*0.5);
91162307 1084
1085 angle2 = (z1-z2)*c/(angle2*2.);
1086 return angle2;
1087}
1088
2f051b58 1089Bool_t AliTPCtrackerMI::GetProlongation(Double_t x1, Double_t x2, Double_t x[5], Double_t &y, Double_t &z) const
91162307 1090{//-----------------------------------------------------------------
1091 // This function find proloncation of a track to a reference plane x=x2.
1092 //-----------------------------------------------------------------
1093
1094 Double_t dx=x2-x1;
1095
1096 if (TMath::Abs(x[4]*x1 - x[2]) >= 0.999) {
1097 return kFALSE;
1c53abe2 1098 }
f8aae377 1099
bfd20868 1100 Double_t c1=x[4]*x1 - x[2], r1=TMath::Sqrt((1.-c1)*(1.+c1));
1101 Double_t c2=x[4]*x2 - x[2], r2=TMath::Sqrt((1.-c2)*(1.+c2));
91162307 1102 y = x[0];
1103 z = x[1];
1104
1105 Double_t dy = dx*(c1+c2)/(r1+r2);
1106 Double_t dz = 0;
1107 //
1108 Double_t delta = x[4]*dx*(c1+c2)/(c1*r2 + c2*r1);
1109
1110 if (TMath::Abs(delta)>0.01){
1111 dz = x[3]*TMath::ASin(delta)/x[4];
1112 }else{
b67e07dc 1113 dz = x[3]*AliTPCFastMath::FastAsin(delta)/x[4];
91162307 1114 }
1115
b67e07dc 1116 //dz = x[3]*AliTPCFastMath::FastAsin(delta)/x[4];
f8aae377 1117
91162307 1118 y+=dy;
1119 z+=dz;
1120
1121 return kTRUE;
1c53abe2 1122}
1123
2f051b58 1124Int_t AliTPCtrackerMI::LoadClusters (TTree *const tree)
d26d9159 1125{
1126 //
1127 //
1128 fInput = tree;
1129 return LoadClusters();
1130}
91162307 1131
af86c1fd 1132
47af7ca4 1133Int_t AliTPCtrackerMI::LoadClusters(const TObjArray *arr)
af86c1fd 1134{
1135 //
1136 // load clusters to the memory
e7de6656 1137 AliTPCClustersRow *clrow = new AliTPCClustersRow("AliTPCclusterMI");
af86c1fd 1138 Int_t lower = arr->LowerBound();
1139 Int_t entries = arr->GetEntriesFast();
77f88633 1140
af86c1fd 1141 for (Int_t i=lower; i<entries; i++) {
1142 clrow = (AliTPCClustersRow*) arr->At(i);
77f88633 1143 if(!clrow) continue;
1144 if(!clrow->GetArray()) continue;
1145
af86c1fd 1146 //
1147 Int_t sec,row;
47af7ca4 1148 fkParam->AdjustSectorRow(clrow->GetID(),sec,row);
77f88633 1149
af86c1fd 1150 for (Int_t icl=0; icl<clrow->GetArray()->GetEntriesFast(); icl++){
1151 Transform((AliTPCclusterMI*)(clrow->GetArray()->At(icl)));
1152 }
1153 //
1154 if (clrow->GetArray()->GetEntriesFast()<=0) continue;
bd26fa83 1155 AliTPCtrackerRow * tpcrow=0;
af86c1fd 1156 Int_t left=0;
1157 if (sec<fkNIS*2){
1158 tpcrow = &(fInnerSec[sec%fkNIS][row]);
1159 left = sec/fkNIS;
1160 }
1161 else{
1162 tpcrow = &(fOuterSec[(sec-fkNIS*2)%fkNOS][row]);
1163 left = (sec-fkNIS*2)/fkNOS;
1164 }
1165 if (left ==0){
1166 tpcrow->SetN1(clrow->GetArray()->GetEntriesFast());
1167 tpcrow->SetClusters1(new AliTPCclusterMI[tpcrow->GetN1()]);
77f88633 1168 for (Int_t j=0;j<tpcrow->GetN1();++j)
1169 tpcrow->SetCluster1(j, *(AliTPCclusterMI*)(clrow->GetArray()->At(j)));
af86c1fd 1170 }
1171 if (left ==1){
1172 tpcrow->SetN2(clrow->GetArray()->GetEntriesFast());
1173 tpcrow->SetClusters2(new AliTPCclusterMI[tpcrow->GetN2()]);
77f88633 1174 for (Int_t j=0;j<tpcrow->GetN2();++j)
1175 tpcrow->SetCluster2(j,*(AliTPCclusterMI*)(clrow->GetArray()->At(j)));
af86c1fd 1176 }
e7de6656 1177 clrow->GetArray()->Clear("C");
af86c1fd 1178 }
1179 //
1180 delete clrow;
1181 LoadOuterSectors();
1182 LoadInnerSectors();
1183 return 0;
1184}
1185
47af7ca4 1186Int_t AliTPCtrackerMI::LoadClusters(const TClonesArray *arr)
aa7f1a5a 1187{
1188 //
1189 // load clusters to the memory from one
1190 // TClonesArray
1191 //
1192 AliTPCclusterMI *clust=0;
98ee6d31 1193 Int_t count[72][96] = { {0} , {0} };
aa7f1a5a 1194
1195 // loop over clusters
1196 for (Int_t icl=0; icl<arr->GetEntriesFast(); icl++) {
1197 clust = (AliTPCclusterMI*)arr->At(icl);
1198 if(!clust) continue;
1199 //printf("cluster: det %d, row %d \n", clust->GetDetector(),clust->GetRow());
1200
1201 // transform clusters
1202 Transform(clust);
1203
1204 // count clusters per pad row
1205 count[clust->GetDetector()][clust->GetRow()]++;
1206 }
1207
1208 // insert clusters to sectors
1209 for (Int_t icl=0; icl<arr->GetEntriesFast(); icl++) {
1210 clust = (AliTPCclusterMI*)arr->At(icl);
1211 if(!clust) continue;
1212
1213 Int_t sec = clust->GetDetector();
1214 Int_t row = clust->GetRow();
98ee6d31 1215
1216 // filter overlapping pad rows needed by HLT
1217 if(sec<fkNIS*2) { //IROCs
1218 if(row == 30) continue;
1219 }
1220 else { // OROCs
1221 if(row == 27 || row == 76) continue;
1222 }
1223
aa7f1a5a 1224 Int_t left=0;
1225 if (sec<fkNIS*2){
1226 left = sec/fkNIS;
47af7ca4 1227 fInnerSec[sec%fkNIS].InsertCluster(clust, count[sec][row], fkParam);
aa7f1a5a 1228 }
1229 else{
1230 left = (sec-fkNIS*2)/fkNOS;
47af7ca4 1231 fOuterSec[(sec-fkNIS*2)%fkNOS].InsertCluster(clust, count[sec][row], fkParam);
aa7f1a5a 1232 }
1233 }
1234
98ee6d31 1235 // Load functions must be called behind LoadCluster(TClonesArray*)
1236 // needed by HLT
1237 //LoadOuterSectors();
1238 //LoadInnerSectors();
aa7f1a5a 1239
1240 return 0;
1241}
1242
af86c1fd 1243
91162307 1244Int_t AliTPCtrackerMI::LoadClusters()
1c53abe2 1245{
1246 //
1247 // load clusters to the memory
e7de6656 1248 AliTPCClustersRow *clrow= new AliTPCClustersRow("AliTPCclusterMI");
91162307 1249 //
1250 // TTree * tree = fClustersArray.GetTree();
1251
1252 TTree * tree = fInput;
1253 TBranch * br = tree->GetBranch("Segment");
1254 br->SetAddress(&clrow);
1255 //
1256 Int_t j=Int_t(tree->GetEntries());
1c53abe2 1257 for (Int_t i=0; i<j; i++) {
91162307 1258 br->GetEntry(i);
1259 //
1260 Int_t sec,row;
47af7ca4 1261 fkParam->AdjustSectorRow(clrow->GetID(),sec,row);
0201b65c 1262 for (Int_t icl=0; icl<clrow->GetArray()->GetEntriesFast(); icl++){
75fb37cc 1263 Transform((AliTPCclusterMI*)(clrow->GetArray()->At(icl)));
0201b65c 1264 }
91162307 1265 //
bd26fa83 1266 AliTPCtrackerRow * tpcrow=0;
91162307 1267 Int_t left=0;
1268 if (sec<fkNIS*2){
1269 tpcrow = &(fInnerSec[sec%fkNIS][row]);
1270 left = sec/fkNIS;
1271 }
1272 else{
1273 tpcrow = &(fOuterSec[(sec-fkNIS*2)%fkNOS][row]);
1274 left = (sec-fkNIS*2)/fkNOS;
1275 }
1276 if (left ==0){
b9671574 1277 tpcrow->SetN1(clrow->GetArray()->GetEntriesFast());
1278 tpcrow->SetClusters1(new AliTPCclusterMI[tpcrow->GetN1()]);
77f88633 1279 for (Int_t k=0;k<tpcrow->GetN1();++k)
1280 tpcrow->SetCluster1(k, *(AliTPCclusterMI*)(clrow->GetArray()->At(k)));
91162307 1281 }
1282 if (left ==1){
b9671574 1283 tpcrow->SetN2(clrow->GetArray()->GetEntriesFast());
1284 tpcrow->SetClusters2(new AliTPCclusterMI[tpcrow->GetN2()]);
77f88633 1285 for (Int_t k=0;k<tpcrow->GetN2();++k)
1286 tpcrow->SetCluster2(k,*(AliTPCclusterMI*)(clrow->GetArray()->At(k)));
91162307 1287 }
1c53abe2 1288 }
91162307 1289 //
1290 delete clrow;
1291 LoadOuterSectors();
1292 LoadInnerSectors();
1293 return 0;
1c53abe2 1294}
1295
1296
91162307 1297void AliTPCtrackerMI::UnloadClusters()
1298{
1299 //
1300 // unload clusters from the memory
1301 //
1302 Int_t nrows = fOuterSec->GetNRows();
1303 for (Int_t sec = 0;sec<fkNOS;sec++)
1304 for (Int_t row = 0;row<nrows;row++){
bd26fa83 1305 AliTPCtrackerRow* tpcrow = &(fOuterSec[sec%fkNOS][row]);
982aff31 1306 // if (tpcrow){
1307 // if (tpcrow->fClusters1) delete []tpcrow->fClusters1;
1308 // if (tpcrow->fClusters2) delete []tpcrow->fClusters2;
1309 //}
1310 tpcrow->ResetClusters();
91162307 1311 }
1312 //
1313 nrows = fInnerSec->GetNRows();
1314 for (Int_t sec = 0;sec<fkNIS;sec++)
1315 for (Int_t row = 0;row<nrows;row++){
bd26fa83 1316 AliTPCtrackerRow* tpcrow = &(fInnerSec[sec%fkNIS][row]);
982aff31 1317 //if (tpcrow){
1318 // if (tpcrow->fClusters1) delete []tpcrow->fClusters1;
1319 //if (tpcrow->fClusters2) delete []tpcrow->fClusters2;
1320 //}
1321 tpcrow->ResetClusters();
91162307 1322 }
1323
1324 return ;
1325}
1326
002af263 1327void AliTPCtrackerMI::FillClusterArray(TObjArray* array) const{
1328 //
1329 // Filling cluster to the array - For visualization purposes
1330 //
1331 Int_t nrows=0;
1332 nrows = fOuterSec->GetNRows();
1333 for (Int_t sec = 0;sec<fkNOS;sec++)
1334 for (Int_t row = 0;row<nrows;row++){
1335 AliTPCtrackerRow* tpcrow = &(fOuterSec[sec%fkNOS][row]);
1336 if (!tpcrow) continue;
1337 for (Int_t icl = 0;icl<tpcrow->GetN();icl++){
1338 array->AddLast((TObject*)((*tpcrow)[icl]));
1339 }
1340 }
1341 nrows = fInnerSec->GetNRows();
1342 for (Int_t sec = 0;sec<fkNIS;sec++)
1343 for (Int_t row = 0;row<nrows;row++){
1344 AliTPCtrackerRow* tpcrow = &(fInnerSec[sec%fkNIS][row]);
1345 if (!tpcrow) continue;
1346 for (Int_t icl = 0;icl<tpcrow->GetN();icl++){
1347 array->AddLast((TObject*)(*tpcrow)[icl]);
1348 }
1349 }
1350}
1351
1352
75fb37cc 1353void AliTPCtrackerMI::Transform(AliTPCclusterMI * cluster){
893468d9 1354 //
1355 //
1356 //
24db6af7 1357 AliTPCTransform *transform = AliTPCcalibDB::Instance()->GetTransform() ;
1358 if (!transform) {
1359 AliFatal("Tranformations not in calibDB");
ec26e231 1360 return;
24db6af7 1361 }
239f39b1 1362 transform->SetCurrentRecoParam((AliTPCRecoParam*)AliTPCReconstructor::GetRecoParam());
24db6af7 1363 Double_t x[3]={cluster->GetRow(),cluster->GetPad(),cluster->GetTimeBin()};
1364 Int_t i[1]={cluster->GetDetector()};
022ee144 1365 transform->Transform(x,i,0,1);
afbaa016 1366 // if (cluster->GetDetector()%36>17){
1367 // x[1]*=-1;
1368 //}
022ee144 1369
24db6af7 1370 //
1371 // in debug mode check the transformation
1372 //
16299eac 1373 if (AliTPCReconstructor::StreamLevel()>2) {
af86c1fd 1374 Float_t gx[3];
1375 cluster->GetGlobalXYZ(gx);
002af263 1376 Int_t event = (fEvent==NULL)? 0: fEvent->GetEventNumberInFile();
24db6af7 1377 TTreeSRedirector &cstream = *fDebugStreamer;
1378 cstream<<"Transform"<<
002af263 1379 "event="<<event<<
24db6af7 1380 "x0="<<x[0]<<
1381 "x1="<<x[1]<<
1382 "x2="<<x[2]<<
af86c1fd 1383 "gx0="<<gx[0]<<
1384 "gx1="<<gx[1]<<
1385 "gx2="<<gx[2]<<
24db6af7 1386 "Cl.="<<cluster<<
1387 "\n";
1388 }
1389 cluster->SetX(x[0]);
1390 cluster->SetY(x[1]);
1391 cluster->SetZ(x[2]);
19b00333 1392 // The old stuff:
1393
0201b65c 1394 //
1395 //
1396 //
47af7ca4 1397 //if (!fkParam->IsGeoRead()) fkParam->ReadGeoMatrices();
1398 TGeoHMatrix *mat = fkParam->GetClusterMatrix(cluster->GetDetector());
e7eb17e4 1399 //TGeoHMatrix mat;
0201b65c 1400 Double_t pos[3]= {cluster->GetX(),cluster->GetY(),cluster->GetZ()};
a7760332 1401 Double_t posC[3]={cluster->GetX(),cluster->GetY(),cluster->GetZ()};
1402 if (mat) mat->LocalToMaster(pos,posC);
1403 else{
1404 // chack Loading of Geo matrices from GeoManager - TEMPORARY FIX
1405 }
24db6af7 1406 cluster->SetX(posC[0]);
1407 cluster->SetY(posC[1]);
1408 cluster->SetZ(posC[2]);
0201b65c 1409}
1c53abe2 1410
1411//_____________________________________________________________________________
91162307 1412Int_t AliTPCtrackerMI::LoadOuterSectors() {
1c53abe2 1413 //-----------------------------------------------------------------
1414 // This function fills outer TPC sectors with clusters.
1415 //-----------------------------------------------------------------
91162307 1416 Int_t nrows = fOuterSec->GetNRows();
1417 UInt_t index=0;
1418 for (Int_t sec = 0;sec<fkNOS;sec++)
1419 for (Int_t row = 0;row<nrows;row++){
bd26fa83 1420 AliTPCtrackerRow* tpcrow = &(fOuterSec[sec%fkNOS][row]);
91162307 1421 Int_t sec2 = sec+2*fkNIS;
1422 //left
b9671574 1423 Int_t ncl = tpcrow->GetN1();
91162307 1424 while (ncl--) {
b9671574 1425 AliTPCclusterMI *c= (tpcrow->GetCluster1(ncl));
91162307 1426 index=(((sec2<<8)+row)<<16)+ncl;
1427 tpcrow->InsertCluster(c,index);
1428 }
1429 //right
b9671574 1430 ncl = tpcrow->GetN2();
91162307 1431 while (ncl--) {
b9671574 1432 AliTPCclusterMI *c= (tpcrow->GetCluster2(ncl));
91162307 1433 index=((((sec2+fkNOS)<<8)+row)<<16)+ncl;
1434 tpcrow->InsertCluster(c,index);
1435 }
1436 //
1437 // write indexes for fast acces
1438 //
1439 for (Int_t i=0;i<510;i++)
b9671574 1440 tpcrow->SetFastCluster(i,-1);
91162307 1441 for (Int_t i=0;i<tpcrow->GetN();i++){
1442 Int_t zi = Int_t((*tpcrow)[i]->GetZ()+255.);
b9671574 1443 tpcrow->SetFastCluster(zi,i); // write index
91162307 1444 }
1445 Int_t last = 0;
1446 for (Int_t i=0;i<510;i++){
b9671574 1447 if (tpcrow->GetFastCluster(i)<0)
1448 tpcrow->SetFastCluster(i,last);
91162307 1449 else
b9671574 1450 last = tpcrow->GetFastCluster(i);
91162307 1451 }
1452 }
1c53abe2 1453 fN=fkNOS;
1454 fSectors=fOuterSec;
91162307 1455 return 0;
1c53abe2 1456}
1457
1458
1459//_____________________________________________________________________________
91162307 1460Int_t AliTPCtrackerMI::LoadInnerSectors() {
1c53abe2 1461 //-----------------------------------------------------------------
1462 // This function fills inner TPC sectors with clusters.
1463 //-----------------------------------------------------------------
91162307 1464 Int_t nrows = fInnerSec->GetNRows();
1465 UInt_t index=0;
1466 for (Int_t sec = 0;sec<fkNIS;sec++)
1467 for (Int_t row = 0;row<nrows;row++){
bd26fa83 1468 AliTPCtrackerRow* tpcrow = &(fInnerSec[sec%fkNIS][row]);
91162307 1469 //
1470 //left
b9671574 1471 Int_t ncl = tpcrow->GetN1();
91162307 1472 while (ncl--) {
b9671574 1473 AliTPCclusterMI *c= (tpcrow->GetCluster1(ncl));
91162307 1474 index=(((sec<<8)+row)<<16)+ncl;
1475 tpcrow->InsertCluster(c,index);
1476 }
1477 //right
b9671574 1478 ncl = tpcrow->GetN2();
91162307 1479 while (ncl--) {
b9671574 1480 AliTPCclusterMI *c= (tpcrow->GetCluster2(ncl));
91162307 1481 index=((((sec+fkNIS)<<8)+row)<<16)+ncl;
1482 tpcrow->InsertCluster(c,index);
1483 }
1484 //
1485 // write indexes for fast acces
1486 //
1487 for (Int_t i=0;i<510;i++)
b9671574 1488 tpcrow->SetFastCluster(i,-1);
91162307 1489 for (Int_t i=0;i<tpcrow->GetN();i++){
1490 Int_t zi = Int_t((*tpcrow)[i]->GetZ()+255.);
b9671574 1491 tpcrow->SetFastCluster(zi,i); // write index
91162307 1492 }
1493 Int_t last = 0;
1494 for (Int_t i=0;i<510;i++){
b9671574 1495 if (tpcrow->GetFastCluster(i)<0)
1496 tpcrow->SetFastCluster(i,last);
91162307 1497 else
b9671574 1498 last = tpcrow->GetFastCluster(i);
91162307 1499 }
1c53abe2 1500
91162307 1501 }
1502
1c53abe2 1503 fN=fkNIS;
1504 fSectors=fInnerSec;
91162307 1505 return 0;
1506}
1507
1508
1509
1510//_________________________________________________________________________
1511AliTPCclusterMI *AliTPCtrackerMI::GetClusterMI(Int_t index) const {
1512 //--------------------------------------------------------------------
1513 // Return pointer to a given cluster
1514 //--------------------------------------------------------------------
e7eb17e4 1515 if (index<0) return 0; // no cluster
91162307 1516 Int_t sec=(index&0xff000000)>>24;
1517 Int_t row=(index&0x00ff0000)>>16;
d26d9159 1518 Int_t ncl=(index&0x00007fff)>>00;
91162307 1519
bd26fa83 1520 const AliTPCtrackerRow * tpcrow=0;
91162307 1521 AliTPCclusterMI * clrow =0;
3da363a1 1522
ad23441a 1523 if (sec<0 || sec>=fkNIS*4) {
1524 AliWarning(Form("Wrong sector %d",sec));
1525 return 0x0;
1526 }
1527
91162307 1528 if (sec<fkNIS*2){
462fb6e0 1529 AliTPCtrackerSector& tracksec = fInnerSec[sec%fkNIS];
1530 if (tracksec.GetNRows()<=row) return 0;
1531 tpcrow = &(tracksec[row]);
3da363a1 1532 if (tpcrow==0) return 0;
1533
1534 if (sec<fkNIS) {
b9671574 1535 if (tpcrow->GetN1()<=ncl) return 0;
1536 clrow = tpcrow->GetClusters1();
3da363a1 1537 }
1538 else {
b9671574 1539 if (tpcrow->GetN2()<=ncl) return 0;
1540 clrow = tpcrow->GetClusters2();
3da363a1 1541 }
91162307 1542 }
3da363a1 1543 else {
462fb6e0 1544 AliTPCtrackerSector& tracksec = fOuterSec[(sec-fkNIS*2)%fkNOS];
1545 if (tracksec.GetNRows()<=row) return 0;
1546 tpcrow = &(tracksec[row]);
3da363a1 1547 if (tpcrow==0) return 0;
1548
1549 if (sec-2*fkNIS<fkNOS) {
b9671574 1550 if (tpcrow->GetN1()<=ncl) return 0;
1551 clrow = tpcrow->GetClusters1();
3da363a1 1552 }
1553 else {
b9671574 1554 if (tpcrow->GetN2()<=ncl) return 0;
1555 clrow = tpcrow->GetClusters2();
3da363a1 1556 }
91162307 1557 }
3da363a1 1558
91162307 1559 return &(clrow[ncl]);
1560
1c53abe2 1561}
1562
91162307 1563
1564
1c53abe2 1565Int_t AliTPCtrackerMI::FollowToNext(AliTPCseed& t, Int_t nr) {
1566 //-----------------------------------------------------------------
1567 // This function tries to find a track prolongation to next pad row
1568 //-----------------------------------------------------------------
1c53abe2 1569 //
91162307 1570 Double_t x= GetXrow(nr), ymax=GetMaxY(nr);
76d56fd6 1571 //
1572 //
4d158c36 1573 AliTPCclusterMI *cl=0;
1574 Int_t tpcindex= t.GetClusterIndex2(nr);
1575 //
1576 // update current shape info every 5 pad-row
1577 // if ( (nr%5==0) || t.GetNumberOfClusters()<2 || (t.fCurrentSigmaY2<0.0001) ){
1578 GetShape(&t,nr);
1579 //}
1580 //
1581 if (fIteration>0 && tpcindex>=-1){ //if we have already clusters
1582 //
1583 if (tpcindex==-1) return 0; //track in dead zone
1584 if (tpcindex>0){ //
b9671574 1585 cl = t.GetClusterPointer(nr);
e0656451 1586 if ( (cl==0) ) cl = GetClusterMI(tpcindex);
b9671574 1587 t.SetCurrentClusterIndex1(tpcindex);
4d158c36 1588 }
1589 if (cl){
1590 Int_t relativesector = ((tpcindex&0xff000000)>>24)%18; // if previously accepted cluster in different sector
1591 Float_t angle = relativesector*fSectors->GetAlpha()+fSectors->GetAlphaShift();
1592 //
1593 if (angle<-TMath::Pi()) angle += 2*TMath::Pi();
1594 if (angle>=TMath::Pi()) angle -= 2*TMath::Pi();
1595
1596 if (TMath::Abs(angle-t.GetAlpha())>0.001){
1597 Double_t rotation = angle-t.GetAlpha();
b9671574 1598 t.SetRelativeSector(relativesector);
3f82c4f2 1599 if (!t.Rotate(rotation)) return 0;
4d158c36 1600 }
3f82c4f2 1601 if (!t.PropagateTo(x)) return 0;
4d158c36 1602 //
b9671574 1603 t.SetCurrentCluster(cl);
1604 t.SetRow(nr);
00055a22 1605 Int_t accept = AcceptCluster(&t,t.GetCurrentCluster());
4d158c36 1606 if ((tpcindex&0x8000)==0) accept =0;
1607 if (accept<3) {
1608 //if founded cluster is acceptible
1609 if (cl->IsUsed(11)) { // id cluster is shared inrease uncertainty
b9671574 1610 t.SetErrorY2(t.GetErrorY2()+0.03);
1611 t.SetErrorZ2(t.GetErrorZ2()+0.03);
1612 t.SetErrorY2(t.GetErrorY2()*3);
1613 t.SetErrorZ2(t.GetErrorZ2()*3);
4d158c36 1614 }
b9671574 1615 t.SetNFoundable(t.GetNFoundable()+1);
4d158c36 1616 UpdateTrack(&t,accept);
1617 return 1;
1618 }
1619 }
1627d1c4 1620 }
3f82c4f2 1621 if (TMath::Abs(t.GetSnp())>AliTPCReconstructor::GetMaxSnpTracker()) return 0; // cut on angle
76d56fd6 1622 if (fIteration>1 && IsFindable(t)){
3f82c4f2 1623 // not look for new cluster during refitting
b9671574 1624 t.SetNFoundable(t.GetNFoundable()+1);
3f82c4f2 1625 return 0;
1626 }
91162307 1627 //
4d158c36 1628 UInt_t index=0;
ca142b1f 1629 // if (TMath::Abs(t.GetSnp())>0.95 || TMath::Abs(x*t.GetC()-t.GetEta())>0.95) return 0;// patch 28 fev 06
4d158c36 1630 Double_t y=t.GetYat(x);
91162307 1631 if (TMath::Abs(y)>ymax){
1632 if (y > ymax) {
b9671574 1633 t.SetRelativeSector((t.GetRelativeSector()+1) % fN);
91162307 1634 if (!t.Rotate(fSectors->GetAlpha()))
1635 return 0;
1636 } else if (y <-ymax) {
b9671574 1637 t.SetRelativeSector((t.GetRelativeSector()-1+fN) % fN);
91162307 1638 if (!t.Rotate(-fSectors->GetAlpha()))
1639 return 0;
1640 }
4d158c36 1641 //return 1;
91162307 1642 }
1643 //
4d158c36 1644 if (!t.PropagateTo(x)) {
b9671574 1645 if (fIteration==0) t.SetRemoval(10);
4d158c36 1646 return 0;
91162307 1647 }
4d158c36 1648 y=t.GetY();
1649 Double_t z=t.GetZ();
1650 //
a3232aae 1651
b9671574 1652 if (!IsActive(t.GetRelativeSector(),nr)) {
1653 t.SetInDead(kTRUE);
a3232aae 1654 t.SetClusterIndex2(nr,-1);
1655 return 0;
1656 }
1657 //AliInfo(Form("A - Sector%d phi %f - alpha %f", t.fRelativeSector,y/x, t.GetAlpha()));
b9671574 1658 Bool_t isActive = IsActive(t.GetRelativeSector(),nr);
1659 Bool_t isActive2 = (nr>=fInnerSec->GetNRows()) ? fOuterSec[t.GetRelativeSector()][nr-fInnerSec->GetNRows()].GetN()>0:fInnerSec[t.GetRelativeSector()][nr].GetN()>0;
a3232aae 1660
1661 if (!isActive || !isActive2) return 0;
1662
bd26fa83 1663 const AliTPCtrackerRow &krow=GetRow(t.GetRelativeSector(),nr);
91162307 1664 if ( (t.GetSigmaY2()<0) || t.GetSigmaZ2()<0) return 0;
1665 Double_t roady =1.;
1666 Double_t roadz = 1.;
1667 //
b9671574 1668 if (TMath::Abs(TMath::Abs(y)-ymax)<krow.GetDeadZone()){
1669 t.SetInDead(kTRUE);
91162307 1670 t.SetClusterIndex2(nr,-1);
1c53abe2 1671 return 0;
1672 }
1673 else
1674 {
76d56fd6 1675 if (IsFindable(t))
47af7ca4 1676 // if (TMath::Abs(z)<(AliTPCReconstructor::GetCtgRange()*x+10) && TMath::Abs(z)<fkParam->GetZLength(0) && (TMath::Abs(t.GetSnp())<AliTPCReconstructor::GetMaxSnpTracker()))
b9671574 1677 t.SetNFoundable(t.GetNFoundable()+1);
1627d1c4 1678 else
1679 return 0;
1c53abe2 1680 }
1681 //calculate
91162307 1682 if (krow) {
1683 // cl = krow.FindNearest2(y+10.,z,roady,roadz,index);
1684 cl = krow.FindNearest2(y,z,roady,roadz,index);
b9671574 1685 if (cl) t.SetCurrentClusterIndex1(krow.GetIndex(index));
91162307 1686 }
91162307 1687 if (cl) {
b9671574 1688 t.SetCurrentCluster(cl);
1689 t.SetRow(nr);
4d158c36 1690 if (fIteration==2&&cl->IsUsed(10)) return 0;
00055a22 1691 Int_t accept = AcceptCluster(&t,t.GetCurrentCluster());
4d158c36 1692 if (fIteration==2&&cl->IsUsed(11)) {
b9671574 1693 t.SetErrorY2(t.GetErrorY2()+0.03);
1694 t.SetErrorZ2(t.GetErrorZ2()+0.03);
1695 t.SetErrorY2(t.GetErrorY2()*3);
1696 t.SetErrorZ2(t.GetErrorZ2()*3);
4d158c36 1697 }
d26d9159 1698 /*
91162307 1699 if (t.fCurrentCluster->IsUsed(10)){
1700 //
1701 //
c9427e08 1702
91162307 1703 t.fNShared++;
1704 if (t.fNShared>0.7*t.GetNumberOfClusters()) {
1705 t.fRemoval =10;
1706 return 0;
1707 }
1708 }
d26d9159 1709 */
91162307 1710 if (accept<3) UpdateTrack(&t,accept);
c9427e08 1711
91162307 1712 } else {
b9671574 1713 if ( fIteration==0 && t.GetNFoundable()*0.5 > t.GetNumberOfClusters()) t.SetRemoval(10);
91162307 1714
1715 }
1716 return 1;
1717}
c9427e08 1718
1c53abe2 1719
91162307 1720
5d837844 1721//_________________________________________________________________________
1722Bool_t AliTPCtrackerMI::GetTrackPoint(Int_t index, AliTrackPoint &p ) const
1723{
1724 // Get track space point by index
1725 // return false in case the cluster doesn't exist
1726 AliTPCclusterMI *cl = GetClusterMI(index);
1727 if (!cl) return kFALSE;
1728 Int_t sector = (index&0xff000000)>>24;
0201b65c 1729 // Int_t row = (index&0x00ff0000)>>16;
5d837844 1730 Float_t xyz[3];
47af7ca4 1731 // xyz[0] = fkParam->GetPadRowRadii(sector,row);
0201b65c 1732 xyz[0] = cl->GetX();
5d837844 1733 xyz[1] = cl->GetY();
1734 xyz[2] = cl->GetZ();
1735 Float_t sin,cos;
47af7ca4 1736 fkParam->AdjustCosSin(sector,cos,sin);
5d837844 1737 Float_t x = cos*xyz[0]-sin*xyz[1];
1738 Float_t y = cos*xyz[1]+sin*xyz[0];
1739 Float_t cov[6];
1740 Float_t sigmaY2 = 0.027*cl->GetSigmaY2();
47af7ca4 1741 if (sector < fkParam->GetNInnerSector()) sigmaY2 *= 2.07;
5d837844 1742 Float_t sigmaZ2 = 0.066*cl->GetSigmaZ2();
47af7ca4 1743 if (sector < fkParam->GetNInnerSector()) sigmaZ2 *= 1.77;
5d837844 1744 cov[0] = sin*sin*sigmaY2;
1745 cov[1] = -sin*cos*sigmaY2;
1746 cov[2] = 0.;
1747 cov[3] = cos*cos*sigmaY2;
1748 cov[4] = 0.;
1749 cov[5] = sigmaZ2;
1750 p.SetXYZ(x,y,xyz[2],cov);
ae079791 1751 AliGeomManager::ELayerID iLayer;
5d837844 1752 Int_t idet;
47af7ca4 1753 if (sector < fkParam->GetNInnerSector()) {
ae079791 1754 iLayer = AliGeomManager::kTPC1;
5d837844 1755 idet = sector;
1756 }
1757 else {
ae079791 1758 iLayer = AliGeomManager::kTPC2;
47af7ca4 1759 idet = sector - fkParam->GetNInnerSector();
5d837844 1760 }
ae079791 1761 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,idet);
5d837844 1762 p.SetVolumeID(volid);
1763 return kTRUE;
1764}
1765
1766
1767
91162307 1768Int_t AliTPCtrackerMI::UpdateClusters(AliTPCseed& t, Int_t nr) {
1c53abe2 1769 //-----------------------------------------------------------------
1770 // This function tries to find a track prolongation to next pad row
1771 //-----------------------------------------------------------------
b9671574 1772 t.SetCurrentCluster(0);
1773 t.SetCurrentClusterIndex1(0);
1c53abe2 1774
1775 Double_t xt=t.GetX();
91162307 1776 Int_t row = GetRowNumber(xt)-1;
1777 Double_t ymax= GetMaxY(nr);
1778
1c53abe2 1779 if (row < nr) return 1; // don't prolongate if not information until now -
ca142b1f 1780// if (TMath::Abs(t.GetSnp())>0.9 && t.GetNumberOfClusters()>40. && fIteration!=2) {
1781// t.fRemoval =10;
1782// return 0; // not prolongate strongly inclined tracks
1783// }
1784// if (TMath::Abs(t.GetSnp())>0.95) {
1785// t.fRemoval =10;
1786// return 0; // not prolongate strongly inclined tracks
1787// }// patch 28 fev 06
91162307 1788
1789 Double_t x= GetXrow(nr);
1790 Double_t y,z;
1791 //t.PropagateTo(x+0.02);
1792 //t.PropagateTo(x+0.01);
1627d1c4 1793 if (!t.PropagateTo(x)){
1627d1c4 1794 return 0;
1795 }
1c53abe2 1796 //
91162307 1797 y=t.GetY();
1798 z=t.GetZ();
1c53abe2 1799
91162307 1800 if (TMath::Abs(y)>ymax){
1801 if (y > ymax) {
b9671574 1802 t.SetRelativeSector((t.GetRelativeSector()+1) % fN);
91162307 1803 if (!t.Rotate(fSectors->GetAlpha()))
1804 return 0;
1805 } else if (y <-ymax) {
b9671574 1806 t.SetRelativeSector((t.GetRelativeSector()-1+fN) % fN);
91162307 1807 if (!t.Rotate(-fSectors->GetAlpha()))
1808 return 0;
1809 }
982aff31 1810 // if (!t.PropagateTo(x)){
1811 // return 0;
1812 //}
1813 return 1;
1814 //y = t.GetY();
1c53abe2 1815 }
91162307 1816 //
3f82c4f2 1817 if (TMath::Abs(t.GetSnp())>AliTPCReconstructor::GetMaxSnpTracker()) return 0;
a3232aae 1818
b9671574 1819 if (!IsActive(t.GetRelativeSector(),nr)) {
1820 t.SetInDead(kTRUE);
a3232aae 1821 t.SetClusterIndex2(nr,-1);
1822 return 0;
1823 }
1824 //AliInfo(Form("A - Sector%d phi %f - alpha %f", t.fRelativeSector,y/x, t.GetAlpha()));
1825
bd26fa83 1826 AliTPCtrackerRow &krow=GetRow(t.GetRelativeSector(),nr);
1c53abe2 1827
b9671574 1828 if (TMath::Abs(TMath::Abs(y)-ymax)<krow.GetDeadZone()){
1829 t.SetInDead(kTRUE);
91162307 1830 t.SetClusterIndex2(nr,-1);
1c53abe2 1831 return 0;
1832 }
1833 else
1834 {
76d56fd6 1835
1836 // if (TMath::Abs(t.GetZ())<(AliTPCReconstructor::GetCtgRange()*t.GetX()+10) && (TMath::Abs(t.GetSnp())<AliTPCReconstructor::GetMaxSnpTracker()))
1837 if (IsFindable(t)) t.SetNFoundable(t.GetNFoundable()+1);
1627d1c4 1838 else
1839 return 0;
1c53abe2 1840 }
1c53abe2 1841
91162307 1842 // update current
42aec1f1 1843 if ( (nr%2==0) || t.GetNumberOfClusters()<2){
91162307 1844 // t.fCurrentSigmaY = GetSigmaY(&t);
1845 //t.fCurrentSigmaZ = GetSigmaZ(&t);
1846 GetShape(&t,nr);
1847 }
1c53abe2 1848
91162307 1849 AliTPCclusterMI *cl=0;
d184f295 1850 Int_t index=0;
91162307 1851 //
1852 Double_t roady = 1.;
1853 Double_t roadz = 1.;
1854 //
d26d9159 1855
1856 if (!cl){
1857 index = t.GetClusterIndex2(nr);
1858 if ( (index>0) && (index&0x8000)==0){
b9671574 1859 cl = t.GetClusterPointer(nr);
d26d9159 1860 if ( (cl==0) && (index>0)) cl = GetClusterMI(index);
b9671574 1861 t.SetCurrentClusterIndex1(index);
d26d9159 1862 if (cl) {
b9671574 1863 t.SetCurrentCluster(cl);
d26d9159 1864 return 1;
1865 }
1866 }
1867 }
1868
3d172d79 1869 // if (index<0) return 0;
1870 UInt_t uindex = TMath::Abs(index);
d184f295 1871
91162307 1872 if (krow) {
d184f295 1873 //cl = krow.FindNearest2(y+10,z,roady,roadz,uindex);
1874 cl = krow.FindNearest2(y,z,roady,roadz,uindex);
91162307 1875 }
d26d9159 1876
b9671574 1877 if (cl) t.SetCurrentClusterIndex1(krow.GetIndex(uindex));
1878 t.SetCurrentCluster(cl);
d26d9159 1879
91162307 1880 return 1;
1881}
1c53abe2 1882
1c53abe2 1883
91162307 1884Int_t AliTPCtrackerMI::FollowToNextCluster(AliTPCseed & t, Int_t nr) {
1885 //-----------------------------------------------------------------
1886 // This function tries to find a track prolongation to next pad row
1887 //-----------------------------------------------------------------
1c53abe2 1888
91162307 1889 //update error according neighborhoud
1c53abe2 1890
b9671574 1891 if (t.GetCurrentCluster()) {
1892 t.SetRow(nr);
00055a22 1893 Int_t accept = AcceptCluster(&t,t.GetCurrentCluster());
91162307 1894
b9671574 1895 if (t.GetCurrentCluster()->IsUsed(10)){
91162307 1896 //
1897 //
1898 // t.fErrorZ2*=2;
1899 // t.fErrorY2*=2;
b9671574 1900 t.SetNShared(t.GetNShared()+1);
1901 if (t.GetNShared()>0.7*t.GetNumberOfClusters()) {
1902 t.SetRemoval(10);
91162307 1903 return 0;
1904 }
b364ca79 1905 }
d26d9159 1906 if (fIteration>0) accept = 0;
b364ca79 1907 if (accept<3) UpdateTrack(&t,accept);
1908
1c53abe2 1909 } else {
91162307 1910 if (fIteration==0){
b9671574 1911 if ( ( (t.GetSigmaY2()+t.GetSigmaZ2())>0.16)&& t.GetNumberOfClusters()>18) t.SetRemoval(10);
1912 if ( t.GetChi2()/t.GetNumberOfClusters()>6 &&t.GetNumberOfClusters()>18) t.SetRemoval(10);
91162307 1913
b9671574 1914 if (( (t.GetNFoundable()*0.5 > t.GetNumberOfClusters()) || t.GetNoCluster()>15)) t.SetRemoval(10);
1c53abe2 1915 }
1916 }
1917 return 1;
1918}
1919
1920
1921
91162307 1922//_____________________________________________________________________________
1923Int_t AliTPCtrackerMI::FollowProlongation(AliTPCseed& t, Int_t rf, Int_t step) {
1c53abe2 1924 //-----------------------------------------------------------------
91162307 1925 // This function tries to find a track prolongation.
1c53abe2 1926 //-----------------------------------------------------------------
1927 Double_t xt=t.GetX();
1928 //
91162307 1929 Double_t alpha=t.GetAlpha() - fSectors->GetAlphaShift();
1c53abe2 1930 if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi();
1931 if (alpha < 0. ) alpha += 2.*TMath::Pi();
91162307 1932 //
b9671574 1933 t.SetRelativeSector(Int_t(alpha/fSectors->GetAlpha()+0.0001)%fN);
1c53abe2 1934
91162307 1935 Int_t first = GetRowNumber(xt)-1;
51ad6848 1936 for (Int_t nr= first; nr>=rf; nr-=step) {
1937 // update kink info
1938 if (t.GetKinkIndexes()[0]>0){
1939 for (Int_t i=0;i<3;i++){
1940 Int_t index = t.GetKinkIndexes()[i];
1941 if (index==0) break;
1942 if (index<0) continue;
1943 //
6c94f330 1944 AliKink * kink = (AliKink*)fEvent->GetKink(index-1);
51ad6848 1945 if (!kink){
1946 printf("PROBLEM\n");
1947 }
1948 else{
eea478d3 1949 Int_t kinkrow = kink->GetTPCRow0()+2+Int_t(0.5/(0.05+kink->GetAngle(2)));
51ad6848 1950 if (kinkrow==nr){
1951 AliExternalTrackParam paramd(t);
1952 kink->SetDaughter(paramd);
eea478d3 1953 kink->SetStatus(2,5);
51ad6848 1954 kink->Update();
51ad6848 1955 }
1956 }
1957 }
1958 }
1959
1960 if (nr==80) t.UpdateReference();
982aff31 1961 if (nr<fInnerSec->GetNRows())
1962 fSectors = fInnerSec;
1963 else
1964 fSectors = fOuterSec;
91162307 1965 if (FollowToNext(t,nr)==0)
4d158c36 1966 if (!t.IsActive())
1967 return 0;
91162307 1968
1969 }
1970 return 1;
1971}
1972
1c53abe2 1973
1c53abe2 1974
91162307 1975
1976
1977
1c53abe2 1978Int_t AliTPCtrackerMI::FollowBackProlongation(AliTPCseed& t, Int_t rf) {
1979 //-----------------------------------------------------------------
1980 // This function tries to find a track prolongation.
1981 //-----------------------------------------------------------------
1c53abe2 1982 //
eea478d3 1983 Double_t xt=t.GetX();
1c53abe2 1984 Double_t alpha=t.GetAlpha() - fSectors->GetAlphaShift();
1985 if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi();
1986 if (alpha < 0. ) alpha += 2.*TMath::Pi();
b9671574 1987 t.SetRelativeSector(Int_t(alpha/fSectors->GetAlpha()+0.0001)%fN);
1c53abe2 1988
b9671574 1989 Int_t first = t.GetFirstPoint();
eea478d3 1990 if (first<GetRowNumber(xt)+1) first = GetRowNumber(xt)+1;
91162307 1991 //
1992 if (first<0) first=0;
4d158c36 1993 for (Int_t nr=first; nr<=rf; nr++) {
ca142b1f 1994 // if ( (TMath::Abs(t.GetSnp())>0.95)) break;//patch 28 fev 06
51ad6848 1995 if (t.GetKinkIndexes()[0]<0){
1996 for (Int_t i=0;i<3;i++){
1997 Int_t index = t.GetKinkIndexes()[i];
1998 if (index==0) break;
1999 if (index>0) continue;
2000 index = TMath::Abs(index);
6c94f330 2001 AliKink * kink = (AliKink*)fEvent->GetKink(index-1);
51ad6848 2002 if (!kink){
2003 printf("PROBLEM\n");
2004 }
2005 else{
eea478d3 2006 Int_t kinkrow = kink->GetTPCRow0()-2-Int_t(0.5/(0.05+kink->GetAngle(2)));
51ad6848 2007 if (kinkrow==nr){
2008 AliExternalTrackParam paramm(t);
2009 kink->SetMother(paramm);
eea478d3 2010 kink->SetStatus(2,1);
51ad6848 2011 kink->Update();
51ad6848 2012 }
2013 }
eea478d3 2014 }
51ad6848 2015 }
eea478d3 2016 //
d26d9159 2017 if (nr<fInnerSec->GetNRows())
2018 fSectors = fInnerSec;
2019 else
2020 fSectors = fOuterSec;
c274e255 2021
d26d9159 2022 FollowToNext(t,nr);
1c53abe2 2023 }
2024 return 1;
2025}
2026
2027
2028
2029
2030
2031Float_t AliTPCtrackerMI::OverlapFactor(AliTPCseed * s1, AliTPCseed * s2, Int_t &sum1, Int_t & sum2)
2032{
2033 //
2034 //
2035 sum1=0;
2036 sum2=0;
2037 Int_t sum=0;
1c53abe2 2038 //
2039 Float_t dz2 =(s1->GetZ() - s2->GetZ());
c9427e08 2040 dz2*=dz2;
91162307 2041
c9427e08 2042 Float_t dy2 =TMath::Abs((s1->GetY() - s2->GetY()));
1c53abe2 2043 dy2*=dy2;
2044 Float_t distance = TMath::Sqrt(dz2+dy2);
c9427e08 2045 if (distance>4.) return 0; // if there are far away - not overlap - to reduce combinatorics
1c53abe2 2046
91162307 2047 // Int_t offset =0;
b9671574 2048 Int_t firstpoint = TMath::Min(s1->GetFirstPoint(),s2->GetFirstPoint());
2049 Int_t lastpoint = TMath::Max(s1->GetLastPoint(),s2->GetLastPoint());
c9427e08 2050 if (lastpoint>160)
2051 lastpoint =160;
2052 if (firstpoint<0)
2053 firstpoint = 0;
91162307 2054 if (firstpoint>lastpoint) {
2055 firstpoint =lastpoint;
2056 // lastpoint =160;
c9427e08 2057 }
2058
2059
91162307 2060 for (Int_t i=firstpoint-1;i<lastpoint+1;i++){
2061 if (s1->GetClusterIndex2(i)>0) sum1++;
2062 if (s2->GetClusterIndex2(i)>0) sum2++;
2063 if (s1->GetClusterIndex2(i)==s2->GetClusterIndex2(i) && s1->GetClusterIndex2(i)>0) {
1c53abe2 2064 sum++;
2065 }
2066 }
91162307 2067 if (sum<5) return 0;
2068
1627d1c4 2069 Float_t summin = TMath::Min(sum1+1,sum2+1);
2070 Float_t ratio = (sum+1)/Float_t(summin);
1c53abe2 2071 return ratio;
2072}
2073
2074void AliTPCtrackerMI::SignShared(AliTPCseed * s1, AliTPCseed * s2)
2075{
2076 //
2077 //
a0f4d6a6 2078 Float_t thetaCut = 0.2;//+10.*TMath::Sqrt(s1->GetSigmaTglZ()+ s2->GetSigmaTglZ());
2079 if (TMath::Abs(s1->GetTgl()-s2->GetTgl())>thetaCut) return;
2080 Float_t minCl = TMath::Min(s1->GetNumberOfClusters(),s2->GetNumberOfClusters());
2081 Int_t cutN0 = TMath::Max(5,TMath::Nint(0.1*minCl));
91162307 2082
1c53abe2 2083 //
91162307 2084 Int_t sumshared=0;
2085 //
a0f4d6a6 2086 //Int_t firstpoint = TMath::Max(s1->GetFirstPoint(),s2->GetFirstPoint());
2087 //Int_t lastpoint = TMath::Min(s1->GetLastPoint(),s2->GetLastPoint());
2088 Int_t firstpoint = 0;
2089 Int_t lastpoint = 160;
91162307 2090 //
a0f4d6a6 2091 // if (firstpoint>=lastpoint-5) return;;
1af5da7e 2092
91162307 2093 for (Int_t i=firstpoint;i<lastpoint;i++){
2094 // if ( (s1->GetClusterIndex2(i)&0xFFFF8FFF)==(s2->GetClusterIndex2(i)&0xFFFF8FFF) && s1->GetClusterIndex2(i)>0) {
2095 if ( (s1->GetClusterIndex2(i))==(s2->GetClusterIndex2(i)) && s1->GetClusterIndex2(i)>0) {
2096 sumshared++;
19b00333 2097 s1->SetSharedMapBit(i, kTRUE);
2098 s2->SetSharedMapBit(i, kTRUE);
91162307 2099 }
19b00333 2100 if (s1->GetClusterIndex2(i)>0)
2101 s1->SetClusterMapBit(i, kTRUE);
91162307 2102 }
a0f4d6a6 2103 if (sumshared>cutN0){
91162307 2104 // sign clusters
2105 //
2106 for (Int_t i=firstpoint;i<lastpoint;i++){
2107 // if ( (s1->GetClusterIndex2(i)&0xFFFF8FFF)==(s2->GetClusterIndex2(i)&0xFFFF8FFF) && s1->GetClusterIndex2(i)>0) {
2108 if ( (s1->GetClusterIndex2(i))==(s2->GetClusterIndex2(i)) && s1->GetClusterIndex2(i)>0) {
2109 AliTPCTrackerPoint *p1 = s1->GetTrackPoint(i);
2110 AliTPCTrackerPoint *p2 = s2->GetTrackPoint(i);;
2111 if (s1->IsActive()&&s2->IsActive()){
b9671574 2112 p1->SetShared(kTRUE);
2113 p2->SetShared(kTRUE);
91162307 2114 }
2115 }
2116 }
2117 }
2118 //
a0f4d6a6 2119 if (sumshared>cutN0){
91162307 2120 for (Int_t i=0;i<4;i++){
b9671574 2121 if (s1->GetOverlapLabel(3*i)==0){
2122 s1->SetOverlapLabel(3*i, s2->GetLabel());
2123 s1->SetOverlapLabel(3*i+1,sumshared);
2124 s1->SetOverlapLabel(3*i+2,s2->GetUniqueID());
91162307 2125 break;
2126 }
2127 }
2128 for (Int_t i=0;i<4;i++){
b9671574 2129 if (s2->GetOverlapLabel(3*i)==0){
2130 s2->SetOverlapLabel(3*i, s1->GetLabel());
2131 s2->SetOverlapLabel(3*i+1,sumshared);
2132 s2->SetOverlapLabel(3*i+2,s1->GetUniqueID());
91162307 2133 break;
2134 }
2135 }
2136 }
91162307 2137}
1c53abe2 2138
91162307 2139void AliTPCtrackerMI::SignShared(TObjArray * arr)
2140{
1c53abe2 2141 //
91162307 2142 //sort trackss according sectors
2143 //
c9427e08 2144 for (Int_t i=0; i<arr->GetEntriesFast(); i++) {
2145 AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i);
91162307 2146 if (!pt) continue;
2147 //if (pt) RotateToLocal(pt);
b9671574 2148 pt->SetSort(0);
c9427e08 2149 }
91162307 2150 arr->UnSort();
6d493ea0 2151 arr->Sort(); // sorting according relative sectors
1c53abe2 2152 arr->Expand(arr->GetEntries());
91162307 2153 //
2154 //
1c53abe2 2155 Int_t nseed=arr->GetEntriesFast();
1c53abe2 2156 for (Int_t i=0; i<nseed; i++) {
2157 AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i);
91162307 2158 if (!pt) continue;
ec26e231 2159 for (Int_t j=0;j<12;j++){
b9671574 2160 pt->SetOverlapLabel(j,0);
1c53abe2 2161 }
91162307 2162 }
2163 for (Int_t i=0; i<nseed; i++) {
2164 AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i);
2165 if (!pt) continue;
b9671574 2166 if (pt->GetRemoval()>10) continue;
1c53abe2 2167 for (Int_t j=i+1; j<nseed; j++){
2168 AliTPCseed *pt2=(AliTPCseed*)arr->UncheckedAt(j);
1af5da7e 2169 if (TMath::Abs(pt->GetRelativeSector()-pt2->GetRelativeSector())>1) continue;
91162307 2170 // if (pt2){
b9671574 2171 if (pt2->GetRemoval()<=10) {
6d493ea0 2172 //if ( TMath::Abs(pt->GetRelativeSector()-pt2->GetRelativeSector())>0) break;
91162307 2173 SignShared(pt,pt2);
c9427e08 2174 }
91162307 2175 }
2176 }
2177}
2178
91162307 2179
47966a6d 2180void AliTPCtrackerMI::SortTracks(TObjArray * arr, Int_t mode) const
91162307 2181{
2182 //
2183 //sort tracks in array according mode criteria
2184 Int_t nseed = arr->GetEntriesFast();
2185 for (Int_t i=0; i<nseed; i++) {
2186 AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i);
2187 if (!pt) {
2188 continue;
2189 }
b9671574 2190 pt->SetSort(mode);
91162307 2191 }
2192 arr->UnSort();
2193 arr->Sort();
1c53abe2 2194}
c9427e08 2195
51ad6848 2196
2197void AliTPCtrackerMI::RemoveUsed2(TObjArray * arr, Float_t factor1, Float_t factor2, Int_t minimal)
2198{
51ad6848 2199 //
6d493ea0 2200 // Loop over all tracks and remove overlaped tracks (with lower quality)
2201 // Algorithm:
2202 // 1. Unsign clusters
2203 // 2. Sort tracks according quality
2204 // Quality is defined by the number of cluster between first and last points
2205 //
2206 // 3. Loop over tracks - decreasing quality order
2207 // a.) remove - If the fraction of shared cluster less than factor (1- n or 2)
2208 // b.) remove - If the minimal number of clusters less than minimal and not ITS
2209 // c.) if track accepted - sign clusters
51ad6848 2210 //
6d493ea0 2211 //Called in - AliTPCtrackerMI::Clusters2Tracks()
2212 // - AliTPCtrackerMI::PropagateBack()
2213 // - AliTPCtrackerMI::RefitInward()
2214 //
be34cb88 2215 // Arguments:
2216 // factor1 - factor for constrained
2217 // factor2 - for non constrained tracks
2218 // if (Float_t(shared+1)/Float_t(found+1)>factor) - DELETE
2219 //
51ad6848 2220 UnsignClusters();
2221 //
2222 Int_t nseed = arr->GetEntriesFast();
2223 Float_t * quality = new Float_t[nseed];
2224 Int_t * indexes = new Int_t[nseed];
2225 Int_t good =0;
2226 //
2227 //
2228 for (Int_t i=0; i<nseed; i++) {
2229 AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i);
2230 if (!pt){
2231 quality[i]=-1;
2232 continue;
2233 }
2234 pt->UpdatePoints(); //select first last max dens points
2235 Float_t * points = pt->GetPoints();
2236 if (points[3]<0.8) quality[i] =-1;
51ad6848 2237 quality[i] = (points[2]-points[0])+pt->GetNumberOfClusters();
6d493ea0 2238 //prefer high momenta tracks if overlaps
2239 quality[i] *= TMath::Sqrt(TMath::Abs(pt->Pt())+0.5);
51ad6848 2240 }
2241 TMath::Sort(nseed,quality,indexes);
2242 //
2243 //
2244 for (Int_t itrack=0; itrack<nseed; itrack++) {
2245 Int_t trackindex = indexes[itrack];
6d493ea0 2246 AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(trackindex);
2247 if (!pt) continue;
2248 //
51ad6848 2249 if (quality[trackindex]<0){
51ad6848 2250 delete arr->RemoveAt(trackindex);
ec26e231 2251 continue;
51ad6848 2252 }
2253 //
6d493ea0 2254 //
51ad6848 2255 Int_t first = Int_t(pt->GetPoints()[0]);
2256 Int_t last = Int_t(pt->GetPoints()[2]);
b9671574 2257 Double_t factor = (pt->GetBConstrain()) ? factor1: factor2;
51ad6848 2258 //
2259 Int_t found,foundable,shared;
6d493ea0 2260 pt->GetClusterStatistic(first,last, found, foundable,shared,kFALSE); // better to get statistic in "high-dens" region do't use full track as in line bellow
2261 // pt->GetClusterStatistic(0,160, found, foundable,shared,kFALSE);
b406fdb0 2262 Bool_t itsgold =kFALSE;
b9671574 2263 if (pt->GetESD()){
ef7253ac 2264 Int_t dummy[12];
b9671574 2265 if (pt->GetESD()->GetITSclusters(dummy)>4) itsgold= kTRUE;
51ad6848 2266 }
b406fdb0 2267 if (!itsgold){
2268 //
2269 if (Float_t(shared+1)/Float_t(found+1)>factor){
2270 if (pt->GetKinkIndexes()[0]!=0) continue; //don't remove tracks - part of the kinks
16299eac 2271 if( AliTPCReconstructor::StreamLevel()>3){
be34cb88 2272 TTreeSRedirector &cstream = *fDebugStreamer;
2273 cstream<<"RemoveUsed"<<
2274 "iter="<<fIteration<<
2275 "pt.="<<pt<<
2276 "\n";
2277 }
b406fdb0 2278 delete arr->RemoveAt(trackindex);
2279 continue;
2280 }
2281 if (pt->GetNumberOfClusters()<50&&(found-0.5*shared)<minimal){ //remove short tracks
2282 if (pt->GetKinkIndexes()[0]!=0) continue; //don't remove tracks - part of the kinks
16299eac 2283 if( AliTPCReconstructor::StreamLevel()>3){
be34cb88 2284 TTreeSRedirector &cstream = *fDebugStreamer;
2285 cstream<<"RemoveShort"<<
2286 "iter="<<fIteration<<
2287 "pt.="<<pt<<
2288 "\n";
2289 }
b406fdb0 2290 delete arr->RemoveAt(trackindex);
2291 continue;
2292 }
51ad6848 2293 }
2294
2295 good++;
6d493ea0 2296 //if (sharedfactor>0.4) continue;
b406fdb0 2297 if (pt->GetKinkIndexes()[0]>0) continue;
6d493ea0 2298 //Remove tracks with undefined properties - seems
2299 if (pt->GetSigmaY2()<kAlmost0) continue; // ? what is the origin ?
2300 //
51ad6848 2301 for (Int_t i=first; i<last; i++) {
2302 Int_t index=pt->GetClusterIndex2(i);
2303 // if (index<0 || index&0x8000 ) continue;
2304 if (index<0 || index&0x8000 ) continue;
b9671574 2305 AliTPCclusterMI *c= pt->GetClusterPointer(i);
51ad6848 2306 if (!c) continue;
2307 c->Use(10);
2308 }
2309 }
2310 fNtracks = good;
2311 if (fDebug>0){
2312 Info("RemoveUsed","\n*****\nNumber of good tracks after shared removal\t%d\n",fNtracks);
2313 }
2314 delete []quality;
2315 delete []indexes;
2316}
2317
f47588e0 2318void AliTPCtrackerMI::DumpClusters(Int_t iter, TObjArray *trackArray)
2319{
2320 //
2321 // Dump clusters after reco
2322 // signed and unsigned cluster can be visualized
2323 // 1. Unsign all cluster
2324 // 2. Sign all used clusters
2325 // 3. Dump clusters
2326 UnsignClusters();
2327 Int_t nseed = trackArray->GetEntries();
2328 for (Int_t i=0; i<nseed; i++){
2329 AliTPCseed *pt=(AliTPCseed*)trackArray->UncheckedAt(i);
2330 if (!pt) {
2331 continue;
2332 }
2333 Bool_t isKink=pt->GetKinkIndex(0)!=0;
2334 for (Int_t j=0; j<160; ++j) {
2335 Int_t index=pt->GetClusterIndex2(j);
2336 if (index<0) continue;
2337 AliTPCclusterMI *c= pt->GetClusterPointer(j);
2338 if (!c) continue;
2339 if (isKink) c->Use(100); // kink
2340 c->Use(10); // by default usage 10
2341 }
2342 }
2343 //
2344
2345 for (Int_t sec=0;sec<fkNIS;sec++){
2346 for (Int_t row=0;row<fInnerSec->GetNRows();row++){
2347 AliTPCclusterMI *cl = fInnerSec[sec][row].GetClusters1();
2348 for (Int_t icl =0;icl< fInnerSec[sec][row].GetN1();icl++){
2349 Float_t gx[3]; cl[icl].GetGlobalXYZ(gx);
2350 (*fDebugStreamer)<<"clDump"<<
2351 "iter="<<iter<<
2352 "cl.="<<&cl[icl]<<
2353 "gx0="<<gx[0]<<
2354 "gx1="<<gx[1]<<
2355 "gx2="<<gx[2]<<
2356 "\n";
2357 }
2358 cl = fInnerSec[sec][row].GetClusters2();
2359 for (Int_t icl =0;icl< fInnerSec[sec][row].GetN2();icl++){
2360 Float_t gx[3]; cl[icl].GetGlobalXYZ(gx);
2361 (*fDebugStreamer)<<"clDump"<<
2362 "iter="<<iter<<
2363 "cl.="<<&cl[icl]<<
2364 "gx0="<<gx[0]<<
2365 "gx1="<<gx[1]<<
2366 "gx2="<<gx[2]<<
2367 "\n";
2368 }
2369 }
2370 }
2371
2372 for (Int_t sec=0;sec<fkNOS;sec++){
2373 for (Int_t row=0;row<fOuterSec->GetNRows();row++){
2374 AliTPCclusterMI *cl = fOuterSec[sec][row].GetClusters1();
2375 for (Int_t icl =0;icl< fOuterSec[sec][row].GetN1();icl++){
2376 Float_t gx[3]; cl[icl].GetGlobalXYZ(gx);
2377 (*fDebugStreamer)<<"clDump"<<
2378 "iter="<<iter<<
2379 "cl.="<<&cl[icl]<<
2380 "gx0="<<gx[0]<<
2381 "gx1="<<gx[1]<<
2382 "gx2="<<gx[2]<<
2383 "\n";
2384 }
2385 cl = fOuterSec[sec][row].GetClusters2();
2386 for (Int_t icl =0;icl< fOuterSec[sec][row].GetN2();icl++){
2387 Float_t gx[3]; cl[icl].GetGlobalXYZ(gx);
2388 (*fDebugStreamer)<<"clDump"<<
2389 "iter="<<iter<<
2390 "cl.="<<&cl[icl]<<
2391 "gx0="<<gx[0]<<
2392 "gx1="<<gx[1]<<
2393 "gx2="<<gx[2]<<
2394 "\n";
2395 }
2396 }
2397 }
2398
2399}
91162307 2400void AliTPCtrackerMI::UnsignClusters()
1c53abe2 2401{
91162307 2402 //
2403 // loop over all clusters and unsign them
2404 //
2405
2406 for (Int_t sec=0;sec<fkNIS;sec++){
2407 for (Int_t row=0;row<fInnerSec->GetNRows();row++){
b9671574 2408 AliTPCclusterMI *cl = fInnerSec[sec][row].GetClusters1();
2409 for (Int_t icl =0;icl< fInnerSec[sec][row].GetN1();icl++)
91162307 2410 // if (cl[icl].IsUsed(10))
2411 cl[icl].Use(-1);
b9671574 2412 cl = fInnerSec[sec][row].GetClusters2();
2413 for (Int_t icl =0;icl< fInnerSec[sec][row].GetN2();icl++)
91162307 2414 //if (cl[icl].IsUsed(10))
2415 cl[icl].Use(-1);
2416 }
2417 }
2418
2419 for (Int_t sec=0;sec<fkNOS;sec++){
2420 for (Int_t row=0;row<fOuterSec->GetNRows();row++){
b9671574 2421 AliTPCclusterMI *cl = fOuterSec[sec][row].GetClusters1();
2422 for (Int_t icl =0;icl< fOuterSec[sec][row].GetN1();icl++)
91162307 2423 //if (cl[icl].IsUsed(10))
2424 cl[icl].Use(-1);
b9671574 2425 cl = fOuterSec[sec][row].GetClusters2();
2426 for (Int_t icl =0;icl< fOuterSec[sec][row].GetN2();icl++)
91162307 2427 //if (cl[icl].IsUsed(10))
2428 cl[icl].Use(-1);
2429 }
2430 }
2431
1c53abe2 2432}
2433
91162307 2434
2435
47af7ca4 2436void AliTPCtrackerMI::SignClusters(const TObjArray * arr, Float_t fnumber, Float_t fdensity)
1c53abe2 2437{
2438 //
91162307 2439 //sign clusters to be "used"
2440 //
2441 // snumber and sdensity sign number of sigmas - bellow mean value to be accepted
2442 // loop over "primaries"
2443
2444 Float_t sumdens=0;
2445 Float_t sumdens2=0;
2446 Float_t sumn =0;
2447 Float_t sumn2 =0;
2448 Float_t sumchi =0;
2449 Float_t sumchi2 =0;
2450
2451 Float_t sum =0;
2452
1c53abe2 2453 TStopwatch timer;
91162307 2454 timer.Start();
1c53abe2 2455
91162307 2456 Int_t nseed = arr->GetEntriesFast();
2457 for (Int_t i=0; i<nseed; i++) {
2458 AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i);
2459 if (!pt) {
2460 continue;
2461 }
2462 if (!(pt->IsActive())) continue;
b9671574 2463 Float_t dens = pt->GetNumberOfClusters()/Float_t(pt->GetNFoundable());
91162307 2464 if ( (dens>0.7) && (pt->GetNumberOfClusters()>70)){
2465 sumdens += dens;
2466 sumdens2+= dens*dens;
2467 sumn += pt->GetNumberOfClusters();
2468 sumn2 += pt->GetNumberOfClusters()*pt->GetNumberOfClusters();
2469 Float_t chi2 = pt->GetChi2()/pt->GetNumberOfClusters();
2470 if (chi2>5) chi2=5;
2471 sumchi +=chi2;
2472 sumchi2 +=chi2*chi2;
2473 sum++;
2474 }
1627d1c4 2475 }
91162307 2476
2477 Float_t mdensity = 0.9;
2478 Float_t meann = 130;
2479 Float_t meanchi = 1;
2480 Float_t sdensity = 0.1;
2481 Float_t smeann = 10;
2482 Float_t smeanchi =0.4;
1627d1c4 2483
91162307 2484
2485 if (sum>20){
2486 mdensity = sumdens/sum;
2487 meann = sumn/sum;
2488 meanchi = sumchi/sum;
2489 //
2490 sdensity = sumdens2/sum-mdensity*mdensity;
c1ea348f 2491 if (sdensity >= 0)
2492 sdensity = TMath::Sqrt(sdensity);
2493 else
2494 sdensity = 0.1;
91162307 2495 //
2496 smeann = sumn2/sum-meann*meann;
c1ea348f 2497 if (smeann >= 0)
2498 smeann = TMath::Sqrt(smeann);
2499 else
2500 smeann = 10;
91162307 2501 //
2502 smeanchi = sumchi2/sum - meanchi*meanchi;
c1ea348f 2503 if (smeanchi >= 0)
2504 smeanchi = TMath::Sqrt(smeanchi);
2505 else
2506 smeanchi = 0.4;
91162307 2507 }
2508
2509
2510 //REMOVE SHORT DELTAS or tracks going out of sensitive volume of TPC
2511 //
2512 for (Int_t i=0; i<nseed; i++) {
2513 AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i);
2514 if (!pt) {
2515 continue;
1c53abe2 2516 }
b9671574 2517 if (pt->GetBSigned()) continue;
2518 if (pt->GetBConstrain()) continue;
91162307 2519 //if (!(pt->IsActive())) continue;
2520 /*
2521 Int_t found,foundable,shared;
2522 pt->GetClusterStatistic(0,160,found, foundable,shared);
2523 if (shared/float(found)>0.3) {
2524 if (shared/float(found)>0.9 ){
2525 //delete arr->RemoveAt(i);
2526 }
2527 continue;
c9427e08 2528 }
91162307 2529 */
2530 Bool_t isok =kFALSE;
b9671574 2531 if ( (pt->GetNShared()/pt->GetNumberOfClusters()<0.5) &&pt->GetNumberOfClusters()>60)
91162307 2532 isok = kTRUE;
b9671574 2533 if ((TMath::Abs(1/pt->GetC())<100.) && (pt->GetNShared()/pt->GetNumberOfClusters()<0.7))
91162307 2534 isok =kTRUE;
2535 if (TMath::Abs(pt->GetZ()/pt->GetX())>1.1)
2536 isok =kTRUE;
2537 if ( (TMath::Abs(pt->GetSnp()>0.7) && pt->GetD(0,0)>60.))
2538 isok =kTRUE;
2539
2540 if (isok)
77f88633 2541 for (Int_t j=0; j<160; ++j) {
2542 Int_t index=pt->GetClusterIndex2(j);
91162307 2543 if (index<0) continue;
77f88633 2544 AliTPCclusterMI *c= pt->GetClusterPointer(j);
91162307 2545 if (!c) continue;
2546 //if (!(c->IsUsed(10))) c->Use();
2547 c->Use(10);
2548 }
2549 }
2550
c9427e08 2551
1c53abe2 2552 //
91162307 2553 Double_t maxchi = meanchi+2.*smeanchi;
2554
2555 for (Int_t i=0; i<nseed; i++) {
2556 AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i);
2557 if (!pt) {
1c53abe2 2558 continue;
91162307 2559 }
2560 //if (!(pt->IsActive())) continue;
b9671574 2561 if (pt->GetBSigned()) continue;
91162307 2562 Double_t chi = pt->GetChi2()/pt->GetNumberOfClusters();
2563 if (chi>maxchi) continue;
2564
2565 Float_t bfactor=1;
b9671574 2566 Float_t dens = pt->GetNumberOfClusters()/Float_t(pt->GetNFoundable());
91162307 2567
2568 //sign only tracks with enoug big density at the beginning
2569
2570 if ((pt->GetDensityFirst(40)<0.75) && pt->GetNumberOfClusters()<meann) continue;
2571
2572
3e5d0aa2 2573 Double_t mindens = TMath::Max(double(mdensity-sdensity*fdensity*bfactor),0.65);
91162307 2574 Double_t minn = TMath::Max(Int_t(meann-fnumber*smeann*bfactor),50);
2575
2576 // if (pt->fBConstrain) mindens = TMath::Max(mdensity-sdensity*fdensity*bfactor,0.65);
b9671574 2577 if ( (pt->GetRemoval()==10) && (pt->GetSnp()>0.8)&&(dens>mindens))
91162307 2578 minn=0;
2579
2580 if ((dens>mindens && pt->GetNumberOfClusters()>minn) && chi<maxchi ){
2581 //Int_t noc=pt->GetNumberOfClusters();
b9671574 2582 pt->SetBSigned(kTRUE);
77f88633 2583 for (Int_t j=0; j<160; ++j) {
91162307 2584
77f88633 2585 Int_t index=pt->GetClusterIndex2(j);
91162307 2586 if (index<0) continue;
77f88633 2587 AliTPCclusterMI *c= pt->GetClusterPointer(j);
91162307 2588 if (!c) continue;
2589 // if (!(c->IsUsed(10))) c->Use();
2590 c->Use(10);
2591 }
1c53abe2 2592 }
91162307 2593 }
2594 // gLastCheck = nseed;
2595 // arr->Compress();
2596 if (fDebug>0){
2597 timer.Print();
2598 }
2599}
2600
2601
47af7ca4 2602void AliTPCtrackerMI::StopNotActive(const TObjArray * arr, Int_t row0, Float_t th0, Float_t th1, Float_t th2) const
91162307 2603{
2604 // stop not active tracks
2605 // take th1 as threshold for number of founded to number of foundable on last 10 active rows
2606 // take th2 as threshold for number of founded to number of foundable on last 20 active rows
2607 Int_t nseed = arr->GetEntriesFast();
2608 //
2609 for (Int_t i=0; i<nseed; i++) {
2610 AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i);
2611 if (!pt) {
2612 continue;
2613 }
2614 if (!(pt->IsActive())) continue;
2615 StopNotActive(pt,row0,th0, th1,th2);
2616 }
2617}
2618
2619
2620
2621void AliTPCtrackerMI::StopNotActive(AliTPCseed * seed, Int_t row0, Float_t th0, Float_t th1,
47966a6d 2622 Float_t th2) const
91162307 2623{
2624 // stop not active tracks
2625 // take th1 as threshold for number of founded to number of foundable on last 10 active rows
2626 // take th2 as threshold for number of founded to number of foundable on last 20 active rows
2627 Int_t sumgood1 = 0;
2628 Int_t sumgood2 = 0;
2629 Int_t foundable = 0;
b9671574 2630 Int_t maxindex = seed->GetLastPoint(); //last foundable row
2631 if (seed->GetNFoundable()*th0 > seed->GetNumberOfClusters()) {
91162307 2632 seed->Desactivate(10) ;
2633 return;
2634 }
2635
3e5d0aa2 2636 for (Int_t i=row0; i<maxindex; i++){
91162307 2637 Int_t index = seed->GetClusterIndex2(i);
2638 if (index!=-1) foundable++;
2639 //if (!c) continue;
2640 if (foundable<=30) sumgood1++;
2641 if (foundable<=50) {
2642 sumgood2++;
2643 }
2644 else{
2645 break;
2646 }
2647 }
2648 if (foundable>=30.){
2649 if (sumgood1<(th1*30.)) seed->Desactivate(10);
2650 }
2651 if (foundable>=50)
2652 if (sumgood2<(th2*50.)) seed->Desactivate(10);
2653}
2654
2655
af885e0f 2656Int_t AliTPCtrackerMI::RefitInward(AliESDEvent *event)
d26d9159 2657{
2658 //
2659 // back propagation of ESD tracks
2660 //
2661 //return 0;
ec26e231 2662 if (!event) return 0;
6d493ea0 2663 const Int_t kMaxFriendTracks=2000;
d26d9159 2664 fEvent = event;
2665 ReadSeeds(event,2);
2666 fIteration=2;
982aff31 2667 //PrepareForProlongation(fSeeds,1);
2668 PropagateForward2(fSeeds);
6d493ea0 2669 RemoveUsed2(fSeeds,0.4,0.4,20);
1af5da7e 2670
a0f4d6a6 2671 TObjArray arraySeed(fSeeds->GetEntries());
2672 for (Int_t i=0;i<fSeeds->GetEntries();i++) {
2673 arraySeed.AddAt(fSeeds->At(i),i);
2674 }
2675 SignShared(&arraySeed);
6d493ea0 2676 // FindCurling(fSeeds, event,2); // find multi found tracks
1af5da7e 2677 FindSplitted(fSeeds, event,2); // find multi found tracks
16299eac 2678 if (AliTPCReconstructor::StreamLevel()>5) FindMultiMC(fSeeds, fEvent,2); // find multi found tracks
af32720d 2679
4d158c36 2680 Int_t ntracks=0;
d26d9159 2681 Int_t nseed = fSeeds->GetEntriesFast();
2682 for (Int_t i=0;i<nseed;i++){
2683 AliTPCseed * seed = (AliTPCseed*) fSeeds->UncheckedAt(i);
4d158c36 2684 if (!seed) continue;
eea478d3 2685 if (seed->GetKinkIndex(0)>0) UpdateKinkQualityD(seed); // update quality informations for kinks
be34cb88 2686 AliESDtrack *esd=event->GetTrack(i);
2687
2688 if (seed->GetNumberOfClusters()<60 && seed->GetNumberOfClusters()<(esd->GetTPCclusters(0) -5)*0.8){
2689 AliExternalTrackParam paramIn;
2690 AliExternalTrackParam paramOut;
2691 Int_t ncl = seed->RefitTrack(seed,&paramIn,&paramOut);
16299eac 2692 if (AliTPCReconstructor::StreamLevel()>2) {
0e90d29a 2693 (*fDebugStreamer)<<"RecoverIn"<<
2694 "seed.="<<seed<<
2695 "esd.="<<esd<<
2696 "pin.="<<&paramIn<<
2697 "pout.="<<&paramOut<<
2698 "ncl="<<ncl<<
2699 "\n";
2700 }
be34cb88 2701 if (ncl>15) {
2702 seed->Set(paramIn.GetX(),paramIn.GetAlpha(),paramIn.GetParameter(),paramIn.GetCovariance());
2703 seed->SetNumberOfClusters(ncl);
2704 }
2705 }
eea478d3 2706
47af7ca4 2707 seed->PropagateTo(fkParam->GetInnerRadiusLow());
51ad6848 2708 seed->UpdatePoints();
92f513f5 2709 AddCovariance(seed);
19b00333 2710 MakeBitmaps(seed);
d26d9159 2711 seed->CookdEdx(0.02,0.6);
2712 CookLabel(seed,0.1); //For comparison only
19b00333 2713 esd->SetTPCClusterMap(seed->GetClusterMap());
2714 esd->SetTPCSharedMap(seed->GetSharedMap());
af32720d 2715 //
ec26e231 2716 if (AliTPCReconstructor::StreamLevel()>1 && seed!=0) {
af32720d 2717 TTreeSRedirector &cstream = *fDebugStreamer;
2718 cstream<<"Crefit"<<
2719 "Esd.="<<esd<<
2720 "Track.="<<seed<<
2721 "\n";
2722 }
c274e255 2723
51ad6848 2724 if (seed->GetNumberOfClusters()>15){
4d158c36 2725 esd->UpdateTrackParams(seed,AliESDtrack::kTPCrefit);
51ad6848 2726 esd->SetTPCPoints(seed->GetPoints());
b9671574 2727 esd->SetTPCPointsF(seed->GetNFoundable());
83afd539 2728 Int_t ndedx = seed->GetNCDEDX(0);
2729 Float_t sdedx = seed->GetSDEDX(0);
b406fdb0 2730 Float_t dedx = seed->GetdEdx();
2731 esd->SetTPCsignal(dedx, sdedx, ndedx);
fdedfdec 2732 //
2733 // add seed to the esd track in Calib level
2734 //
6d493ea0 2735 Bool_t storeFriend = gRandom->Rndm()<(kMaxFriendTracks)/Float_t(nseed);
2736 if (AliTPCReconstructor::StreamLevel()>0 &&storeFriend){
fdedfdec 2737 AliTPCseed * seedCopy = new AliTPCseed(*seed, kTRUE);
2738 esd->AddCalibObject(seedCopy);
2739 }
4d158c36 2740 ntracks++;
d26d9159 2741 }
2742 else{
2743 //printf("problem\n");
2744 }
2745 }
51ad6848 2746 //FindKinks(fSeeds,event);
f47588e0 2747 if (AliTPCReconstructor::StreamLevel()>3) DumpClusters(2,fSeeds);
4d158c36 2748 Info("RefitInward","Number of refitted tracks %d",ntracks);
d26d9159 2749 return 0;
2750}
2751
91162307 2752
af885e0f 2753Int_t AliTPCtrackerMI::PropagateBack(AliESDEvent *event)
91162307 2754{
2755 //
2756 // back propagation of ESD tracks
2757 //
ec26e231 2758 if (!event) return 0;
91162307 2759 fEvent = event;
d26d9159 2760 fIteration = 1;
5d837844 2761 ReadSeeds(event,1);
b406fdb0 2762 PropagateBack(fSeeds);
2763 RemoveUsed2(fSeeds,0.4,0.4,20);
6d493ea0 2764 //FindCurling(fSeeds, fEvent,1);
1af5da7e 2765 FindSplitted(fSeeds, event,1); // find multi found tracks
16299eac 2766 if (AliTPCReconstructor::StreamLevel()>5) FindMultiMC(fSeeds, fEvent,1); // find multi found tracks
1af5da7e 2767
b406fdb0 2768 //
91162307 2769 Int_t nseed = fSeeds->GetEntriesFast();
4d158c36 2770 Int_t ntracks=0;
91162307 2771 for (Int_t i=0;i<nseed;i++){
2772 AliTPCseed * seed = (AliTPCseed*) fSeeds->UncheckedAt(i);
d9e62e7e 2773 if (!seed) continue;
51ad6848 2774 if (seed->GetKinkIndex(0)<0) UpdateKinkQualityM(seed); // update quality informations for kinks
2775 seed->UpdatePoints();
92f513f5 2776 AddCovariance(seed);
91162307 2777 AliESDtrack *esd=event->GetTrack(i);
be34cb88 2778 if (seed->GetNumberOfClusters()<60 && seed->GetNumberOfClusters()<(esd->GetTPCclusters(0) -5)*0.8){
2779 AliExternalTrackParam paramIn;
2780 AliExternalTrackParam paramOut;
2781 Int_t ncl = seed->RefitTrack(seed,&paramIn,&paramOut);
16299eac 2782 if (AliTPCReconstructor::StreamLevel()>2) {
ca449e98 2783 (*fDebugStreamer)<<"RecoverBack"<<
2784 "seed.="<<seed<<
2785 "esd.="<<esd<<
2786 "pin.="<<&paramIn<<
2787 "pout.="<<&paramOut<<
2788 "ncl="<<ncl<<
2789 "\n";
2790 }
be34cb88 2791 if (ncl>15) {
2792 seed->Set(paramOut.GetX(),paramOut.GetAlpha(),paramOut.GetParameter(),paramOut.GetCovariance());
2793 seed->SetNumberOfClusters(ncl);
2794 }
2795 }
d26d9159 2796 seed->CookdEdx(0.02,0.6);
91162307 2797 CookLabel(seed,0.1); //For comparison only
51ad6848 2798 if (seed->GetNumberOfClusters()>15){
4d158c36 2799 esd->UpdateTrackParams(seed,AliESDtrack::kTPCout);
51ad6848 2800 esd->SetTPCPoints(seed->GetPoints());
b9671574 2801 esd->SetTPCPointsF(seed->GetNFoundable());
83afd539 2802 Int_t ndedx = seed->GetNCDEDX(0);
2803 Float_t sdedx = seed->GetSDEDX(0);
167c41ab 2804 Float_t dedx = seed->GetdEdx();
2805 esd->SetTPCsignal(dedx, sdedx, ndedx);
4d158c36 2806 ntracks++;
31fd97b2 2807 Int_t eventnumber = event->GetEventNumberInFile();// patch 28 fev 06
2808 // This is most likely NOT the event number you'd like to use. It has nothing to do with the 'real' event number
8cecaa87 2809 if (AliTPCReconstructor::StreamLevel()>1 && esd) {
6d493ea0 2810 (*fDebugStreamer)<<"Cback"<<
2811 "Tr0.="<<seed<<
8cecaa87 2812 "esd.="<<esd<<
6d493ea0 2813 "EventNrInFile="<<eventnumber<<
8cecaa87 2814 "\n";
6d493ea0 2815 }
4d158c36 2816 }
91162307 2817 }
f47588e0 2818 if (AliTPCReconstructor::StreamLevel()>3) DumpClusters(1,fSeeds);
51ad6848 2819 //FindKinks(fSeeds,event);
4d158c36 2820 Info("PropagateBack","Number of back propagated tracks %d",ntracks);
91162307 2821 fEvent =0;
6d493ea0 2822
91162307 2823 return 0;
2824}
2825
2826
2827void AliTPCtrackerMI::DeleteSeeds()
2828{
b67e07dc 2829 //
2830 //delete Seeds
6c94f330 2831
91162307 2832 Int_t nseed = fSeeds->GetEntriesFast();
2833 for (Int_t i=0;i<nseed;i++){
2834 AliTPCseed * seed = (AliTPCseed*)fSeeds->At(i);
2835 if (seed) delete fSeeds->RemoveAt(i);
2836 }
2837 delete fSeeds;
6c94f330 2838
91162307 2839 fSeeds =0;
2840}
2841
2f051b58 2842void AliTPCtrackerMI::ReadSeeds(AliESDEvent *const event, Int_t direction)
91162307 2843{
2844 //
2845 //read seeds from the event
2846
2847 Int_t nentr=event->GetNumberOfTracks();
6bdc18d6 2848 if (fDebug>0){
2849 Info("ReadSeeds", "Number of ESD tracks: %d\n", nentr);
2850 }
91162307 2851 if (fSeeds)
2852 DeleteSeeds();
2853 if (!fSeeds){
4d158c36 2854 fSeeds = new TObjArray(nentr);
91162307 2855 }
4d158c36 2856 UnsignClusters();
2857 // Int_t ntrk=0;
91162307 2858 for (Int_t i=0; i<nentr; i++) {
2859 AliESDtrack *esd=event->GetTrack(i);
51ad6848 2860 ULong_t status=esd->GetStatus();
2861 if (!(status&AliESDtrack::kTPCin)) continue;
1af5da7e 2862 AliTPCtrack t(*esd);
5d837844 2863 t.SetNumberOfClusters(0);
eea478d3 2864 // AliTPCseed *seed = new AliTPCseed(t,t.GetAlpha());
2865 AliTPCseed *seed = new AliTPCseed(t/*,t.GetAlpha()*/);
a0f4d6a6 2866 seed->SetUniqueID(esd->GetID());
92f513f5 2867 AddCovariance(seed); //add systematic ucertainty
eea478d3 2868 for (Int_t ikink=0;ikink<3;ikink++) {
2869 Int_t index = esd->GetKinkIndex(ikink);
2870 seed->GetKinkIndexes()[ikink] = index;
2871 if (index==0) continue;
2872 index = TMath::Abs(index);
2873 AliESDkink * kink = fEvent->GetKink(index-1);
2874 if (kink&&esd->GetKinkIndex(ikink)<0){
2875 if ((status & AliESDtrack::kTRDrefit) != 0) kink->SetStatus(1,2);
2876 if ((status & AliESDtrack::kITSout) != 0) kink->SetStatus(1,0);
2877 }
2878 if (kink&&esd->GetKinkIndex(ikink)>0){
2879 if ((status & AliESDtrack::kTRDrefit) != 0) kink->SetStatus(1,6);
2880 if ((status & AliESDtrack::kITSout) != 0) kink->SetStatus(1,4);
2881 }
2882
2883 }
6c94f330 2884 if (((status&AliESDtrack::kITSout)==0)&&(direction==1)) seed->ResetCovariance(10.);
2885 if ( direction ==2 &&(status & AliESDtrack::kTRDrefit) == 0 ) seed->ResetCovariance(10.);
be34cb88 2886 //if ( direction ==2 && ((status & AliESDtrack::kTPCout) == 0) ) {
2887 // fSeeds->AddAt(0,i);
2888 // delete seed;
2889 // continue;
2890 //}
4d158c36 2891 if ( direction ==2 &&(status & AliESDtrack::kTRDrefit) > 0 ) {
c0b978f0 2892 Double_t par0[5],par1[5],alpha,x;
2893 esd->GetInnerExternalParameters(alpha,x,par0);
4d158c36 2894 esd->GetExternalParameters(x,par1);
2895 Double_t delta1 = TMath::Abs(par0[4]-par1[4])/(0.000000001+TMath::Abs(par0[4]+par1[4]));
2896 Double_t delta2 = TMath::Abs(par0[3]-par1[3]);
51ad6848 2897 Double_t trdchi2=0;
2898 if (esd->GetTRDncls()>0) trdchi2 = esd->GetTRDchi2()/esd->GetTRDncls();
4d158c36 2899 //reset covariance if suspicious
51ad6848 2900 if ( (delta1>0.1) || (delta2>0.006) ||trdchi2>7.)
6c94f330 2901 seed->ResetCovariance(10.);
4d158c36 2902 }
982aff31 2903
91162307 2904 //
2905 //
2906 // rotate to the local coordinate system
eea478d3 2907 //
2908 fSectors=fInnerSec; fN=fkNIS;
91162307 2909 Double_t alpha=seed->GetAlpha() - fSectors->GetAlphaShift();
2910 if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi();
2911 if (alpha < 0. ) alpha += 2.*TMath::Pi();
2912 Int_t ns=Int_t(alpha/fSectors->GetAlpha())%fN;
2913 alpha =ns*fSectors->GetAlpha() + fSectors->GetAlphaShift();
4d158c36 2914 if (alpha<-TMath::Pi()) alpha += 2*TMath::Pi();
2915 if (alpha>=TMath::Pi()) alpha -= 2*TMath::Pi();
91162307 2916 alpha-=seed->GetAlpha();
d9b8978b 2917 if (!seed->Rotate(alpha)) {
2918 delete seed;
2919 continue;
2920 }
b9671574 2921 seed->SetESD(esd);
4d158c36 2922 // sign clusters
b406fdb0 2923 if (esd->GetKinkIndex(0)<=0){
2924 for (Int_t irow=0;irow<160;irow++){
2925 Int_t index = seed->GetClusterIndex2(irow);
2926 if (index>0){
2927 //
2928 AliTPCclusterMI * cl = GetClusterMI(index);
b9671574 2929 seed->SetClusterPointer(irow,cl);
b406fdb0 2930 if (cl){
2931 if ((index & 0x8000)==0){
2932 cl->Use(10); // accepted cluster
2933 }else{
2934 cl->Use(6); // close cluster not accepted
2935 }
4d158c36 2936 }else{
b406fdb0 2937 Info("ReadSeeds","Not found cluster");
2938 }
4d158c36 2939 }
2940 }
2941 }
2942 fSeeds->AddAt(seed,i);
91162307 2943 }
1c53abe2 2944}
2945
2946
2947
2948//_____________________________________________________________________________
91162307 2949void AliTPCtrackerMI::MakeSeeds3(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Float_t cuts[4],
2950 Float_t deltay, Int_t ddsec) {
1c53abe2 2951 //-----------------------------------------------------------------
2952 // This function creates track seeds.
91162307 2953 // SEEDING WITH VERTEX CONSTRAIN
1c53abe2 2954 //-----------------------------------------------------------------
91162307 2955 // cuts[0] - fP4 cut
2956 // cuts[1] - tan(phi) cut
2957 // cuts[2] - zvertex cut
2958 // cuts[3] - fP3 cut
2959 Int_t nin0 = 0;
2960 Int_t nin1 = 0;
2961 Int_t nin2 = 0;
2962 Int_t nin = 0;
2963 Int_t nout1 = 0;
2964 Int_t nout2 = 0;
1c53abe2 2965
2966 Double_t x[5], c[15];
91162307 2967 // Int_t di = i1-i2;
2968 //
d757548f 2969 AliTPCseed * seed = new AliTPCseed();
91162307 2970 Double_t alpha=fSectors->GetAlpha(), shift=fSectors->GetAlphaShift();
1c53abe2 2971 Double_t cs=cos(alpha), sn=sin(alpha);
d757548f 2972 //
2973 // Double_t x1 =fOuterSec->GetX(i1);
2974 //Double_t xx2=fOuterSec->GetX(i2);
2975
91162307 2976 Double_t x1 =GetXrow(i1);
2977 Double_t xx2=GetXrow(i2);
1c53abe2 2978
91162307 2979 Double_t x3=GetX(), y3=GetY(), z3=GetZ();
2980
2981 Int_t imiddle = (i2+i1)/2; //middle pad row index
2982 Double_t xm = GetXrow(imiddle); // radius of middle pad-row
bd26fa83 2983 const AliTPCtrackerRow& krm=GetRow(sec,imiddle); //middle pad -row
1c53abe2 2984 //
91162307 2985 Int_t ns =sec;
2986
bd26fa83 2987 const AliTPCtrackerRow& kr1=GetRow(ns,i1);
b9671574 2988 Double_t ymax = GetMaxY(i1)-kr1.GetDeadZone()-1.5;
2989 Double_t ymaxm = GetMaxY(imiddle)-kr1.GetDeadZone()-1.5;
91162307 2990
2991 //
2992 // change cut on curvature if it can't reach this layer
2993 // maximal curvature set to reach it
2994 Double_t dvertexmax = TMath::Sqrt((x1-x3)*(x1-x3)+(ymax+5-y3)*(ymax+5-y3));
2995 if (dvertexmax*0.5*cuts[0]>0.85){
2996 cuts[0] = 0.85/(dvertexmax*0.5+1.);
2997 }
2998 Double_t r2min = 1/(cuts[0]*cuts[0]); //minimal square of radius given by cut
2999
3000 // Int_t ddsec = 1;
3001 if (deltay>0) ddsec = 0;
3002 // loop over clusters
3003 for (Int_t is=0; is < kr1; is++) {
3004 //
3005 if (kr1[is]->IsUsed(10)) continue;
3006 Double_t y1=kr1[is]->GetY(), z1=kr1[is]->GetZ();
3007 //if (TMath::Abs(y1)>ymax) continue;
3008
3009 if (deltay>0 && TMath::Abs(ymax-TMath::Abs(y1))> deltay ) continue; // seed only at the edge
3010
3011 // find possible directions
3012 Float_t anglez = (z1-z3)/(x1-x3);
3013 Float_t extraz = z1 - anglez*(x1-xx2); // extrapolated z
3014 //
3015 //
3016 //find rotation angles relative to line given by vertex and point 1
3017 Double_t dvertex2 = (x1-x3)*(x1-x3)+(y1-y3)*(y1-y3);
3018 Double_t dvertex = TMath::Sqrt(dvertex2);
3019 Double_t angle13 = TMath::ATan((y1-y3)/(x1-x3));
3020 Double_t cs13 = cos(-angle13), sn13 = sin(-angle13);
3021
3022 //
3023 // loop over 2 sectors
3024 Int_t dsec1=-ddsec;
3025 Int_t dsec2= ddsec;
3026 if (y1<0) dsec2= 0;
3027 if (y1>0) dsec1= 0;
3028
3029 Double_t dddz1=0; // direction of delta inclination in z axis
3030 Double_t dddz2=0;
3031 if ( (z1-z3)>0)
3032 dddz1 =1;
3033 else
3034 dddz2 =1;
3035 //
3036 for (Int_t dsec = dsec1; dsec<=dsec2;dsec++){
3037 Int_t sec2 = sec + dsec;
3038 //
bd26fa83 3039 // AliTPCtrackerRow& kr2 = fOuterSec[(sec2+fkNOS)%fkNOS][i2];
3040 //AliTPCtrackerRow& kr2m = fOuterSec[(sec2+fkNOS)%fkNOS][imiddle];
3041 AliTPCtrackerRow& kr2 = GetRow((sec2+fkNOS)%fkNOS,i2);
3042 AliTPCtrackerRow& kr2m = GetRow((sec2+fkNOS)%fkNOS,imiddle);
91162307 3043 Int_t index1 = TMath::Max(kr2.Find(extraz-0.6-dddz1*TMath::Abs(z1)*0.05)-1,0);
3044 Int_t index2 = TMath::Min(kr2.Find(extraz+0.6+dddz2*TMath::Abs(z1)*0.05)+1,kr2);
3045
3046 // rotation angles to p1-p3
3047 Double_t cs13r = cos(-angle13+dsec*alpha)/dvertex, sn13r = sin(-angle13+dsec*alpha)/dvertex;
3048 Double_t x2, y2, z2;
3049 //
3050 // Double_t dymax = maxangle*TMath::Abs(x1-xx2);
3051
3052 //
3053 Double_t dxx0 = (xx2-x3)*cs13r;
3054 Double_t dyy0 = (xx2-x3)*sn13r;
3055 for (Int_t js=index1; js < index2; js++) {
3056 const AliTPCclusterMI *kcl = kr2[js];
3057 if (kcl->IsUsed(10)) continue;
3058 //
3059 //calcutate parameters
3060 //
3061 Double_t yy0 = dyy0 +(kcl->GetY()-y3)*cs13r;
3062 // stright track
3063 if (TMath::Abs(yy0)<0.000001) continue;
3064 Double_t xx0 = dxx0 -(kcl->GetY()-y3)*sn13r;
3065 Double_t y0 = 0.5*(xx0*xx0+yy0*yy0-xx0)/yy0;
3066 Double_t r02 = (0.25+y0*y0)*dvertex2;
3067 //curvature (radius) cut
3068 if (r02<r2min) continue;
3069
3070 nin0++;
3071 //
3072 Double_t c0 = 1/TMath::Sqrt(r02);
3073 if (yy0>0) c0*=-1.;
3074
3075
3076 //Double_t dfi0 = 2.*TMath::ASin(dvertex*c0*0.5);
3077 //Double_t dfi1 = 2.*TMath::ASin(TMath::Sqrt(yy0*yy0+(1-xx0)*(1-xx0))*dvertex*c0*0.5);
b67e07dc 3078 Double_t dfi0 = 2.*AliTPCFastMath::FastAsin(dvertex*c0*0.5);
3079 Double_t dfi1 = 2.*AliTPCFastMath::FastAsin(TMath::Sqrt(yy0*yy0+(1-xx0)*(1-xx0))*dvertex*c0*0.5);
91162307 3080 //
3081 //
3082 Double_t z0 = kcl->GetZ();
3083 Double_t zzzz2 = z1-(z1-z3)*dfi1/dfi0;
3084 if (TMath::Abs(zzzz2-z0)>0.5) continue;
3085 nin1++;
3086 //
3087 Double_t dip = (z1-z0)*c0/dfi1;
3088 Double_t x0 = (0.5*cs13+y0*sn13)*dvertex*c0;
3089 //
3090 y2 = kcl->GetY();
3091 if (dsec==0){
3092 x2 = xx2;
3093 z2 = kcl->GetZ();
3094 }
3095 else
3096 {
3097 // rotation
3098 z2 = kcl->GetZ();
3099 x2= xx2*cs-y2*sn*dsec;
3100 y2=+xx2*sn*dsec+y2*cs;
3101 }
3102
3103 x[0] = y1;
3104 x[1] = z1;
3105 x[2] = x0;
3106 x[3] = dip;
3107 x[4] = c0;
3108 //
3109 //
3110 // do we have cluster at the middle ?
3111 Double_t ym,zm;
3112 GetProlongation(x1,xm,x,ym,zm);
3113 UInt_t dummy;
3114 AliTPCclusterMI * cm=0;
3115 if (TMath::Abs(ym)-ymaxm<0){
3116 cm = krm.FindNearest2(ym,zm,1.0,0.6,dummy);
3117 if ((!cm) || (cm->IsUsed(10))) {
1c53abe2 3118 continue;
3119 }
91162307 3120 }
3121 else{
3122 // rotate y1 to system 0
3123 // get state vector in rotated system
3124 Double_t yr1 = (-0.5*sn13+y0*cs13)*dvertex*c0;
3125 Double_t xr2 = x0*cs+yr1*sn*dsec;
3126 Double_t xr[5]={kcl->GetY(),kcl->GetZ(), xr2, dip, c0};
3127 //
3128 GetProlongation(xx2,xm,xr,ym,zm);
3129 if (TMath::Abs(ym)-ymaxm<0){
3130 cm = kr2m.FindNearest2(ym,zm,1.0,0.6,dummy);
3131 if ((!cm) || (cm->IsUsed(10))) {
1c53abe2