]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITStrackMI.cxx
1) removed global variables from AliITSRecoParam.h
[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"
e50912db 29#include "AliITSgeomTGeo.h"
15dd636f 30#include "AliITStrackMI.h"
31
32ClassImp(AliITStrackMI)
33
34const Int_t kWARN=5;
35
36//____________________________________________________________________________
37AliITStrackMI::AliITStrackMI():AliITStrackV2(),
8221b41b 38fNUsed(0),
39fNSkipped(0),
40fNDeadZone(0),
41fDeadZoneProbability(0),
42fReconstructed(kFALSE),
43fExpQ(40),
44fChi22(0),
45fdEdxMismatch(0),
46fConstrain(kFALSE),
47fGoldV0(kFALSE)
15dd636f 48{
8221b41b 49 //constructor
e50912db 50 for(Int_t i=0; i<AliITSgeomTGeo::GetNLayers(); i++) fClIndex[i]=-1;
15dd636f 51 for(Int_t i=0; i<6; i++) { fNy[i]=0; fNz[i]=0; fNormQ[i]=0; fNormChi2[i]=1000;}
52 for(Int_t i=0; i<12; i++) {fDy[i]=0; fDz[i]=0; fSigmaY[i]=0; fSigmaZ[i]=0; fChi2MIP[i]=0;}
53 fD[0]=0; fD[1]=0;
15dd636f 54}
55
56//____________________________________________________________________________
57AliITStrackMI::AliITStrackMI(AliESDtrack& t,Bool_t c) throw (const Char_t *) :
8221b41b 58AliITStrackV2(t,c),
59fNUsed(0),
60fNSkipped(0),
61fNDeadZone(0),
62fDeadZoneProbability(0),
63fReconstructed(kFALSE),
64fExpQ(40),
65fChi22(0),
66fdEdxMismatch(0),
67fConstrain(kFALSE),
68fGoldV0(kFALSE) {
15dd636f 69 //------------------------------------------------------------------
70 // Conversion ESD track -> ITS track.
71 // If c==kTRUE, create the ITS track out of the constrained params.
72 //------------------------------------------------------------------
15dd636f 73 for(Int_t i=0; i<6; i++) {fClIndex[i]=-1; fNy[i]=0; fNz[i]=0; fNormQ[i]=0; fNormChi2[i]=1000;}
74 for(Int_t i=0; i<12; i++) {fDy[i]=0; fDz[i]=0; fSigmaY[i]=0; fSigmaZ[i]=0;fChi2MIP[i]=0;}
75 fD[0]=0; fD[1]=0;
15dd636f 76 //if (!Invariant()) throw "AliITStrackV2: conversion failed !\n";
77
78}
79
80void AliITStrackMI::UpdateESDtrack(ULong_t flags) {
81 fESDtrack->UpdateTrackParams(this,flags);
15e85efa 82 //if (flags == AliESDtrack::kITSin) fESDtrack->SetITSChi2MIP(fChi2MIP);
15dd636f 83}
84
85//____________________________________________________________________________
8221b41b 86AliITStrackMI::AliITStrackMI(const AliITStrackMI& t) : AliITStrackV2(t),
87fNUsed(t.fNUsed),
88fNSkipped(t.fNSkipped),
89fNDeadZone(t.fNDeadZone),
90fDeadZoneProbability(t.fDeadZoneProbability),
91fReconstructed(t.fReconstructed),
92fExpQ(t.fExpQ),
93fChi22(t.fChi22),
94fdEdxMismatch(t.fdEdxMismatch),
95fConstrain(t.fConstrain),
96fGoldV0(t.fGoldV0) {
15dd636f 97 //------------------------------------------------------------------
98 //Copy constructor
99 //------------------------------------------------------------------
15dd636f 100 fLab = t.fLab;
101 fFakeRatio = t.fFakeRatio;
15dd636f 102
103 fD[0]=t.fD[0]; fD[1]=t.fD[1];
628e7bb0 104 fDnorm[0] = t.fDnorm[0]; fDnorm[1]=t.fDnorm[1];
15dd636f 105 for(Int_t i=0; i<6; i++) {
106 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];
107 }
108 for(Int_t i=0; i<12; i++) {fDy[i]=t.fDy[i]; fDz[i]=t.fDz[i];
109 fSigmaY[i]=t.fSigmaY[i]; fSigmaZ[i]=t.fSigmaZ[i];fChi2MIP[i]=t.fChi2MIP[i];}
15dd636f 110 //memcpy(fDy,t.fDy,6*sizeof(Float_t));
111 //memcpy(fDz,t.fDz,6*sizeof(Float_t));
112 //memcpy(fSigmaY,t.fSigmaY,6*sizeof(Float_t));
113 //memcpy(fSigmaZ,t.fSigmaZ,6*sizeof(Float_t));
114 //memcpy(fChi2MIP,t.fChi2MIP,12*sizeof(Float_t));
115}
116
117//_____________________________________________________________________________
118Int_t AliITStrackMI::Compare(const TObject *o) const {
119 //-----------------------------------------------------------------
120 // This function compares tracks according to the their curvature
121 //-----------------------------------------------------------------
122 AliITStrackMI *t=(AliITStrackMI*)o;
123 //Double_t co=TMath::Abs(t->Get1Pt());
124 //Double_t c =TMath::Abs(Get1Pt());
125 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]));
126 Double_t c =GetSigmaY2()*GetSigmaZ2()*(0.5+TMath::Sqrt(0.5*fD[0]*fD[0]+fD[1]*fD[1]));
127 if (c>co) return 1;
128 else if (c<co) return -1;
129 return 0;
130}
131
132
133Double_t AliITStrackMI::GetPredictedChi2MI(Double_t cy, Double_t cz, Double_t cerry, Double_t cerrz) const
134{
135 //-----------------------------------------------------------------
136 // This function calculates a predicted chi2 increment.
137 //-----------------------------------------------------------------
6c94f330 138 Double_t p[2]={cy, cz};
139 Double_t cov[3]={cerry*cerry, 0., cerrz*cerrz};
140 return AliExternalTrackParam::GetPredictedChi2(p,cov);
15dd636f 141}
142
143//____________________________________________________________________________
144Int_t AliITStrackMI::CorrectForMaterial(Double_t d, Double_t x0) {
145 //------------------------------------------------------------------
146 //This function corrects the track parameters for crossed material
147 //------------------------------------------------------------------
6c94f330 148 //d=x0=0.;
149
6c23ffed 150 Double_t p2=(1.+ GetTgl()*GetTgl())/(GetSigned1Pt()*GetSigned1Pt());
15dd636f 151 Double_t et = p2 + GetMass()*GetMass();
152 Double_t beta2=p2/et;
153 et = sqrt(et);
6c94f330 154 d*=TMath::Sqrt((1.+ GetTgl()*GetTgl())/(1.- GetSnp()*GetSnp()));
15dd636f 155
156 //Multiple scattering******************
157 if (d!=0) {
158 Double_t theta2=14.1*14.1/(beta2*p2*1e6)*TMath::Abs(d);
159 //Double_t theta2=1.0259e-6*14*14/28/(beta2*p2)*TMath::Abs(d)*9.36*2.33;
6c94f330 160 Cov(5) += theta2*(1.- GetSnp()*GetSnp())*(1. + GetTgl()*GetTgl());
161 Cov(9) += theta2*(1. + GetTgl()*GetTgl())*(1. + GetTgl()*GetTgl());
6c23ffed 162 Cov(13)+= theta2*GetTgl()*GetSigned1Pt()*(1. + GetTgl()*GetTgl());
163 Cov(14)+= theta2*GetTgl()*GetSigned1Pt()*GetTgl()*GetSigned1Pt();
15dd636f 164 }
165
166 //Energy losses************************
167 if (x0!=0.) {
168 d*=x0;
169 // Double_t dE=0.153e-3/beta2*(log(5940*beta2/(1-beta2)) - beta2)*d;
170 //Double_t dE=0;
171 Double_t dE = 0.265*0.153e-3*(39.2-55.6*beta2+28.7*beta2*beta2+27.41/beta2)*d;
6c94f330 172 //if (beta2/(1-beta2)>3.5*3.5){
173 // dE=0.153e-3/beta2*(log(3.5*5940)+0.5*log(beta2/(1-beta2)) - beta2)*d;
174 //}
175 //else{
176 // dE=0.153e-3/beta2*(log(5940*beta2/(1-beta2)) - beta2)*d;
177 // dE+=0.06e-3/(beta2*beta2)*d;
178 //}
179
180 Par(4)*=(1.- et/p2*dE);
6c23ffed 181 Double_t delta44 = (dE*GetSigned1Pt()*et/p2);
15dd636f 182 delta44*=delta44;
6c94f330 183 Cov(14)+= delta44/400.;
15dd636f 184 }
185
186 if (!Invariant()) return 0;
187
188 return 1;
189}
190
191//____________________________________________________________________________
6c94f330 192Bool_t AliITStrackMI::UpdateMI(Double_t cy, Double_t cz, Double_t cerry, Double_t cerrz, Double_t chi2, Int_t index) {
15dd636f 193 //------------------------------------------------------------------
194 //This function updates track parameters
195 //------------------------------------------------------------------
6c94f330 196 Double_t dy=cy - GetY(), dz=cz - GetZ();
15dd636f 197 Int_t layer = (index & 0xf0000000) >> 28;
198 fDy[layer] = dy;
199 fDz[layer] = dz;
6c94f330 200 fSigmaY[layer] = TMath::Sqrt(cerry*cerry+GetSigmaY2());
201 fSigmaZ[layer] = TMath::Sqrt(cerrz*cerrz+GetSigmaZ2());
15dd636f 202
6c94f330 203 Double_t p[2]={cy, cz};
204 Double_t cov[3]={cerry*cerry, 0., cerrz*cerrz};
205 if (!AliExternalTrackParam::Update(p,cov)) return kFALSE;
15dd636f 206
207 if (!Invariant()) {
6c94f330 208 AliWarning("Wrong invariant !");
209 return kFALSE;
15dd636f 210 }
211
212 if (chi2<0) return 1;
213 Int_t n=GetNumberOfClusters();
214 fIndex[n]=index;
215 SetNumberOfClusters(n+1);
216 SetChi2(GetChi2()+chi2);
217
6c94f330 218 return kTRUE;
15dd636f 219}
220
221Int_t AliITStrackMI::GetProlongationFast(Double_t alp, Double_t xk,Double_t &y, Double_t &z)
222{
223 //-----------------------------------------------------------------------------
224 //get fast prolongation
225 //-----------------------------------------------------------------------------
6c94f330 226 Double_t ca=TMath::Cos(alp-GetAlpha()), sa=TMath::Sin(alp-GetAlpha());
227 Double_t cf=TMath::Sqrt(1.- GetSnp()*GetSnp());
15dd636f 228 // **** rotation **********************
6c94f330 229 y= -GetX()*sa + GetY()*ca;
15dd636f 230 // **** translation ******************
6c94f330 231 Double_t dx = xk- GetX()*ca - GetY()*sa;
232 Double_t f1=GetSnp()*ca - cf*sa, f2=f1 + GetC()*dx;
15dd636f 233 if (TMath::Abs(f2) >= 0.9999) {
234 return 0;
235 }
236 Double_t r1=TMath::Sqrt(1.- f1*f1), r2=TMath::Sqrt(1.- f2*f2);
237 y += dx*(f1+f2)/(r1+r2);
6c94f330 238 z = GetZ()+dx*(f1+f2)/(f1*r2 + f2*r1)*GetTgl();
15dd636f 239 return 1;
240}
241
628e7bb0 242
243Bool_t AliITStrackMI::IsGoldPrimary()
244{
245 //
246 // Indicates gold pimary track
247 //
248 Bool_t isGold=kTRUE;
249 if (!fConstrain) return kFALSE; //
250 if (fNDeadZone+fNDeadZone<5.5) isGold = kFALSE; // short track
251 //
252 if (fChi2/Float_t(fN)>2.){
253 if (fChi2MIP[0]+fNUsed>3.5) isGold = kFALSE;
254 }
255 if (fChi2MIP[2]>4.5) isGold = kFALSE; //back propagation chi2
256 //
257 if (fDnorm[0]>0&&fDnorm[1]>0){
258 const Float_t distcut2 =2.5*2.5; //normalize distance cut
259 Float_t dist2 = fD[0]*fD[0]/(fDnorm[0]*fDnorm[0])+fD[1]*fD[1]/(fDnorm[1]*fDnorm[1]); //normalize distance to the vertex (pools)
260 if (dist2>distcut2) isGold = kFALSE;
261 }
262 return isGold;
263}