]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITStrackMI.cxx
Bug fix (Yu.Belikov)
[u/mrichter/AliRoot.git] / ITS / AliITStrackMI.cxx
CommitLineData
15dd636f 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//-------------------------------------------------------------------------
17// Implementation of the ITS track class
18//
19// Origin: Marian Ivanov, CERN, Marian.Ivanov@cern.ch
20// dEdx analysis by: Boris Batyunya, JINR, Boris.Batiounia@cern.ch
21//-------------------------------------------------------------------------
22
23#include <TMatrixD.h>
24
25#include <TMath.h>
26
27#include "AliCluster.h"
28#include "AliESDtrack.h"
29#include "AliITStrackMI.h"
30
31ClassImp(AliITStrackMI)
32
33const Int_t kWARN=5;
34
35//____________________________________________________________________________
36AliITStrackMI::AliITStrackMI():AliITStrackV2(),
37 fNUsed(0),
38 fNSkipped(0),
39 fNDeadZone(0),
40 fDeadZoneProbability(0),
41 fReconstructed(kFALSE),
42 fConstrain(kFALSE)
43{
44 for(Int_t i=0; i<kMaxLayer; i++) fClIndex[i]=-1;
45 for(Int_t i=0; i<6; i++) { fNy[i]=0; fNz[i]=0; fNormQ[i]=0; fNormChi2[i]=1000;}
46 for(Int_t i=0; i<12; i++) {fDy[i]=0; fDz[i]=0; fSigmaY[i]=0; fSigmaZ[i]=0; fChi2MIP[i]=0;}
47 fD[0]=0; fD[1]=0;
48 fExpQ=40;
49 fdEdxMismatch=0;
50 fChi22=0;
51}
52
53//____________________________________________________________________________
54AliITStrackMI::AliITStrackMI(AliESDtrack& t,Bool_t c) throw (const Char_t *) :
55AliITStrackV2(t,c) {
56 //------------------------------------------------------------------
57 // Conversion ESD track -> ITS track.
58 // If c==kTRUE, create the ITS track out of the constrained params.
59 //------------------------------------------------------------------
60 fNUsed = 0;
61 fReconstructed = kFALSE;
62 fNSkipped =0;
63 fNDeadZone = 0;
64 fDeadZoneProbability = 0;
65 for(Int_t i=0; i<6; i++) {fClIndex[i]=-1; fNy[i]=0; fNz[i]=0; fNormQ[i]=0; fNormChi2[i]=1000;}
66 for(Int_t i=0; i<12; i++) {fDy[i]=0; fDz[i]=0; fSigmaY[i]=0; fSigmaZ[i]=0;fChi2MIP[i]=0;}
67 fD[0]=0; fD[1]=0;
68 fExpQ=40;
69 fConstrain = kFALSE;
70 fdEdxMismatch=0;
71 fChi22 =0;
72
73 //if (!Invariant()) throw "AliITStrackV2: conversion failed !\n";
74
75}
76
77void AliITStrackMI::UpdateESDtrack(ULong_t flags) {
78 fESDtrack->UpdateTrackParams(this,flags);
79 if (flags == AliESDtrack::kITSin) fESDtrack->SetITSChi2MIP(fChi2MIP);
80}
81
82//____________________________________________________________________________
83AliITStrackMI::AliITStrackMI(const AliITStrackMI& t) : AliITStrackV2(t) {
84 //------------------------------------------------------------------
85 //Copy constructor
86 //------------------------------------------------------------------
87 fNUsed = t.fNUsed;
88 fReconstructed = t.fReconstructed;
89 fNSkipped = t.fNSkipped;
90 fNDeadZone = t.fNDeadZone;
91 fDeadZoneProbability = t.fDeadZoneProbability;
92 fLab = t.fLab;
93 fFakeRatio = t.fFakeRatio;
94 fdEdxMismatch = t.fdEdxMismatch;
95 fChi22 = t.fChi22;
96
97
98 fD[0]=t.fD[0]; fD[1]=t.fD[1];
99 fExpQ= t.fExpQ;
100 for(Int_t i=0; i<6; i++) {
101 fClIndex[i]= t.fClIndex[i]; fNy[i]=t.fNy[i]; fNz[i]=t.fNz[i]; fNormQ[i]=t.fNormQ[i]; fNormChi2[i] = t.fNormChi2[i];
102 }
103 for(Int_t i=0; i<12; i++) {fDy[i]=t.fDy[i]; fDz[i]=t.fDz[i];
104 fSigmaY[i]=t.fSigmaY[i]; fSigmaZ[i]=t.fSigmaZ[i];fChi2MIP[i]=t.fChi2MIP[i];}
105 fConstrain = t.fConstrain;
106 //memcpy(fDy,t.fDy,6*sizeof(Float_t));
107 //memcpy(fDz,t.fDz,6*sizeof(Float_t));
108 //memcpy(fSigmaY,t.fSigmaY,6*sizeof(Float_t));
109 //memcpy(fSigmaZ,t.fSigmaZ,6*sizeof(Float_t));
110 //memcpy(fChi2MIP,t.fChi2MIP,12*sizeof(Float_t));
111}
112
113//_____________________________________________________________________________
114Int_t AliITStrackMI::Compare(const TObject *o) const {
115 //-----------------------------------------------------------------
116 // This function compares tracks according to the their curvature
117 //-----------------------------------------------------------------
118 AliITStrackMI *t=(AliITStrackMI*)o;
119 //Double_t co=TMath::Abs(t->Get1Pt());
120 //Double_t c =TMath::Abs(Get1Pt());
121 Double_t co=t->GetSigmaY2()*t->GetSigmaZ2()*(0.5+TMath::Sqrt(0.5*t->fD[0]*t->fD[0]+t->fD[1]*t->fD[1]));
122 Double_t c =GetSigmaY2()*GetSigmaZ2()*(0.5+TMath::Sqrt(0.5*fD[0]*fD[0]+fD[1]*fD[1]));
123 if (c>co) return 1;
124 else if (c<co) return -1;
125 return 0;
126}
127
128
129Double_t AliITStrackMI::GetPredictedChi2MI(Double_t cy, Double_t cz, Double_t cerry, Double_t cerrz) const
130{
131 //-----------------------------------------------------------------
132 // This function calculates a predicted chi2 increment.
133 //-----------------------------------------------------------------
134 Double_t r00=cerry*cerry, r01=0., r11=cerrz*cerrz;
135 r00+=fC00; r01+=fC10; r11+=fC11;
136 //
137 Double_t det=r00*r11 - r01*r01;
138 if (TMath::Abs(det) < 1.e-30) {
139 Int_t n=GetNumberOfClusters();
140 if (n>kWARN)
141 Warning("GetPredictedChi2","Singular matrix (%d) !\n",n);
142 return 1e10;
143 }
144 Double_t tmp=r00; r00=r11; r11=tmp; r01=-r01;
145
146 Double_t dy=cy - fP0, dz=cz - fP1;
147
148 return (dy*r00*dy + 2*r01*dy*dz + dz*r11*dz)/det;
149}
150
151//____________________________________________________________________________
152Int_t AliITStrackMI::CorrectForMaterial(Double_t d, Double_t x0) {
153 //------------------------------------------------------------------
154 //This function corrects the track parameters for crossed material
155 //------------------------------------------------------------------
156 // Double_t p2=(1.+ GetTgl()*GetTgl())/(Get1Pt()*Get1Pt());
157 Double_t p2=(1.+ fP3*fP3)/(Get1Pt()*Get1Pt());
158 Double_t et = p2 + GetMass()*GetMass();
159 Double_t beta2=p2/et;
160 et = sqrt(et);
161 d*=TMath::Sqrt((1.+ fP3*fP3)/(1.- fP2*fP2));
162 //d*=TMath::Sqrt(1.+ fP3*fP3 +fP2*fP2/(1.- fP2*fP2));
163
164 //Multiple scattering******************
165 if (d!=0) {
166 Double_t theta2=14.1*14.1/(beta2*p2*1e6)*TMath::Abs(d);
167 //Double_t theta2=1.0259e-6*14*14/28/(beta2*p2)*TMath::Abs(d)*9.36*2.33;
168 fC22 += theta2*(1.- fP2*fP2)*(1. + fP3*fP3);
169 fC33 += theta2*(1. + fP3*fP3)*(1. + fP3*fP3);
170 fC43 += theta2*fP3*fP4*(1. + fP3*fP3);
171 fC44 += theta2*fP3*fP4*fP3*fP4;
172 }
173
174 //Energy losses************************
175 if (x0!=0.) {
176 d*=x0;
177 // Double_t dE=0.153e-3/beta2*(log(5940*beta2/(1-beta2)) - beta2)*d;
178 //Double_t dE=0;
179 Double_t dE = 0.265*0.153e-3*(39.2-55.6*beta2+28.7*beta2*beta2+27.41/beta2)*d;
180 /*
181 if (beta2/(1-beta2)>3.5*3.5){
182 dE=0.153e-3/beta2*(log(3.5*5940)+0.5*log(beta2/(1-beta2)) - beta2)*d;
183 }
184 else{
185 dE=0.153e-3/beta2*(log(5940*beta2/(1-beta2)) - beta2)*d;
186 dE+=0.06e-3/(beta2*beta2)*d;
187 }
188 */
189 fP4*=(1.- et/p2*dE);
190 Double_t delta44 = (dE*fP4*et/p2);
191 delta44*=delta44;
192 fC44+= delta44/400.;
193 }
194
195 if (!Invariant()) return 0;
196
197 return 1;
198}
199
200//____________________________________________________________________________
201Int_t AliITStrackMI::UpdateMI(Double_t cy, Double_t cz, Double_t cerry, Double_t cerrz, Double_t chi2,UInt_t index) {
202 //------------------------------------------------------------------
203 //This function updates track parameters
204 //------------------------------------------------------------------
205 Double_t p0=fP0,p1=fP1,p2=fP2,p3=fP3,p4=fP4;
206 Double_t c00=fC00;
207 Double_t c10=fC10, c11=fC11;
208 Double_t c20=fC20, c21=fC21, c22=fC22;
209 Double_t c30=fC30, c31=fC31, c32=fC32, c33=fC33;
210 Double_t c40=fC40, c41=fC41, c42=fC42, c43=fC43, c44=fC44;
211
212
213 Double_t r00=cerry*cerry, r01=0., r11=cerrz*cerrz;
214 r00+=fC00; r01+=fC10; r11+=fC11;
215 Double_t det=r00*r11 - r01*r01;
216 Double_t tmp=r00; r00=r11/det; r11=tmp/det; r01=-r01/det;
217
218
219 Double_t k00=fC00*r00+fC10*r01, k01=fC00*r01+fC10*r11;
220 Double_t k10=fC10*r00+fC11*r01, k11=fC10*r01+fC11*r11;
221 Double_t k20=fC20*r00+fC21*r01, k21=fC20*r01+fC21*r11;
222 Double_t k30=fC30*r00+fC31*r01, k31=fC30*r01+fC31*r11;
223 Double_t k40=fC40*r00+fC41*r01, k41=fC40*r01+fC41*r11;
224
225 Double_t dy=cy - fP0, dz=cz - fP1;
226 Int_t layer = (index & 0xf0000000) >> 28;
227 fDy[layer] = dy;
228 fDz[layer] = dz;
229 fSigmaY[layer] = TMath::Sqrt(cerry*cerry+fC00);
230 fSigmaZ[layer] = TMath::Sqrt(cerrz*cerrz+fC11);
231
232 Double_t sf=fP2 + k20*dy + k21*dz;
233
234 fP0 += k00*dy + k01*dz;
235 fP1 += k10*dy + k11*dz;
236 fP2 = sf;
237 fP3 += k30*dy + k31*dz;
238 fP4 += k40*dy + k41*dz;
239
240 Double_t c01=fC10, c02=fC20, c03=fC30, c04=fC40;
241 Double_t c12=fC21, c13=fC31, c14=fC41;
242
243 fC00-=k00*fC00+k01*fC10; fC10-=k00*c01+k01*fC11;
244 fC20-=k00*c02+k01*c12; fC30-=k00*c03+k01*c13;
245 fC40-=k00*c04+k01*c14;
246
247 fC11-=k10*c01+k11*fC11;
248 fC21-=k10*c02+k11*c12; fC31-=k10*c03+k11*c13;
249 fC41-=k10*c04+k11*c14;
250
251 fC22-=k20*c02+k21*c12; fC32-=k20*c03+k21*c13;
252 fC42-=k20*c04+k21*c14;
253
254 fC33-=k30*c03+k31*c13;
255 fC43-=k30*c04+k31*c14;
256
257 fC44-=k40*c04+k41*c14;
258
259 if (!Invariant()) {
260 fP0=p0; fP1=p1; fP2=p2; fP3=p3; fP4=p4;
261 fC00=c00;
262 fC10=c10; fC11=c11;
263 fC20=c20; fC21=c21; fC22=c22;
264 fC30=c30; fC31=c31; fC32=c32; fC33=c33;
265 fC40=c40; fC41=c41; fC42=c42; fC43=c43; fC44=c44;
266 return 0;
267 }
268
269 if (chi2<0) return 1;
270 Int_t n=GetNumberOfClusters();
271 fIndex[n]=index;
272 SetNumberOfClusters(n+1);
273 SetChi2(GetChi2()+chi2);
274
275 return 1;
276}
277
278Int_t AliITStrackMI::GetProlongationFast(Double_t alp, Double_t xk,Double_t &y, Double_t &z)
279{
280 //-----------------------------------------------------------------------------
281 //get fast prolongation
282 //-----------------------------------------------------------------------------
283 Double_t ca=TMath::Cos(alp-fAlpha), sa=TMath::Sin(alp-fAlpha);
284 Double_t cf=TMath::Sqrt(1.- fP2*fP2);
285 // **** rotation **********************
286 y= -fX*sa + fP0*ca;
287 // **** translation ******************
288 Double_t dx = xk- fX*ca - fP0*sa;
289 Double_t f1=fP2*ca - cf*sa, f2=f1 + fP4*dx;
290 if (TMath::Abs(f2) >= 0.9999) {
291 return 0;
292 }
293 Double_t r1=TMath::Sqrt(1.- f1*f1), r2=TMath::Sqrt(1.- f2*f2);
294 y += dx*(f1+f2)/(r1+r2);
295 z = fP1+dx*(f1+f2)/(f1*r2 + f2*r1)*fP3;
296 return 1;
297}
298