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