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 <TGeoMatrix.h>
28 #include "AliTracker.h"
29 #include "AliGeomManager.h"
30 #include "AliCluster.h"
31 #include "AliKalmanTrack.h"
32 #include "AliGlobalQADataMaker.h"
33 #include "AliPoolsSet.h"
35 Bool_t AliTracker::fFillResiduals=kFALSE;
36 TObjArray **AliTracker::fResiduals=NULL;
37 AliRecoParam::EventSpecie_t AliTracker::fEventSpecie=AliRecoParam::kDefault;
41 AliTracker::AliTracker():
46 //--------------------------------------------------------------------
47 // The default constructor.
48 //--------------------------------------------------------------------
51 //__________________________________________________________________________
52 AliTracker::AliTracker(const AliTracker &atr):
54 fEventInfo(atr.fEventInfo),
57 //--------------------------------------------------------------------
58 // The default constructor.
59 //--------------------------------------------------------------------
62 //__________________________________________________________________________
63 void AliTracker::FillClusterArray(TObjArray* /*array*/) const
65 // Publishes all pointers to clusters known to the tracker into the
66 // passed object array.
67 // The ownership is not transfered - the caller is not expected to delete
70 AliWarning("should be overriden by a sub-class.");
73 //__________________________________________________________________________
74 void AliTracker::CookLabel(AliKalmanTrack *t, Float_t wrong) const {
75 //--------------------------------------------------------------------
76 //This function "cooks" a track label. If label<0, this track is fake.
77 //--------------------------------------------------------------------
78 Int_t noc=t->GetNumberOfClusters();
80 Int_t *lb=new Int_t[noc];
81 Int_t *mx=new Int_t[noc];
82 AliCluster **clusters=new AliCluster*[noc];
85 for (i=0; i<noc; i++) {
87 Int_t index=t->GetClusterIndex(i);
88 clusters[i]=GetCluster(index);
92 for (i=0; i<noc; i++) {
93 AliCluster *c=clusters[i];
94 lab=TMath::Abs(c->GetLabel(0));
96 for (j=0; j<noc; j++) if (lb[j]==lab || mx[j]==0) break;
104 for (i=0; i<noc; i++) if (mx[i]>max) {max=mx[i]; lab=lb[i];}
106 for (i=0; i<noc; i++) {
107 AliCluster *c=clusters[i];
108 //if (TMath::Abs(c->GetLabel(1)) == lab ||
109 // TMath::Abs(c->GetLabel(2)) == lab ) max++;
110 if (TMath::Abs(c->GetLabel(0)!=lab))
111 if (TMath::Abs(c->GetLabel(1)) == lab ||
112 TMath::Abs(c->GetLabel(2)) == lab ) max++;
115 if ((1.- Float_t(max)/noc) > wrong) lab=-lab;
116 t->SetFakeRatio((1.- Float_t(max)/noc));
124 //____________________________________________________________________________
125 void AliTracker::UseClusters(const AliKalmanTrack *t, Int_t from) const {
126 //------------------------------------------------------------------
127 //This function marks clusters associated with the track.
128 //------------------------------------------------------------------
129 Int_t noc=t->GetNumberOfClusters();
130 for (Int_t i=from; i<noc; i++) {
131 Int_t index=t->GetClusterIndex(i);
132 AliCluster *c=GetCluster(index);
137 void AliTracker::FillResiduals(const AliExternalTrackParam *t,
138 Double_t *p, Double_t *cov,
139 UShort_t id, Bool_t updated) {
141 // This function fills the histograms of residuals
142 // The array of these histos is external for this AliTracker class.
143 // Normally, this array belong to AliGlobalQADataMaker class.
145 if (!fFillResiduals) return;
146 if (!fResiduals) return;
148 const Double_t *residuals=t->GetResiduals(p,cov,updated);
149 if (!residuals) return;
152 Int_t esIndex = AliRecoParam::AConvert(fEventSpecie) ;
153 AliGeomManager::ELayerID layer=AliGeomManager::VolUIDToLayer(id);
154 h=(TH1F*)fResiduals[esIndex]->At(2*layer-2);
155 if (h) h->Fill(residuals[0]);
156 h=(TH1F*)fResiduals[esIndex]->At(2*layer-1);
157 if (h) h->Fill(residuals[1]);
160 if (p[1]<0) { // SSD1 absolute residuals
161 h = (TH1F*)fResiduals[esIndex]->At(40);
162 if (h) h->Fill(t->GetY()-p[0]); //C side
163 h = (TH1F*)fResiduals[esIndex]->At(41);
164 if (h) h->Fill(t->GetZ()-p[1]);
166 h = (TH1F*)fResiduals[esIndex]->At(42);
167 if (h) h->Fill(t->GetY()-p[0]); //A side
168 h = (TH1F*)fResiduals[esIndex]->At(43);
169 if (h) h->Fill(t->GetZ()-p[1]);
172 if (layer==6) { // SSD2 absolute residuals
174 h = (TH1F*)fResiduals[esIndex]->At(44);
175 if (h) h->Fill(t->GetY()-p[0]); //C side
176 h = (TH1F*)fResiduals[esIndex]->At(45);
177 if (h) h->Fill(t->GetZ()-p[1]);
179 h = (TH1F*)fResiduals[esIndex]->At(46);
180 if (h) h->Fill(t->GetY()-p[0]); //A side
181 h = (TH1F*)fResiduals[esIndex]->At(47);
182 if (h) h->Fill(t->GetZ()-p[1]);
188 void AliTracker::FillResiduals(const AliExternalTrackParam *t,
189 const AliCluster *c, Bool_t /*updated*/) {
191 // This function fills the histograms of residuals
192 // The array of these histos is external for this AliTracker class.
193 // Normally, this array belong to AliGlobalQADataMaker class.
195 // For the moment, the residuals are absolute !
198 if (!fFillResiduals) return;
199 if (!fResiduals) return;
201 UShort_t id=c->GetVolumeId();
202 const TGeoHMatrix *matrixT2L=AliGeomManager::GetTracking2LocalMatrix(id);
204 // Position of the cluster in the tracking c.s.
205 Double_t clsTrk[3]={c->GetX(), c->GetY(), c->GetZ()};
206 // Position of the cluster in the local module c.s.
207 Double_t clsLoc[3]={0.,0.,0.};
208 matrixT2L->LocalToMaster(clsTrk,clsLoc);
211 // Position of the intersection point in the tracking c.s.
212 Double_t trkTrk[3]={t->GetX(),t->GetY(),t->GetZ()};
213 // Position of the intersection point in the local module c.s.
214 Double_t trkLoc[3]={0.,0.,0.};
215 matrixT2L->LocalToMaster(trkTrk,trkLoc);
217 Double_t residuals[2]={trkLoc[0]-clsLoc[0], trkLoc[2]-clsLoc[2]};
220 Int_t esIndex = AliRecoParam::AConvert(fEventSpecie) ;
221 AliGeomManager::ELayerID layer=AliGeomManager::VolUIDToLayer(id);
222 h=(TH1F*)fResiduals[esIndex]->At(2*layer-2);
223 if (h) h->Fill(residuals[0]);
224 h=(TH1F*)fResiduals[esIndex]->At(2*layer-1);
225 if (h) h->Fill(residuals[1]);