]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TOF/AliTOFtrack.cxx
adding track matching histograms
[u/mrichter/AliRoot.git] / TOF / AliTOFtrack.cxx
CommitLineData
74ea065c 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 **************************************************************************/
74ea065c 15
0e46b9ae 16/* $Id$ */
d3c7bfac 17
0e46b9ae 18/////////////////////////////////////////////////////////////////////////////
19// //
20// AliTOFtrack class //
21// //
22// Authors: Bologna-CERN-ITEP-Salerno Group //
23// //
24// Description: class for handling ESD extracted tracks for TOF matching. //
25// //
26/////////////////////////////////////////////////////////////////////////////
d3c7bfac 27
74ea065c 28#include "AliESDtrack.h"
6c94f330 29#include "AliTracker.h"
74ea065c 30
0e46b9ae 31#include "AliTOFGeometry.h"
d3c7bfac 32#include "AliTOFtrack.h"
33
74ea065c 34ClassImp(AliTOFtrack)
35
36//_____________________________________________________________________________
655e379f 37AliTOFtrack::AliTOFtrack() :
38 AliKalmanTrack(),
39 fSeedInd(-1),
ba66add8 40 fSeedLab(-1)
6c94f330 41{
74ea065c 42 //
6c94f330 43 // Default constructor.
74ea065c 44 //
6c94f330 45}
74ea065c 46
6c94f330 47//_____________________________________________________________________________
48AliTOFtrack::AliTOFtrack(const AliTOFtrack& t) :
49 AliKalmanTrack(t),
50 fSeedInd(t.fSeedInd),
ba66add8 51 fSeedLab(t.fSeedLab)
6c94f330 52{
53 //
54 // Copy constructor.
55 //
74ea065c 56}
57
58//_____________________________________________________________________________
6c94f330 59AliTOFtrack::AliTOFtrack(const AliESDtrack& t) :
60 AliKalmanTrack(),
655e379f 61 fSeedInd(-1),
ba66add8 62 fSeedLab(-1)
6c94f330 63{
74ea065c 64 //
65 // Constructor from AliESDtrack
66 //
74ea065c 67 SetLabel(t.GetLabel());
68 SetChi2(0.);
69 SetMass(t.GetMass());
70
6c94f330 71 Set(t.GetX(),t.GetAlpha(),t.GetParameter(),t.GetCovariance());
74ea065c 72
73 if ((t.GetStatus()&AliESDtrack::kTIME) == 0) return;
74 StartTimeIntegral();
75 Double_t times[10]; t.GetIntegratedTimes(times); SetIntegratedTimes(times);
76 SetIntegratedLength(t.GetIntegratedLength());
77
74ea065c 78}
7aeeaf38 79
80//____________________________________________________________________________
2f584d46 81AliTOFtrack& AliTOFtrack::operator=(const AliTOFtrack &/*source*/)
7aeeaf38 82{
83 // ass. op.
84
7aeeaf38 85 return *this;
86
87}
88
74ea065c 89//_____________________________________________________________________________
35b6d6a6 90Bool_t AliTOFtrack::PropagateTo(Double_t xk,Double_t /*x0*/,Double_t /*rho*/)
18f005ac 91 {
92 //
74ea065c 93 // Propagates a track of particle with mass=pm to a reference plane
94 // defined by x=xk through media of density=rho and radiationLength=x0
18f005ac 95 //
74ea065c 96
6c94f330 97 if (xk == GetX()) return kTRUE;
74ea065c 98
35b6d6a6 99 Double_t oldX=GetX();//, oldY=GetY(), oldZ=GetZ();
100 Double_t start[3], end[3], mparam[7];
74ea065c 101
5a388465 102 /* get start position */
103 GetXYZ(start);
104
105 /* propagate the track */
c4eac485 106 Double_t b[3];GetBxByBz(b);
107 if (!AliExternalTrackParam::PropagateToBxByBz(xk,b)) return kFALSE;
108 // OLD used code
109 //Double_t bz=GetBz();
110 //if (!AliExternalTrackParam::PropagateTo(xk,bz)) return kFALSE;
74ea065c 111
5a388465 112 /* get end position */
113 GetXYZ(end);
114
115 /* add time step to integral */
116#if 0 /*** OLD ***/
6c94f330 117 Double_t d = TMath::Sqrt((GetX()-oldX)*(GetX()-oldX) +
118 (GetY()-oldY)*(GetY()-oldY) +
119 (GetZ()-oldZ)*(GetZ()-oldZ));
120 if (IsStartedTimeIntegral() && GetX()>oldX) AddTimeStep(d);
5a388465 121#endif
122 Double_t d = TMath::Sqrt((end[0]-start[0])*(end[0]-start[0]) +
123 (end[1]-start[1])*(end[1]-start[1]) +
124 (end[2]-start[2])*(end[2]-start[2]));
125 if (IsStartedTimeIntegral() && GetX()>oldX) AddTimeStep(d);
126
127 /* get material budget from tracker */
128 AliTracker::MeanMaterialBudget(start, end, mparam);
129 Double_t xTimesRho = mparam[4]*mparam[0];
78c25bbc 130 if (oldX < xk) { // CZ
131 xTimesRho = -xTimesRho; // it should be negative in case of outward
132 // propagation (--> energy decreases)
133 } // CZ
5a388465 134 Double_t xOverX0 = mparam[1];
6c94f330 135
5a388465 136 /* correct for mean material */
137 if (!AliExternalTrackParam::CorrectForMeanMaterial(xOverX0,xTimesRho,GetMass())) return kFALSE;
138
139
140#if 0 /*** OLD ***/
6c94f330 141 if (!AliExternalTrackParam::CorrectForMaterial(d*rho/x0,x0,GetMass()))
142 return kFALSE;
5a388465 143#endif
74ea065c 144
74ea065c 145 /*
74ea065c 146 //Energy losses************************
147 if((5940*beta2/(1-beta2+1e-10) - beta2) < 0){return 0;}
148
149 Double_t dE=0.153e-3/beta2*(log(5940*beta2/(1-beta2+1e-10)) - beta2)*d*rho;
983ebc4f 150 //
151 // suspicious part - think about it ?
152 Double_t kinE = TMath::Sqrt(p2);
153 if (dE>0.8*kinE) dE = 0.8*kinE; //
154 if (dE<0) dE = 0.0; // not valid region for Bethe bloch
6c94f330 155 */
74ea065c 156
6c94f330 157 return kTRUE;
74ea065c 158}
159
160//_____________________________________________________________________________
ba4161e8 161Bool_t AliTOFtrack::PropagateToInnerTOF()
74ea065c 162{
163 // Propagates a track of particle with mass=pm to a reference plane
164 // defined by x=xk through media of density=rho and radiationLength=x0
165
78c25bbc 166 //const Double_t kAlphac = TMath::Pi()/9.0; // 20 degree
167 const Double_t kAlphac = AliTOFGeometry::GetAlpha(); // 20 degree
168 const Double_t kTalphac = TMath::Tan(kAlphac*0.5);
169
170 //const Double_t kStepSize = 0.1; // [cm] Step size
171 const Double_t kStepSize = 0.5; // [cm] Step size
172
173 Double_t x = GetX();
174 //Double_t bz = GetBz();
175
176 //Double_t xyz0[3];
177 //Double_t xyz1[3];
178 //Double_t y;
179 //Double_t z;
180
181 Int_t nsteps = (Int_t)((AliTOFGeometry::Rmin()-x)/kStepSize);
182 for (Int_t istep=0; istep<nsteps; istep++){
183
184 // Critical alpha - cross sector indication
185
186 Double_t dir = (GetX() > AliTOFGeometry::Rmin()) ? -1.0 : 1.0;
187
188 x = GetX()+dir*kStepSize;
189 if ( x<GetX() && GetX()<AliTOFGeometry::Rmin()) {
190 AliDebug(1,Form("Track doesn't reach rho=%f",AliTOFGeometry::Rmin()));
191 return kFALSE;
192 }
193
194 //GetXYZ(xyz0);
195 //bz = GetBz();
196 //GetXYZAt(x,bz,xyz1);
197 //AliExternalTrackParam::GetYAt(x,bz,y);
198 //AliExternalTrackParam::GetZAt(x,bz,z);
199
9a4d9088 200 if (!(PropagateTo(x,0.,0.))) { /* passing 0.,0. as arguments since now
201 this method queries TGeo for material budget
202 */
203 return kFALSE;
204 }
78c25bbc 205
9a4d9088 206 if (GetY() > GetX()*kTalphac) {
207 if (!(Rotate(kAlphac))) return kFALSE;
208 } else if (GetY() < -GetX()*kTalphac) {
209 if (!(Rotate(-kAlphac))) return kFALSE;
210 }
78c25bbc 211
212 }
213
214 //Bool_t check = PropagateTo(AliTOFGeometry::RinTOF());
215 Bool_t check = PropagateTo(AliTOFGeometry::RinTOF(),0.,0.); /* passing 0.,0. as arguments since now
216 this method queries TGeo for material budget
217 */
218
219 if (!check) return kFALSE;
220
9a4d9088 221 if (GetY() > GetX()*kTalphac) {
222 if (!(Rotate(kAlphac))) return kFALSE;
223 } else if (GetY() < -GetX()*kTalphac) {
224 if (!(Rotate(-kAlphac))) return kFALSE;
225 }
78c25bbc 226
227 return kTRUE;
228
229}
230
231//_____________________________________________________________________________
232Bool_t AliTOFtrack::PropagateToInnerTOFold()
233{
234 // Propagates a track of particle with mass=pm to a reference plane
235 // defined by x=xk through media of density=rho and radiationLength=x0
236
74ea065c 237
ba66add8 238 Double_t ymax=AliTOFGeometry::RinTOF()*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());
74ea065c 239 Bool_t skip = kFALSE;
ba66add8 240 Double_t y=GetYat(AliTOFGeometry::RinTOF(),skip);
6c94f330 241 if (skip) {
242 return kFALSE;
74ea065c 243 }
244 if (y > ymax) {
9a4d9088 245 if (!Rotate(AliTOFGeometry::GetAlpha())) return kFALSE;
74ea065c 246 } else if (y <-ymax) {
9a4d9088 247 if (!Rotate(-AliTOFGeometry::GetAlpha())) return kFALSE;
74ea065c 248 }
249
2c770f53 250 Double_t x = GetX();
b3e52baa 251 Int_t nsteps=Int_t((AliTOFGeometry::Rmin()-x)/0.5); // 0.5 cm Steps
74ea065c 252 for (Int_t istep=0;istep<nsteps;istep++){
253 Float_t xp = x+istep*0.5;
5a388465 254 // GetPropagationParameters(param);
9a4d9088 255 if (!(PropagateTo(xp,0.,0.))) { /* passing 0.,0. as arguments since now
256 this method queries TGeo for material budget
257 */
258 return kFALSE;
259 }
74ea065c 260
261 }
262
9a4d9088 263 if (!(PropagateTo(AliTOFGeometry::RinTOF()))) return kFALSE;
264
6c94f330 265 return kTRUE;
74ea065c 266
267}
268
ac359ffe 269//_________________________________________________________________________
270Double_t AliTOFtrack::GetPredictedChi2(const AliCluster3D *c) const {
271 //
18f005ac 272 // Estimate the chi2 of the space point "c" with its cov. matrix elements
ac359ffe 273 //
18f005ac 274
ac359ffe 275 Double_t p[3]={c->GetX(), c->GetY(), c->GetZ()};
276 Double_t covyz[3]={c->GetSigmaY2(), c->GetSigmaYZ(), c->GetSigmaZ2()};
277 Double_t covxyz[3]={c->GetSigmaX2(), c->GetSigmaXY(), c->GetSigmaXZ()};
278 return AliExternalTrackParam::GetPredictedChi2(p, covyz, covxyz);
279}
280//_________________________________________________________________________
281Bool_t AliTOFtrack::PropagateTo(const AliCluster3D *c) {
282 //
18f005ac 283 // Propagates a track to the plane containing cluster 'c'
ac359ffe 284 //
285 Double_t oldX=GetX(), oldY=GetY(), oldZ=GetZ();
286 Double_t p[3]={c->GetX(), c->GetY(), c->GetZ()};
287 Double_t covyz[3]={c->GetSigmaY2(), c->GetSigmaYZ(), c->GetSigmaZ2()};
288 Double_t covxyz[3]={c->GetSigmaX2(), c->GetSigmaXY(), c->GetSigmaXZ()};
289 Double_t bz=GetBz();
290 if (!AliExternalTrackParam::PropagateTo(p, covyz, covxyz, bz)) return kFALSE;
291 if (IsStartedTimeIntegral()) {
292 Double_t d = TMath::Sqrt((GetX()-oldX)*(GetX()-oldX) +
293 (GetY()-oldY)*(GetY()-oldY) +
294 (GetZ()-oldZ)*(GetZ()-oldZ));
295 if (GetX()<oldX) d=-d;
296 AddTimeStep(d);
78c25bbc 297
ac359ffe 298 }
78c25bbc 299
9a4d9088 300 if (GetY() > GetX()*TMath::Tan(0.5*AliTOFGeometry::GetAlpha())) {
301 if (!(Rotate(AliTOFGeometry::GetAlpha()))) return kFALSE;
302 } else if (GetY() < -GetX()*TMath::Tan(0.5*AliTOFGeometry::GetAlpha())) {
303 if (!(Rotate(-AliTOFGeometry::GetAlpha()))) return kFALSE;
304 }
78c25bbc 305
ac359ffe 306 return kTRUE;
307}
2c770f53 308//_________________________________________________________________________
4668c628 309Double_t AliTOFtrack::GetYat(Double_t xk, Bool_t & skip) const {
2c770f53 310//-----------------------------------------------------------------
311// This function calculates the Y-coordinate of a track at the plane x=xk.
312// Needed for matching with the TOF (I.Belikov)
313//-----------------------------------------------------------------
6c94f330 314 Double_t y=0.;
315 skip=(!GetYAt(xk,GetBz(),y));
316 return y;
2c770f53 317}
74ea065c 318
319//_____________________________________________________________________________
320Int_t AliTOFtrack::Compare(const TObject *o) const {
321 //-----------------------------------------------------------------
322 // This function compares tracks according to the their curvature
323 //-----------------------------------------------------------------
324 AliTOFtrack *t=(AliTOFtrack*)o;
325 Double_t co=t->GetSigmaY2()*t->GetSigmaZ2();
326 Double_t c =GetSigmaY2()*GetSigmaZ2();
327 if (c>co) return 1;
328 else if (c<co) return -1;
329 return 0;
330}
331
6c94f330 332
74ea065c 333//_____________________________________________________________________________
ba4161e8 334void AliTOFtrack::GetPropagationParameters(Double_t *param) {
74ea065c 335
2c770f53 336 //Get average medium density, x0 while propagating the track
337
338 //For TRD holes description
ba4161e8 339 /*
74ea065c 340 Double_t thetamin = (90.-31.1) * TMath::Pi()/180.;
341 Double_t thetamax = (90.+31.1) * TMath::Pi()/180.;
342
343 Double_t zmin = -55.;
344 Double_t zmax = 55.;
ba4161e8 345 */
74ea065c 346
2c770f53 347 // Detector inner/outer radii
74ea065c 348 Double_t rTPC = 261.53;
349 Double_t rTPCTRD = 294.5;
350 Double_t rTRD = 369.1;
351
2c770f53 352 // Medium parameters
74ea065c 353 Double_t x0TPC = 40.;
354 Double_t rhoTPC =0.06124;
355
356 Double_t x0Air = 36.66;
357 Double_t rhoAir =1.2931e-3;
358
359 Double_t x0TRD = 171.7;
360 Double_t rhoTRD =0.33;
361
ba4161e8 362 // Int_t isec = GetSector();
6c94f330 363 Double_t r[3]; GetXYZ(r);
ba4161e8 364 // Float_t thetatr = TMath::ATan2(TMath::Sqrt(r[0]*r[0]+r[1]*r[1]),r[2]);
74ea065c 365
ba4161e8 366 /*
74ea065c 367 if(holes){
368 if (isec == 0 || isec == 1 || isec == 2 ) {
369 if( thetatr>=thetamin && thetatr<=thetamax){
370 x0TRD= x0Air;
371 rhoTRD = rhoAir;
372 }
373 }
374 if (isec == 11 || isec == 12 || isec == 13 || isec == 14 || isec == 15 ) {
6c94f330 375 if( r[2]>=zmin && r[2]<=zmax){
74ea065c 376 x0TRD= x0Air;
377 rhoTRD = rhoAir;
378 }
379 }
380 }
ba4161e8 381 */
2c770f53 382 if(GetX() <= rTPC)
74ea065c 383 {param[0]=x0TPC;param[1]=rhoTPC;}
2c770f53 384 else if(GetX() > rTPC && GetX() < rTPCTRD)
74ea065c 385 {param[0]=x0Air;param[1]=rhoAir;}
2c770f53 386 else if(GetX() >= rTPCTRD && GetX() < rTRD)
74ea065c 387 {param[0]=x0TRD;param[1]=rhoTRD;}
2c770f53 388 else if(GetX() >= rTRD )
74ea065c 389 {param[0]=x0Air;param[1]=rhoAir;}
74ea065c 390}