include optional use of AliTOFtrackerV1
[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
0f49d1bc 31#include "AliTOFGeometryV5.h"
0e46b9ae 32#include "AliTOFGeometry.h"
d3c7bfac 33#include "AliTOFtrack.h"
34
74ea065c 35ClassImp(AliTOFtrack)
36
37//_____________________________________________________________________________
655e379f 38AliTOFtrack::AliTOFtrack() :
39 AliKalmanTrack(),
40 fSeedInd(-1),
41 fSeedLab(-1),
6c94f330 42 fTOFgeometry(0)
43{
74ea065c 44 //
6c94f330 45 // Default constructor.
74ea065c 46 //
6c94f330 47}
74ea065c 48
6c94f330 49//_____________________________________________________________________________
50AliTOFtrack::AliTOFtrack(const AliTOFtrack& t) :
51 AliKalmanTrack(t),
52 fSeedInd(t.fSeedInd),
53 fSeedLab(t.fSeedLab),
0f49d1bc 54 fTOFgeometry(new AliTOFGeometryV5())
6c94f330 55{
56 //
57 // Copy constructor.
58 //
74ea065c 59}
60
61//_____________________________________________________________________________
6c94f330 62AliTOFtrack::AliTOFtrack(const AliESDtrack& t) :
63 AliKalmanTrack(),
655e379f 64 fSeedInd(-1),
65 fSeedLab(-1),
0f49d1bc 66 fTOFgeometry(new AliTOFGeometryV5())
6c94f330 67{
74ea065c 68 //
69 // Constructor from AliESDtrack
70 //
74ea065c 71 SetLabel(t.GetLabel());
72 SetChi2(0.);
73 SetMass(t.GetMass());
74
6c94f330 75 Set(t.GetX(),t.GetAlpha(),t.GetParameter(),t.GetCovariance());
74ea065c 76
77 if ((t.GetStatus()&AliESDtrack::kTIME) == 0) return;
78 StartTimeIntegral();
79 Double_t times[10]; t.GetIntegratedTimes(times); SetIntegratedTimes(times);
80 SetIntegratedLength(t.GetIntegratedLength());
81
74ea065c 82}
7aeeaf38 83
84//____________________________________________________________________________
85AliTOFtrack& AliTOFtrack::operator=(const AliTOFtrack &source)
86{
87 // ass. op.
88
89 this->fTOFgeometry=source.fTOFgeometry;
90 return *this;
91
92}
93
74ea065c 94//_____________________________________________________________________________
6c94f330 95Bool_t AliTOFtrack::PropagateTo(Double_t xk,Double_t x0,Double_t rho)
74ea065c 96{
97 // Propagates a track of particle with mass=pm to a reference plane
98 // defined by x=xk through media of density=rho and radiationLength=x0
99
6c94f330 100 if (xk == GetX()) return kTRUE;
74ea065c 101
6c94f330 102 Double_t oldX=GetX(), oldY=GetY(), oldZ=GetZ();
74ea065c 103
6c94f330 104 Double_t bz=GetBz();
105 if (!AliExternalTrackParam::PropagateTo(xk,bz)) return kFALSE;
74ea065c 106
6c94f330 107 Double_t d = TMath::Sqrt((GetX()-oldX)*(GetX()-oldX) +
108 (GetY()-oldY)*(GetY()-oldY) +
109 (GetZ()-oldZ)*(GetZ()-oldZ));
110 if (IsStartedTimeIntegral() && GetX()>oldX) AddTimeStep(d);
111
112 if (!AliExternalTrackParam::CorrectForMaterial(d*rho/x0,x0,GetMass()))
113 return kFALSE;
74ea065c 114
74ea065c 115 /*
74ea065c 116 //Energy losses************************
117 if((5940*beta2/(1-beta2+1e-10) - beta2) < 0){return 0;}
118
119 Double_t dE=0.153e-3/beta2*(log(5940*beta2/(1-beta2+1e-10)) - beta2)*d*rho;
983ebc4f 120 //
121 // suspicious part - think about it ?
122 Double_t kinE = TMath::Sqrt(p2);
123 if (dE>0.8*kinE) dE = 0.8*kinE; //
124 if (dE<0) dE = 0.0; // not valid region for Bethe bloch
6c94f330 125 */
74ea065c 126
6c94f330 127 return kTRUE;
74ea065c 128}
129
130//_____________________________________________________________________________
ba4161e8 131Bool_t AliTOFtrack::PropagateToInnerTOF()
74ea065c 132{
133 // Propagates a track of particle with mass=pm to a reference plane
134 // defined by x=xk through media of density=rho and radiationLength=x0
135
136
d3c7bfac 137 Double_t ymax=fTOFgeometry->RinTOF()*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());
74ea065c 138 Bool_t skip = kFALSE;
d3c7bfac 139 Double_t y=GetYat(fTOFgeometry->RinTOF(),skip);
6c94f330 140 if (skip) {
141 return kFALSE;
74ea065c 142 }
143 if (y > ymax) {
2c770f53 144 if (!Rotate(AliTOFGeometry::GetAlpha())) {
6c94f330 145 return kFALSE;
74ea065c 146 }
147 } else if (y <-ymax) {
2c770f53 148 if (!Rotate(-AliTOFGeometry::GetAlpha())) {
6c94f330 149 return kFALSE;
74ea065c 150 }
151 }
152
153
2c770f53 154 Double_t x = GetX();
74ea065c 155 Int_t nsteps=Int_t((370.-x)/0.5); // 0.5 cm Steps
156 for (Int_t istep=0;istep<nsteps;istep++){
157 Float_t xp = x+istep*0.5;
158 Double_t param[2];
ba4161e8 159 GetPropagationParameters(param);
2c770f53 160 PropagateTo(xp,param[0],param[1]);
74ea065c 161
162 }
163
d3c7bfac 164 if(!PropagateTo(fTOFgeometry->RinTOF()))return 0;
74ea065c 165
6c94f330 166 return kTRUE;
74ea065c 167
168}
169
2c770f53 170//_________________________________________________________________________
4668c628 171Double_t AliTOFtrack::GetYat(Double_t xk, Bool_t & skip) const {
2c770f53 172//-----------------------------------------------------------------
173// This function calculates the Y-coordinate of a track at the plane x=xk.
174// Needed for matching with the TOF (I.Belikov)
175//-----------------------------------------------------------------
6c94f330 176 Double_t y=0.;
177 skip=(!GetYAt(xk,GetBz(),y));
178 return y;
2c770f53 179}
74ea065c 180
181//_____________________________________________________________________________
182Int_t AliTOFtrack::Compare(const TObject *o) const {
183 //-----------------------------------------------------------------
184 // This function compares tracks according to the their curvature
185 //-----------------------------------------------------------------
186 AliTOFtrack *t=(AliTOFtrack*)o;
187 Double_t co=t->GetSigmaY2()*t->GetSigmaZ2();
188 Double_t c =GetSigmaY2()*GetSigmaZ2();
189 if (c>co) return 1;
190 else if (c<co) return -1;
191 return 0;
192}
193
6c94f330 194Double_t AliTOFtrack::GetBz() const {
195 //
196 // returns Bz component of the magnetic field (kG)
197 //
198 if (AliTracker::UniformField()) return AliTracker::GetBz();
199 Double_t r[3]; GetXYZ(r);
200 return AliTracker::GetBz(r);
201}
202
74ea065c 203//_____________________________________________________________________________
ba4161e8 204void AliTOFtrack::GetPropagationParameters(Double_t *param) {
74ea065c 205
2c770f53 206 //Get average medium density, x0 while propagating the track
207
208 //For TRD holes description
ba4161e8 209 /*
74ea065c 210 Double_t thetamin = (90.-31.1) * TMath::Pi()/180.;
211 Double_t thetamax = (90.+31.1) * TMath::Pi()/180.;
212
213 Double_t zmin = -55.;
214 Double_t zmax = 55.;
ba4161e8 215 */
74ea065c 216
2c770f53 217 // Detector inner/outer radii
74ea065c 218 Double_t rTPC = 261.53;
219 Double_t rTPCTRD = 294.5;
220 Double_t rTRD = 369.1;
221
2c770f53 222 // Medium parameters
74ea065c 223 Double_t x0TPC = 40.;
224 Double_t rhoTPC =0.06124;
225
226 Double_t x0Air = 36.66;
227 Double_t rhoAir =1.2931e-3;
228
229 Double_t x0TRD = 171.7;
230 Double_t rhoTRD =0.33;
231
ba4161e8 232 // Int_t isec = GetSector();
6c94f330 233 Double_t r[3]; GetXYZ(r);
ba4161e8 234 // Float_t thetatr = TMath::ATan2(TMath::Sqrt(r[0]*r[0]+r[1]*r[1]),r[2]);
74ea065c 235
ba4161e8 236 /*
74ea065c 237 if(holes){
238 if (isec == 0 || isec == 1 || isec == 2 ) {
239 if( thetatr>=thetamin && thetatr<=thetamax){
240 x0TRD= x0Air;
241 rhoTRD = rhoAir;
242 }
243 }
244 if (isec == 11 || isec == 12 || isec == 13 || isec == 14 || isec == 15 ) {
6c94f330 245 if( r[2]>=zmin && r[2]<=zmax){
74ea065c 246 x0TRD= x0Air;
247 rhoTRD = rhoAir;
248 }
249 }
250 }
ba4161e8 251 */
2c770f53 252 if(GetX() <= rTPC)
74ea065c 253 {param[0]=x0TPC;param[1]=rhoTPC;}
2c770f53 254 else if(GetX() > rTPC && GetX() < rTPCTRD)
74ea065c 255 {param[0]=x0Air;param[1]=rhoAir;}
2c770f53 256 else if(GetX() >= rTPCTRD && GetX() < rTRD)
74ea065c 257 {param[0]=x0TRD;param[1]=rhoTRD;}
2c770f53 258 else if(GetX() >= rTRD )
74ea065c 259 {param[0]=x0Air;param[1]=rhoAir;}
74ea065c 260}