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