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