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