]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/tracking-ca/AliHLTTPCCATrackConvertor.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCATrackConvertor.cxx
index 3f67852636cfa8529db8655f6c0a03a052bb7859..cba11f872332ed6d8a87b7a189169ddfc2b98c9b 100644 (file)
@@ -1,6 +1,6 @@
 // $Id: AliHLTTPCCATrackConvertor.cxx 27042 2008-07-02 12:06:02Z richterm $
-//***************************************************************************
-// This file is property of and copyright by the ALICE HLT Project          * 
+// **************************************************************************
+// This file is property of and copyright by the ALICE HLT Project          *
 // ALICE Experiment at CERN, All rights reserved.                           *
 //                                                                          *
 // Primary Authors: Sergey Gorbunov <sergey.gorbunov@kip.uni-heidelberg.de> *
 // appear in the supporting documentation. The authors make no claims       *
 // about the suitability of this software for any purpose. It is            *
 // provided "as is" without express or implied warranty.                    *
+//                                                                          *
 //***************************************************************************
 
+
 #include "AliHLTTPCCATrackConvertor.h"
 #include "AliExternalTrackParam.h"
 #include "AliHLTTPCCATrackParam.h"
 #include "AliHLTTPCCAMath.h"
 
 
-void AliHLTTPCCATrackConvertor::GetExtParam( const AliHLTTPCCATrackParam &T1, AliExternalTrackParam &T2, Double_t alpha, Double_t Bz )
+bool AliHLTTPCCATrackConvertor::GetExtParam( const AliHLTTPCCATrackParam &T1, AliExternalTrackParam &T2, double alpha )
 {
-  //* Convert from AliHLTTPCCATrackParam to AliExternalTrackParam parameterisation, 
-  //* the angle alpha is the global angle of the local X axis 
+  //* Convert from AliHLTTPCCATrackParam to AliExternalTrackParam parameterisation,
+  //* the angle alpha is the global angle of the local X axis
 
-  Double_t par[5], cov[15];
-  for( Int_t i=0; i<5; i++ ) par[i] = T1.GetPar()[i];
-  for( Int_t i=0; i<15; i++ ) cov[i] = T1.GetCov()[i];
+  bool ok = T1.CheckNumericalQuality();
 
-  if(par[2]>.99 ) par[2]=.99;
-  if(par[2]<-.99 ) par[2]=-.99;
+  double par[5], cov[15];
+  for ( int i = 0; i < 5; i++ ) par[i] = T1.GetPar()[i];
+  for ( int i = 0; i < 15; i++ ) cov[i] = T1.GetCov()[i];
 
-  { // kappa => 1/pt
-    const Double_t kCLight = 0.000299792458;  
-    Double_t c = 1.e4;
-    if( CAMath::Abs(Bz)>1.e-4 ) c = 1./(Bz*kCLight);
-    par[4] *= c;
-    cov[10]*= c;
-    cov[11]*= c;
-    cov[12]*= c;
-    cov[13]*= c;
-    cov[14]*= c*c;
-  }
-  if( T1.GetCosPhi()<0 ){ // change direction
+  if ( par[2] > .99 ) par[2] = .99;
+  if ( par[2] < -.99 ) par[2] = -.99;
+
+  if ( T1.GetSignCosPhi() < 0 ) { // change direction
     par[2] = -par[2]; // sin phi
     par[3] = -par[3]; // DzDs
     par[4] = -par[4]; // kappa
@@ -56,28 +49,24 @@ void AliHLTTPCCATrackConvertor::GetExtParam( const AliHLTTPCCATrackParam &T1, Al
     cov[10] = -cov[10];
     cov[11] = -cov[11];
   }
-  T2.Set( (Double_t) T1.GetX(),alpha,par,cov);
+
+  if ( CAMath::Abs( par[4] ) < 1.e-5 ) par[4] = 1.e-5; // some other software will crash if q/Pt==0
+  if ( CAMath::Abs( par[4] ) > 1./0.08 ) ok = 0; // some other software will crash if q/Pt is too big
+
+  T2.Set( ( double ) T1.GetX(), alpha, par, cov );
+
+  return ok;
 }
 
-void AliHLTTPCCATrackConvertor::SetExtParam( AliHLTTPCCATrackParam &T1, const AliExternalTrackParam &T2, Double_t Bz )
+void AliHLTTPCCATrackConvertor::SetExtParam( AliHLTTPCCATrackParam &T1, const AliExternalTrackParam &T2 )
 {
   //* Convert from AliExternalTrackParam parameterisation
-  
-  for( Int_t i=0; i<5; i++ ) T1.Par()[i] = T2.GetParameter()[i];
-  for( Int_t i=0; i<15; i++ ) T1.Cov()[i] = T2.GetCovariance()[i];
-  T1.X() = T2.GetX();
-  if(T1.SinPhi()>.99 ) T1.SinPhi()=.99;
-  if(T1.SinPhi()<-.99 ) T1.SinPhi()=-.99;
-  T1.CosPhi() = CAMath::Sqrt(1.-T1.SinPhi()*T1.SinPhi());
-  const Double_t kCLight = 0.000299792458;  
-  Double_t c = Bz*kCLight;
-  { // 1/pt -> kappa 
-    T1.Par()[4] *= c;
-    T1.Cov()[10]*= c;
-    T1.Cov()[11]*= c;
-    T1.Cov()[12]*= c;
-    T1.Cov()[13]*= c;
-    T1.Cov()[14]*= c*c;
-  }
+
+  for ( int i = 0; i < 5; i++ ) T1.SetPar( i, T2.GetParameter()[i] );
+  for ( int i = 0; i < 15; i++ ) T1.SetCov( i, T2.GetCovariance()[i] );
+  T1.SetX( T2.GetX() );
+  if ( T1.SinPhi() > .99 ) T1.SetSinPhi( .99 );
+  if ( T1.SinPhi() < -.99 ) T1.SetSinPhi( -.99 );
+  T1.SetSignCosPhi( 1 );
 }