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