]>
Commit | Line | Data |
---|---|---|
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 | //------------------------------------------------------------------------- |
7d0f8548 | 23 | #include <TClass.h> |
be9c5115 | 24 | #include <TMath.h> |
25 | ||
26 | #include "AliTracker.h" | |
c84a5e9e | 27 | #include "AliCluster.h" |
7d0f8548 | 28 | #include "AliKalmanTrack.h" |
41377c29 | 29 | |
7d0f8548 | 30 | Bool_t AliTracker::fgUniformField=kTRUE; |
31 | Double_t AliTracker::fgBz=0.; | |
3b242889 | 32 | const AliMagF *AliTracker::fgkFieldMap=0; |
33 | ||
be9c5115 | 34 | ClassImp(AliTracker) |
35 | ||
3b242889 | 36 | AliTracker::AliTracker(): |
3b242889 | 37 | fX(0), |
38 | fY(0), | |
39 | fZ(0), | |
40 | fSigmaX(0.005), | |
41 | fSigmaY(0.005), | |
42 | fSigmaZ(0.010) | |
43 | { | |
44 | //-------------------------------------------------------------------- | |
45 | // The default constructor. | |
46 | //-------------------------------------------------------------------- | |
c9b9861a | 47 | if (!fgkFieldMap) AliWarning("Field map is not set. Call AliTracker::SetFieldMap before creating a tracker!"); |
3b242889 | 48 | } |
49 | ||
7d0f8548 | 50 | void AliTracker::SetFieldMap(const AliMagF* map, Bool_t uni) { |
51 | //-------------------------------------------------------------------- | |
52 | //This passes the field map to the reconstruction. | |
53 | //-------------------------------------------------------------------- | |
54 | if (map==0) AliFatalClass("Can't access the field map !"); | |
55 | ||
729c2fa2 | 56 | if (fgkFieldMap) { |
57 | AliWarningClass("The magnetic field map has been already set !"); | |
58 | return; | |
59 | } | |
60 | ||
7d0f8548 | 61 | fgUniformField=uni; |
62 | fgkFieldMap=map; | |
63 | ||
64 | //Float_t r[3]={0.,0.,0.},b[3]; map->Field(r,b); | |
7ebb06c3 | 65 | //Double_t bz=-b[2]; |
7d0f8548 | 66 | |
7ebb06c3 | 67 | Double_t bz=-map->SolenoidField(); |
68 | fgBz=TMath::Sign(1e-13,bz) + bz; | |
7d0f8548 | 69 | |
70 | } | |
71 | ||
be9c5115 | 72 | //__________________________________________________________________________ |
73 | void AliTracker::CookLabel(AliKalmanTrack *t, Float_t wrong) const { | |
74 | //-------------------------------------------------------------------- | |
75 | //This function "cooks" a track label. If label<0, this track is fake. | |
76 | //-------------------------------------------------------------------- | |
77 | Int_t noc=t->GetNumberOfClusters(); | |
78 | Int_t *lb=new Int_t[noc]; | |
79 | Int_t *mx=new Int_t[noc]; | |
80 | AliCluster **clusters=new AliCluster*[noc]; | |
81 | ||
82 | Int_t i; | |
83 | for (i=0; i<noc; i++) { | |
84 | lb[i]=mx[i]=0; | |
85 | Int_t index=t->GetClusterIndex(i); | |
86 | clusters[i]=GetCluster(index); | |
87 | } | |
88 | ||
89 | Int_t lab=123456789; | |
90 | for (i=0; i<noc; i++) { | |
91 | AliCluster *c=clusters[i]; | |
92 | lab=TMath::Abs(c->GetLabel(0)); | |
93 | Int_t j; | |
94 | for (j=0; j<noc; j++) if (lb[j]==lab || mx[j]==0) break; | |
95 | lb[j]=lab; | |
96 | (mx[j])++; | |
97 | } | |
98 | ||
99 | Int_t max=0; | |
100 | for (i=0; i<noc; i++) if (mx[i]>max) {max=mx[i]; lab=lb[i];} | |
101 | ||
102 | for (i=0; i<noc; i++) { | |
103 | AliCluster *c=clusters[i]; | |
babd135a | 104 | //if (TMath::Abs(c->GetLabel(1)) == lab || |
105 | // TMath::Abs(c->GetLabel(2)) == lab ) max++; | |
106 | if (TMath::Abs(c->GetLabel(0)!=lab)) | |
107 | if (TMath::Abs(c->GetLabel(1)) == lab || | |
108 | TMath::Abs(c->GetLabel(2)) == lab ) max++; | |
be9c5115 | 109 | } |
110 | ||
111 | if ((1.- Float_t(max)/noc) > wrong) lab=-lab; | |
babd135a | 112 | t->SetFakeRatio((1.- Float_t(max)/noc)); |
be9c5115 | 113 | t->SetLabel(lab); |
114 | ||
115 | delete[] lb; | |
116 | delete[] mx; | |
117 | delete[] clusters; | |
118 | } | |
119 | ||
120 | //____________________________________________________________________________ | |
121 | void AliTracker::UseClusters(const AliKalmanTrack *t, Int_t from) const { | |
122 | //------------------------------------------------------------------ | |
123 | //This function marks clusters associated with the track. | |
124 | //------------------------------------------------------------------ | |
125 | Int_t noc=t->GetNumberOfClusters(); | |
126 | for (Int_t i=from; i<noc; i++) { | |
127 | Int_t index=t->GetClusterIndex(i); | |
128 | AliCluster *c=GetCluster(index); | |
129 | c->Use(); | |
130 | } | |
131 | } |