]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliTracker.cxx
Fixed bug in version number of AliITSpListItem and removed delete[] for
[u/mrichter/AliRoot.git] / STEER / AliTracker.cxx
CommitLineData
be9c5115 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
16//-------------------------------------------------------------------------
17// Implementation of the AliTracker class
18//
19// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
20//-------------------------------------------------------------------------
21#include <TMath.h>
22
23#include "AliTracker.h"
24#include "AliCluster.h"
25#include "AliKalmanTrack.h"
26
27ClassImp(AliTracker)
28
7f6ddf58 29Double_t AliTracker::fX;
30Double_t AliTracker::fY;
31Double_t AliTracker::fZ;
32
be9c5115 33//__________________________________________________________________________
34void AliTracker::CookLabel(AliKalmanTrack *t, Float_t wrong) const {
35 //--------------------------------------------------------------------
36 //This function "cooks" a track label. If label<0, this track is fake.
37 //--------------------------------------------------------------------
38 Int_t noc=t->GetNumberOfClusters();
39 Int_t *lb=new Int_t[noc];
40 Int_t *mx=new Int_t[noc];
41 AliCluster **clusters=new AliCluster*[noc];
42
43 Int_t i;
44 for (i=0; i<noc; i++) {
45 lb[i]=mx[i]=0;
46 Int_t index=t->GetClusterIndex(i);
47 clusters[i]=GetCluster(index);
48 }
49
50 Int_t lab=123456789;
51 for (i=0; i<noc; i++) {
52 AliCluster *c=clusters[i];
53 lab=TMath::Abs(c->GetLabel(0));
54 Int_t j;
55 for (j=0; j<noc; j++) if (lb[j]==lab || mx[j]==0) break;
56 lb[j]=lab;
57 (mx[j])++;
58 }
59
60 Int_t max=0;
61 for (i=0; i<noc; i++) if (mx[i]>max) {max=mx[i]; lab=lb[i];}
62
63 for (i=0; i<noc; i++) {
64 AliCluster *c=clusters[i];
65 if (TMath::Abs(c->GetLabel(1)) == lab ||
66 TMath::Abs(c->GetLabel(2)) == lab ) max++;
67 }
68
69 if ((1.- Float_t(max)/noc) > wrong) lab=-lab;
70 t->SetLabel(lab);
71
72 delete[] lb;
73 delete[] mx;
74 delete[] clusters;
75}
76
77//____________________________________________________________________________
78void AliTracker::UseClusters(const AliKalmanTrack *t, Int_t from) const {
79 //------------------------------------------------------------------
80 //This function marks clusters associated with the track.
81 //------------------------------------------------------------------
82 Int_t noc=t->GetNumberOfClusters();
83 for (Int_t i=from; i<noc; i++) {
84 Int_t index=t->GetClusterIndex(i);
85 AliCluster *c=GetCluster(index);
86 c->Use();
87 }
88}
89
90