Fit mathematics improved, obsollete GBTracker cleaned up
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCAParam.cxx
CommitLineData
326c2d4b 1// @(#) $Id$
ce565086 2// **************************************************************************
d54804bf 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. *
ce565086 17// *
d54804bf 18//***************************************************************************
326c2d4b 19
ce565086 20
326c2d4b 21#include "AliHLTTPCCAParam.h"
00d07bcd 22#include "AliHLTTPCCAMath.h"
326c2d4b 23
24
00d07bcd 25#if !defined(HLTCA_GPUCODE)
26
27GPUd() AliHLTTPCCAParam::AliHLTTPCCAParam()
d54804bf 28 : fISlice(0),fNRows(63),fAlpha(0.174533), fDAlpha(0.349066),
326c2d4b 29 fCosAlpha(0), fSinAlpha(0), fAngleMin(0), fAngleMax(0), fRMin(83.65), fRMax(133.3),
d54804bf 30 fZMin(0.0529937), fZMax(249.778), fErrX(0), fErrY(0), fErrZ(0.228808),fPadPitch(0.4),fBz(-5.),
ce565086 31 fHitPickUpFactor(1.),
d54804bf 32 fMaxTrackMatchDRow(4), fTrackConnectionFactor(3.5), fTrackChiCut(3.5), fTrackChi2Cut(10)
326c2d4b 33{
00d07bcd 34 // constructor
eb30eb49 35 fParamS0Par[0][0][0] = 0.00047013;
36 fParamS0Par[0][0][1] = 2.00135e-05;
37 fParamS0Par[0][0][2] = 0.0106533;
38 fParamS0Par[0][0][3] = 5.27104e-08;
39 fParamS0Par[0][0][4] = 0.012829;
40 fParamS0Par[0][0][5] = 0.000147125;
41 fParamS0Par[0][0][6] = 4.99432;
42 fParamS0Par[0][1][0] = 0.000883342;
43 fParamS0Par[0][1][1] = 1.07011e-05;
44 fParamS0Par[0][1][2] = 0.0103187;
45 fParamS0Par[0][1][3] = 4.25141e-08;
46 fParamS0Par[0][1][4] = 0.0224292;
47 fParamS0Par[0][1][5] = 8.27274e-05;
48 fParamS0Par[0][1][6] = 4.17233;
49 fParamS0Par[0][2][0] = 0.000745399;
50 fParamS0Par[0][2][1] = 5.62408e-06;
51 fParamS0Par[0][2][2] = 0.0151562;
52 fParamS0Par[0][2][3] = 5.08757e-08;
53 fParamS0Par[0][2][4] = 0.0601004;
54 fParamS0Par[0][2][5] = 7.97129e-05;
55 fParamS0Par[0][2][6] = 4.84913;
56 fParamS0Par[1][0][0] = 0.00215126;
57 fParamS0Par[1][0][1] = 6.82233e-05;
58 fParamS0Par[1][0][2] = 0.0221867;
59 fParamS0Par[1][0][3] = -6.27825e-09;
60 fParamS0Par[1][0][4] = -0.00745378;
61 fParamS0Par[1][0][5] = 0.000172629;
62 fParamS0Par[1][0][6] = 6.24987;
63 fParamS0Par[1][1][0] = 0.00181667;
64 fParamS0Par[1][1][1] = -4.17772e-06;
65 fParamS0Par[1][1][2] = 0.0253429;
66 fParamS0Par[1][1][3] = 1.3011e-07;
67 fParamS0Par[1][1][4] = -0.00362827;
68 fParamS0Par[1][1][5] = 0.00030406;
69 fParamS0Par[1][1][6] = 17.7775;
70 fParamS0Par[1][2][0] = 0.00158251;
71 fParamS0Par[1][2][1] = -3.55911e-06;
72 fParamS0Par[1][2][2] = 0.0247899;
73 fParamS0Par[1][2][3] = 7.20604e-08;
74 fParamS0Par[1][2][4] = 0.0179946;
75 fParamS0Par[1][2][5] = 0.000425504;
76 fParamS0Par[1][2][6] = 20.9294;
77
15d2e9cf 78 const Double_t kCLight = 0.000299792458;
79
80 fPolinomialFieldBz[0] = kCLight* 4.99643;
81 fPolinomialFieldBz[1] = kCLight* -2.27193e-06;
82 fPolinomialFieldBz[2] = kCLight* 0.000116475;
83 fPolinomialFieldBz[3] = kCLight* -1.49956e-06;
84 fPolinomialFieldBz[4] = kCLight* -1.01721e-07;
85 fPolinomialFieldBz[5] = kCLight* 4.85701e-07;
86
326c2d4b 87 Update();
88}
00d07bcd 89#endif
326c2d4b 90
00d07bcd 91GPUd() void AliHLTTPCCAParam::Initialize( Int_t iSlice,
eb30eb49 92 Int_t nRows, Float_t rowX[],
93 Float_t alpha, Float_t dAlpha,
94 Float_t rMin, Float_t rMax,
95 Float_t zMin, Float_t zMax,
96 Float_t padPitch, Float_t zSigma,
97 Float_t bz
326c2d4b 98 )
99{
100 // initialization
d54804bf 101 fISlice = iSlice;
102 fAlpha = alpha;
103 fDAlpha = dAlpha;
104 fRMin = rMin;
105 fRMax = rMax;
106 fZMin = zMin;
107 fZMax = zMax;
108 fPadPitch = padPitch;
326c2d4b 109 fErrY = 1.; // not in use
d54804bf 110 fErrZ = zSigma;
111 fBz = bz;
112 fNRows = nRows;
113 for( Int_t irow=0; irow<nRows; irow++ ){
114 fRowX[irow] = rowX[irow];
dc4788ec 115 }
116
326c2d4b 117 Update();
118}
119
00d07bcd 120GPUd() void AliHLTTPCCAParam::Update()
326c2d4b 121{
122 // update of calculated values
00d07bcd 123 fCosAlpha = CAMath::Cos(fAlpha);
124 fSinAlpha = CAMath::Sin(fAlpha);
326c2d4b 125 fAngleMin = fAlpha - fDAlpha/2.;
126 fAngleMax = fAlpha + fDAlpha/2.;
00d07bcd 127 fErrX = fPadPitch/CAMath::Sqrt(12.);
326c2d4b 128 fTrackChi2Cut = fTrackChiCut * fTrackChiCut;
129}
130
00d07bcd 131GPUd() void AliHLTTPCCAParam::Slice2Global( Float_t x, Float_t y, Float_t z,
eb30eb49 132 Float_t *X, Float_t *Y, Float_t *Z ) const
326c2d4b 133{
134 // conversion of coorinates sector->global
135 *X = x*fCosAlpha - y*fSinAlpha;
136 *Y = y*fCosAlpha + x*fSinAlpha;
137 *Z = z;
138}
139
00d07bcd 140GPUd() void AliHLTTPCCAParam::Global2Slice( Float_t X, Float_t Y, Float_t Z,
eb30eb49 141 Float_t *x, Float_t *y, Float_t *z ) const
326c2d4b 142{
143 // conversion of coorinates global->sector
144 *x = X*fCosAlpha + Y*fSinAlpha;
145 *y = Y*fCosAlpha - X*fSinAlpha;
146 *z = Z;
147}
eb30eb49 148
00d07bcd 149GPUd() Float_t AliHLTTPCCAParam::GetClusterError2( Int_t yz, Int_t type, Float_t z, Float_t angle ) const
eb30eb49 150{
151 //* recalculate the cluster error wih respect to the track slope
152 Float_t angle2 = angle*angle;
00d07bcd 153 const Float_t *c = fParamS0Par[yz][type];
eb30eb49 154 Float_t v = c[0] + z*(c[1] + c[3]*z) + angle2*(c[2] + angle2*c[4] + c[5]*z );
00d07bcd 155 return CAMath::Abs(v);
eb30eb49 156}
157
63d8b79d 158GPUd() void AliHLTTPCCAParam::GetClusterErrors2( Int_t iRow, Float_t z, Float_t sinPhi, Float_t cosPhi, Float_t DzDs, Float_t &Err2Y, Float_t &Err2Z ) const
159{
160 //
161 // Use calibrated cluster error from OCDB
162 //
163
164 z = CAMath::Abs((250.-0.275)-CAMath::Abs(z));
165 Int_t type = (iRow<63) ? 0: ( (iRow>126) ? 1:2 );
166 Float_t cosPhiInv = CAMath::Abs(cosPhi)>1.e-2 ?1./cosPhi :0;
167 Float_t angleY = sinPhi*cosPhiInv ;
168 Float_t angleZ = DzDs*cosPhiInv ; // SG was bug???
169
170 Err2Y = GetClusterError2(0,type, z,angleY);
171 Err2Z = GetClusterError2(1,type, z,angleZ);
172}
173
174
00d07bcd 175GPUh() void AliHLTTPCCAParam::WriteSettings( std::ostream &out ) const
eb30eb49 176{
00d07bcd 177 // write settings to the file
4687b8fc 178 out << fISlice<<std::endl;
179 out << fNRows<<std::endl;
180 out << fAlpha<<std::endl;
181 out << fDAlpha<<std::endl;
182 out << fCosAlpha<<std::endl;
183 out << fSinAlpha<<std::endl;
184 out << fAngleMin<<std::endl;
185 out << fAngleMax<<std::endl;
186 out << fRMin<<std::endl;
187 out << fRMax<<std::endl;
188 out << fZMin<<std::endl;
189 out << fZMax<<std::endl;
190 out << fErrX<<std::endl;
191 out << fErrY<<std::endl;
192 out << fErrZ<<std::endl;
193 out << fPadPitch<<std::endl;
194 out << fBz<<std::endl;
693d2443 195 out << fHitPickUpFactor<<std::endl;
4687b8fc 196 out << fMaxTrackMatchDRow<<std::endl;
197 out << fTrackConnectionFactor<<std::endl;
198 out << fTrackChiCut<<std::endl;
199 out << fTrackChi2Cut<<std::endl;
eb30eb49 200 for( Int_t iRow = 0; iRow<fNRows; iRow++ ){
4687b8fc 201 out << fRowX[iRow]<<std::endl;
eb30eb49 202 }
4687b8fc 203 out<<std::endl;
eb30eb49 204 for( Int_t i=0; i<2; i++ )
205 for( Int_t j=0; j<3; j++ )
206 for( Int_t k=0; k<7; k++ )
4687b8fc 207 out << fParamS0Par[i][j][k]<<std::endl;
208 out<<std::endl;
eb30eb49 209}
210
00d07bcd 211GPUh() void AliHLTTPCCAParam::ReadSettings( std::istream &in )
eb30eb49 212{
00d07bcd 213 // Read settings from the file
214
eb30eb49 215 in >> fISlice;
216 in >> fNRows;
217 in >> fAlpha;
218 in >> fDAlpha;
219 in >> fCosAlpha;
220 in >> fSinAlpha;
221 in >> fAngleMin;
222 in >> fAngleMax;
223 in >> fRMin;
224 in >> fRMax;
225 in >> fZMin;
226 in >> fZMax;
227 in >> fErrX;
228 in >> fErrY;
229 in >> fErrZ;
230 in >> fPadPitch;
231 in >> fBz;
693d2443 232 in >> fHitPickUpFactor;
eb30eb49 233 in >> fMaxTrackMatchDRow;
234 in >> fTrackConnectionFactor;
235 in >> fTrackChiCut;
236 in >> fTrackChi2Cut;
237 for( Int_t iRow = 0; iRow<fNRows; iRow++ ){
238 in >> fRowX[iRow];
239 }
240 for( Int_t i=0; i<2; i++ )
241 for( Int_t j=0; j<3; j++ )
242 for( Int_t k=0; k<7; k++ )
243 in >> fParamS0Par[i][j][k];
244}