* provided "as is" without express or implied warranty. *
**************************************************************************/
+/* $Id$ */
+
//-------------------------------------------------------------------------
// Implementation of the AliKalmanTrack class
-//
+// that is the base for AliTPCtrack, AliITStrackV2 and AliTRDtrack
// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
//-------------------------------------------------------------------------
+#include <TGeoManager.h>
#include "AliKalmanTrack.h"
-#include "AliCluster.h"
-#include <TMath.h>
-#include <iostream.h>
ClassImp(AliKalmanTrack)
-//_____________________________________________________________________________
-AliKalmanTrack::AliKalmanTrack(const AliKalmanTrack& t) {
- //-----------------------------------------------------------------
- // This is a copy constructor.
- //-----------------------------------------------------------------
- fLab=t.fLab;
+//_______________________________________________________________________
+ AliKalmanTrack::AliKalmanTrack():AliExternalTrackParam(),
+ fFakeRatio(0),
+ fChi2(0),
+ fMass(AliPID::ParticleMass(AliPID::kPion)),
+ fLab(-3141593),
+ fN(0),
+ fStartTimeIntegral(kFALSE),
+ fIntegratedLength(0)
+{
+ //
+ // Default constructor
+ //
- fP0=t.fP0; fP1=t.fP1; fP2=t.fP2; fP3=t.fP3; fP4=t.fP4;
+ for(Int_t i=0; i<AliPID::kSPECIES; i++) fIntegratedTime[i] = 0;
+}
- fC00=t.fC00;
- fC10=t.fC10; fC11=t.fC11;
- fC20=t.fC20; fC21=t.fC21; fC22=t.fC22;
- fC30=t.fC30; fC31=t.fC31; fC32=t.fC32; fC33=t.fC33;
- fC40=t.fC40; fC41=t.fC41; fC42=t.fC42; fC43=t.fC43; fC44=t.fC44;
+AliKalmanTrack::AliKalmanTrack(const AliKalmanTrack &t):
+ AliExternalTrackParam(t),
+ fFakeRatio(t.fFakeRatio),
+ fChi2(t.fChi2),
+ fMass(t.fMass),
+ fLab(t.fLab),
+ fN(t.fN),
+ fStartTimeIntegral(t.fStartTimeIntegral),
+ fIntegratedLength(t.fIntegratedLength)
+{
+ //
+ // Copy constructor
+ //
+
+ for (Int_t i=0; i<AliPID::kSPECIES; i++)
+ fIntegratedTime[i] = t.fIntegratedTime[i];
+}
- fChi2=t.fChi2;
- fN=t.fN;
+AliKalmanTrack& AliKalmanTrack::operator=(const AliKalmanTrack&o){
+ if(this!=&o){
+ AliExternalTrackParam::operator=(o);
+ fLab = o.fLab;
+ fFakeRatio = o.fFakeRatio;
+ fChi2 = o.fChi2;
+ fMass = o.fMass;
+ fN = o.fN;
+ fStartTimeIntegral = o.fStartTimeIntegral;
+ for(Int_t i = 0;i<AliPID::kSPECIES;++i)fIntegratedTime[i] = o.fIntegratedTime[i];
+ fIntegratedLength = o.fIntegratedLength;
+ }
+ return *this;
}
-//_____________________________________________________________________________
-Int_t AliKalmanTrack::Compare(TObject *o) {
- //-----------------------------------------------------------------
- // This function compares tracks according to the their curvature
- //-----------------------------------------------------------------
- AliKalmanTrack *t=(AliKalmanTrack*)o;
- Double_t co=TMath::Abs(t->GetPt());
- Double_t c =TMath::Abs(GetPt());
- if (c<co) return 1;
- else if (c>co) return -1;
- return 0;
+//_______________________________________________________________________
+void AliKalmanTrack::StartTimeIntegral()
+{
+ // Sylwester Radomski, GSI
+ // S.Radomski@gsi.de
+ //
+ // Start time integration
+ // To be called at Vertex by ITS tracker
+ //
+
+ //if (fStartTimeIntegral)
+ // AliWarning("Reseting Recorded Time.");
+
+ fStartTimeIntegral = kTRUE;
+ for(Int_t i=0; i<AliPID::kSPECIES; i++) fIntegratedTime[i] = 0;
+ fIntegratedLength = 0;
}
-//_____________________________________________________________________________
-Double_t AliKalmanTrack::GetPredictedChi2(const AliCluster *c) const
+//_______________________________________________________________________
+void AliKalmanTrack:: AddTimeStep(Double_t length)
{
- //-----------------------------------------------------------------
- // This function calculates a predicted chi2 increment.
- //-----------------------------------------------------------------
- Double_t r00=c->GetSigmaY2(), r01=0., r11=c->GetSigmaZ2();
- r00+=fC00; r01+=fC10; r11+=fC11;
-
- Double_t det=r00*r11 - r01*r01;
- if (TMath::Abs(det) < 1.e-10) {
- if (fN>4) cerr<<fN<<" AliKalmanTrack warning: Singular matrix !\n";
- return 1e10;
- }
- Double_t tmp=r00; r00=r11; r11=tmp; r01=-r01;
+ //
+ // Add step to integrated time
+ // this method should be called by a sublasses at the end
+ // of the PropagateTo function or by a tracker
+ // each time step is made.
+ //
+ // If integration not started function does nothing
+ //
+ // Formula
+ // dt = dl * sqrt(p^2 + m^2) / p
+ // p = pT * (1 + tg^2 (lambda) )
+ //
+ // pt = 1/external parameter [4]
+ // tg lambda = external parameter [3]
+ //
+ //
+ // Sylwester Radomski, GSI
+ // S.Radomski@gsi.de
+ //
- Double_t dy=c->GetY() - fP0, dz=c->GetZ() - fP1;
+ static const Double_t kcc = 2.99792458e-2;
+
+ if (!fStartTimeIntegral) return;
- return (dy*r00*dy + 2*r01*dy*dz + dz*r11*dz)/det;
-}
+ fIntegratedLength += length;
-//_____________________________________________________________________________
-void AliKalmanTrack::GetCovariance(Double_t cc[15]) const {
- // return covariance maxtrix
- cc[0 ]=fC00;
- cc[1 ]=fC10; cc[2 ]=fC11;
- cc[3 ]=fC20; cc[4 ]=fC21; cc[5 ]=fC22;
- cc[6 ]=fC30; cc[7 ]=fC31; cc[8 ]=fC32; cc[9 ]=fC33;
- cc[10]=fC40; cc[11]=fC41; cc[12]=fC42; cc[13]=fC43; cc[14]=fC44;
+ Double_t xr, param[5];
+ Double_t pt, tgl;
+
+ GetExternalParameters(xr, param);
+ pt = 1/param[4] ;
+ tgl = param[3];
+
+ Double_t p = TMath::Abs(pt * TMath::Sqrt(1+tgl*tgl));
+
+ if (length > 100) return;
+
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) {
+
+ Double_t mass = AliPID::ParticleMass(i);
+ Double_t correction = TMath::Sqrt( pt*pt * (1 + tgl*tgl) + mass * mass ) / p;
+ Double_t time = length * correction / kcc;
+
+ fIntegratedTime[i] += time;
+ }
}
-//____________________________________________________________________________
-void AliKalmanTrack::Streamer(TBuffer &R__b)
+//_______________________________________________________________________
+Double_t AliKalmanTrack::GetIntegratedTime(Int_t pdg) const
{
- //-----------------------------------------------------
- // This is AliKalmanTrack streamer.
- //-----------------------------------------------------
- if (R__b.IsReading()) {
- Version_t R__v = R__b.ReadVersion(); if (R__v) { }
- TObject::Streamer(R__b);
- R__b >> fLab;
- R__b >> fP0;
- R__b >> fP1;
- R__b >> fP2;
- R__b >> fP3;
- R__b >> fP4;
- R__b >> fC00;
- R__b >> fC10;
- R__b >> fC11;
- R__b >> fC20;
- R__b >> fC21;
- R__b >> fC22;
- R__b >> fC30;
- R__b >> fC31;
- R__b >> fC32;
- R__b >> fC33;
- R__b >> fC40;
- R__b >> fC41;
- R__b >> fC42;
- R__b >> fC43;
- R__b >> fC44;
- R__b >> fChi2;
- R__b >> fN;
- } else {
- R__b.WriteVersion(AliKalmanTrack::IsA());
- TObject::Streamer(R__b);
- R__b << fLab;
- R__b << fP0;
- R__b << fP1;
- R__b << fP2;
- R__b << fP3;
- R__b << fP4;
- R__b << fC00;
- R__b << fC10;
- R__b << fC11;
- R__b << fC20;
- R__b << fC21;
- R__b << fC22;
- R__b << fC30;
- R__b << fC31;
- R__b << fC32;
- R__b << fC33;
- R__b << fC40;
- R__b << fC41;
- R__b << fC42;
- R__b << fC43;
- R__b << fC44;
- R__b << fChi2;
- R__b << fN;
- }
+ // Sylwester Radomski, GSI
+ // S.Radomski@gsi.de
+ //
+ // Return integrated time hypothesis for a given particle
+ // type assumption.
+ //
+ // Input parameter:
+ // pdg - Pdg code of a particle type
+ //
+
+
+ if (!fStartTimeIntegral) {
+ AliWarning("Time integration not started");
+ return 0.;
+ }
+
+ for (Int_t i=0; i<AliPID::kSPECIES; i++)
+ if (AliPID::ParticleCode(i) == TMath::Abs(pdg)) return fIntegratedTime[i];
+
+ AliWarning(Form("Particle type [%d] not found", pdg));
+ return 0;
}
+void AliKalmanTrack::GetIntegratedTimes(Double_t *times) const {
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fIntegratedTime[i];
+}
+
+void AliKalmanTrack::SetIntegratedTimes(const Double_t *times) {
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) fIntegratedTime[i]=times[i];
+}