1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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 //-------------------------------------------------------------------------
26 #include "AliTracker.h"
27 #include "AliCluster.h"
28 #include "AliKalmanTrack.h"
33 const AliMagF *AliTracker::fgkFieldMap=0;
37 AliTracker::AliTracker():
47 //--------------------------------------------------------------------
48 // The default constructor.
49 //--------------------------------------------------------------------
50 AliRunLoader* runLoader = AliRunLoader::GetRunLoader();
51 if (!runLoader) AliFatal("Can't get the default run loader");
52 if (!runLoader->GetAliRun()) runLoader->LoadgAlice();
53 if (!runLoader->GetAliRun()) AliFatal("Can't get the AliRun object");
54 AliMagF *field=runLoader->GetAliRun()->Field();
55 if (field==0) AliFatal("Can't access the field map !");
59 void AliTracker::SetFieldMap(const AliMagF* map) {
60 //--------------------------------------------------------------------
61 //This passes the field map to the reconstruction.
62 //--------------------------------------------------------------------
63 if (map==0) AliFatalClass("Can't access the field map !");
64 AliKalmanTrack::SetConvConst(1000/0.299792458/(map->SolenoidField()+1e-13));
68 //__________________________________________________________________________
69 void AliTracker::CookLabel(AliKalmanTrack *t, Float_t wrong) const {
70 //--------------------------------------------------------------------
71 //This function "cooks" a track label. If label<0, this track is fake.
72 //--------------------------------------------------------------------
73 Int_t noc=t->GetNumberOfClusters();
74 Int_t *lb=new Int_t[noc];
75 Int_t *mx=new Int_t[noc];
76 AliCluster **clusters=new AliCluster*[noc];
79 for (i=0; i<noc; i++) {
81 Int_t index=t->GetClusterIndex(i);
82 clusters[i]=GetCluster(index);
86 for (i=0; i<noc; i++) {
87 AliCluster *c=clusters[i];
88 lab=TMath::Abs(c->GetLabel(0));
90 for (j=0; j<noc; j++) if (lb[j]==lab || mx[j]==0) break;
96 for (i=0; i<noc; i++) if (mx[i]>max) {max=mx[i]; lab=lb[i];}
98 for (i=0; i<noc; i++) {
99 AliCluster *c=clusters[i];
100 //if (TMath::Abs(c->GetLabel(1)) == lab ||
101 // TMath::Abs(c->GetLabel(2)) == lab ) max++;
102 if (TMath::Abs(c->GetLabel(0)!=lab))
103 if (TMath::Abs(c->GetLabel(1)) == lab ||
104 TMath::Abs(c->GetLabel(2)) == lab ) max++;
107 if ((1.- Float_t(max)/noc) > wrong) lab=-lab;
108 t->SetFakeRatio((1.- Float_t(max)/noc));
116 //____________________________________________________________________________
117 void AliTracker::UseClusters(const AliKalmanTrack *t, Int_t from) const {
118 //------------------------------------------------------------------
119 //This function marks clusters associated with the track.
120 //------------------------------------------------------------------
121 Int_t noc=t->GetNumberOfClusters();
122 for (Int_t i=from; i<noc; i++) {
123 Int_t index=t->GetClusterIndex(i);
124 AliCluster *c=GetCluster(index);