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