Modifications needed to use PID framework based mass during tracking and
[u/mrichter/AliRoot.git] / STEER / ESD / AliKalmanTrack.cxx
CommitLineData
87594435 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
acd84897 16/* $Id$ */
fb17acd4 17
87594435 18//-------------------------------------------------------------------------
19// Implementation of the AliKalmanTrack class
066782e8 20// that is the base for AliTPCtrack, AliITStrackV2 and AliTRDtrack
87594435 21// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
22//-------------------------------------------------------------------------
6c94f330 23#include <TGeoManager.h>
39d4ae58 24
87594435 25#include "AliKalmanTrack.h"
87594435 26
27ClassImp(AliKalmanTrack)
28
e2afb3b6 29//_______________________________________________________________________
6c94f330 30 AliKalmanTrack::AliKalmanTrack():AliExternalTrackParam(),
68b8060b 31 fFakeRatio(0),
e2afb3b6 32 fChi2(0),
304864ab 33 fMass(AliPID::ParticleMass(AliPID::kPion)),
562dd0b4 34 fLab(-3141593),
c6e740ea 35 fN(0),
90e48c0c 36 fStartTimeIntegral(kFALSE),
37 fIntegratedLength(0)
e2afb3b6 38{
116cbefd 39 //
40 // Default constructor
41 //
c84a5e9e 42
115179c6 43 for(Int_t i=0; i<AliPID::kSPECIESC; i++) fIntegratedTime[i] = 0;
e2afb3b6 44}
45
e2afb3b6 46AliKalmanTrack::AliKalmanTrack(const AliKalmanTrack &t):
6c94f330 47 AliExternalTrackParam(t),
babd135a 48 fFakeRatio(t.fFakeRatio),
e2afb3b6 49 fChi2(t.fChi2),
50 fMass(t.fMass),
562dd0b4 51 fLab(t.fLab),
c6e740ea 52 fN(t.fN),
90e48c0c 53 fStartTimeIntegral(t.fStartTimeIntegral),
54 fIntegratedLength(t.fIntegratedLength)
e2afb3b6 55{
116cbefd 56 //
57 // Copy constructor
58 //
74f9526e 59
115179c6 60 for (Int_t i=0; i<AliPID::kSPECIESC; i++)
c84a5e9e 61 fIntegratedTime[i] = t.fIntegratedTime[i];
74f9526e 62}
c5507f6d 63
316c6cd9 64AliKalmanTrack& AliKalmanTrack::operator=(const AliKalmanTrack&o){
65 if(this!=&o){
66 AliExternalTrackParam::operator=(o);
67 fLab = o.fLab;
68 fFakeRatio = o.fFakeRatio;
69 fChi2 = o.fChi2;
70 fMass = o.fMass;
71 fN = o.fN;
72 fStartTimeIntegral = o.fStartTimeIntegral;
115179c6 73 for(Int_t i = 0;i<AliPID::kSPECIESC;++i)fIntegratedTime[i] = o.fIntegratedTime[i];
316c6cd9 74 fIntegratedLength = o.fIntegratedLength;
75 }
76 return *this;
77}
78
74f9526e 79//_______________________________________________________________________
80void AliKalmanTrack::StartTimeIntegral()
81{
49a7a79a 82 // Sylwester Radomski, GSI
83 // S.Radomski@gsi.de
74f9526e 84 //
85 // Start time integration
86 // To be called at Vertex by ITS tracker
87 //
88
89 //if (fStartTimeIntegral)
f37d970d 90 // AliWarning("Reseting Recorded Time.");
74f9526e 91
92 fStartTimeIntegral = kTRUE;
115179c6 93 for(Int_t i=0; i<AliPID::kSPECIESC; i++) fIntegratedTime[i] = 0;
74f9526e 94 fIntegratedLength = 0;
95}
7d0f8548 96
74f9526e 97//_______________________________________________________________________
98void AliKalmanTrack:: AddTimeStep(Double_t length)
99{
100 //
101 // Add step to integrated time
102 // this method should be called by a sublasses at the end
103 // of the PropagateTo function or by a tracker
104 // each time step is made.
105 //
106 // If integration not started function does nothing
107 //
108 // Formula
109 // dt = dl * sqrt(p^2 + m^2) / p
110 // p = pT * (1 + tg^2 (lambda) )
111 //
112 // pt = 1/external parameter [4]
113 // tg lambda = external parameter [3]
114 //
115 //
116 // Sylwester Radomski, GSI
117 // S.Radomski@gsi.de
118 //
119
5d8718b8 120 static const Double_t kcc = 2.99792458e-2;
74f9526e 121
122 if (!fStartTimeIntegral) return;
123
124 fIntegratedLength += length;
125
74f9526e 126 Double_t xr, param[5];
74f9526e 127
128 GetExternalParameters(xr, param);
1d26da6d 129 double tgl = param[3];
74f9526e 130
1d26da6d 131 Double_t p2inv = param[4]*param[4]/(1+tgl*tgl);
74f9526e 132
2bf46337 133 // if (length > 100) return;
74f9526e 134
115179c6 135 for (Int_t i=0; i<AliPID::kSPECIESC; i++) {
74f9526e 136
1d26da6d 137 Double_t massz = AliPID::ParticleMassZ(i);
138 Double_t correction = TMath::Sqrt( 1. + massz*massz*p2inv ); // 1/beta
5d8718b8 139 Double_t time = length * correction / kcc;
74f9526e 140
74f9526e 141 fIntegratedTime[i] += time;
142 }
e2afb3b6 143}
144
74f9526e 145//_______________________________________________________________________
74f9526e 146Double_t AliKalmanTrack::GetIntegratedTime(Int_t pdg) const
147{
49a7a79a 148 // Sylwester Radomski, GSI
149 // S.Radomski@gsi.de
74f9526e 150 //
151 // Return integrated time hypothesis for a given particle
152 // type assumption.
153 //
154 // Input parameter:
155 // pdg - Pdg code of a particle type
156 //
157
158
159 if (!fStartTimeIntegral) {
f37d970d 160 AliWarning("Time integration not started");
74f9526e 161 return 0.;
162 }
163
115179c6 164 for (Int_t i=0; i<AliPID::kSPECIESC; i++)
304864ab 165 if (AliPID::ParticleCode(i) == TMath::Abs(pdg)) return fIntegratedTime[i];
74f9526e 166
f37d970d 167 AliWarning(Form("Particle type [%d] not found", pdg));
74f9526e 168 return 0;
169}
ae982df3 170
171void AliKalmanTrack::GetIntegratedTimes(Double_t *times) const {
115179c6 172 for (Int_t i=0; i<AliPID::kSPECIESC; i++) times[i]=fIntegratedTime[i];
ae982df3 173}
174
175void AliKalmanTrack::SetIntegratedTimes(const Double_t *times) {
115179c6 176 for (Int_t i=0; i<AliPID::kSPECIESC; i++) fIntegratedTime[i]=times[i];
ae982df3 177}
178