]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliTracker.cxx
Completely reengineered version of CMake build system (Johny)
[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//-------------------------------------------------------------------------
4811a3f4 23
be9c5115 24#include <TMath.h>
e23a38cb 25#include <TH1F.h>
9efabefd 26#include <TGeoMatrix.h>
be9c5115 27
28#include "AliTracker.h"
e23a38cb 29#include "AliGeomManager.h"
c84a5e9e 30#include "AliCluster.h"
7d0f8548 31#include "AliKalmanTrack.h"
eca4fa66 32#include "AliGlobalQADataMaker.h"
41377c29 33
e23a38cb 34Bool_t AliTracker::fFillResiduals=kFALSE;
57acd2d2 35TObjArray **AliTracker::fResiduals=NULL;
36AliRecoParam::EventSpecie_t AliTracker::fEventSpecie=AliRecoParam::kDefault;
3b242889 37
be9c5115 38ClassImp(AliTracker)
39
3b242889 40AliTracker::AliTracker():
4811a3f4 41 AliTrackerBase(),
1f26f3e7 42 fEventInfo(NULL)
3b242889 43{
44 //--------------------------------------------------------------------
45 // The default constructor.
46 //--------------------------------------------------------------------
3b242889 47}
48
fe12e09c 49//__________________________________________________________________________
50AliTracker::AliTracker(const AliTracker &atr):
4811a3f4 51 AliTrackerBase(atr),
1f26f3e7 52 fEventInfo(atr.fEventInfo)
fe12e09c 53{
54 //--------------------------------------------------------------------
55 // The default constructor.
56 //--------------------------------------------------------------------
f7920267 57}
58
2f4c86d7 59//__________________________________________________________________________
60void 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
be9c5115 70//__________________________________________________________________________
71void 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();
9b4aca55 76 if (noc<1) return;
be9c5115 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 lb[j]=lab;
95 (mx[j])++;
96 }
97
98 Int_t max=0;
99 for (i=0; i<noc; i++) if (mx[i]>max) {max=mx[i]; lab=lb[i];}
100
101 for (i=0; i<noc; i++) {
102 AliCluster *c=clusters[i];
babd135a 103 //if (TMath::Abs(c->GetLabel(1)) == lab ||
104 // TMath::Abs(c->GetLabel(2)) == lab ) max++;
105 if (TMath::Abs(c->GetLabel(0)!=lab))
106 if (TMath::Abs(c->GetLabel(1)) == lab ||
107 TMath::Abs(c->GetLabel(2)) == lab ) max++;
be9c5115 108 }
109
110 if ((1.- Float_t(max)/noc) > wrong) lab=-lab;
babd135a 111 t->SetFakeRatio((1.- Float_t(max)/noc));
be9c5115 112 t->SetLabel(lab);
113
114 delete[] lb;
115 delete[] mx;
116 delete[] clusters;
117}
118
119//____________________________________________________________________________
120void AliTracker::UseClusters(const AliKalmanTrack *t, Int_t from) const {
121 //------------------------------------------------------------------
122 //This function marks clusters associated with the track.
123 //------------------------------------------------------------------
124 Int_t noc=t->GetNumberOfClusters();
125 for (Int_t i=from; i<noc; i++) {
126 Int_t index=t->GetClusterIndex(i);
127 AliCluster *c=GetCluster(index);
128 c->Use();
129 }
130}
7b5ef2e6 131
e23a38cb 132void AliTracker::FillResiduals(const AliExternalTrackParam *t,
133 Double_t *p, Double_t *cov,
134 UShort_t id, Bool_t updated) {
135 //
136 // This function fills the histograms of residuals
137 // The array of these histos is external for this AliTracker class.
138 // Normally, this array belong to AliGlobalQADataMaker class.
139 //
140 if (!fFillResiduals) return;
141 if (!fResiduals) return;
142
143 const Double_t *residuals=t->GetResiduals(p,cov,updated);
144 if (!residuals) return;
145
146 TH1F *h=0;
eca4fa66 147 Int_t esIndex = AliRecoParam::AConvert(fEventSpecie) ;
e23a38cb 148 AliGeomManager::ELayerID layer=AliGeomManager::VolUIDToLayer(id);
eca4fa66 149 h=(TH1F*)fResiduals[esIndex]->At(2*layer-2);
74e15cf4 150 if (h) h->Fill(residuals[0]);
eca4fa66 151 h=(TH1F*)fResiduals[esIndex]->At(2*layer-1);
74e15cf4 152 if (h) h->Fill(residuals[1]);
a935c6c0 153
154 if (layer==5) {
49ab451d 155 if (p[1]<0) { // SSD1 absolute residuals
74e15cf4 156 h = (TH1F*)fResiduals[esIndex]->At(40);
157 if (h) h->Fill(t->GetY()-p[0]); //C side
158 h = (TH1F*)fResiduals[esIndex]->At(41);
159 if (h) h->Fill(t->GetZ()-p[1]);
49ab451d 160 } else {
74e15cf4 161 h = (TH1F*)fResiduals[esIndex]->At(42);
162 if (h) h->Fill(t->GetY()-p[0]); //A side
163 h = (TH1F*)fResiduals[esIndex]->At(43);
164 if (h) h->Fill(t->GetZ()-p[1]);
49ab451d 165 }
a935c6c0 166 }
49ab451d 167 if (layer==6) { // SSD2 absolute residuals
168 if (p[1]<0) {
74e15cf4 169 h = (TH1F*)fResiduals[esIndex]->At(44);
170 if (h) h->Fill(t->GetY()-p[0]); //C side
171 h = (TH1F*)fResiduals[esIndex]->At(45);
172 if (h) h->Fill(t->GetZ()-p[1]);
49ab451d 173 } else {
74e15cf4 174 h = (TH1F*)fResiduals[esIndex]->At(46);
175 if (h) h->Fill(t->GetY()-p[0]); //A side
176 h = (TH1F*)fResiduals[esIndex]->At(47);
177 if (h) h->Fill(t->GetZ()-p[1]);
49ab451d 178 }
a935c6c0 179 }
180
e23a38cb 181}
182
9efabefd 183void AliTracker::FillResiduals(const AliExternalTrackParam *t,
184 const AliCluster *c, Bool_t /*updated*/) {
185 //
186 // This function fills the histograms of residuals
187 // The array of these histos is external for this AliTracker class.
188 // Normally, this array belong to AliGlobalQADataMaker class.
189 //
190 // For the moment, the residuals are absolute !
191 //
192
193 if (!fFillResiduals) return;
194 if (!fResiduals) return;
195
196 UShort_t id=c->GetVolumeId();
197 const TGeoHMatrix *matrixT2L=AliGeomManager::GetTracking2LocalMatrix(id);
198
199 // Position of the cluster in the tracking c.s.
200 Double_t clsTrk[3]={c->GetX(), c->GetY(), c->GetZ()};
201 // Position of the cluster in the local module c.s.
202 Double_t clsLoc[3]={0.,0.,0.};
203 matrixT2L->LocalToMaster(clsTrk,clsLoc);
204
205
206 // Position of the intersection point in the tracking c.s.
207 Double_t trkTrk[3]={t->GetX(),t->GetY(),t->GetZ()};
208 // Position of the intersection point in the local module c.s.
209 Double_t trkLoc[3]={0.,0.,0.};
210 matrixT2L->LocalToMaster(trkTrk,trkLoc);
211
212 Double_t residuals[2]={trkLoc[0]-clsLoc[0], trkLoc[2]-clsLoc[2]};
213
214 TH1F *h=0;
eca4fa66 215 Int_t esIndex = AliRecoParam::AConvert(fEventSpecie) ;
9efabefd 216 AliGeomManager::ELayerID layer=AliGeomManager::VolUIDToLayer(id);
eca4fa66 217 h=(TH1F*)fResiduals[esIndex]->At(2*layer-2);
74e15cf4 218 if (h) h->Fill(residuals[0]);
eca4fa66 219 h=(TH1F*)fResiduals[esIndex]->At(2*layer-1);
74e15cf4 220 if (h) h->Fill(residuals[1]);
9efabefd 221
222}
237adab4 223