StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
AliHLTTPCCATrackParamVector.h
1 //-*- Mode: C++ -*-
2 // $Id: AliHLTTPCCATrackParamVector.h,v 1.2 2016/07/15 14:43:33 fisyak Exp $
3 // ************************************************************************
4 // This file is property of and copyright by the ALICE HLT Project *
5 // ALICE Experiment at CERN, All rights reserved. *
6 // See cxx source for full Copyright notice *
7 // *
8 //*************************************************************************
9 
10 
11 #ifndef ALIHLTTPCCATRACKPARAMVECTOR_H
12 #define ALIHLTTPCCATRACKPARAMVECTOR_H
13 
14 #include "AliHLTTPCCADef.h"
15 #include "AliHLTTPCCAMath.h"
16 #include <cstring>
17 
19 #if 0
20 namespace std
21 {
22  template<typename T> struct char_traits;
23  template<typename _CharT, typename _Traits> class basic_istream;
24  typedef basic_istream<char, char_traits<char> > istream;
25  template<typename _CharT, typename _Traits> class basic_ostream;
26  typedef basic_ostream<char, char_traits<char> > ostream;
27 } // namespace std
28 #endif
29 
37 {
38  friend std::istream &operator>>( std::istream &, AliHLTTPCCATrackParamVector & );
39  friend std::ostream &operator<<( std::ostream &, const AliHLTTPCCATrackParamVector & );
40  public:
42  : fX( Vc::Zero ),
43  fSignCosPhi( Vc::Zero ),
44  fChi2( Vc::Zero ),
45  fNDF( Vc::Zero )
46  {
47  for ( int i = 0; i < 5; ++i ) fP[i].setZero();
48  for ( int i = 0; i < 15; ++i ) fC[i].setZero();
49  }
50 
52  sfloat_v fBethe;
53  sfloat_v fE;
54  sfloat_v fTheta2;
55  sfloat_v fEP2;
56  sfloat_v fSigmadE2;
57  sfloat_v fK22;
58  sfloat_v fK33;
59  sfloat_v fK43;
60  sfloat_v fK44;
61  };
62 
63  sfloat_v X() const { return fX; }
64  sfloat_v Y() const { return fP[0]; }
65  sfloat_v Z() const { return fP[1]; }
66  sfloat_v SinPhi() const { return fP[2]; }
67  sfloat_v DzDs() const { return fP[3]; }
68  sfloat_v QPt() const { return fP[4]; }
69 
74  sfloat_v SignCosPhi() const { return fSignCosPhi; }
75  sfloat_v Chi2() const { return fChi2; }
76  short_v NDF() const { return fNDF; }
77 
78  sfloat_v Err2Y() const { return fC[0]; }
79  sfloat_v Err2Z() const { return fC[2]; }
80  sfloat_v Err2SinPhi() const { return fC[5]; }
81  sfloat_v Err2DzDs() const { return fC[9]; }
82  sfloat_v Err2QPt() const { return fC[14]; }
83 
84  sfloat_v GetX() const { return fX; }
85  sfloat_v GetY() const { return fP[0]; }
86  sfloat_v GetZ() const { return fP[1]; }
87  sfloat_v GetSinPhi() const { return fP[2]; }
88  sfloat_v GetDzDs() const { return fP[3]; }
89  sfloat_v GetQPt() const { return fP[4]; }
90  sfloat_v GetSignCosPhi() const { return fSignCosPhi; }
91  sfloat_v GetChi2() const { return fChi2; }
92  short_v GetNDF() const { return fNDF; }
93 
94  sfloat_v GetKappa( const sfloat_v &Bz ) const { return fP[4]*Bz; }
95  sfloat_v GetCosPhiPositive() const { return CAMath::Sqrt( sfloat_v( Vc::One ) - SinPhi()*SinPhi() ); }
96  sfloat_v GetCosPhi() const { return fSignCosPhi*CAMath::Sqrt( sfloat_v( Vc::One ) - SinPhi()*SinPhi() ); }
97 
98  sfloat_v GetErr2Y() const { return fC[0]; }
99  sfloat_v GetErr2Z() const { return fC[2]; }
100  sfloat_v GetErr2SinPhi() const { return fC[5]; }
101  sfloat_v GetErr2DzDs() const { return fC[9]; }
102  sfloat_v GetErr2QPt() const { return fC[14]; }
103 
104  const sfloat_v *Par() const { return fP; }
105  const sfloat_v *Cov() const { return fC; }
106 
107  const sfloat_v *GetPar() const { return fP; }
108  const sfloat_v *GetCov() const { return fC; }
109 
110  void SetTrackParam(const AliHLTTPCCATrackParamVector &param, const sfloat_m &m = sfloat_m( true ) )
111  {
112  for(int i=0; i<5; i++) fP[i](m) = param.Par()[i];
113  for(int i=0; i<15; i++) fC[i](m) = param.Cov()[i];
114  fX(m) = param.X();
115  fSignCosPhi(m) = param.SignCosPhi();
116  fChi2(m) = param.GetChi2();
117  fNDF(static_cast<short_m>(m)) = param.GetNDF();
118  }
119 
120  void SetPar( int i, const sfloat_v &v ) { fP[i] = v; }
121  void SetPar( int i, const sfloat_v &v, const sfloat_m &m ) { fP[i]( m ) = v; }
122  void SetCov( int i, const sfloat_v &v ) { fC[i] = v; }
123  void SetCov( int i, const sfloat_v &v, const sfloat_m &m ) { fC[i]( m ) = v; }
124 
125  void SetX( const sfloat_v &v ) { fX = v; }
126  void SetY( const sfloat_v &v ) { fP[0] = v; }
127  void SetZ( const sfloat_v &v ) { fP[1] = v; }
128  void SetX( const sfloat_v &v, const sfloat_m &m ) { fX( m ) = v; }
129  void SetY( const sfloat_v &v, const sfloat_m &m ) { fP[0]( m ) = v; }
130  void SetZ( const sfloat_v &v, const sfloat_m &m ) { fP[1]( m ) = v; }
131  void SetSinPhi( const sfloat_v &v ) { fP[2] = v; }
132  void SetSinPhi( const sfloat_v &v, const sfloat_m &m ) { fP[2]( m ) = v; }
133  void SetDzDs( const sfloat_v &v ) { fP[3] = v; }
134  void SetDzDs( const sfloat_v &v, const sfloat_m &m ) { fP[3]( m ) = v; }
135  void SetQPt( const sfloat_v &v ) { fP[4] = v; }
136  void SetQPt( const sfloat_v &v, const sfloat_m &m ) { fP[4]( m ) = v; }
137  void SetSignCosPhi( const sfloat_v &v ) { fSignCosPhi = v; }
138  void SetSignCosPhi( const sfloat_v &v, const sfloat_m &m ) { fSignCosPhi(m) = v; }
139  void SetChi2( const sfloat_v &v ) { fChi2 = v; }
140  void SetChi2( const sfloat_v &v, const sfloat_m &m ) { fChi2(m) = v; }
141  void SetNDF( int v ) { fNDF = v; }
142  void SetNDF( const short_v &v ) { fNDF = v; }
143  void SetNDF( const short_v &v, const short_m &m ) { fNDF(m) = v; }
144 
145  sfloat_v GetDist2( const AliHLTTPCCATrackParamVector &t ) const;
146  sfloat_v GetDistXZ2( const AliHLTTPCCATrackParamVector &t ) const;
147 
148 
149  sfloat_v GetS( const sfloat_v &x, const sfloat_v &y, const sfloat_v &Bz ) const;
150 
151  void GetDCAPoint( const sfloat_v &x, const sfloat_v &y, const sfloat_v &z,
152  sfloat_v *px, sfloat_v *py, sfloat_v *pz, const sfloat_v &Bz ) const;
153 
154 
155  sfloat_m TransportToXWithMaterial( const sfloat_v &x, const sfloat_v &Bz, const float maxSinPhi = .999f );
156 
157  sfloat_m TransportToX( const sfloat_v &x, const sfloat_v &Bz, const float maxSinPhi = .999f, const sfloat_m &mask = sfloat_m( true ) );
158 
159  sfloat_m TransportToX( const sfloat_v &x, AliHLTTPCCATrackLinearisationVector &t0,
160  const sfloat_v &Bz, const float maxSinPhi = .999f, sfloat_v *DL = 0, const sfloat_m &mask = sfloat_m( true ) );
161 
162  sfloat_m TransportToX( const sfloat_v &x, const sfloat_v &sinPhi0,
163  const sfloat_v &Bz, const sfloat_v maxSinPhi = .999f, const sfloat_m &mask = sfloat_m( true ) );
164 
165  sfloat_m TransportToXWithMaterial( const sfloat_v &x, AliHLTTPCCATrackLinearisationVector &t0,
166  AliHLTTPCCATrackFitParam &par, const sfloat_v &Bz, const float maxSinPhi = .999f, const sfloat_m &mask = sfloat_m( true ) );
167 
168  sfloat_m TransportToXWithMaterial( const sfloat_v &x,
169  AliHLTTPCCATrackFitParam &par, const sfloat_v &Bz, const float maxSinPhi = .999f );
170 
171  sfloat_m Rotate( const sfloat_v &alpha, AliHLTTPCCATrackLinearisationVector &t0,
172  const float maxSinPhi = .999f, const sfloat_m &mask = sfloat_m( true ) );
173  sfloat_m Rotate( const sfloat_v &alpha, const float maxSinPhi = .999f, const sfloat_m &mask = sfloat_m( true ) );
174  void RotateXY( sfloat_v alpha, sfloat_v &x, sfloat_v &y, sfloat_v &sin, const sfloat_m &mask = sfloat_m( true ) ) const ;
175 
176  sfloat_m FilterWithMaterial( const sfloat_v &y, const sfloat_v &z, sfloat_v err2Y, sfloat_v err2Z,
177  float maxSinPhi=0.999f, const sfloat_m &mask = sfloat_m( true ) );
178 
179  static sfloat_v ApproximateBetheBloch( const sfloat_v &beta2 );
180  static sfloat_v BetheBlochGeant( const sfloat_v &bg,
181  const sfloat_v &kp0 = 2.33f,
182  const sfloat_v &kp1 = 0.20f,
183  const sfloat_v &kp2 = 3.00f,
184  const sfloat_v &kp3 = 173e-9f,
185  const sfloat_v &kp4 = 0.49848f
186  );
187  static sfloat_v BetheBlochSolid( const sfloat_v &bg );
188  static sfloat_v BetheBlochGas( const sfloat_v &bg );
189 
190 
191  void CalculateFitParameters( AliHLTTPCCATrackFitParam &par, const sfloat_v &mass = 0.13957f );
192  sfloat_m CorrectForMeanMaterial( const sfloat_v &xOverX0, const sfloat_v &xTimesRho,
193  const AliHLTTPCCATrackFitParam &par, const sfloat_m &_mask );
194 
195  sfloat_m FilterDelta( const sfloat_m &mask, const sfloat_v &dy, const sfloat_v &dz,
196  sfloat_v err2Y, sfloat_v err2Z, const float maxSinPhi = .999f );
197  sfloat_m Filter( const sfloat_m &mask, const sfloat_v &y, const sfloat_v &z,
198  sfloat_v err2Y, sfloat_v err2Z, const float maxSinPhi = .999f );
199 
200 
201  private:
202 
203  sfloat_v fX; // x position
204  sfloat_v fSignCosPhi; // sign of cosPhi
205  sfloat_v fP[5]; // 'active' track parameters: Y, Z, SinPhi, DzDs, q/Pt
206  sfloat_v fC[15]; // the covariance matrix for Y,Z,SinPhi,..
207  sfloat_v fChi2; // the chi^2 value
208  short_v fNDF; // the Number of Degrees of Freedom
209 };
210 
211 #include "debug.h"
212 
213 inline sfloat_m AliHLTTPCCATrackParamVector::TransportToX( const sfloat_v &x, const sfloat_v &sinPhi0,
214  const sfloat_v &Bz, const sfloat_v maxSinPhi, const sfloat_m &_mask )
215 {
216  //* Transport the track parameters to X=x, using linearization at phi0 with 0 curvature,
217  //* and the field value Bz
218  //* maxSinPhi is the max. allowed value for |t0.SinPhi()|
219  //* linearisation of trajectory t0 is also transported to X=x,
220  //* returns 1 if OK
221  //*
222 
223  debugKF() << "Start TransportToX(" << x << ", " << _mask << ")\n" << *this << std::endl;
224 
225  const sfloat_v &ey = sinPhi0;
226  const sfloat_v &dx = x - X();
227  const sfloat_v &exi = sfloat_v( Vc::One ) * CAMath::RSqrt( sfloat_v( Vc::One ) - ey * ey ); // RSqrt
228 
229  const sfloat_v &dxBz = dx * Bz;
230  const sfloat_v &dS = dx * exi;
231  const sfloat_v &h2 = dS * exi * exi;
232  const sfloat_v &h4 = .5f * h2 * dxBz;
233 //#define LOSE_DEBUG
234 #ifdef LOSE_DEBUG
235  std::cout << " TrTo-sinPhi0 = " << sinPhi0 << std::endl;
236 #endif
237 // const sfloat_v &sinPhi = SinPhi() * (sfloat_v( Vc::One ) - 0.5f * dxBz * QPt() *dxBz * QPt()/ ( sfloat_v( Vc::One ) - SinPhi()*SinPhi() )) + dxBz * QPt();
239  const sfloat_v &sinPhi = SinPhi() + dxBz * QPt();
241 #ifdef LOSE_DEBUG
242  std::cout << " TrTo-sinPhi = " << sinPhi << std::endl;
243 #endif
244  sfloat_m mask = _mask && CAMath::Abs( exi ) <= 1.e4f;
245  mask &= ( (CAMath::Abs( sinPhi ) <= maxSinPhi) || (maxSinPhi <= 0.f) );
246 
247 
248  fX ( mask ) += dx;
249  fP[0]( mask ) += dS * ey + h2 * ( SinPhi() - ey ) + h4 * QPt();
250  fP[1]( mask ) += dS * DzDs();
251  fP[2]( mask ) = sinPhi;
252 
253 
254  //const sfloat_v c00 = fC[0];
255  //const sfloat_v c11 = fC[2];
256  const sfloat_v c20 = fC[3];
257  //const sfloat_v c21 = fC[4];
258  const sfloat_v c22 = fC[5];
259  //const sfloat_v c30 = fC[6];
260  const sfloat_v c31 = fC[7];
261  //const sfloat_v c32 = fC[8];
262  const sfloat_v c33 = fC[9];
263  const sfloat_v c40 = fC[10];
264  //const sfloat_v c41 = fC[11];
265  const sfloat_v c42 = fC[12];
266  //const sfloat_v c43 = fC[13];
267  const sfloat_v c44 = fC[14];
268 
269  const sfloat_v two( 2.f );
270 
271  fC[0] ( mask ) += h2 * h2 * c22 + h4 * h4 * c44
272  + two * ( h2 * c20 + h4 * ( c40 + h2 * c42 ) );
273 
274  //fC[1] ( mask ) += h2 * c21 + h4 * c41 + dS * ( c30 + h2 * c32 + h4 * c43 );
275  fC[2] ( mask ) += dS * ( two * c31 + dS * c33 );
276 
277  fC[3] ( mask ) += h2 * c22 + h4 * c42 + dxBz * ( c40 + h2 * c42 + h4 * c44 );
278  //fC[4] ( mask ) += dS * c32 + dxBz * ( c41 + dS * c43 );
279  const sfloat_v &dxBz_c44 = dxBz * c44;
280  fC[12]( mask ) += dxBz_c44;
281  fC[5] ( mask ) += dxBz * ( two * c42 + dxBz_c44 );
282 
283  //fC[6] ( mask ) += h2 * c32 + h4 * c43;
284  fC[7] ( mask ) += dS * c33;
285  //fC[8] ( mask ) += dxBz * c43;
286  //fC[9] ( mask ) = c33;
287 
288  fC[10]( mask ) += h2 * c42 + h4 * c44;
289  //fC[11]( mask ) += dS * c43;
290  //fC[13]( mask ) = c43;
291  //fC[14]( mask ) = c44;
292 
293  debugKF() << mask << "\n" << *this << std::endl;
294  return mask;
295 }
296 
297 #include <assert.h>
298 
299 inline sfloat_m AliHLTTPCCATrackParamVector::FilterDelta( const sfloat_m &mask, const sfloat_v &dy, const sfloat_v &dz,
300  sfloat_v err2Y, sfloat_v err2Z, const float maxSinPhi )
301 {
302  debugKF() << "Kalman filter( " << mask
303  << "\n " << dy
304  << "\n " << dz
305  << "\n " << err2Y
306  << "\n " << err2Z
307  << "\n):" << std::endl;
308 
309  assert( err2Y > 0.f || !mask );
310  assert( err2Z > 0.f || !mask );
311 
312  //* Add the y,z measurement with the Kalman filter
313 
314  const sfloat_v c00 = fC[ 0];
315  const sfloat_v c11 = fC[ 2];
316  const sfloat_v c20 = fC[ 3];
317  const sfloat_v c31 = fC[ 7];
318  const sfloat_v c40 = fC[10];
319 
320  err2Y += c00;
321  err2Z += c11;
322 #ifndef NODEBUG
323  if ( !( err2Y > 0.f || !mask ).isFull() ) {
324  std::cerr << err2Y << mask << ( err2Y > 0.f || !mask ) << c00 << std::endl;
325  }
326 #endif
327  assert( err2Y > 0.f || !mask );
328  assert( err2Z > 0.f || !mask );
329 
330  const sfloat_v &z0 = dy;
331  const sfloat_v &z1 = dz;
332 
333  const sfloat_v &mS0 = sfloat_v( Vc::One ) / err2Y;
334  const sfloat_v &mS2 = sfloat_v( Vc::One ) / err2Z;
335  //const sfloat_v &mS0 = CAMath::Reciprocal( err2Y );
336  //const sfloat_v &mS2 = CAMath::Reciprocal( err2Z );
337  debugKF() << "delta(mS0): " << CAMath::Abs( sfloat_v( Vc::One ) / err2Y - mS0 ) << std::endl;
338  debugKF() << "delta(mS2): " << CAMath::Abs( sfloat_v( Vc::One ) / err2Z - mS2 ) << std::endl;
339  assert( mS0 > 0.f || !mask );
340  assert( mS2 > 0.f || !mask );
341 
342  // K = CHtS
343 
344  const sfloat_v &k00 = c00 * mS0;
345  const sfloat_v &k20 = c20 * mS0;
346  const sfloat_v &k40 = c40 * mS0;
347 
348  const sfloat_v &k11 = c11 * mS2;
349  const sfloat_v &k31 = c31 * mS2;
350 
351  debugKF() << "delta(k00): " << ( c00 / err2Y - k00 ) << std::endl;
352  debugKF() << "delta(k20): " << ( c20 / err2Y - k20 ) << std::endl;
353  debugKF() << "delta(k40): " << ( c40 / err2Y - k40 ) << std::endl;
354 
355  debugKF() << "delta(k11): " << ( c11 / err2Z - k11 ) << std::endl;
356  debugKF() << "delta(k31): " << ( c31 / err2Z - k31 ) << std::endl;
357 
358  const sfloat_v &sinPhi = fP[2] + k20 * z0 ;
359  debugKF() << "delta(sinPhi): " << ( z0 * c20 / err2Y + fP[2] - sinPhi ) << std::endl;
360 
361  assert( maxSinPhi > 0.f );
362  const sfloat_m &success = mask && err2Y >= 1.e-8f && err2Z >= 1.e-8f && CAMath::Abs( sinPhi ) < maxSinPhi;
363 
364  fNDF ( static_cast<short_m>( success ) ) += 2;
365  fChi2 ( success ) += mS0 * z0 * z0 + mS2 * z1 * z1 ;
366 
367  fP[ 0]( success ) += k00 * z0 ;
368  fP[ 1]( success ) += k11 * z1 ;
369  fP[ 2]( success ) = sinPhi ;
370  fP[ 3]( success ) += k31 * z1 ;
371  fP[ 4]( success ) += k40 * z0 ;
372 
373  fC[ 0]( success ) -= k00 * c00 ;
374  fC[ 3]( success ) -= k20 * c00 ;
375  fC[ 5]( success ) -= k20 * c20 ;
376  fC[10]( success ) -= k40 * c00 ;
377  fC[12]( success ) -= k40 * c20 ;
378  fC[14]( success ) -= k40 * c40 ;
379 
380  fC[ 2]( success ) -= k11 * c11 ;
381  fC[ 7]( success ) -= k31 * c11 ;
382  fC[ 9]( success ) -= k31 * c31 ;
383 #if 1
384  const sfloat_m check = ( fC[ 0] >= 0.f ) && ( fC[ 2] >= 0.f ) && ( fC[ 5] >= 0.f ) && ( fC[ 9] >= 0.f ) && ( fC[14] >= 0.f );
385 #else
386  assert( fC[ 0] >= 0.f );
387  assert( fC[ 2] >= 0.f );
388  assert( fC[ 5] >= 0.f );
389  assert( fC[ 9] >= 0.f );
390  assert( fC[14] >= 0.f );
391 #endif
392  return success && check;
393 }
394 
395 inline sfloat_m AliHLTTPCCATrackParamVector::Filter( const sfloat_m &mask, const sfloat_v &y, const sfloat_v &z,
396  sfloat_v err2Y, sfloat_v err2Z, const float maxSinPhi )
397 {
398  debugKF() << "Kalman filter( " << mask
399  << "\n " << y
400  << "\n " << z
401  << "\n " << err2Y
402  << "\n " << err2Z
403  << "\n):" << std::endl;
404 
405  assert( err2Y > 0.f || !mask );
406  assert( err2Z > 0.f || !mask );
407 
408  //* Add the y,z measurement with the Kalman filter
409 
410  const sfloat_v c00 = fC[ 0];
411  const sfloat_v c11 = fC[ 2];
412  const sfloat_v c20 = fC[ 3];
413  const sfloat_v c31 = fC[ 7];
414  const sfloat_v c40 = fC[10];
415 
416  err2Y += c00;
417  err2Z += c11;
418 #ifndef NODEBUG
419  if ( !( err2Y > 0.f || !mask ).isFull() ) {
420  std::cerr << err2Y << mask << ( err2Y > 0.f || !mask ) << c00 << std::endl;
421  }
422 #endif
423  assert( err2Y > 0.f || !mask );
424  assert( err2Z > 0.f || !mask );
425 
426  const sfloat_v &z0 = y - fP[0];
427  const sfloat_v &z1 = z - fP[1];
428 
429  const sfloat_v &mS0 = sfloat_v( Vc::One ) / err2Y;
430  const sfloat_v &mS2 = sfloat_v( Vc::One ) / err2Z;
431  //const sfloat_v &mS0 = CAMath::Reciprocal( err2Y );
432  //const sfloat_v &mS2 = CAMath::Reciprocal( err2Z );
433  debugKF() << "delta(mS0): " << CAMath::Abs( sfloat_v( Vc::One ) / err2Y - mS0 ) << std::endl;
434  debugKF() << "delta(mS2): " << CAMath::Abs( sfloat_v( Vc::One ) / err2Z - mS2 ) << std::endl;
435  assert( mS0 > 0.f || !mask );
436  assert( mS2 > 0.f || !mask );
437 
438  // K = CHtS
439 
440  const sfloat_v &k00 = c00 * mS0;
441  const sfloat_v &k20 = c20 * mS0;
442  const sfloat_v &k40 = c40 * mS0;
443 
444  const sfloat_v &k11 = c11 * mS2;
445  const sfloat_v &k31 = c31 * mS2;
446 
447  debugKF() << "delta(k00): " << ( c00 / err2Y - k00 ) << std::endl;
448  debugKF() << "delta(k20): " << ( c20 / err2Y - k20 ) << std::endl;
449  debugKF() << "delta(k40): " << ( c40 / err2Y - k40 ) << std::endl;
450 
451  debugKF() << "delta(k11): " << ( c11 / err2Z - k11 ) << std::endl;
452  debugKF() << "delta(k31): " << ( c31 / err2Z - k31 ) << std::endl;
453 
454  const sfloat_v &sinPhi = fP[2] + k20 * z0 ;
455  debugKF() << "delta(sinPhi): " << ( z0 * c20 / err2Y + fP[2] - sinPhi ) << std::endl;
456 
457  assert( maxSinPhi > 0.f );
458  const sfloat_m &success = mask && err2Y >= 1.e-8f && err2Z >= 1.e-8f && CAMath::Abs( sinPhi ) < maxSinPhi;
459 
460  fNDF ( static_cast<short_m>( success ) ) += 2;
461  fChi2 ( success ) += mS0 * z0 * z0 + mS2 * z1 * z1 ;
462 
463  fP[ 0]( success ) += k00 * z0 ;
464  fP[ 1]( success ) += k11 * z1 ;
465  fP[ 2]( success ) = sinPhi ;
466  fP[ 3]( success ) += k31 * z1 ;
467  fP[ 4]( success ) += k40 * z0 ;
468 
469  fC[ 0]( success ) -= k00 * c00 ;
470  fC[ 3]( success ) -= k20 * c00 ;
471  fC[ 5]( success ) -= k20 * c20 ;
472  fC[10]( success ) -= k40 * c00 ;
473  fC[12]( success ) -= k40 * c20 ;
474  fC[14]( success ) -= k40 * c40 ;
475 
476  fC[ 2]( success ) -= k11 * c11 ;
477  fC[ 7]( success ) -= k31 * c11 ;
478  fC[ 9]( success ) -= k31 * c31 ;
479 #if 1
480  const sfloat_m check = ( fC[ 0] >= 0.f ) && ( fC[ 2] >= 0.f ) && ( fC[ 5] >= 0.f ) && ( fC[ 9] >= 0.f ) && ( fC[14] >= 0.f );
481 #else
482  assert( fC[ 0] >= 0.f );
483  assert( fC[ 2] >= 0.f );
484  assert( fC[ 5] >= 0.f );
485  assert( fC[ 9] >= 0.f );
486  assert( fC[14] >= 0.f );
487 #endif
488  return success && check;
489 }
490 
491 inline sfloat_m AliHLTTPCCATrackParamVector::Rotate( const sfloat_v &alpha, const float maxSinPhi, const sfloat_m &mask )
492 {
493  //* Rotate the coordinate system in XY on the angle alpha
494 
495  const sfloat_v cA = CAMath::Cos( alpha );
496  const sfloat_v sA = CAMath::Sin( alpha );
497  const sfloat_v x = X(), y = Y(), sP = SinPhi(), cP = GetCosPhi();
498  const sfloat_v cosPhi = cP * cA + sP * sA;
499  const sfloat_v sinPhi = -cP * sA + sP * cA;
500 
501  sfloat_m mReturn = mask && (CAMath::Abs( sinPhi ) < maxSinPhi) && (CAMath::Abs( cosPhi ) > 1.e-2f) && (CAMath::Abs( cP ) > 1.e-2f);
502 
503  const sfloat_v j0 = cP / cosPhi;
504  const sfloat_v j2 = cosPhi / cP;
505 
506  SetX( x*cA + y*sA, mReturn);
507  SetY( -x*sA + y*cA, mReturn );
508  SetSignCosPhi( CAMath::Abs(cosPhi)/cosPhi, mReturn );
509  SetSinPhi( sinPhi, mReturn );
510 
511 
512  //float J[5][5] = { { j0, 0, 0, 0, 0 }, // Y
513  // { 0, 1, 0, 0, 0 }, // Z
514  // { 0, 0, j2, 0, 0 }, // SinPhi
515  // { 0, 0, 0, 1, 0 }, // DzDs
516  // { 0, 0, 0, 0, 1 } }; // Kappa
517  //cout<<"alpha="<<alpha<<" "<<x<<" "<<y<<" "<<sP<<" "<<cP<<" "<<j0<<" "<<j2<<endl;
518  //cout<<" "<<fC[0]<<" "<<fC[1]<<" "<<fC[6]<<" "<<fC[10]<<" "<<fC[4]<<" "<<fC[5]<<" "<<fC[8]<<" "<<fC[12]<<endl;
519  fC[0](mReturn) *= j0 * j0;
520  fC[1](mReturn) *= j0;
521  fC[3](mReturn) *= j0;
522  fC[6](mReturn) *= j0;
523  fC[10](mReturn) *= j0;
524 
525  fC[3](mReturn) *= j2;
526  fC[4](mReturn) *= j2;
527  fC[5](mReturn) *= j2 * j2;
528  fC[8](mReturn) *= j2;
529  fC[12](mReturn) *= j2;
530  //cout<<" "<<fC[0]<<" "<<fC[1]<<" "<<fC[6]<<" "<<fC[10]<<" "<<fC[4]<<" "<<fC[5]<<" "<<fC[8]<<" "<<fC[12]<<endl;
531  return mReturn;
532 }
533 
534 inline void AliHLTTPCCATrackParamVector::RotateXY( sfloat_v alpha, sfloat_v &x, sfloat_v &y, sfloat_v &sin, const sfloat_m &mask ) const
535 {
536  //* Rotate the coordinate system in XY on the angle alpha
537  const sfloat_v cA = CAMath::Cos( alpha );
538  const sfloat_v sA = CAMath::Sin( alpha );
539 
540  x(mask) = ( X()*cA + Y()*sA );
541  y(mask) = ( -X()*sA + Y()*cA );
542  sin(mask) = -GetCosPhi() * sA + SinPhi() * cA;
543 }
544 
546 
547 std::istream &operator>>( std::istream &in, AliHLTTPCCATrackParamVector &ot );
548 std::ostream &operator<<( std::ostream &out, const AliHLTTPCCATrackParamVector &ot );
549 
550 #endif
Definition: Filter.h:17