2 // **************************************************************************
3 // This file is property of and copyright by the ALICE HLT Project *
4 // ALICE Experiment at CERN, All rights reserved. *
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. *
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. *
18 //***************************************************************************
21 #include "AliHLTTPCCAParam.h"
22 #include "AliHLTTPCCAMath.h"
25 #if !defined(HLTCA_GPUCODE)
27 GPUdi() AliHLTTPCCAParam::AliHLTTPCCAParam()
28 : fISlice( 0 ), fNRows( 63 ), fAlpha( 0.174533 ), fDAlpha( 0.349066 ),
29 fCosAlpha( 0 ), fSinAlpha( 0 ), fAngleMin( 0 ), fAngleMax( 0 ), fRMin( 83.65 ), fRMax( 133.3 ),
30 fZMin( 0.0529937 ), fZMax( 249.778 ), fErrX( 0 ), fErrY( 0 ), fErrZ( 0.228808 ), fPadPitch( 0.4 ), fBzkG( -5.00668 ),
31 fConstBz( -5.00668*0.000299792458 ), fHitPickUpFactor( 1. ),
32 fMaxTrackMatchDRow( 4 ), fNeighboursSearchArea(3.), fTrackConnectionFactor( 3.5 ), fTrackChiCut( 3.5 ), fTrackChi2Cut( 10 ), fClusterError2CorrectionY(1.), fClusterError2CorrectionZ(1.),
33 fMinNTrackClusters( 30 ),
37 fParamS0Par[0][0][0] = 0.00047013;
38 fParamS0Par[0][0][1] = 2.00135e-05;
39 fParamS0Par[0][0][2] = 0.0106533;
40 fParamS0Par[0][0][3] = 5.27104e-08;
41 fParamS0Par[0][0][4] = 0.012829;
42 fParamS0Par[0][0][5] = 0.000147125;
43 fParamS0Par[0][0][6] = 4.99432;
44 fParamS0Par[0][1][0] = 0.000883342;
45 fParamS0Par[0][1][1] = 1.07011e-05;
46 fParamS0Par[0][1][2] = 0.0103187;
47 fParamS0Par[0][1][3] = 4.25141e-08;
48 fParamS0Par[0][1][4] = 0.0224292;
49 fParamS0Par[0][1][5] = 8.27274e-05;
50 fParamS0Par[0][1][6] = 4.17233;
51 fParamS0Par[0][2][0] = 0.000745399;
52 fParamS0Par[0][2][1] = 5.62408e-06;
53 fParamS0Par[0][2][2] = 0.0151562;
54 fParamS0Par[0][2][3] = 5.08757e-08;
55 fParamS0Par[0][2][4] = 0.0601004;
56 fParamS0Par[0][2][5] = 7.97129e-05;
57 fParamS0Par[0][2][6] = 4.84913;
58 fParamS0Par[1][0][0] = 0.00215126;
59 fParamS0Par[1][0][1] = 6.82233e-05;
60 fParamS0Par[1][0][2] = 0.0221867;
61 fParamS0Par[1][0][3] = -6.27825e-09;
62 fParamS0Par[1][0][4] = -0.00745378;
63 fParamS0Par[1][0][5] = 0.000172629;
64 fParamS0Par[1][0][6] = 6.24987;
65 fParamS0Par[1][1][0] = 0.00181667;
66 fParamS0Par[1][1][1] = -4.17772e-06;
67 fParamS0Par[1][1][2] = 0.0253429;
68 fParamS0Par[1][1][3] = 1.3011e-07;
69 fParamS0Par[1][1][4] = -0.00362827;
70 fParamS0Par[1][1][5] = 0.00030406;
71 fParamS0Par[1][1][6] = 17.7775;
72 fParamS0Par[1][2][0] = 0.00158251;
73 fParamS0Par[1][2][1] = -3.55911e-06;
74 fParamS0Par[1][2][2] = 0.0247899;
75 fParamS0Par[1][2][3] = 7.20604e-08;
76 fParamS0Par[1][2][4] = 0.0179946;
77 fParamS0Par[1][2][5] = 0.000425504;
78 fParamS0Par[1][2][6] = 20.9294;
80 for( int i=0; i<200; i++ ) fRowX[i] = 0;
85 void AliHLTTPCCAParam::Initialize( int iSlice,
86 int nRows, float rowX[],
87 float alpha, float dAlpha,
88 float rMin, float rMax,
89 float zMin, float zMax,
90 float padPitch, float zSigma,
102 fPadPitch = padPitch;
103 fErrY = 1.; // not in use
107 for ( int irow = 0; irow < nRows; irow++ ) {
108 fRowX[irow] = rowX[irow];
109 //std::cout << " row " << irow << " x= " << rowX[irow] << std::endl;
115 void AliHLTTPCCAParam::Update()
117 // update of calculated values
119 const double kCLight = 0.000299792458;
120 fConstBz = fBzkG * kCLight;
122 fPolinomialFieldBz[0] = fConstBz * ( 0.999286 );
123 fPolinomialFieldBz[1] = fConstBz * ( -4.54386e-7 );
124 fPolinomialFieldBz[2] = fConstBz * ( 2.32950e-5 );
125 fPolinomialFieldBz[3] = fConstBz * ( -2.99912e-7 );
126 fPolinomialFieldBz[4] = fConstBz * ( -2.03442e-8 );
127 fPolinomialFieldBz[5] = fConstBz * ( 9.71402e-8 );
129 fCosAlpha = CAMath::Cos( fAlpha );
130 fSinAlpha = CAMath::Sin( fAlpha );
131 fAngleMin = fAlpha - fDAlpha / 2.f;
132 fAngleMax = fAlpha + fDAlpha / 2.f;
133 fErrX = fPadPitch / CAMath::Sqrt( 12. );
134 fTrackChi2Cut = fTrackChiCut * fTrackChiCut;
140 MEM_CLASS_PRE() GPUdi() void MEM_LG(AliHLTTPCCAParam)::Slice2Global( float x, float y, float z,
141 float *X, float *Y, float *Z ) const
143 // conversion of coorinates sector->global
144 *X = x * fCosAlpha - y * fSinAlpha;
145 *Y = y * fCosAlpha + x * fSinAlpha;
149 MEM_CLASS_PRE() GPUdi() void MEM_LG(AliHLTTPCCAParam)::Global2Slice( float X, float Y, float Z,
150 float *x, float *y, float *z ) const
152 // conversion of coorinates global->sector
153 *x = X * fCosAlpha + Y * fSinAlpha;
154 *y = Y * fCosAlpha - X * fSinAlpha;
158 MEM_CLASS_PRE() GPUdi() float MEM_LG(AliHLTTPCCAParam)::GetClusterError2( int yz, int type, float z, float angle ) const
160 //* recalculate the cluster error wih respect to the track slope
162 float angle2 = angle * angle;
163 MakeType(const float*) c = fParamS0Par[yz][type];
164 float v = c[0] + z * ( c[1] + c[3] * z ) + angle2 * ( c[2] + angle2 * c[4] + c[5] * z );
165 return CAMath::Abs( v );
168 MEM_CLASS_PRE() GPUdi() void MEM_LG(AliHLTTPCCAParam)::GetClusterErrors2( int iRow, float z, float sinPhi, float cosPhi, float DzDs, float &Err2Y, float &Err2Z ) const
171 // Use calibrated cluster error from OCDB
174 z = CAMath::Abs( ( 250. - 0.275 ) - CAMath::Abs( z ) );
175 int type = ( iRow < 63 ) ? 0 : ( ( iRow > 126 ) ? 1 : 2 );
176 float cosPhiInv = CAMath::Abs( cosPhi ) > 1.e-2 ? 1. / cosPhi : 0;
177 float angleY = sinPhi * cosPhiInv ; // dy/dx
178 float angleZ = DzDs * cosPhiInv ; // dz/dx
180 Err2Y = GetClusterError2( 0, type, z, angleY );
181 Err2Z = GetClusterError2( 1, type, z, angleZ );
184 MEM_CLASS_PRE() GPUdi() void MEM_LG(AliHLTTPCCAParam)::GetClusterErrors2v1( int rowType, float z, float sinPhi, float cosPhi, float DzDs, float &Err2Y, float &Err2Z ) const
187 // Use calibrated cluster error from OCDB
190 z = CAMath::Abs( ( 250. - 0.275 ) - CAMath::Abs( z ) );
191 float cosPhiInv = CAMath::Abs( cosPhi ) > 1.e-2 ? 1. / cosPhi : 0;
192 float angleY = sinPhi * cosPhiInv ; // dy/dx
193 float angleZ = DzDs * cosPhiInv ; // dz/dx
195 Err2Y = GetClusterError2( 0, rowType, z, angleY );
196 Err2Z = GetClusterError2( 1, rowType, z, angleZ );
199 #ifndef HLTCA_GPUCODE
200 GPUh() void AliHLTTPCCAParam::WriteSettings( std::ostream &out ) const
202 // write settings to the file
203 out << fISlice << std::endl;
204 out << fNRows << std::endl;
205 out << fAlpha << std::endl;
206 out << fDAlpha << std::endl;
207 out << fCosAlpha << std::endl;
208 out << fSinAlpha << std::endl;
209 out << fAngleMin << std::endl;
210 out << fAngleMax << std::endl;
211 out << fRMin << std::endl;
212 out << fRMax << std::endl;
213 out << fZMin << std::endl;
214 out << fZMax << std::endl;
215 out << fErrX << std::endl;
216 out << fErrY << std::endl;
217 out << fErrZ << std::endl;
218 out << fPadPitch << std::endl;
219 out << fBzkG << std::endl;
220 out << fHitPickUpFactor << std::endl;
221 out << fMaxTrackMatchDRow << std::endl;
222 out << fTrackConnectionFactor << std::endl;
223 out << fTrackChiCut << std::endl;
224 out << fTrackChi2Cut << std::endl;
225 for ( int iRow = 0; iRow < fNRows; iRow++ ) {
226 out << fRowX[iRow] << std::endl;
229 for ( int i = 0; i < 2; i++ )
230 for ( int j = 0; j < 3; j++ )
231 for ( int k = 0; k < 7; k++ )
232 out << fParamS0Par[i][j][k] << std::endl;
236 GPUh() void AliHLTTPCCAParam::ReadSettings( std::istream &in )
238 // Read settings from the file
257 in >> fHitPickUpFactor;
258 in >> fMaxTrackMatchDRow;
259 in >> fTrackConnectionFactor;
263 if( fNRows<0 || fNRows > 200 ) fNRows = 0;
265 for ( int iRow = 0; iRow < fNRows; iRow++ ) {
268 for ( int i = 0; i < 2; i++ )
269 for ( int j = 0; j < 3; j++ )
270 for ( int k = 0; k < 7; k++ )
271 in >> fParamS0Par[i][j][k];