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