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