]>
Commit | Line | Data |
---|---|---|
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 | ||
16 | /* $Id$ */ | |
17 | ||
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 | //------------------------------------------------------------------------- | |
23 | ||
24 | #include <TMath.h> | |
25 | #include <TH1F.h> | |
26 | #include <TGeoMatrix.h> | |
27 | ||
28 | #include "AliTracker.h" | |
29 | #include "AliGeomManager.h" | |
30 | #include "AliCluster.h" | |
31 | #include "AliKalmanTrack.h" | |
32 | #include "AliGlobalQADataMaker.h" | |
33 | ||
34 | Bool_t AliTracker::fFillResiduals=kFALSE; | |
35 | TObjArray **AliTracker::fResiduals=NULL; | |
36 | AliRecoParam::EventSpecie_t AliTracker::fEventSpecie=AliRecoParam::kDefault; | |
37 | ||
38 | ClassImp(AliTracker) | |
39 | ||
40 | AliTracker::AliTracker(): | |
41 | AliTrackerBase(), | |
42 | fEventInfo(NULL) | |
43 | { | |
44 | //-------------------------------------------------------------------- | |
45 | // The default constructor. | |
46 | //-------------------------------------------------------------------- | |
47 | } | |
48 | ||
49 | //__________________________________________________________________________ | |
50 | AliTracker::AliTracker(const AliTracker &atr): | |
51 | AliTrackerBase(atr), | |
52 | fEventInfo(atr.fEventInfo) | |
53 | { | |
54 | //-------------------------------------------------------------------- | |
55 | // The default constructor. | |
56 | //-------------------------------------------------------------------- | |
57 | } | |
58 | ||
59 | //__________________________________________________________________________ | |
60 | void AliTracker::FillClusterArray(TObjArray* /*array*/) const | |
61 | { | |
62 | // Publishes all pointers to clusters known to the tracker into the | |
63 | // passed object array. | |
64 | // The ownership is not transfered - the caller is not expected to delete | |
65 | // the clusters. | |
66 | ||
67 | AliWarning("should be overriden by a sub-class."); | |
68 | } | |
69 | ||
70 | //__________________________________________________________________________ | |
71 | void AliTracker::CookLabel(AliKalmanTrack *t, Float_t wrong) const { | |
72 | //-------------------------------------------------------------------- | |
73 | //This function "cooks" a track label. If label<0, this track is fake. | |
74 | //-------------------------------------------------------------------- | |
75 | Int_t noc=t->GetNumberOfClusters(); | |
76 | if (noc<1) return; | |
77 | Int_t *lb=new Int_t[noc]; | |
78 | Int_t *mx=new Int_t[noc]; | |
79 | AliCluster **clusters=new AliCluster*[noc]; | |
80 | ||
81 | Int_t i; | |
82 | for (i=0; i<noc; i++) { | |
83 | lb[i]=mx[i]=0; | |
84 | Int_t index=t->GetClusterIndex(i); | |
85 | clusters[i]=GetCluster(index); | |
86 | } | |
87 | ||
88 | Int_t lab=123456789; | |
89 | for (i=0; i<noc; i++) { | |
90 | AliCluster *c=clusters[i]; | |
91 | lab=TMath::Abs(c->GetLabel(0)); | |
92 | Int_t j; | |
93 | for (j=0; j<noc; j++) if (lb[j]==lab || mx[j]==0) break; | |
94 | if (j<noc) { | |
95 | lb[j]=lab; | |
96 | (mx[j])++; | |
97 | } | |
98 | } | |
99 | ||
100 | Int_t max=0; | |
101 | for (i=0; i<noc; i++) if (mx[i]>max) {max=mx[i]; lab=lb[i];} | |
102 | ||
103 | for (i=0; i<noc; i++) { | |
104 | AliCluster *c=clusters[i]; | |
105 | //if (TMath::Abs(c->GetLabel(1)) == lab || | |
106 | // TMath::Abs(c->GetLabel(2)) == lab ) max++; | |
107 | if (TMath::Abs(c->GetLabel(0)!=lab)) | |
108 | if (TMath::Abs(c->GetLabel(1)) == lab || | |
109 | TMath::Abs(c->GetLabel(2)) == lab ) max++; | |
110 | } | |
111 | ||
112 | if ((1.- Float_t(max)/noc) > wrong) lab=-lab; | |
113 | t->SetFakeRatio((1.- Float_t(max)/noc)); | |
114 | t->SetLabel(lab); | |
115 | ||
116 | delete[] lb; | |
117 | delete[] mx; | |
118 | delete[] clusters; | |
119 | } | |
120 | ||
121 | //____________________________________________________________________________ | |
122 | void AliTracker::UseClusters(const AliKalmanTrack *t, Int_t from) const { | |
123 | //------------------------------------------------------------------ | |
124 | //This function marks clusters associated with the track. | |
125 | //------------------------------------------------------------------ | |
126 | Int_t noc=t->GetNumberOfClusters(); | |
127 | for (Int_t i=from; i<noc; i++) { | |
128 | Int_t index=t->GetClusterIndex(i); | |
129 | AliCluster *c=GetCluster(index); | |
130 | c->Use(); | |
131 | } | |
132 | } | |
133 | ||
134 | void AliTracker::FillResiduals(const AliExternalTrackParam *t, | |
135 | Double_t *p, Double_t *cov, | |
136 | UShort_t id, Bool_t updated) { | |
137 | // | |
138 | // This function fills the histograms of residuals | |
139 | // The array of these histos is external for this AliTracker class. | |
140 | // Normally, this array belong to AliGlobalQADataMaker class. | |
141 | // | |
142 | if (!fFillResiduals) return; | |
143 | if (!fResiduals) return; | |
144 | ||
145 | const Double_t *residuals=t->GetResiduals(p,cov,updated); | |
146 | if (!residuals) return; | |
147 | ||
148 | TH1F *h=0; | |
149 | Int_t esIndex = AliRecoParam::AConvert(fEventSpecie) ; | |
150 | AliGeomManager::ELayerID layer=AliGeomManager::VolUIDToLayer(id); | |
151 | h=(TH1F*)fResiduals[esIndex]->At(2*layer-2); | |
152 | if (h) h->Fill(residuals[0]); | |
153 | h=(TH1F*)fResiduals[esIndex]->At(2*layer-1); | |
154 | if (h) h->Fill(residuals[1]); | |
155 | ||
156 | if (layer==5) { | |
157 | if (p[1]<0) { // SSD1 absolute residuals | |
158 | h = (TH1F*)fResiduals[esIndex]->At(40); | |
159 | if (h) h->Fill(t->GetY()-p[0]); //C side | |
160 | h = (TH1F*)fResiduals[esIndex]->At(41); | |
161 | if (h) h->Fill(t->GetZ()-p[1]); | |
162 | } else { | |
163 | h = (TH1F*)fResiduals[esIndex]->At(42); | |
164 | if (h) h->Fill(t->GetY()-p[0]); //A side | |
165 | h = (TH1F*)fResiduals[esIndex]->At(43); | |
166 | if (h) h->Fill(t->GetZ()-p[1]); | |
167 | } | |
168 | } | |
169 | if (layer==6) { // SSD2 absolute residuals | |
170 | if (p[1]<0) { | |
171 | h = (TH1F*)fResiduals[esIndex]->At(44); | |
172 | if (h) h->Fill(t->GetY()-p[0]); //C side | |
173 | h = (TH1F*)fResiduals[esIndex]->At(45); | |
174 | if (h) h->Fill(t->GetZ()-p[1]); | |
175 | } else { | |
176 | h = (TH1F*)fResiduals[esIndex]->At(46); | |
177 | if (h) h->Fill(t->GetY()-p[0]); //A side | |
178 | h = (TH1F*)fResiduals[esIndex]->At(47); | |
179 | if (h) h->Fill(t->GetZ()-p[1]); | |
180 | } | |
181 | } | |
182 | ||
183 | } | |
184 | ||
185 | void AliTracker::FillResiduals(const AliExternalTrackParam *t, | |
186 | const AliCluster *c, Bool_t /*updated*/) { | |
187 | // | |
188 | // This function fills the histograms of residuals | |
189 | // The array of these histos is external for this AliTracker class. | |
190 | // Normally, this array belong to AliGlobalQADataMaker class. | |
191 | // | |
192 | // For the moment, the residuals are absolute ! | |
193 | // | |
194 | ||
195 | if (!fFillResiduals) return; | |
196 | if (!fResiduals) return; | |
197 | ||
198 | UShort_t id=c->GetVolumeId(); | |
199 | const TGeoHMatrix *matrixT2L=AliGeomManager::GetTracking2LocalMatrix(id); | |
200 | ||
201 | // Position of the cluster in the tracking c.s. | |
202 | Double_t clsTrk[3]={c->GetX(), c->GetY(), c->GetZ()}; | |
203 | // Position of the cluster in the local module c.s. | |
204 | Double_t clsLoc[3]={0.,0.,0.}; | |
205 | matrixT2L->LocalToMaster(clsTrk,clsLoc); | |
206 | ||
207 | ||
208 | // Position of the intersection point in the tracking c.s. | |
209 | Double_t trkTrk[3]={t->GetX(),t->GetY(),t->GetZ()}; | |
210 | // Position of the intersection point in the local module c.s. | |
211 | Double_t trkLoc[3]={0.,0.,0.}; | |
212 | matrixT2L->LocalToMaster(trkTrk,trkLoc); | |
213 | ||
214 | Double_t residuals[2]={trkLoc[0]-clsLoc[0], trkLoc[2]-clsLoc[2]}; | |
215 | ||
216 | TH1F *h=0; | |
217 | Int_t esIndex = AliRecoParam::AConvert(fEventSpecie) ; | |
218 | AliGeomManager::ELayerID layer=AliGeomManager::VolUIDToLayer(id); | |
219 | h=(TH1F*)fResiduals[esIndex]->At(2*layer-2); | |
220 | if (h) h->Fill(residuals[0]); | |
221 | h=(TH1F*)fResiduals[esIndex]->At(2*layer-1); | |
222 | if (h) h->Fill(residuals[1]); | |
223 | ||
224 | } | |
225 |