]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITStrackMI.cxx
Making the BF work again
[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
ae00569a 23/* $Id$ */
24
15dd636f 25#include <TMatrixD.h>
26
27#include <TMath.h>
28
29#include "AliCluster.h"
30#include "AliESDtrack.h"
e50912db 31#include "AliITSgeomTGeo.h"
15dd636f 32#include "AliITStrackMI.h"
33
34ClassImp(AliITStrackMI)
35
36const Int_t kWARN=5;
37
38//____________________________________________________________________________
39AliITStrackMI::AliITStrackMI():AliITStrackV2(),
8221b41b 40fNUsed(0),
41fNSkipped(0),
f8720bda 42fNDeadZone(0),
8221b41b 43fReconstructed(kFALSE),
44fExpQ(40),
45fChi22(0),
46fdEdxMismatch(0),
47fConstrain(kFALSE),
48fGoldV0(kFALSE)
15dd636f 49{
8221b41b 50 //constructor
e50912db 51 for(Int_t i=0; i<AliITSgeomTGeo::GetNLayers(); i++) fClIndex[i]=-1;
f8720bda 52 for(Int_t i=0; i<6; i++) { fNy[i]=0; fNz[i]=0; fNormQ[i]=0; fNormChi2[i]=1000; fDeadZoneProbability[i]=0;}
d9ead1a0 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;}
15dd636f 54 fD[0]=0; fD[1]=0;
bc3da11b 55 fDnorm[0]=0; fDnorm[1]=0;
15dd636f 56}
57
58//____________________________________________________________________________
59AliITStrackMI::AliITStrackMI(AliESDtrack& t,Bool_t c) throw (const Char_t *) :
8221b41b 60AliITStrackV2(t,c),
61fNUsed(0),
62fNSkipped(0),
63fNDeadZone(0),
8221b41b 64fReconstructed(kFALSE),
65fExpQ(40),
66fChi22(0),
67fdEdxMismatch(0),
68fConstrain(kFALSE),
69fGoldV0(kFALSE) {
15dd636f 70 //------------------------------------------------------------------
71 // Conversion ESD track -> ITS track.
72 // If c==kTRUE, create the ITS track out of the constrained params.
73 //------------------------------------------------------------------
f8720bda 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;}
d9ead1a0 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;}
15dd636f 76 fD[0]=0; fD[1]=0;
bc3da11b 77 fDnorm[0]=0; fDnorm[1]=0;
15dd636f 78 //if (!Invariant()) throw "AliITStrackV2: conversion failed !\n";
79
80}
81
15dd636f 82//____________________________________________________________________________
8221b41b 83AliITStrackMI::AliITStrackMI(const AliITStrackMI& t) : AliITStrackV2(t),
84fNUsed(t.fNUsed),
85fNSkipped(t.fNSkipped),
86fNDeadZone(t.fNDeadZone),
8221b41b 87fReconstructed(t.fReconstructed),
88fExpQ(t.fExpQ),
89fChi22(t.fChi22),
90fdEdxMismatch(t.fdEdxMismatch),
91fConstrain(t.fConstrain),
92fGoldV0(t.fGoldV0) {
15dd636f 93 //------------------------------------------------------------------
94 //Copy constructor
95 //------------------------------------------------------------------
15dd636f 96 fLab = t.fLab;
97 fFakeRatio = t.fFakeRatio;
15dd636f 98
99 fD[0]=t.fD[0]; fD[1]=t.fD[1];
628e7bb0 100 fDnorm[0] = t.fDnorm[0]; fDnorm[1]=t.fDnorm[1];
15dd636f 101 for(Int_t i=0; i<6; i++) {
f8720bda 102 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];
15dd636f 103 }
104 for(Int_t i=0; i<12; i++) {fDy[i]=t.fDy[i]; fDz[i]=t.fDz[i];
d9ead1a0 105 fSigmaY[i]=t.fSigmaY[i]; fSigmaZ[i]=t.fSigmaZ[i]; fSigmaYZ[i]=t.fSigmaYZ[i]; fChi2MIP[i]=t.fChi2MIP[i];}
15dd636f 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
d9ead1a0 129Double_t AliITStrackMI::GetPredictedChi2MI(Double_t cy, Double_t cz, Double_t cerry, Double_t cerrz, Double_t covyz) const
15dd636f 130{
131 //-----------------------------------------------------------------
132 // This function calculates a predicted chi2 increment.
133 //-----------------------------------------------------------------
6c94f330 134 Double_t p[2]={cy, cz};
d9ead1a0 135 Double_t cov[3]={cerry*cerry, covyz, cerrz*cerrz};
6c94f330 136 return AliExternalTrackParam::GetPredictedChi2(p,cov);
15dd636f 137}
138
15dd636f 139//____________________________________________________________________________
150f264c 140Bool_t AliITStrackMI::UpdateMI(const AliCluster *c, Double_t chi2, Int_t index) {
15dd636f 141 //------------------------------------------------------------------
142 //This function updates track parameters
143 //------------------------------------------------------------------
150f264c 144 Double_t dy=c->GetY() - GetY(), dz=c->GetZ() - GetZ();
15dd636f 145 Int_t layer = (index & 0xf0000000) >> 28;
146 fDy[layer] = dy;
147 fDz[layer] = dz;
150f264c 148 fSigmaY[layer] = TMath::Sqrt(c->GetSigmaY2()+GetSigmaY2());
149 fSigmaZ[layer] = TMath::Sqrt(c->GetSigmaZ2()+GetSigmaZ2());
d9ead1a0 150 fSigmaYZ[layer] = c->GetSigmaYZ()+GetSigmaZY();
151
15dd636f 152
150f264c 153 return Update(c,chi2,index);
15dd636f 154}
155
156Int_t AliITStrackMI::GetProlongationFast(Double_t alp, Double_t xk,Double_t &y, Double_t &z)
157{
158 //-----------------------------------------------------------------------------
159 //get fast prolongation
160 //-----------------------------------------------------------------------------
6c94f330 161 Double_t ca=TMath::Cos(alp-GetAlpha()), sa=TMath::Sin(alp-GetAlpha());
60e55aee 162 Double_t cf=TMath::Sqrt((1.-GetSnp())*(1.+GetSnp()));
15dd636f 163 // **** rotation **********************
6c94f330 164 y= -GetX()*sa + GetY()*ca;
15dd636f 165 // **** translation ******************
6c94f330 166 Double_t dx = xk- GetX()*ca - GetY()*sa;
167 Double_t f1=GetSnp()*ca - cf*sa, f2=f1 + GetC()*dx;
15dd636f 168 if (TMath::Abs(f2) >= 0.9999) {
169 return 0;
170 }
60e55aee 171 Double_t r1=TMath::Sqrt((1.-f1)*(1.+f1)), r2=TMath::Sqrt((1.-f2)*(1.+f2));
15dd636f 172 y += dx*(f1+f2)/(r1+r2);
6c94f330 173 z = GetZ()+dx*(f1+f2)/(f1*r2 + f2*r1)*GetTgl();
15dd636f 174 return 1;
175}
176
628e7bb0 177
178Bool_t AliITStrackMI::IsGoldPrimary()
179{
180 //
181 // Indicates gold pimary track
182 //
183 Bool_t isGold=kTRUE;
184 if (!fConstrain) return kFALSE; //
185 if (fNDeadZone+fNDeadZone<5.5) isGold = kFALSE; // short track
186 //
187 if (fChi2/Float_t(fN)>2.){
188 if (fChi2MIP[0]+fNUsed>3.5) isGold = kFALSE;
189 }
190 if (fChi2MIP[2]>4.5) isGold = kFALSE; //back propagation chi2
191 //
192 if (fDnorm[0]>0&&fDnorm[1]>0){
193 const Float_t distcut2 =2.5*2.5; //normalize distance cut
194 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)
195 if (dist2>distcut2) isGold = kFALSE;
196 }
197 return isGold;
198}