]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/tracking-ca/AliHLTTPCCATrackParam.cxx
configuration 'TPC-compression-emulation' added, to be activated in separate commit
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCATrackParam.cxx
index 112b558fa2d6405079fb8237011b8c4f979b4c76..7a21021202e3f1497c2dbfce117865e97c3988d2 100644 (file)
@@ -33,7 +33,7 @@
 // Yc = Y + cos(Phi)/Kappa;
 //
 
-GPUd() float AliHLTTPCCATrackParam::GetDist2( const AliHLTTPCCATrackParam &t ) const
+GPUdi() float AliHLTTPCCATrackParam::GetDist2( const AliHLTTPCCATrackParam &t ) const
 {
   // get squared distance between tracks
 
@@ -43,7 +43,7 @@ GPUd() float AliHLTTPCCATrackParam::GetDist2( const AliHLTTPCCATrackParam &t ) c
   return dx*dx + dy*dy + dz*dz;
 }
 
-GPUd() float AliHLTTPCCATrackParam::GetDistXZ2( const AliHLTTPCCATrackParam &t ) const
+GPUdi() float AliHLTTPCCATrackParam::GetDistXZ2( const AliHLTTPCCATrackParam &t ) const
 {
   // get squared distance between tracks in X&Z
 
@@ -53,7 +53,7 @@ GPUd() float AliHLTTPCCATrackParam::GetDistXZ2( const AliHLTTPCCATrackParam &t )
 }
 
 
-GPUd() float  AliHLTTPCCATrackParam::GetS( float x, float y, float Bz ) const
+GPUdi() float  AliHLTTPCCATrackParam::GetS( float x, float y, float Bz ) const
 {
   //* Get XY path length to the given point
 
@@ -67,7 +67,7 @@ GPUd() float  AliHLTTPCCATrackParam::GetS( float x, float y, float Bz ) const
   return dS;
 }
 
-GPUd() void  AliHLTTPCCATrackParam::GetDCAPoint( float x, float y, float z,
+GPUdi() void  AliHLTTPCCATrackParam::GetDCAPoint( float x, float y, float z,
     float &xp, float &yp, float &zp,
     float Bz ) const
 {
@@ -101,7 +101,7 @@ GPUd() void  AliHLTTPCCATrackParam::GetDCAPoint( float x, float y, float z,
 //*
 
 
-GPUd() bool  AliHLTTPCCATrackParam::TransportToX( float x, AliHLTTPCCATrackLinearisation &t0, float Bz,  float maxSinPhi, float *DL )
+GPUdi() bool  AliHLTTPCCATrackParam::TransportToX( float x, AliHLTTPCCATrackLinearisation &t0, float Bz,  float maxSinPhi, float *DL )
 {
   //* Transport the track parameters to X=x, using linearization at t0, and the field value Bz
   //* maxSinPhi is the max. allowed value for |t0.SinPhi()|
@@ -150,9 +150,9 @@ GPUd() bool  AliHLTTPCCATrackParam::TransportToX( float x, AliHLTTPCCATrackLinea
 
   float d[5] = { 0,
                  0,
-                 fP[2] - t0.SinPhi(),
-                 fP[3] - t0.DzDs(),
-                 fP[4] - t0.QPt()
+                 GetPar(2) - t0.SinPhi(),
+                 GetPar(3) - t0.DzDs(),
+                 GetPar(4) - t0.QPt()
                };
 
   //float H0[5] = { 1,0, h2,  0, h4 };
@@ -168,10 +168,10 @@ GPUd() bool  AliHLTTPCCATrackParam::TransportToX( float x, AliHLTTPCCATrackLinea
   t0.SetCosPhi( ex1 );
   t0.SetSinPhi( ey1 );
 
-  fX    = X() + dx;
-  fP[0] = Y() + dy     + h2 * d[2]           +   h4 * d[4];
-  fP[1] = Z() + dz               + dS * d[3];
-  fP[2] = t0.SinPhi() +     d[2]           + dxBz * d[4];
+  SetX(X() + dx);
+  SetPar(0, Y() + dy     + h2 * d[2]           +   h4 * d[4]);
+  SetPar(1, Z() + dz               + dS * d[3]);
+  SetPar(2, t0.SinPhi() +     d[2]           + dxBz * d[4]);
 
   float c00 = fC[0];
   float c10 = fC[1];
@@ -214,7 +214,7 @@ GPUd() bool  AliHLTTPCCATrackParam::TransportToX( float x, AliHLTTPCCATrackLinea
 }
 
 
-GPUd() bool  AliHLTTPCCATrackParam::TransportToX( float x, float sinPhi0, float cosPhi0,  float Bz, float maxSinPhi )
+GPUdi() bool  AliHLTTPCCATrackParam::TransportToX( float x, float sinPhi0, float cosPhi0,  float Bz, float maxSinPhi )
 {
   //* Transport the track parameters to X=x, using linearization at phi0 with 0 curvature,
   //* and the field value Bz
@@ -244,10 +244,10 @@ GPUd() bool  AliHLTTPCCATrackParam::TransportToX( float x, float sinPhi0, float
   float sinPhi = SinPhi() + dxBz * QPt();
   if ( maxSinPhi > 0 && CAMath::Abs( sinPhi ) > maxSinPhi ) return 0;
 
-  fX    = X() + dx;
-  fP[0] += dS * ey + h2 * ( SinPhi() - ey )  +   h4 * QPt();
-  fP[1] += dS * DzDs();
-  fP[2] = sinPhi;
+  SetX(X() + dx);
+  SetPar(0, GetPar(0) + dS * ey + h2 * ( SinPhi() - ey )  +   h4 * QPt());
+  SetPar(1, GetPar(1) + dS * DzDs());
+  SetPar(2, sinPhi);
 
 
   float c00 = fC[0];
@@ -296,7 +296,7 @@ GPUd() bool  AliHLTTPCCATrackParam::TransportToX( float x, float sinPhi0, float
 
 
 
-GPUd() bool  AliHLTTPCCATrackParam::TransportToX( float x, float Bz, float maxSinPhi )
+GPUdi() bool  AliHLTTPCCATrackParam::TransportToX( float x, float Bz, float maxSinPhi )
 {
   //* Transport the track parameters to X=x
 
@@ -307,7 +307,7 @@ GPUd() bool  AliHLTTPCCATrackParam::TransportToX( float x, float Bz, float maxSi
 
 
 
-GPUd() bool  AliHLTTPCCATrackParam::TransportToXWithMaterial( float x,  AliHLTTPCCATrackLinearisation &t0, AliHLTTPCCATrackFitParam &par, float Bz, float maxSinPhi )
+GPUdi() bool  AliHLTTPCCATrackParam::TransportToXWithMaterial( float x,  AliHLTTPCCATrackLinearisation &t0, AliHLTTPCCATrackFitParam &par, float Bz, float maxSinPhi )
 {
   //* Transport the track parameters to X=x  taking into account material budget
 
@@ -323,7 +323,7 @@ GPUd() bool  AliHLTTPCCATrackParam::TransportToXWithMaterial( float x,  AliHLTTP
 }
 
 
-GPUd() bool  AliHLTTPCCATrackParam::TransportToXWithMaterial( float x,  AliHLTTPCCATrackFitParam &par, float Bz, float maxSinPhi )
+GPUdi() bool  AliHLTTPCCATrackParam::TransportToXWithMaterial( float x,  AliHLTTPCCATrackFitParam &par, float Bz, float maxSinPhi )
 {
   //* Transport the track parameters to X=x  taking into account material budget
 
@@ -331,7 +331,7 @@ GPUd() bool  AliHLTTPCCATrackParam::TransportToXWithMaterial( float x,  AliHLTTP
   return TransportToXWithMaterial( x, t0, par, Bz, maxSinPhi );
 }
 
-GPUd() bool AliHLTTPCCATrackParam::TransportToXWithMaterial( float x, float Bz, float maxSinPhi )
+GPUdi() bool AliHLTTPCCATrackParam::TransportToXWithMaterial( float x, float Bz, float maxSinPhi )
 {
   //* Transport the track parameters to X=x taking into account material budget
 
@@ -346,7 +346,7 @@ GPUd() bool AliHLTTPCCATrackParam::TransportToXWithMaterial( float x, float Bz,
 //*
 
 
-float AliHLTTPCCATrackParam::BetheBlochGeant( float bg2,
+GPUi() float AliHLTTPCCATrackParam::BetheBlochGeant( float bg2,
     float kp0,
     float kp1,
     float kp2,
@@ -390,7 +390,7 @@ float AliHLTTPCCATrackParam::BetheBlochGeant( float bg2,
   return mK*mZA*( 1 + bg2 ) / bg2*( 0.5*AliHLTTPCCAMath::Log( 2*me*bg2*maxT / ( mI*mI ) ) - bg2 / ( 1 + bg2 ) - d2 );
 }
 
-float AliHLTTPCCATrackParam::BetheBlochSolid( float bg )
+GPUi() float AliHLTTPCCATrackParam::BetheBlochSolid( float bg )
 {
   //------------------------------------------------------------------
   // This is an approximation of the Bethe-Bloch formula,
@@ -402,7 +402,7 @@ float AliHLTTPCCATrackParam::BetheBlochSolid( float bg )
   return BetheBlochGeant( bg );
 }
 
-float AliHLTTPCCATrackParam::BetheBlochGas( float bg )
+GPUi() float AliHLTTPCCATrackParam::BetheBlochGas( float bg )
 {
   //------------------------------------------------------------------
   // This is an approximation of the Bethe-Bloch formula,
@@ -423,7 +423,7 @@ float AliHLTTPCCATrackParam::BetheBlochGas( float bg )
 
 
 
-GPUd() float AliHLTTPCCATrackParam::ApproximateBetheBloch( float beta2 )
+GPUdi() float AliHLTTPCCATrackParam::ApproximateBetheBloch( float beta2 )
 {
   //------------------------------------------------------------------
   // This is an approximation of the Bethe-Bloch formula with
@@ -438,14 +438,14 @@ GPUd() float AliHLTTPCCATrackParam::ApproximateBetheBloch( float beta2 )
 }
 
 
-GPUd() void AliHLTTPCCATrackParam::CalculateFitParameters( AliHLTTPCCATrackFitParam &par, float mass )
+GPUdi() void AliHLTTPCCATrackParam::CalculateFitParameters( AliHLTTPCCATrackFitParam &par, float mass )
 {
   //*!
 
-  float qpt = fP[4];
+  float qpt = GetPar(4);
   if( fC[14]>=1. ) qpt = 1./0.35;
 
-  float p2 = ( 1. + fP[3] * fP[3] );
+  float p2 = ( 1. + GetPar(3) * GetPar(3) );
   float k2 = qpt * qpt;
   float mass2 = mass * mass;
   float beta2 = p2 / ( p2 + mass2 * k2 );
@@ -464,15 +464,15 @@ GPUd() void AliHLTTPCCATrackParam::CalculateFitParameters( AliHLTTPCCATrackFitPa
   par.fSigmadE2 = knst * par.fEP2 * qpt;
   par.fSigmadE2 = par.fSigmadE2 * par.fSigmadE2;
 
-  par.fK22 = ( 1. + fP[3] * fP[3] );
+  par.fK22 = ( 1. + GetPar(3) * GetPar(3) );
   par.fK33 = par.fK22 * par.fK22;
-  par.fK43 = fP[3] * qpt * par.fK22;
-  par.fK44 = fP[3] * fP[3] * k2;
+  par.fK43 = 0;
+  par.fK44 = GetPar(3) * GetPar(3) * k2;
 
 }
 
 
-GPUd() bool AliHLTTPCCATrackParam::CorrectForMeanMaterial( float xOverX0,  float xTimesRho, const AliHLTTPCCATrackFitParam &par )
+GPUdi() bool AliHLTTPCCATrackParam::CorrectForMeanMaterial( float xOverX0,  float xTimesRho, const AliHLTTPCCATrackFitParam &par )
 {
   //------------------------------------------------------------------
   // This function corrects the track parameters for the crossed material.
@@ -495,7 +495,7 @@ GPUd() bool AliHLTTPCCATrackParam::CorrectForMeanMaterial( float xOverX0,  float
   float corr = ( 1. - par.fEP2 * dE );
   if ( corr < 0.3 || corr > 1.3 ) return 0;
 
-  fP[4] *= corr;
+  SetPar(4, GetPar(4) * corr);
   fC40 *= corr;
   fC41 *= corr;
   fC42 *= corr;
@@ -506,7 +506,7 @@ GPUd() bool AliHLTTPCCATrackParam::CorrectForMeanMaterial( float xOverX0,  float
   //Multiple scattering******************
 
   float theta2 = par.fTheta2 * CAMath::Abs( xOverX0 );
-  fC22 += theta2 * par.fK22 * ( 1. - fP[2] * fP[2] );
+  fC22 += theta2 * par.fK22 * (1.-GetPar(2))*(1.+GetPar(2));
   fC33 += theta2 * par.fK33;
   fC43 += theta2 * par.fK43;
   fC44 += theta2 * par.fK44;
@@ -520,7 +520,7 @@ GPUd() bool AliHLTTPCCATrackParam::CorrectForMeanMaterial( float xOverX0,  float
 //*
 
 
-GPUd() bool AliHLTTPCCATrackParam::Rotate( float alpha, float maxSinPhi )
+GPUdi() bool AliHLTTPCCATrackParam::Rotate( float alpha, float maxSinPhi )
 {
   //* Rotate the coordinate system in XY on the angle alpha
 
@@ -559,11 +559,25 @@ GPUd() bool AliHLTTPCCATrackParam::Rotate( float alpha, float maxSinPhi )
   fC[5] *= j2 * j2;
   fC[8] *= j2;
   fC[12] *= j2;
+
+       if (cosPhi < 0)
+       {
+               SetSinPhi(-SinPhi());
+               SetDzDs(-DzDs());
+               SetQPt(-QPt());
+               fC[3] = - fC[3];
+               fC[4] = - fC[4];
+               fC[6] = - fC[6];
+               fC[7] = - fC[7];
+               fC[10] = -fC[10];
+               fC[11] = -fC[11];
+       }
+
   //cout<<"      "<<fC[0]<<" "<<fC[1]<<" "<<fC[6]<<" "<<fC[10]<<" "<<fC[4]<<" "<<fC[5]<<" "<<fC[8]<<" "<<fC[12]<<endl;
   return 1;
 }
 
-GPUd() bool AliHLTTPCCATrackParam::Rotate( float alpha, AliHLTTPCCATrackLinearisation &t0, float maxSinPhi )
+GPUdi() bool AliHLTTPCCATrackParam::Rotate( float alpha, AliHLTTPCCATrackLinearisation &t0, float maxSinPhi )
 {
   //* Rotate the coordinate system in XY on the angle alpha
 
@@ -607,7 +621,7 @@ GPUd() bool AliHLTTPCCATrackParam::Rotate( float alpha, AliHLTTPCCATrackLinearis
   return 1;
 }
 
-GPUd() bool AliHLTTPCCATrackParam::Filter( float y, float z, float err2Y, float err2Z, float maxSinPhi )
+GPUdi() bool AliHLTTPCCATrackParam::Filter( float y, float z, float err2Y, float err2Z, float maxSinPhi )
 {
   //* Add the y,z measurement with the Kalman filter
 
@@ -622,8 +636,8 @@ GPUd() bool AliHLTTPCCATrackParam::Filter( float y, float z, float err2Y, float
   err2Z += c11;
 
   float
-  z0 = y - fP[0],
-       z1 = z - fP[1];
+  z0 = y - GetPar(0),
+       z1 = z - GetPar(1);
 
   if ( err2Y < 1.e-8 || err2Z < 1.e-8 ) return 0;
 
@@ -641,18 +655,18 @@ GPUd() bool AliHLTTPCCATrackParam::Filter( float y, float z, float err2Y, float
   k11 = c11 * mS2;
   k31 = c31 * mS2;
 
-  float sinPhi = fP[2] + k20 * z0  ;
+  float sinPhi = GetPar(2) + k20 * z0  ;
 
   if ( maxSinPhi > 0 && CAMath::Abs( sinPhi ) >= maxSinPhi ) return 0;
 
   fNDF  += 2;
   fChi2 += mS0 * z0 * z0 + mS2 * z1 * z1 ;
 
-  fP[ 0] += k00 * z0 ;
-  fP[ 1] += k11 * z1 ;
-  fP[ 2] = sinPhi ;
-  fP[ 3] += k31 * z1 ;
-  fP[ 4] += k40 * z0 ;
+  SetPar(0, GetPar(0) + k00 * z0);
+  SetPar(1, GetPar(1) + k11 * z1);
+  SetPar(2, sinPhi);
+  SetPar(3, GetPar(3) + k31 * z1);
+  SetPar(4, GetPar(4) + k40 * z0);
 
   fC[ 0] -= k00 * c00 ;
   fC[ 3] -= k20 * c00 ;
@@ -668,22 +682,36 @@ GPUd() bool AliHLTTPCCATrackParam::Filter( float y, float z, float err2Y, float
   return 1;
 }
 
-GPUd() bool AliHLTTPCCATrackParam::CheckNumericalQuality() const
+GPUdi() bool AliHLTTPCCATrackParam::CheckNumericalQuality() const
 {
   //* Check that the track parameters and covariance matrix are reasonable
 
-  bool ok = AliHLTTPCCAMath::Finite( fX ) && AliHLTTPCCAMath::Finite( fSignCosPhi ) && AliHLTTPCCAMath::Finite( fChi2 ) && AliHLTTPCCAMath::Finite( fNDF );
+  bool ok = AliHLTTPCCAMath::Finite( GetX() ) && AliHLTTPCCAMath::Finite( fSignCosPhi ) && AliHLTTPCCAMath::Finite( fChi2 ) && AliHLTTPCCAMath::Finite( fNDF );
 
   const float *c = Cov();
   for ( int i = 0; i < 15; i++ ) ok = ok && AliHLTTPCCAMath::Finite( c[i] );
   for ( int i = 0; i < 5; i++ ) ok = ok && AliHLTTPCCAMath::Finite( Par()[i] );
 
   if ( c[0] <= 0 || c[2] <= 0 || c[5] <= 0 || c[9] <= 0 || c[14] <= 0 ) ok = 0;
-  if ( c[0] > 5. || c[2] > 5. || c[5] > 2. || c[9] > 2 || ( CAMath::Abs( QPt() ) > 1.e-4 && c[14] > 2. ) ) ok = 0;
+  if ( c[0] > 5. || c[2] > 5. || c[5] > 2. || c[9] > 2 
+       //|| ( CAMath::Abs( QPt() ) > 1.e-2 && c[14] > 2. ) 
+       ) ok = 0;
 
   if ( CAMath::Abs( SinPhi() ) > .99 ) ok = 0;
   if ( CAMath::Abs( QPt() ) > 1. / 0.05 ) ok = 0;
-
+  if( ok ){
+    ok = ok 
+      && ( c[1]*c[1]<=c[2]*c[0] )
+      && ( c[3]*c[3]<=c[5]*c[0] )
+      && ( c[4]*c[4]<=c[5]*c[2] )
+      && ( c[6]*c[6]<=c[9]*c[0] )
+      && ( c[7]*c[7]<=c[9]*c[2] )
+      && ( c[8]*c[8]<=c[9]*c[5] )
+      && ( c[10]*c[10]<=c[14]*c[0] )
+      && ( c[11]*c[11]<=c[14]*c[2] )
+      && ( c[12]*c[12]<=c[14]*c[5] )
+      && ( c[13]*c[13]<=c[14]*c[9] );      
+  }
   return ok;
 }
 
@@ -692,7 +720,7 @@ GPUd() bool AliHLTTPCCATrackParam::CheckNumericalQuality() const
 #include <iostream>
 #endif
 
-GPUd() void AliHLTTPCCATrackParam::Print() const
+GPUdi() void AliHLTTPCCATrackParam::Print() const
 {
   //* print parameters