]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliTracker.cxx
Version number ++
[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 /* $Id$ */
17
18 //-------------------------------------------------------------------------
19 //               Implementation of the AliTracker class
20 //  that is the base for AliTPCtracker, AliITStrackerV2 and AliTRDtracker    
21 //        Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
22 //-------------------------------------------------------------------------
23
24 #include <TMath.h>
25
26 #include "AliTracker.h"
27 #include "AliCluster.h"
28 #include "AliRun.h"
29
30 const AliMagF *AliTracker::fgkFieldMap=0;
31
32 ClassImp(AliTracker)
33
34 AliTracker::AliTracker():
35   fX(0),
36   fY(0),
37   fZ(0),
38   fSigmaX(0.005),
39   fSigmaY(0.005),
40   fSigmaZ(0.010)
41 {
42   //--------------------------------------------------------------------
43   // The default constructor.
44   //--------------------------------------------------------------------
45   if (!fgkFieldMap) AliWarning("Field map is not set. Call AliTracker::SetFieldMap before creating a tracker!");
46 }
47
48 //__________________________________________________________________________
49 void AliTracker::CookLabel(AliKalmanTrack *t, Float_t wrong) const {
50   //--------------------------------------------------------------------
51   //This function "cooks" a track label. If label<0, this track is fake.
52   //--------------------------------------------------------------------
53   Int_t noc=t->GetNumberOfClusters();
54   Int_t *lb=new Int_t[noc];
55   Int_t *mx=new Int_t[noc];
56   AliCluster **clusters=new AliCluster*[noc];
57
58   Int_t i;
59   for (i=0; i<noc; i++) {
60      lb[i]=mx[i]=0;
61      Int_t index=t->GetClusterIndex(i);
62      clusters[i]=GetCluster(index);
63   }
64
65   Int_t lab=123456789;
66   for (i=0; i<noc; i++) {
67     AliCluster *c=clusters[i];
68     lab=TMath::Abs(c->GetLabel(0));
69     Int_t j;
70     for (j=0; j<noc; j++) if (lb[j]==lab || mx[j]==0) break;
71     lb[j]=lab;
72     (mx[j])++;
73   }
74
75   Int_t max=0;
76   for (i=0; i<noc; i++) if (mx[i]>max) {max=mx[i]; lab=lb[i];}
77     
78   for (i=0; i<noc; i++) {
79     AliCluster *c=clusters[i];
80     //if (TMath::Abs(c->GetLabel(1)) == lab ||
81     //    TMath::Abs(c->GetLabel(2)) == lab ) max++;
82     if (TMath::Abs(c->GetLabel(0)!=lab))
83         if (TMath::Abs(c->GetLabel(1)) == lab ||
84             TMath::Abs(c->GetLabel(2)) == lab ) max++;
85   }
86
87   if ((1.- Float_t(max)/noc) > wrong) lab=-lab;
88   t->SetFakeRatio((1.- Float_t(max)/noc));
89   t->SetLabel(lab);
90
91   delete[] lb;
92   delete[] mx;
93   delete[] clusters;
94 }
95
96 //____________________________________________________________________________
97 void AliTracker::UseClusters(const AliKalmanTrack *t, Int_t from) const {
98   //------------------------------------------------------------------
99   //This function marks clusters associated with the track.
100   //------------------------------------------------------------------
101   Int_t noc=t->GetNumberOfClusters();
102   for (Int_t i=from; i<noc; i++) {
103      Int_t index=t->GetClusterIndex(i);
104      AliCluster *c=GetCluster(index); 
105      c->Use();   
106   }
107 }