]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/tracking-ca/AliHLTTPCCATrackConvertor.cxx
Ensure that the ADC array is only called for valid entries (AliTRDmcmSim) and bug...
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCATrackConvertor.cxx
CommitLineData
eb30eb49 1// $Id: AliHLTTPCCATrackConvertor.cxx 27042 2008-07-02 12:06:02Z richterm $
2//***************************************************************************
3// This file is property of and copyright by the ALICE HLT Project *
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. *
17//***************************************************************************
18
19#include "AliHLTTPCCATrackConvertor.h"
20#include "AliExternalTrackParam.h"
21#include "AliHLTTPCCATrackParam.h"
00d07bcd 22#include "AliHLTTPCCAMath.h"
eb30eb49 23
24
25void AliHLTTPCCATrackConvertor::GetExtParam( const AliHLTTPCCATrackParam &T1, AliExternalTrackParam &T2, Double_t alpha, Double_t Bz )
26{
27 //* Convert from AliHLTTPCCATrackParam to AliExternalTrackParam parameterisation,
28 //* the angle alpha is the global angle of the local X axis
29
30 Double_t par[5], cov[15];
31 for( Int_t i=0; i<5; i++ ) par[i] = T1.GetPar()[i];
32 for( Int_t i=0; i<15; i++ ) cov[i] = T1.GetCov()[i];
33
34 if(par[2]>.99 ) par[2]=.99;
35 if(par[2]<-.99 ) par[2]=-.99;
36
37 { // kappa => 1/pt
38 const Double_t kCLight = 0.000299792458;
39 Double_t c = 1.e4;
00d07bcd 40 if( CAMath::Abs(Bz)>1.e-4 ) c = 1./(Bz*kCLight);
eb30eb49 41 par[4] *= c;
42 cov[10]*= c;
43 cov[11]*= c;
44 cov[12]*= c;
45 cov[13]*= c;
46 cov[14]*= c*c;
47 }
48 if( T1.GetCosPhi()<0 ){ // change direction
49 par[2] = -par[2]; // sin phi
50 par[3] = -par[3]; // DzDs
51 par[4] = -par[4]; // kappa
52 cov[3] = -cov[3];
53 cov[4] = -cov[4];
54 cov[6] = -cov[6];
55 cov[7] = -cov[7];
56 cov[10] = -cov[10];
57 cov[11] = -cov[11];
58 }
16fc8dc8 59 T2.Set( (Double_t) T1.GetX(),alpha,par,cov);
eb30eb49 60}
61
62void AliHLTTPCCATrackConvertor::SetExtParam( AliHLTTPCCATrackParam &T1, const AliExternalTrackParam &T2, Double_t Bz )
63{
64 //* Convert from AliExternalTrackParam parameterisation
65
693d2443 66 for( Int_t i=0; i<5; i++ ) T1.SetPar( i, T2.GetParameter()[i] );
67 for( Int_t i=0; i<15; i++ ) T1.SetCov( i, T2.GetCovariance()[i] );
68 T1.SetX( T2.GetX() );
69 if(T1.SinPhi()>.99 ) T1.SetSinPhi( .99 );
70 if(T1.SinPhi()<-.99 ) T1.SetSinPhi( -.99 );
71 T1.SetCosPhi( CAMath::Sqrt(1.-T1.SinPhi()*T1.SinPhi()));
eb30eb49 72 const Double_t kCLight = 0.000299792458;
73 Double_t c = Bz*kCLight;
74 { // 1/pt -> kappa
693d2443 75 T1.SetPar( 4, T1.Par()[4]*c );
76 T1.SetCov( 10, T1.Cov()[10]*c );
77 T1.SetCov( 11, T1.Cov()[10]*c );
78 T1.SetCov( 12, T1.Cov()[10]*c );
79 T1.SetCov( 13, T1.Cov()[10]*c );
80 T1.SetCov( 14, T1.Cov()[10]*c*c );
eb30eb49 81 }
82}
83