]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITStrackMI.cxx
added QA for cuts
[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 /* $Id$ */
24
25 #include <TMatrixD.h>
26
27 #include <TMath.h>
28
29 #include "AliCluster.h"
30 #include "AliESDtrack.h"
31 #include "AliITSgeomTGeo.h"
32 #include "AliITStrackMI.h"
33
34 ClassImp(AliITStrackMI)
35
36 const Int_t kWARN=5;
37
38 //____________________________________________________________________________
39 AliITStrackMI::AliITStrackMI():AliITStrackV2(),
40 fNUsed(0),
41 fNSkipped(0),
42 fNDeadZone(0),                         
43 fReconstructed(kFALSE),
44 fExpQ(40),
45 fChi22(0),
46 fdEdxMismatch(0),
47 fConstrain(kFALSE),
48 fGoldV0(kFALSE)
49 {
50   //constructor
51     for(Int_t i=0; i<AliITSgeomTGeo::GetNLayers(); i++) fClIndex[i]=-1;
52     for(Int_t i=0; i<6; i++) { fNy[i]=0; fNz[i]=0; fNormQ[i]=0; fNormChi2[i]=1000; fDeadZoneProbability[i]=0;}
53     for(Int_t i=0; i<12; i++) {fDy[i]=0; fDz[i]=0; fSigmaY[i]=0; fSigmaZ[i]=0; fSigmaYZ[i]=0; fChi2MIP[i]=0;}
54     fD[0]=0; fD[1]=0;
55     fDnorm[0]=0; fDnorm[1]=0;
56 }
57
58 //____________________________________________________________________________
59 AliITStrackMI::AliITStrackMI(AliESDtrack& t,Bool_t c):
60 AliITStrackV2(t,c),
61 fNUsed(0),
62 fNSkipped(0),
63 fNDeadZone(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; fDeadZoneProbability[i]=0;}
75   for(Int_t i=0; i<12; i++) {fDy[i]=0; fDz[i]=0; fSigmaY[i]=0; fSigmaZ[i]=0; fSigmaYZ[i]=0; fChi2MIP[i]=0;}
76   fD[0]=0; fD[1]=0;
77   fDnorm[0]=0; fDnorm[1]=0;
78
79 }
80
81 //____________________________________________________________________________
82 AliITStrackMI::AliITStrackMI(const AliITStrackMI& t) : AliITStrackV2(t),
83 fNUsed(t.fNUsed),
84 fNSkipped(t.fNSkipped),
85 fNDeadZone(t.fNDeadZone),
86 fReconstructed(t.fReconstructed),
87 fExpQ(t.fExpQ),
88 fChi22(t.fChi22),
89 fdEdxMismatch(t.fdEdxMismatch),
90 fConstrain(t.fConstrain),
91 fGoldV0(t.fGoldV0) {
92   //------------------------------------------------------------------
93   //Copy constructor
94   //------------------------------------------------------------------
95   fLab = t.fLab;
96   fFakeRatio = t.fFakeRatio;
97
98   fD[0]=t.fD[0]; fD[1]=t.fD[1];
99   fDnorm[0] = t.fDnorm[0]; fDnorm[1]=t.fDnorm[1];
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];  fDeadZoneProbability[i]=t.fDeadZoneProbability[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]; fSigmaYZ[i]=t.fSigmaYZ[i]; fChi2MIP[i]=t.fChi2MIP[i];}
105   //memcpy(fDy,t.fDy,6*sizeof(Float_t));
106   //memcpy(fDz,t.fDz,6*sizeof(Float_t));
107   //memcpy(fSigmaY,t.fSigmaY,6*sizeof(Float_t));
108   //memcpy(fSigmaZ,t.fSigmaZ,6*sizeof(Float_t));
109   //memcpy(fChi2MIP,t.fChi2MIP,12*sizeof(Float_t));  
110 }
111
112 //_____________________________________________________________________________
113 Int_t AliITStrackMI::Compare(const TObject *o) const {
114   //-----------------------------------------------------------------
115   // This function compares tracks according to the their curvature
116   //-----------------------------------------------------------------
117   AliITStrackMI *t=(AliITStrackMI*)o;
118   //Double_t co=TMath::Abs(t->Get1Pt());
119   //Double_t c =TMath::Abs(Get1Pt());
120   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]));
121   Double_t c =GetSigmaY2()*GetSigmaZ2()*(0.5+TMath::Sqrt(0.5*fD[0]*fD[0]+fD[1]*fD[1]));
122   if (c>co) return 1;
123   else if (c<co) return -1;
124   return 0;
125 }
126
127
128 Double_t AliITStrackMI::GetPredictedChi2MI(Double_t cy, Double_t cz, Double_t cerry, Double_t cerrz, Double_t covyz) const
129 {
130   //-----------------------------------------------------------------
131   // This function calculates a predicted chi2 increment.
132   //-----------------------------------------------------------------
133   Double_t p[2]={cy, cz};
134   Double_t cov[3]={cerry*cerry, covyz, cerrz*cerrz};
135   return AliExternalTrackParam::GetPredictedChi2(p,cov);
136 }
137
138 //____________________________________________________________________________
139 Bool_t AliITStrackMI::UpdateMI(const AliCluster *c, Double_t chi2, Int_t index) {
140   //------------------------------------------------------------------
141   //This function updates track parameters
142   //------------------------------------------------------------------
143   Double_t dy=c->GetY() - GetY(), dz=c->GetZ() - GetZ();
144   Int_t layer = (index & 0xf0000000) >> 28;
145   fDy[layer] = dy;
146   fDz[layer] = dz;
147   fSigmaY[layer] = TMath::Sqrt(c->GetSigmaY2()+GetSigmaY2());
148   fSigmaZ[layer] = TMath::Sqrt(c->GetSigmaZ2()+GetSigmaZ2());
149   fSigmaYZ[layer] = c->GetSigmaYZ()+GetSigmaZY();
150
151
152   return Update(c,chi2,index);
153 }
154
155 Int_t AliITStrackMI::GetProlongationFast(Double_t alp, Double_t xk,Double_t &y, Double_t &z)
156 {
157   //-----------------------------------------------------------------------------
158   //get fast prolongation 
159   //-----------------------------------------------------------------------------
160   Double_t ca=TMath::Cos(alp-GetAlpha()), sa=TMath::Sin(alp-GetAlpha());
161   Double_t cf=TMath::Sqrt((1.-GetSnp())*(1.+GetSnp()));  
162   // **** rotation **********************  
163   y= -GetX()*sa + GetY()*ca;
164   // **** translation ******************  
165   Double_t dx = xk- GetX()*ca - GetY()*sa;
166   Double_t f1=GetSnp()*ca - cf*sa, f2=f1 + GetC()*dx;
167   if (TMath::Abs(f2) >= 0.9999) {
168     return 0;
169   }
170   Double_t r1=TMath::Sqrt((1.-f1)*(1.+f1)), r2=TMath::Sqrt((1.-f2)*(1.+f2));  
171   y += dx*(f1+f2)/(r1+r2);
172   z  = GetZ()+dx*(f1+f2)/(f1*r2 + f2*r1)*GetTgl();  
173   return 1;
174 }
175
176
177 Bool_t AliITStrackMI::IsGoldPrimary()
178 {
179   //
180   // Indicates gold pimary track
181   //
182   Bool_t isGold=kTRUE;
183   if (!fConstrain) return kFALSE;                // 
184   if (fNDeadZone+fNDeadZone<5.5) isGold =  kFALSE; // short track
185   //
186   if (fChi2/Float_t(fN)>2.){
187     if (fChi2MIP[0]+fNUsed>3.5) isGold = kFALSE;    
188   }
189   if (fChi2MIP[2]>4.5) isGold = kFALSE;         //back propagation chi2
190   //
191   if (fDnorm[0]>0&&fDnorm[1]>0){
192     const Float_t distcut2 =2.5*2.5;  //normalize distance  cut 
193     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)
194     if (dist2>distcut2) isGold = kFALSE;
195   }
196   return isGold;
197 }