1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //-------------------------------------------------------------------------
17 // Implementation of the AliKalmanTrack class
19 // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
20 //-------------------------------------------------------------------------
22 #include "AliKalmanTrack.h"
23 #include "AliCluster.h"
27 ClassImp(AliKalmanTrack)
29 //_____________________________________________________________________________
30 AliKalmanTrack::AliKalmanTrack(const AliKalmanTrack& t) {
31 //-----------------------------------------------------------------
32 // This is a copy constructor.
33 //-----------------------------------------------------------------
36 fP0=t.fP0; fP1=t.fP1; fP2=t.fP2; fP3=t.fP3; fP4=t.fP4;
39 fC10=t.fC10; fC11=t.fC11;
40 fC20=t.fC20; fC21=t.fC21; fC22=t.fC22;
41 fC30=t.fC30; fC31=t.fC31; fC32=t.fC32; fC33=t.fC33;
42 fC40=t.fC40; fC41=t.fC41; fC42=t.fC42; fC43=t.fC43; fC44=t.fC44;
48 //_____________________________________________________________________________
49 Int_t AliKalmanTrack::Compare(TObject *o) {
50 //-----------------------------------------------------------------
51 // This function compares tracks according to the their curvature
52 //-----------------------------------------------------------------
53 AliKalmanTrack *t=(AliKalmanTrack*)o;
54 Double_t co=TMath::Abs(t->GetPt());
55 Double_t c =TMath::Abs(GetPt());
57 else if (c>co) return -1;
61 //_____________________________________________________________________________
62 Double_t AliKalmanTrack::GetPredictedChi2(const AliCluster *c) const
64 //-----------------------------------------------------------------
65 // This function calculates a predicted chi2 increment.
66 //-----------------------------------------------------------------
67 Double_t r00=c->GetSigmaY2(), r01=0., r11=c->GetSigmaZ2();
68 r00+=fC00; r01+=fC10; r11+=fC11;
70 Double_t det=r00*r11 - r01*r01;
71 if (TMath::Abs(det) < 1.e-10) {
72 if (fN>4) cerr<<fN<<" AliKalmanTrack warning: Singular matrix !\n";
75 Double_t tmp=r00; r00=r11; r11=tmp; r01=-r01;
77 Double_t dy=c->GetY() - fP0, dz=c->GetZ() - fP1;
79 return (dy*r00*dy + 2*r01*dy*dz + dz*r11*dz)/det;
82 //_____________________________________________________________________________
83 void AliKalmanTrack::GetCovariance(Double_t cc[15]) const {
84 // return covariance maxtrix
86 cc[1 ]=fC10; cc[2 ]=fC11;
87 cc[3 ]=fC20; cc[4 ]=fC21; cc[5 ]=fC22;
88 cc[6 ]=fC30; cc[7 ]=fC31; cc[8 ]=fC32; cc[9 ]=fC33;
89 cc[10]=fC40; cc[11]=fC41; cc[12]=fC42; cc[13]=fC43; cc[14]=fC44;
92 //____________________________________________________________________________
93 void AliKalmanTrack::Streamer(TBuffer &R__b)
95 //-----------------------------------------------------
96 // This is AliKalmanTrack streamer.
97 //-----------------------------------------------------
98 if (R__b.IsReading()) {
99 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
100 TObject::Streamer(R__b);
125 R__b.WriteVersion(AliKalmanTrack::IsA());
126 TObject::Streamer(R__b);