]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliTracker.cxx
don't set the field map in the constructor (it's done by AliReconstruction)
[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"
27#include "AliCluster.h"
28#include "AliKalmanTrack.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():
38 fEventN(0),
39 fStoreBarrel(1),
40 fX(0),
41 fY(0),
42 fZ(0),
43 fSigmaX(0.005),
44 fSigmaY(0.005),
45 fSigmaZ(0.010)
46{
47 //--------------------------------------------------------------------
48 // The default constructor.
49 //--------------------------------------------------------------------
c9b9861a 50 if (!fgkFieldMap) AliWarning("Field map is not set. Call AliTracker::SetFieldMap before creating a tracker!");
3b242889 51}
52
53void AliTracker::SetFieldMap(const AliMagF* map) {
54 //--------------------------------------------------------------------
55 //This passes the field map to the reconstruction.
56 //--------------------------------------------------------------------
f37d970d 57 if (map==0) AliFatalClass("Can't access the field map !");
277cad11 58 AliKalmanTrack::SetConvConst(1000/0.299792458/(map->SolenoidField()+1e-13));
3b242889 59 fgkFieldMap=map;
60}
61
be9c5115 62//__________________________________________________________________________
63void AliTracker::CookLabel(AliKalmanTrack *t, Float_t wrong) const {
64 //--------------------------------------------------------------------
65 //This function "cooks" a track label. If label<0, this track is fake.
66 //--------------------------------------------------------------------
67 Int_t noc=t->GetNumberOfClusters();
68 Int_t *lb=new Int_t[noc];
69 Int_t *mx=new Int_t[noc];
70 AliCluster **clusters=new AliCluster*[noc];
71
72 Int_t i;
73 for (i=0; i<noc; i++) {
74 lb[i]=mx[i]=0;
75 Int_t index=t->GetClusterIndex(i);
76 clusters[i]=GetCluster(index);
77 }
78
79 Int_t lab=123456789;
80 for (i=0; i<noc; i++) {
81 AliCluster *c=clusters[i];
82 lab=TMath::Abs(c->GetLabel(0));
83 Int_t j;
84 for (j=0; j<noc; j++) if (lb[j]==lab || mx[j]==0) break;
85 lb[j]=lab;
86 (mx[j])++;
87 }
88
89 Int_t max=0;
90 for (i=0; i<noc; i++) if (mx[i]>max) {max=mx[i]; lab=lb[i];}
91
92 for (i=0; i<noc; i++) {
93 AliCluster *c=clusters[i];
babd135a 94 //if (TMath::Abs(c->GetLabel(1)) == lab ||
95 // TMath::Abs(c->GetLabel(2)) == lab ) max++;
96 if (TMath::Abs(c->GetLabel(0)!=lab))
97 if (TMath::Abs(c->GetLabel(1)) == lab ||
98 TMath::Abs(c->GetLabel(2)) == lab ) max++;
be9c5115 99 }
100
101 if ((1.- Float_t(max)/noc) > wrong) lab=-lab;
babd135a 102 t->SetFakeRatio((1.- Float_t(max)/noc));
be9c5115 103 t->SetLabel(lab);
104
105 delete[] lb;
106 delete[] mx;
107 delete[] clusters;
108}
109
110//____________________________________________________________________________
111void AliTracker::UseClusters(const AliKalmanTrack *t, Int_t from) const {
112 //------------------------------------------------------------------
113 //This function marks clusters associated with the track.
114 //------------------------------------------------------------------
115 Int_t noc=t->GetNumberOfClusters();
116 for (Int_t i=from; i<noc; i++) {
117 Int_t index=t->GetClusterIndex(i);
118 AliCluster *c=GetCluster(index);
119 c->Use();
120 }
121}