]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/tracking-ca/AliHLTTPCCAParam.cxx
adding newline at end of file
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCAParam.cxx
index 9800150a09d9816b4d193c73e14c9bae1390d1b6..92f9b1938762ed3b07726542ebb350a06ad10d77 100644 (file)
@@ -1,6 +1,6 @@
 // @(#) $Id$
-//***************************************************************************
-// 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 "AliHLTTPCCAParam.h"
 #include "AliHLTTPCCAMath.h"
 
 
-#if !defined(HLTCA_GPUCODE)  
+#if !defined(HLTCA_GPUCODE)
 
 GPUd() AliHLTTPCCAParam::AliHLTTPCCAParam()
-  : fISlice(0),fNRows(63),fAlpha(0.174533), fDAlpha(0.349066),
-    fCosAlpha(0), fSinAlpha(0), fAngleMin(0), fAngleMax(0), fRMin(83.65), fRMax(133.3),
-    fZMin(0.0529937), fZMax(249.778), fErrX(0), fErrY(0), fErrZ(0.228808),fPadPitch(0.4),fBz(-5.), 
-    fHitPickUpFactor(2.),
-    fMaxTrackMatchDRow(4), fTrackConnectionFactor(3.5), fTrackChiCut(3.5), fTrackChi2Cut(10)
+    : fISlice( 0 ), fNRows( 63 ), fAlpha( 0.174533 ), fDAlpha( 0.349066 ),
+    fCosAlpha( 0 ), fSinAlpha( 0 ), fAngleMin( 0 ), fAngleMax( 0 ), fRMin( 83.65 ), fRMax( 133.3 ),
+    fZMin( 0.0529937 ), fZMax( 249.778 ), fErrX( 0 ), fErrY( 0 ), fErrZ( 0.228808 ), fPadPitch( 0.4 ), fBzkG( -5.00668 ),
+    fConstBz( -5.00668*0.000299792458 ), fHitPickUpFactor( 1. ),
+      fMaxTrackMatchDRow( 4 ), fNeighboursSearchArea(3.), fTrackConnectionFactor( 3.5 ), fTrackChiCut( 3.5 ), fTrackChi2Cut( 10 ), fClusterError2CorrectionY(1.), fClusterError2CorrectionZ(1.)
 {
   // constructor
   fParamS0Par[0][0][0] = 0.00047013;
@@ -73,20 +75,20 @@ GPUd() AliHLTTPCCAParam::AliHLTTPCCAParam()
   fParamS0Par[1][2][5] = 0.000425504;
   fParamS0Par[1][2][6] = 20.9294;
 
+
   Update();
 }
-#endif
 
-GPUd() void AliHLTTPCCAParam::Initialize( Int_t iSlice, 
-                                  Int_t nRows, Float_t rowX[],
-                                  Float_t alpha, Float_t dAlpha,
-                                  Float_t rMin, Float_t rMax,
-                                  Float_t zMin, Float_t zMax,
-                                  Float_t padPitch, Float_t zSigma,
-                                  Float_t bz
-                                  )
+void AliHLTTPCCAParam::Initialize( int iSlice,
+    int nRows, float rowX[],
+    float alpha, float dAlpha,
+    float rMin, float rMax,
+    float zMin, float zMax,
+    float padPitch, float zSigma,
+    float bz
+                                        )
 {
-  // initialization 
+  // initialization
   fISlice = iSlice;
   fAlpha = alpha;
   fDAlpha = dAlpha;
@@ -97,87 +99,120 @@ GPUd() void AliHLTTPCCAParam::Initialize( Int_t iSlice,
   fPadPitch = padPitch;
   fErrY = 1.; // not in use
   fErrZ = zSigma;
-  fBz = bz;
+  fBzkG = bz;
   fNRows = nRows;
-  for( Int_t irow=0; irow<nRows; irow++ ){
+  for ( int irow = 0; irow < nRows; irow++ ) {
     fRowX[irow] = rowX[irow];
+    //std::cout << " row " << irow << " x= " << rowX[irow] << std::endl;
   }
 
   Update();
 }
 
-GPUd() void AliHLTTPCCAParam::Update()
+void AliHLTTPCCAParam::Update()
 {
   // update of calculated values
-  fCosAlpha = CAMath::Cos(fAlpha);
-  fSinAlpha = CAMath::Sin(fAlpha);
-  fAngleMin = fAlpha - fDAlpha/2.;
-  fAngleMax = fAlpha + fDAlpha/2.;
-  fErrX = fPadPitch/CAMath::Sqrt(12.);
+
+  const double kCLight = 0.000299792458;
+  fConstBz = fBzkG * kCLight;
+
+  fPolinomialFieldBz[0] = fConstBz * (  0.999286   );
+  fPolinomialFieldBz[1] = fConstBz * ( -4.54386e-7 );
+  fPolinomialFieldBz[2] = fConstBz * (  2.32950e-5 );
+  fPolinomialFieldBz[3] = fConstBz * ( -2.99912e-7 );
+  fPolinomialFieldBz[4] = fConstBz * ( -2.03442e-8 );
+  fPolinomialFieldBz[5] = fConstBz * (  9.71402e-8 );
+
+  fCosAlpha = CAMath::Cos( fAlpha );
+  fSinAlpha = CAMath::Sin( fAlpha );
+  fAngleMin = fAlpha - fDAlpha / 2.f;
+  fAngleMax = fAlpha + fDAlpha / 2.f;
+  fErrX = fPadPitch / CAMath::Sqrt( 12. );
   fTrackChi2Cut = fTrackChiCut * fTrackChiCut;
 }
 
-GPUd() void AliHLTTPCCAParam::Slice2Global( Float_t x, Float_t y,  Float_t z, 
-                                    Float_t *X, Float_t *Y,  Float_t *Z ) const
-{  
+#endif
+
+
+GPUd() void AliHLTTPCCAParam::Slice2Global( float x, float y,  float z,
+    float *X, float *Y,  float *Z ) const
+{
   // conversion of coorinates sector->global
-  *X = x*fCosAlpha - y*fSinAlpha;
-  *Y = y*fCosAlpha + x*fSinAlpha;
+  *X = x * fCosAlpha - y * fSinAlpha;
+  *Y = y * fCosAlpha + x * fSinAlpha;
   *Z = z;
 }
-GPUd() void AliHLTTPCCAParam::Global2Slice( Float_t X, Float_t Y,  Float_t Z, 
-                                    Float_t *x, Float_t *y,  Float_t *z ) const
+
+GPUd() void AliHLTTPCCAParam::Global2Slice( float X, float Y,  float Z,
+    float *x, float *y,  float *z ) const
 {
   // conversion of coorinates global->sector
-  *x = X*fCosAlpha + Y*fSinAlpha;
-  *y = Y*fCosAlpha - X*fSinAlpha;
+  *x = X * fCosAlpha + Y * fSinAlpha;
+  *y = Y * fCosAlpha - X * fSinAlpha;
   *z = Z;
 }
 
-GPUd() Float_t AliHLTTPCCAParam::GetClusterError2( Int_t yz, Int_t type, Float_t z, Float_t angle ) const
+GPUd() float AliHLTTPCCAParam::GetClusterError2( int yz, int type, float z, float angle ) const
 {
   //* recalculate the cluster error wih respect to the track slope
-  Float_t angle2 = angle*angle;
-  const Float_t *c = fParamS0Par[yz][type];
-  Float_t v = c[0] + z*(c[1] + c[3]*z) + angle2*(c[2] + angle2*c[4] + c[5]*z );
-  return CAMath::Abs(v); 
+
+  float angle2 = angle * angle;
+  const float *c = fParamS0Par[yz][type];
+  float v = c[0] + z * ( c[1] + c[3] * z ) + angle2 * ( c[2] + angle2 * c[4] + c[5] * z );
+  return CAMath::Abs( v );
+}
+
+GPUd() void AliHLTTPCCAParam::GetClusterErrors2( int iRow, float z, float sinPhi, float cosPhi, float DzDs, float &Err2Y, float &Err2Z ) const
+{
+  //
+  // Use calibrated cluster error from OCDB
+  //
+
+  z = CAMath::Abs( ( 250. - 0.275 ) - CAMath::Abs( z ) );
+  int    type = ( iRow < 63 ) ? 0 : ( ( iRow > 126 ) ? 1 : 2 );
+  float cosPhiInv = CAMath::Abs( cosPhi ) > 1.e-2 ? 1. / cosPhi : 0;
+  float angleY = sinPhi * cosPhiInv ; // dy/dx
+  float angleZ = DzDs * cosPhiInv ; // dz/dx
+
+  Err2Y = GetClusterError2( 0, type, z, angleY );
+  Err2Z = GetClusterError2( 1, type, z, angleZ );
 }
 
-GPUh() void AliHLTTPCCAParam::WriteSettings( std::ostream &out ) const 
+#ifndef HLTCA_GPUCODE
+GPUh() void AliHLTTPCCAParam::WriteSettings( std::ostream &out ) const
 {
   // write settings to the file
-  out << fISlice<<std::endl;
-  out << fNRows<<std::endl;
-  out << fAlpha<<std::endl;
-  out << fDAlpha<<std::endl;
-  out << fCosAlpha<<std::endl;
-  out << fSinAlpha<<std::endl;
-  out << fAngleMin<<std::endl;
-  out << fAngleMax<<std::endl;
-  out << fRMin<<std::endl;
-  out << fRMax<<std::endl;
-  out << fZMin<<std::endl;
-  out << fZMax<<std::endl;
-  out << fErrX<<std::endl;
-  out << fErrY<<std::endl;
-  out << fErrZ<<std::endl;
-  out << fPadPitch<<std::endl;
-  out << fBz<<std::endl;
-  out << fHitPickUpFactor<<std::endl;
-  out << fMaxTrackMatchDRow<<std::endl;
-  out << fTrackConnectionFactor<<std::endl;
-  out << fTrackChiCut<<std::endl;
-  out << fTrackChi2Cut<<std::endl;
-  for( Int_t iRow = 0; iRow<fNRows; iRow++ ){
-    out << fRowX[iRow]<<std::endl;
+  out << fISlice << std::endl;
+  out << fNRows << std::endl;
+  out << fAlpha << std::endl;
+  out << fDAlpha << std::endl;
+  out << fCosAlpha << std::endl;
+  out << fSinAlpha << std::endl;
+  out << fAngleMin << std::endl;
+  out << fAngleMax << std::endl;
+  out << fRMin << std::endl;
+  out << fRMax << std::endl;
+  out << fZMin << std::endl;
+  out << fZMax << std::endl;
+  out << fErrX << std::endl;
+  out << fErrY << std::endl;
+  out << fErrZ << std::endl;
+  out << fPadPitch << std::endl;
+  out << fBzkG << std::endl;
+  out << fHitPickUpFactor << std::endl;
+  out << fMaxTrackMatchDRow << std::endl;
+  out << fTrackConnectionFactor << std::endl;
+  out << fTrackChiCut << std::endl;
+  out << fTrackChi2Cut << std::endl;
+  for ( int iRow = 0; iRow < fNRows; iRow++ ) {
+    out << fRowX[iRow] << std::endl;
   }
-  out<<std::endl;
-  for( Int_t i=0; i<2; i++ )
-    for( Int_t j=0; j<3; j++ )
-      for( Int_t k=0; k<7; k++ )
-       out << fParamS0Par[i][j][k]<<std::endl;
-  out<<std::endl;
+  out << std::endl;
+  for ( int i = 0; i < 2; i++ )
+    for ( int j = 0; j < 3; j++ )
+      for ( int k = 0; k < 7; k++ )
+        out << fParamS0Par[i][j][k] << std::endl;
+  out << std::endl;
 }
 
 GPUh() void AliHLTTPCCAParam::ReadSettings( std::istream &in )
@@ -200,17 +235,18 @@ GPUh() void AliHLTTPCCAParam::ReadSettings( std::istream &in )
   in >> fErrY;
   in >> fErrZ;
   in >> fPadPitch;
-  in >> fBz;
+  in >> fBzkG;
   in >> fHitPickUpFactor;
   in >> fMaxTrackMatchDRow;
   in >> fTrackConnectionFactor;
   in >> fTrackChiCut;
   in >> fTrackChi2Cut;
-  for( Int_t iRow = 0; iRow<fNRows; iRow++ ){
+  for ( int iRow = 0; iRow < fNRows; iRow++ ) {
     in >> fRowX[iRow];
   }
-  for( Int_t i=0; i<2; i++ )
-    for( Int_t j=0; j<3; j++ )
-      for( Int_t k=0; k<7; k++ )
-       in >> fParamS0Par[i][j][k];
+  for ( int i = 0; i < 2; i++ )
+    for ( int j = 0; j < 3; j++ )
+      for ( int k = 0; k < 7; k++ )
+        in >> fParamS0Par[i][j][k];
 }
+#endif