]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/tracking-ca/AliHLTTPCCATrackConvertor.cxx
Update master to aliroot
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCATrackConvertor.cxx
CommitLineData
eb30eb49 1// $Id: AliHLTTPCCATrackConvertor.cxx 27042 2008-07-02 12:06:02Z richterm $
ce565086 2// **************************************************************************
fbb9b71b 3// This file is property of and copyright by the ALICE HLT Project *
eb30eb49 4// ALICE Experiment at CERN, All rights reserved. *
5// *
6// Primary Authors: Sergey Gorbunov <sergey.gorbunov@kip.uni-heidelberg.de> *
7// Ivan Kisel <kisel@kip.uni-heidelberg.de> *
8// for The ALICE HLT Project. *
9// *
10// Permission to use, copy, modify and distribute this software and its *
11// documentation strictly for non-commercial purposes is hereby granted *
12// without fee, provided that the above copyright notice appears in all *
13// copies and that both the copyright notice and this permission notice *
14// appear in the supporting documentation. The authors make no claims *
15// about the suitability of this software for any purpose. It is *
16// provided "as is" without express or implied warranty. *
ce565086 17// *
eb30eb49 18//***************************************************************************
19
ce565086 20
eb30eb49 21#include "AliHLTTPCCATrackConvertor.h"
22#include "AliExternalTrackParam.h"
23#include "AliHLTTPCCATrackParam.h"
00d07bcd 24#include "AliHLTTPCCAMath.h"
eb30eb49 25
26
4acc2401 27bool AliHLTTPCCATrackConvertor::GetExtParam( const AliHLTTPCCATrackParam &T1, AliExternalTrackParam &T2, double alpha )
eb30eb49 28{
fbb9b71b 29 //* Convert from AliHLTTPCCATrackParam to AliExternalTrackParam parameterisation,
30 //* the angle alpha is the global angle of the local X axis
eb30eb49 31
4acc2401 32 bool ok = T1.CheckNumericalQuality();
33
fbb9b71b 34 double par[5], cov[15];
35 for ( int i = 0; i < 5; i++ ) par[i] = T1.GetPar()[i];
36 for ( int i = 0; i < 15; i++ ) cov[i] = T1.GetCov()[i];
eb30eb49 37
fbb9b71b 38 if ( par[2] > .99 ) par[2] = .99;
39 if ( par[2] < -.99 ) par[2] = -.99;
eb30eb49 40
fbb9b71b 41 if ( T1.GetSignCosPhi() < 0 ) { // change direction
eb30eb49 42 par[2] = -par[2]; // sin phi
43 par[3] = -par[3]; // DzDs
44 par[4] = -par[4]; // kappa
45 cov[3] = -cov[3];
46 cov[4] = -cov[4];
47 cov[6] = -cov[6];
48 cov[7] = -cov[7];
49 cov[10] = -cov[10];
50 cov[11] = -cov[11];
51 }
4acc2401 52
53 if ( CAMath::Abs( par[4] ) < 1.e-5 ) par[4] = 1.e-5; // some other software will crash if q/Pt==0
75f8516e 54 if ( CAMath::Abs( par[4] ) > 1./0.08 ) ok = 0; // some other software will crash if q/Pt is too big
4acc2401 55
fbb9b71b 56 T2.Set( ( double ) T1.GetX(), alpha, par, cov );
4acc2401 57
58 return ok;
eb30eb49 59}
60
15d2e9cf 61void AliHLTTPCCATrackConvertor::SetExtParam( AliHLTTPCCATrackParam &T1, const AliExternalTrackParam &T2 )
eb30eb49 62{
63 //* Convert from AliExternalTrackParam parameterisation
fbb9b71b 64
65 for ( int i = 0; i < 5; i++ ) T1.SetPar( i, T2.GetParameter()[i] );
66 for ( int i = 0; i < 15; i++ ) T1.SetCov( i, T2.GetCovariance()[i] );
693d2443 67 T1.SetX( T2.GetX() );
fbb9b71b 68 if ( T1.SinPhi() > .99 ) T1.SetSinPhi( .99 );
69 if ( T1.SinPhi() < -.99 ) T1.SetSinPhi( -.99 );
15d2e9cf 70 T1.SetSignCosPhi( 1 );
eb30eb49 71}
72