30 #ifndef KFParticleStandalone
35 #ifdef HomogeneousField
36 float KFParticle::fgBz = -5.;
68 for(
int i=0;
i<21;
i++ ) C[
i] = Cov[
i];
90 for(
int i=0;
i<6;
i++ ) P[
i] = Param[
i];
92 for(
int i=0;
i<21;
i++ ) C[
i] = Cov[
i];
115 #ifdef NonhomogeneousField
116 for(
int iF=0; iF<10; iF++)
117 SetFieldCoeff( track.GetFieldCoeff()[iF], iF);
150 float dsdr[6] = {0.f};
154 float dx = mP[0] - vtx[0];
155 float dy = mP[1] - vtx[1];
158 float pt = sqrt(px*px + py*py);
172 float h3 = (dy*ey + dx*ex)*ey/pt;
173 float h4 = -(dy*ey + dx*ex)*ex/pt;
182 err+= h0*(h0*Cv[0] + h1*Cv[1] ) + h1*(h0*Cv[1] + h1*Cv[2] );
185 err = sqrt(fabs(err));
214 #ifdef HomogeneousField
248 #ifdef HomogeneousField
268 float mP[8], mC[36], mP1[8], mC1[36];
271 float dx = mP[0]-mP1[0];
272 float dy = mP[1]-mP1[1];
273 return sqrt(dx*dx+dy*dy);
285 float mP[8], mC[36], mP1[8], mC1[36];
289 float d[2]={ mP[0]-mP1[0], mP[1]-mP1[1] };
291 float sigmaS = .1+10.*sqrt( (d[0]*d[0]+d[1]*d[1] )/
292 (mP1[3]*mP1[3]+mP1[4]*mP1[4] ) );
294 float h[2] = { mP1[3]*sigmaS, mP1[4]*sigmaS };
313 if( problem || err<1.
e-20 )
return 1.e4;
327 #ifdef HomogeneousField
348 float dsdr[6] = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f};
350 float dsdp[6] = {-dsdr[0], -dsdr[1], -dsdr[2], 0, 0, 0};
353 for(
int i2=0; i2<36; i2++){
361 for(
int i=0;
i<36;
i++)
365 for(
int iC=0; iC<21; iC++)
378 float mP[8], mC[36], mP1[8], mC1[36];
381 float n = sqrt( mP[3]*mP[3] + mP[4]*mP[4] + mP[5]*mP[5] );
382 float n1= sqrt( mP1[3]*mP1[3] + mP1[4]*mP1[4] + mP1[5]*mP1[5] );
385 if( n>1.
e-8 ) a = ( mP[3]*mP1[3] + mP[4]*mP1[4] + mP[5]*mP1[5] )/n;
386 if (fabs(a)<1.) a = acos(a);
387 else a = (a>=0) ?0 :3.14;
400 float mP[8], mC[36], mP1[8], mC1[36];
403 float n = sqrt( mP[3]*mP[3] + mP[4]*mP[4] );
404 float n1= sqrt( mP1[3]*mP1[3] + mP1[4]*mP1[4] );
407 if( n>1.
e-8 ) a = ( mP[3]*mP1[3] + mP[4]*mP1[4] )/n;
408 if (fabs(a)<1.) a = acos(a);
409 else a = (a>=0) ?0 :3.14;
422 float mP[8], mC[36], mP1[8], mC1[36];
425 float nr = sqrt( mP[3]*mP[3] + mP[4]*mP[4] );
426 float n1r= sqrt( mP1[3]*mP1[3] + mP1[4]*mP1[4] );
427 float n = sqrt( nr*nr + mP[5]*mP[5] );
428 float n1= sqrt( n1r*n1r + mP1[5]*mP1[5] );
431 if( n>1.
e-8 ) a = ( nr*n1r +mP[5]*mP1[5])/n;
432 if (fabs(a)<1.) a = acos(a);
433 else a = (a>=0) ?0 :3.14;
445 const float ipt2 = 1/(
Px()*
Px() +
Py()*
Py() );
446 const float mipt2 = mass*ipt2;
447 const float dx =
X() - pV.
X();
448 const float dy =
Y() - pV.
Y();
459 const float f0 =
Px()*mipt2;
460 const float f1 =
Py()*mipt2;
461 const float mipt2derivative = mipt2*(1-2*
Px()*
Px()*ipt2);
462 const float f2 = dx*mipt2derivative;
463 const float f3 = -dy*mipt2derivative;
464 const float f4 = -f0;
465 const float f5 = -
f1;
496 return ( dx*
Px() + dy*
Py() )*mipt2;