26 static const float_v
small = 1.e-20
f;
58 for( Int_t
i=0;
i<6 ;
i++ )
fP[
i] = Param[
i];
59 for( Int_t
i=0;
i<21;
i++ )
fC[
i] = Cov[
i];
70 float_v energyInv = 1.f/
energy;
76 fC[21] = h0*
fC[ 6] + h1*
fC[10] + h2*
fC[15];
77 fC[22] = h0*fC[ 7] + h1*fC[11] + h2*fC[16];
78 fC[23] = h0*fC[ 8] + h1*fC[12] + h2*fC[17];
79 fC[24] = h0*fC[ 9] + h1*fC[13] + h2*fC[18];
80 fC[25] = h0*fC[13] + h1*fC[14] + h2*fC[19];
81 fC[26] = h0*fC[18] + h1*fC[19] + h2*fC[20];
82 fC[27] = ( h0*h0*fC[ 9] + h1*h1*fC[14] + h2*h2*fC[20]
83 + 2*(h0*h1*fC[13] + h0*h2*fC[18] + h1*h2*fC[19] ) );
84 for( Int_t
i=28;
i<36;
i++ ) fC[
i] = 0.
f;
101 for( Int_t
i=0;
i<8;
i++)
fP[
i] = 0.
f;
102 for(Int_t
i=0;
i<36;++
i)
fC[
i]=0.
f;
103 fC[0] =
fC[2] =
fC[5] = 100.f;
128 float_v p2 = x2+y2+z2;
130 error = (x2*
fC[9]+y2*
fC[14]+z2*
fC[20] + 2*(x*y*
fC[13]+x*z*
fC[18]+y*z*
fC[19]) );
131 const float_v LocalSmall = 1.e-4
f;
132 float_m
mask = (0.f <
error) && (LocalSmall < abs(p));
133 error(!mask) = 1.e20f;
150 float_v pt2 = px2+py2;
152 error = (px2*
fC[9] + py2*
fC[14] + 2*px*py*
fC[13] );
153 const float_v LocalSmall = 1.e-4
f;
154 float_m
mask = ( (0.f <
error) && (LocalSmall < abs(pt)));
155 error(!mask) = 1.e20f;
168 const float_v BIG = 1.e8f;
169 const float_v LocalSmall = 1.e-8
f;
174 float_v pt2 = px*px + py*py;
175 float_v p2 = pt2 + pz*pz;
176 float_v
p = sqrt(p2);
181 c(b > LocalSmall) = (a/
b);
183 eta(LocalSmall<abs(c)) = logc;
187 float_v pt4 = pt2*pt2;
188 float_v p2pt4 = p2*pt4;
189 error = (h3*h3*
fC[9] + h4*h4*
fC[14] + pt4*
fC[20] + 2*( h3*(h4*
fC[13] +
fC[18]*pt2) + pt2*h4*
fC[19] ) );
191 float_m
mask = ((LocalSmall < abs(p2pt4)) && (0.
f < error));
192 error(mask) = sqrt(error/p2pt4);
210 float_v pt2 = px2 + py2;
211 phi = KFPMath::ATan2(py,px);
212 error = (py2*
fC[9] + px2*
fC[14] - float_v(2.
f)*px*py*
fC[13] );
215 error(mask) = sqrt(error)/pt2;
216 error(!mask) = 1.e10f;
233 error = (x2*
fC[0] + y2*
fC[2] - float_v(2.
f)*x*y*
fC[1] );
236 error(mask) = sqrt(error)/
r;
237 error(!mask ) = 1.e10f;
249 const float_v BIG = 1.e8f;
250 const float_v LocalSmall = 1.e-8
f;
262 m(!mask) = -sqrt(-m2);
264 mask = (mask && (0.f <=
s) && (LocalSmall < m));
281 const float_v BIG = 1.e20f;
290 float_v p2 = x2+y2+z2;
293 error = p2*
fC[35] + t*t/p2*(x2*
fC[9]+y2*
fC[14]+z2*
fC[20]
294 + float_v(2.
f)*(x*y*
fC[13]+x*z*
fC[18]+y*z*
fC[19]) )
295 + float_v(2.
f)*t*(x*
fC[31]+y*
fC[32]+z*
fC[33]);
297 float_m
mask = ((1.e-4
f) < p2);
298 error(mask) = sqrt(abs(error));
313 const float_v BIG = 1.e8f;
322 error = pt2*
fC[35] + t*t/pt2*(x2*
fC[9]+y2*
fC[14] + 2*x*y*
fC[13] )
323 + float_v(2.
f)*t*(x*
fC[31]+y*
fC[32]);
324 float_m
mask = ((1.e-4
f) < pt2);
325 error(mask) = sqrt(abs(error));
341 const float_v BIG = 1.e20f;
347 error = m*m*
fC[35] + 2*
fP[7]*cTM +
fP[7]*
fP[7]*dm*dm;
349 error(mask) = sqrt(error);
381 float_v ds[2] = {0.f,0.f};
383 float_v
F1[36],
F2[36],
F3[36],
F4[36];
384 for(
int i1=0; i1<36; i1++)
397 for(
int iC=0; iC<36; iC++)
401 daughter.
Transport(ds[1], dsdr[3], m, V, dsdr[2], F4, F3);
406 for(
int iC=0; iC<21; iC++)
413 for(
int i=0;
i<6;
i++)
414 for(
int j=0;
j<6;
j++)
417 for(
int k=0;
k<6;
k++)
419 C1F1T[
i][
j] += C[
IJ(
i,
k)] * F1[
j*6+
k];
422 float_v F3C1F1T[6][6];
423 for(
int i=0;
i<6;
i++)
424 for(
int j=0;
j<6;
j++)
427 for(
int k=0;
k<6;
k++)
429 F3C1F1T[
i][
j] += F3[
i*6+
k] * C1F1T[
k][
j];
433 for(
int i=0;
i<6;
i++)
434 for(
int j=0;
j<6;
j++)
437 for(
int k=0;
k<6;
k++)
439 C2F2T[
i][
j] += daughter.
fC[
IJ(
i,
k)] * F2[
j*6+
k];
442 for(
int i=0;
i<3;
i++)
443 for(
int j=0;
j<3;
j++)
445 D[
i][
j] = F3C1F1T[
i][
j];
446 for(
int k=0;
k<6;
k++)
448 D[
i][
j] += F4[
i*6+
k] * C2F2T[
k][
j];
457 float_v dsdp[6] = {-dsdr[0], -dsdr[1], -dsdr[2], 0.f, 0.f, 0.f};
459 float_v
F[36],
F1[36];
460 for(
int i2=0; i2<36; i2++)
465 daughter.
Transport(dS, dsdr, m, V, dsdp, F, F1);
474 for(
int i=0;
i<3;
i++)
475 for(
int j=0;
j<6;
j++)
478 for(
int k=0;
k<3;
k++)
485 for(
int i=0;
i<6;
i++)
486 for(
int j=0;
j<6;
j++)
489 for(
int k=0;
k<3;
k++)
491 FVFT[
i][
j] += F1[
i*6+
k] * VFT[
k][
j];
495 for(
int i=0;
i<3;
i++)
496 for(
int j=0;
j<3;
j++)
499 for(
int k=0;
k<3;
k++)
531 if(
int(
fNDF[0])<-1 ){
534 for( Int_t
i=0;
i<7;
i++ )
fP[
i] = Daughter.
fP[
i];
535 for( Int_t
i=0;
i<28;
i++ )
fC[
i] = Daughter.
fC[
i];
563 for( Int_t iter=0; iter<maxIter; iter++ ){
565 float_v
m[8], mV[36];
570 float_v mS[6]= {
fC[0]+mV[0],
571 fC[1]+mV[1],
fC[2]+mV[2],
572 fC[3]+mV[3],
fC[4]+mV[4],
fC[5]+mV[5] };
576 float_v zeta[3] = { m[0]-
fP[0], m[1]-fP[1], m[2]-fP[2] };
579 for(
int i=0;
i<3;
i++)
580 for(
int j=0;
j<3;
j++)
583 for(
int k=0;
k<3;
k++)
588 float_v mCHt0[7], mCHt1[7], mCHt2[7];
590 mCHt0[0]=
fC[ 0] ; mCHt1[0]=
fC[ 1] ; mCHt2[0]=
fC[ 3] ;
591 mCHt0[1]=
fC[ 1] ; mCHt1[1]=
fC[ 2] ; mCHt2[1]=
fC[ 4] ;
592 mCHt0[2]=
fC[ 3] ; mCHt1[2]=
fC[ 4] ; mCHt2[2]=
fC[ 5] ;
593 mCHt0[3]=
fC[ 6]-mV[ 6]; mCHt1[3]=
fC[ 7]-mV[ 7]; mCHt2[3]=
fC[ 8]-mV[ 8];
594 mCHt0[4]=
fC[10]-mV[10]; mCHt1[4]=
fC[11]-mV[11]; mCHt2[4]=
fC[12]-mV[12];
595 mCHt0[5]=
fC[15]-mV[15]; mCHt1[5]=
fC[16]-mV[16]; mCHt2[5]=
fC[17]-mV[17];
596 mCHt0[6]=
fC[21]-mV[21]; mCHt1[6]=
fC[22]-mV[22]; mCHt2[6]=
fC[23]-mV[23];
600 float_v k0[7], k1[7], k2[7];
602 for(Int_t
i=0;
i<7;++
i){
603 k0[
i] = mCHt0[
i]*mS[0] + mCHt1[
i]*mS[1] + mCHt2[
i]*mS[3];
604 k1[
i] = mCHt0[
i]*mS[1] + mCHt1[
i]*mS[2] + mCHt2[
i]*mS[4];
605 k2[
i] = mCHt0[
i]*mS[3] + mCHt1[
i]*mS[4] + mCHt2[
i]*mS[5];
629 for(Int_t
i=0;
i<7;++
i)
630 fP[
i] =
fP[
i] + k0[
i]*zeta[0] + k1[
i]*zeta[1] + k2[
i]*zeta[2];
634 for(Int_t
i=0,
k=0;
i<7;++
i){
635 for(Int_t
j=0;
j<=
i;++
j,++
k){
636 fC[
k] =
fC[
k] - (k0[
i]*mCHt0[
j] + k1[
i]*mCHt1[
j] + k2[
i]*mCHt2[
j] );
641 for(
int i=0;
i<3;
i++)
643 for(
int j=0;
j<3;
j++)
649 for(
int i=0;
i<3;
i++)
650 for(
int j=0;
j<3;
j++)
653 for(
int k=0;
k<3;
k++)
655 A[
i][
j] += D[
i][
k] * K2[
k][
j];
660 for(
int i=0;
i<3;
i++)
661 for(
int j=0;
j<3;
j++)
664 for(
int k=0;
k<3;
k++)
666 M[
i][
j] += K[
i][
k] * A[
k][
j];
670 fC[0] += 2.f*M[0][0];
671 fC[1] += M[0][1] + M[1][0];
672 fC[2] += 2.f*M[1][1];
673 fC[3] += M[0][2] + M[2][0];
674 fC[4] += M[1][2] + M[2][1];
675 fC[5] += 2.f*M[2][2];
682 fChi2 += (mS[0]*zeta[0] + mS[1]*zeta[1] + mS[3]*zeta[2])*zeta[0]
683 + (mS[1]*zeta[0] + mS[2]*zeta[1] + mS[4]*zeta[2])*zeta[1]
684 + (mS[3]*zeta[0] + mS[4]*zeta[1] + mS[5]*zeta[2])*zeta[2];
698 for( Int_t iter=0; iter<maxIter; iter++ ){
700 float_v
m[8], mV[36];
705 float_v mS[6]= {
fC[0]+mV[0],
706 fC[1]+mV[1],
fC[2]+mV[2],
707 fC[3]+mV[3],
fC[4]+mV[4],
fC[5]+mV[5] };
711 float_v zeta[3] = { m[0]-
fP[0], m[1]-fP[1], m[2]-fP[2] };
714 for(
int i=0;
i<3;
i++)
715 for(
int j=0;
j<3;
j++)
718 for(
int k=0;
k<3;
k++)
725 float_v mCHt0[7], mCHt1[7], mCHt2[7];
727 mCHt0[0]=
fC[ 0] ; mCHt1[0]=
fC[ 1] ; mCHt2[0]=
fC[ 3] ;
728 mCHt0[1]=
fC[ 1] ; mCHt1[1]=
fC[ 2] ; mCHt2[1]=
fC[ 4] ;
729 mCHt0[2]=
fC[ 3] ; mCHt1[2]=
fC[ 4] ; mCHt2[2]=
fC[ 5] ;
730 mCHt0[3]=
fC[ 6] ; mCHt1[3]=
fC[ 7] ; mCHt2[3]=
fC[ 8] ;
731 mCHt0[4]=
fC[10] ; mCHt1[4]=
fC[11] ; mCHt2[4]=
fC[12] ;
732 mCHt0[5]=
fC[15] ; mCHt1[5]=
fC[16] ; mCHt2[5]=
fC[17] ;
733 mCHt0[6]=
fC[21] ; mCHt1[6]=
fC[22] ; mCHt2[6]=
fC[23] ;
737 float_v k0[7], k1[7], k2[7];
739 for(Int_t
i=0;
i<7;++
i){
740 k0[
i] = mCHt0[
i]*mS[0] + mCHt1[
i]*mS[1] + mCHt2[
i]*mS[3];
741 k1[
i] = mCHt0[
i]*mS[1] + mCHt1[
i]*mS[2] + mCHt2[
i]*mS[4];
742 k2[
i] = mCHt0[
i]*mS[3] + mCHt1[
i]*mS[4] + mCHt2[
i]*mS[5];
749 float_v mVHt0[7], mVHt1[7], mVHt2[7];
751 mVHt0[0]=mV[ 0] ; mVHt1[0]=mV[ 1] ; mVHt2[0]=mV[ 3] ;
752 mVHt0[1]=mV[ 1] ; mVHt1[1]=mV[ 2] ; mVHt2[1]=mV[ 4] ;
753 mVHt0[2]=mV[ 3] ; mVHt1[2]=mV[ 4] ; mVHt2[2]=mV[ 5] ;
754 mVHt0[3]=mV[ 6] ; mVHt1[3]=mV[ 7] ; mVHt2[3]=mV[ 8] ;
755 mVHt0[4]=mV[10] ; mVHt1[4]=mV[11] ; mVHt2[4]=mV[12] ;
756 mVHt0[5]=mV[15] ; mVHt1[5]=mV[16] ; mVHt2[5]=mV[17] ;
757 mVHt0[6]=mV[21] ; mVHt1[6]=mV[22] ; mVHt2[6]=mV[23] ;
761 float_v km0[7], km1[7], km2[7];
763 for(Int_t
i=0;
i<7;++
i){
764 km0[
i] = mVHt0[
i]*mS[0] + mVHt1[
i]*mS[1] + mVHt2[
i]*mS[3];
765 km1[
i] = mVHt0[
i]*mS[1] + mVHt1[
i]*mS[2] + mVHt2[
i]*mS[4];
766 km2[
i] = mVHt0[
i]*mS[3] + mVHt1[
i]*mS[4] + mVHt2[
i]*mS[5];
769 for(Int_t
i=0;
i<7;++
i)
770 fP[
i] =
fP[
i] + k0[
i]*zeta[0] + k1[
i]*zeta[1] + k2[
i]*zeta[2];
772 for(Int_t
i=0;
i<7;++
i)
773 m[
i] = m[
i] - km0[
i]*zeta[0] - km1[
i]*zeta[1] - km2[
i]*zeta[2];
775 for(Int_t
i=0,
k=0;
i<7;++
i){
776 for(Int_t
j=0;
j<=
i;++
j,++
k){
777 fC[
k] =
fC[
k] - (k0[
i]*mCHt0[
j] + k1[
i]*mCHt1[
j] + k2[
i]*mCHt2[
j] );
781 for(Int_t
i=0,
k=0;
i<7;++
i){
782 for(Int_t
j=0;
j<=
i;++
j,++
k){
783 mV[
k] = mV[
k] - (km0[
i]*mVHt0[
j] + km1[
i]*mVHt1[
j] + km2[
i]*mVHt2[
j] );
789 for(Int_t
i=0;
i<7;++
i){
790 for(Int_t
j=0;
j<7;++
j){
791 mDf[
i][
j] = (km0[
i]*mCHt0[
j] + km1[
i]*mCHt1[
j] + km2[
i]*mCHt2[
j] );
795 float_v mJ1[7][7], mJ2[7][7];
796 for(Int_t iPar1=0; iPar1<7; iPar1++)
798 for(Int_t iPar2=0; iPar2<7; iPar2++)
800 mJ1[iPar1][iPar2] = 0;
801 mJ2[iPar1][iPar2] = 0;
805 float_v mMassParticle =
fP[6]*
fP[6] - (
fP[3]*
fP[3] +
fP[4]*
fP[4] +
fP[5]*
fP[5]);
806 float_v mMassDaughter = m[6]*m[6] - (m[3]*m[3] + m[4]*m[4] + m[5]*m[5]);
807 mMassParticle(mMassParticle > 0.
f) = sqrt(mMassParticle);
808 mMassParticle(mMassParticle <= 0.
f) = 0.f;
809 mMassDaughter(mMassDaughter > 0.
f) = sqrt(mMassDaughter);
810 mMassDaughter(mMassDaughter <= 0.
f) = 0.f;
813 float_m mask2 = (!mask1) && ( (mMassParticle <
SumDaughterMass) || (
fP[6]<0.f)) ;
817 float_m mask3 = Daughter.
fMassHypo > -0.5f;
818 float_m mask4 = ( (!mask3) && ( (mMassDaughter<Daughter.
SumDaughterMass) || (m[6]<0.f)) );
824 for(Int_t
i=0;
i<7;
i++) {
825 for(Int_t
j=0;
j<7;
j++) {
827 for(Int_t
k=0;
k<7;
k++) {
828 mDJ[
i][
j] += mDf[
i][
k]*mJ1[
j][
k];
833 for(Int_t
i=0;
i<7; ++
i){
834 for(Int_t
j=0;
j<7; ++
j){
836 for(Int_t l=0; l<7; l++){
837 mDf[
i][
j] += mJ2[
i][l]*mDJ[l][
j];
860 fC[6 ] += mDf[3][0];
fC[7 ] += mDf[3][1];
fC[8 ] += mDf[3][2];
861 fC[10] += mDf[4][0];
fC[11] += mDf[4][1];
fC[12] += mDf[4][2];
862 fC[15] += mDf[5][0];
fC[16] += mDf[5][1];
fC[17] += mDf[5][2];
863 fC[21] += mDf[6][0];
fC[22] += mDf[6][1];
fC[23] += mDf[6][2];
865 fC[9 ] += mDf[3][3] + mDf[3][3];
866 fC[13] += mDf[4][3] + mDf[3][4];
fC[14] += mDf[4][4] + mDf[4][4];
867 fC[18] += mDf[5][3] + mDf[3][5];
fC[19] += mDf[5][4] + mDf[4][5];
fC[20] += mDf[5][5] + mDf[5][5];
868 fC[24] += mDf[6][3] + mDf[3][6];
fC[25] += mDf[6][4] + mDf[4][6];
fC[26] += mDf[6][5] + mDf[5][6];
fC[27] += mDf[6][6] + mDf[6][6];
872 for(
int i=0;
i<3;
i++)
874 for(
int j=0;
j<3;
j++)
880 for(
int i=0;
i<3;
i++)
881 for(
int j=0;
j<3;
j++)
884 for(
int k=0;
k<3;
k++)
886 A[
i][
j] += D[
i][
k] * K2[
k][
j];
891 for(
int i=0;
i<3;
i++)
892 for(
int j=0;
j<3;
j++)
895 for(
int k=0;
k<3;
k++)
897 M[
i][
j] += K[
i][
k] * A[
k][
j];
902 fC[1] += M[0][1] + M[1][0];
904 fC[3] += M[0][2] + M[2][0];
905 fC[4] += M[1][2] + M[2][1];
913 fChi2 += (mS[0]*zeta[0] + mS[1]*zeta[1] + mS[3]*zeta[2])*zeta[0]
914 + (mS[1]*zeta[0] + mS[2]*zeta[1] + mS[4]*zeta[2])*zeta[1]
915 + (mS[3]*zeta[0] + mS[4]*zeta[1] + mS[5]*zeta[2])*zeta[2];
928 float_v
m[8], mV[36];
933 float_v mS[6]= {
fC[0]+mV[0],
934 fC[1]+mV[1],
fC[2]+mV[2],
935 fC[3]+mV[3],
fC[4]+mV[4],
fC[5]+mV[5] };
939 float_v zeta[3] = { m[0]-
fP[0], m[1]-fP[1], m[2]-fP[2] };
942 for(
int i=0;
i<3;
i++)
943 for(
int j=0;
j<3;
j++)
946 for(
int k=0;
k<3;
k++)
951 float_v mCHt0[7], mCHt1[7], mCHt2[7];
953 mCHt0[0]=
fC[ 0] ; mCHt1[0]=
fC[ 1] ; mCHt2[0]=
fC[ 3] ;
954 mCHt0[1]=
fC[ 1] ; mCHt1[1]=
fC[ 2] ; mCHt2[1]=
fC[ 4] ;
955 mCHt0[2]=
fC[ 3] ; mCHt1[2]=
fC[ 4] ; mCHt2[2]=
fC[ 5] ;
956 mCHt0[3]=
fC[ 6]+mV[ 6]; mCHt1[3]=
fC[ 7]+mV[ 7]; mCHt2[3]=
fC[ 8]+mV[ 8];
957 mCHt0[4]=
fC[10]+mV[10]; mCHt1[4]=
fC[11]+mV[11]; mCHt2[4]=
fC[12]+mV[12];
958 mCHt0[5]=
fC[15]+mV[15]; mCHt1[5]=
fC[16]+mV[16]; mCHt2[5]=
fC[17]+mV[17];
959 mCHt0[6]=
fC[21]+mV[21]; mCHt1[6]=
fC[22]+mV[22]; mCHt2[6]=
fC[23]+mV[23];
963 float_v k0[7], k1[7], k2[7];
965 for(Int_t
i=0;
i<7;++
i){
966 k0[
i] = mCHt0[
i]*mS[0] + mCHt1[
i]*mS[1] + mCHt2[
i]*mS[3];
967 k1[
i] = mCHt0[
i]*mS[1] + mCHt1[
i]*mS[2] + mCHt2[
i]*mS[4];
968 k2[
i] = mCHt0[
i]*mS[3] + mCHt1[
i]*mS[4] + mCHt2[
i]*mS[5];
992 for(Int_t
i=0;
i<7;++
i)
993 fP[
i] =
fP[
i] + k0[
i]*zeta[0] + k1[
i]*zeta[1] + k2[
i]*zeta[2];
997 for(Int_t
i=0,
k=0;
i<7;++
i){
998 for(Int_t
j=0;
j<=
i;++
j,++
k){
999 fC[
k] =
fC[
k] - (k0[
i]*mCHt0[
j] + k1[
i]*mCHt1[
j] + k2[
i]*mCHt2[
j] );
1004 for(
int i=0;
i<3;
i++)
1006 for(
int j=0;
j<3;
j++)
1007 K2[
i][
j] = -K[
j][
i];
1012 for(
int i=0;
i<3;
i++)
1013 for(
int j=0;
j<3;
j++)
1016 for(
int k=0;
k<3;
k++)
1018 A[
i][
j] += D[
i][
k] * K2[
k][
j];
1023 for(
int i=0;
i<3;
i++)
1024 for(
int j=0;
j<3;
j++)
1027 for(
int k=0;
k<3;
k++)
1029 M[
i][
j] += K[
i][
k] * A[
k][
j];
1033 fC[0] += 2.f*M[0][0];
1034 fC[1] += M[0][1] + M[1][0];
1035 fC[2] += 2.f*M[1][1];
1036 fC[3] += M[0][2] + M[2][0];
1037 fC[4] += M[1][2] + M[2][1];
1038 fC[5] += 2.f*M[2][2];
1045 fChi2 += (mS[0]*zeta[0] + mS[1]*zeta[1] + mS[3]*zeta[2])*zeta[0]
1046 + (mS[1]*zeta[0] + mS[2]*zeta[1] + mS[4]*zeta[2])*zeta[1]
1047 + (mS[3]*zeta[0] + mS[4]*zeta[1] + mS[5]*zeta[2])*zeta[2];
1060 const float_v *
m = Vtx.
fP, *mV = Vtx.
fC;
1062 float_v decayPoint[3] = {
fP[0],
fP[1], fP[2]};
1063 float_v decayPointCov[6] = {
fC[0],
fC[1], fC[2], fC[3], fC[4], fC[5] };
1066 for(
int iD1=0; iD1<6; iD1++)
1067 for(
int iD2=0; iD2<6; iD2++)
1070 Bool_t noS = (
fC[35][0]<=0.f );
1075 fC[28] =
fC[29] =
fC[30] =
fC[31] =
fC[32] =
fC[33] =
fC[34] =
fC[35] = 0.f;
1079 float_v dsdr[6] = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f};
1082 float_v dsdp[6] = {-dsdr[0], -dsdr[1], -dsdr[2], 0.f, 0.f, 0.f };
1084 float_v
F[36],
F1[36];
1085 for(
int i2=0; i2<36; i2++)
1095 for(
int iC=0; iC<21; iC++)
1098 for(
int i=0;
i<6;
i++)
1099 for(
int j=0;
j<3;
j++)
1102 for(
int k=0;
k<3;
k++)
1104 D[
i][
j] += mV[
IJ(
j,
k)] * F1[
i*6+
k];
1109 float_v mS[6] = {
fC[0] + mV[0],
1110 fC[1] + mV[1],
fC[2] + mV[2],
1111 fC[3] + mV[3],
fC[4] + mV[4],
fC[5] + mV[5] };
1114 float_v res[3] = { m[0] -
X(), m[1] -
Y(), m[2] -
Z() };
1117 for(
int i=0;
i<3;
i++)
1118 for(
int j=0;
j<3;
j++)
1121 for(
int k=0;
k<3;
k++)
1125 float_v mCHt0[7], mCHt1[7], mCHt2[7];
1126 mCHt0[0]=
fC[ 0]; mCHt1[0]=
fC[ 1]; mCHt2[0]=
fC[ 3];
1127 mCHt0[1]=
fC[ 1]; mCHt1[1]=
fC[ 2]; mCHt2[1]=
fC[ 4];
1128 mCHt0[2]=
fC[ 3]; mCHt1[2]=
fC[ 4]; mCHt2[2]=
fC[ 5];
1129 mCHt0[3]=
fC[ 6]; mCHt1[3]=
fC[ 7]; mCHt2[3]=
fC[ 8];
1130 mCHt0[4]=
fC[10]; mCHt1[4]=
fC[11]; mCHt2[4]=
fC[12];
1131 mCHt0[5]=
fC[15]; mCHt1[5]=
fC[16]; mCHt2[5]=
fC[17];
1132 mCHt0[6]=
fC[21]; mCHt1[6]=
fC[22]; mCHt2[6]=
fC[23];
1134 float_v k0[7], k1[7], k2[7];
1135 for(Int_t
i=0;
i<7;++
i){
1136 k0[
i] = mCHt0[
i]*mS[0] + mCHt1[
i]*mS[1] + mCHt2[
i]*mS[3];
1137 k1[
i] = mCHt0[
i]*mS[1] + mCHt1[
i]*mS[2] + mCHt2[
i]*mS[4];
1138 k2[
i] = mCHt0[
i]*mS[3] + mCHt1[
i]*mS[4] + mCHt2[
i]*mS[5];
1141 for(Int_t
i=0;
i<7;++
i)
1142 fP[
i] =
fP[
i] + k0[
i]*res[0] + k1[
i]*res[1] + k2[
i]*res[2];
1144 for(Int_t
i=0,
k=0;
i<7;++
i){
1145 for(Int_t
j=0;
j<=
i;++
j,++
k){
1146 fC[
k] =
fC[
k] - (k0[
i]*mCHt0[
j] + k1[
i]*mCHt1[
j] + k2[
i]*mCHt2[
j] );
1151 for(
int i=0;
i<3;
i++)
1153 for(
int j=0;
j<3;
j++)
1154 K2[
i][
j] = -K[
j][
i];
1159 for(
int i=0;
i<3;
i++)
1160 for(
int j=0;
j<3;
j++)
1163 for(
int k=0;
k<3;
k++)
1165 A[
i][
j] += D[
k][
i] * K2[
k][
j];
1170 for(
int i=0;
i<3;
i++)
1171 for(
int j=0;
j<3;
j++)
1174 for(
int k=0;
k<3;
k++)
1176 M[
i][
j] += K[
i][
k] * A[
k][
j];
1181 fC[1] += M[0][1] + M[1][0];
1183 fC[3] += M[0][2] + M[2][0];
1184 fC[4] += M[1][2] + M[2][1];
1187 fChi2 += (mS[0]*res[0] + mS[1]*res[1] + mS[3]*res[2])*res[0]
1188 + (mS[1]*res[0] + mS[2]*res[1] + mS[4]*res[2])*res[1]
1189 + (mS[3]*res[0] + mS[4]*res[1] + mS[5]*res[2])*res[2];
1194 fC[28] =
fC[29] =
fC[30] =
fC[31] =
fC[32] =
fC[33] =
fC[34] =
fC[35] = 0.f;
1199 float_v dsdr[6] = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f};
1202 float_v dsdp[6] = {-dsdr[0], -dsdr[1], -dsdr[2], 0.f, 0.f, 0.f};
1204 float_v
F[36],
F1[36];
1205 for(
int i2=0; i2<36; i2++)
1210 float_v tmpP[8], tmpC[36];
1211 Transport(
fP[7], dsdr, tmpP, tmpC, dsdp, F, F1 );
1214 for(
int iDsDr=0; iDsDr<6; iDsDr++)
1216 float_v dsdrC = 0.f, dsdpV = 0.f;
1218 for(
int k=0;
k<6;
k++)
1219 dsdrC += dsdr[
k] *
fC[
IJ(
k,iDsDr)];
1221 fC[iDsDr+28] = dsdrC;
1222 fC[35] += dsdrC*dsdr[iDsDr] ;
1225 for(
int k=0;
k<3;
k++)
1226 dsdpV -= dsdr[
k] * decayPointCov[
IJ(
k,iDsDr)];
1227 fC[35] -= dsdpV*dsdr[iDsDr];
1246 const float_v energy2 = mP[6]*mP[6], p2 = mP[3]*mP[3]+mP[4]*mP[4]+mP[5]*mP[5], mass2 = mass*
mass;
1248 const float_v
a = energy2 - p2 + 2.f*mass2;
1249 const float_v
b = -2.f*(energy2 + p2);
1250 const float_v
c = energy2 - p2 - mass2;
1252 float_v lambda(Vc::Zero);
1253 lambda(abs(b) > float_v(1.
e-10
f)) = -c/
b ;
1255 float_v d = 4.f*energy2*p2 - mass2*(energy2-p2-2.f*mass2);
1256 float_m qMask = (d >= 0.f) && (abs(a) > (1.e-10
f)) ;
1257 lambda(qMask) = (energy2 + p2 - sqrt(d))/a;
1259 lambda(mP[6]<0.
f) = -1000000.f;
1262 for(iIter=0; iIter<100; iIter++)
1264 float_v lambda2 = lambda*lambda;
1265 float_v lambda4 = lambda2*lambda2;
1269 float_v
f = -mass2 * lambda4 + a*lambda2 + b*lambda +
c;
1270 float_v
df = -4.f*mass2 * lambda2*lambda + 2.f*a*lambda +
b;
1271 lambda(abs(df) > float_v(1.
e-10f)) -= f/
df;
1275 const float_v lpi = 1.f/(1.f + lambda);
1276 const float_v lmi = 1.f/(1.f - lambda);
1277 const float_v lp2i = lpi*lpi;
1278 const float_v lm2i = lmi*lmi;
1280 float_v lambda2 = lambda*lambda;
1282 float_v dfl = -4.f*mass2 * lambda2*lambda + 2.f*a*lambda +
b;
1283 float_v dfx[4] = {0.f,0.f,0.f,0.f};
1284 dfx[0] = -2.f*(1.f + lambda)*(1.
f + lambda)*mP[3];
1285 dfx[1] = -2.f*(1.f + lambda)*(1.
f + lambda)*mP[4];
1286 dfx[2] = -2.f*(1.f + lambda)*(1.
f + lambda)*mP[5];
1287 dfx[3] = 2.f*(1.f - lambda)*(1.
f - lambda)*mP[6];
1288 float_v dlx[4] = {1.f,1.f,1.f,1.f};
1290 for(
int i=0;
i<4;
i++)
1291 dlx[
i](abs(dfl) > float_v(1.
e-10
f)) = -dfx[
i] / dfl;
1293 float_v dxx[4] = {mP[3]*lm2i, mP[4]*lm2i, mP[5]*lm2i, -mP[6]*lp2i};
1295 for(Int_t
i=0;
i<7;
i++)
1296 for(Int_t
j=0;
j<7;
j++)
1302 for(Int_t
i=3;
i<7;
i++)
1303 for(Int_t
j=3;
j<7;
j++)
1304 mJ[
i][
j] = dlx[
j-3]*dxx[
i-3];
1306 for(Int_t
i=3;
i<6;
i++)
1312 for(Int_t
i=0;
i<7;
i++) {
1313 for(Int_t
j=0;
j<7;
j++) {
1315 for(Int_t
k=0;
k<7;
k++) {
1321 for(Int_t
i=0;
i<7; ++
i){
1322 for(Int_t
j=0;
j<=
i; ++
j){
1324 for(Int_t l=0; l<7; l++){
1342 const float_v& px =
fP[3];
1343 const float_v& py =
fP[4];
1344 const float_v& pz =
fP[5];
1347 const float_v residual = (energy*energy - px*px - py*py - pz*pz) - mass*mass;
1348 const float_v dm2 = float_v(4.
f) * (
fC[9]*px*px +
fC[14]*py*py +
fC[20]*pz*pz +
fC[27]*energy*energy +
1350 const float_v dChi2 = residual*residual / dm2;
1371 float_v
m2 = Mass*Mass;
1372 float_v s2 = m2*SigmaMass*SigmaMass;
1375 float_v e0 = sqrt(m2+p2);
1378 mH[0] = mH[1] = mH[2] = 0.f;
1385 float_v zeta = e0*e0 - e0*fP[6];
1386 zeta = m2 - (fP[6]*fP[6]-p2);
1388 float_v mCHt[8], s2_est=0.f;
1389 for( Int_t
i=0;
i<8; ++
i ){
1391 for (Int_t
j=0;
j<8;++
j) mCHt[
i] +=
Cij(
i,
j)*mH[
j];
1392 s2_est += mH[
i]*mCHt[
i];
1399 float_v w2 = 1.f/( s2 + s2_est );
1400 fChi2 += zeta*zeta*w2;
1402 for( Int_t
i=0, ii=0;
i<8; ++
i ){
1403 float_v ki = mCHt[
i]*w2;
1405 for(Int_t
j=0;
j<=
i;++
j)
fC[ii++] -= ki*mCHt[
j];
1419 h[0] = h[1] = h[2] = h[3] = h[4] = h[5] = h[6] = 0.
f;
1422 float_v zeta = 0.f -
fP[7];
1423 for(Int_t
i=0;
i<8;++
i) zeta -= h[
i]*(
fP[
i]-
fP[
i]);
1431 for( Int_t i=0, ii=0; i<7; ++
i ){
1432 float_v ki =
fC[28+
i]*
s;
1434 for(Int_t
j=0;
j<=
i;++
j)
fC[ii++] -= ki*
fC[28+
j];
1438 fC[28] =
fC[29] =
fC[30] =
fC[31] =
fC[32] =
fC[33] =
fC[34] =
fC[35] = 0.f;
1455 const int maxIter = 1;
1456 for( Int_t iter=0; iter<maxIter; iter++ ){
1465 for(Int_t
i=0;
i<36;++
i)
fC[
i]=0.;
1472 for( Int_t itr =0; itr<nDaughters; itr++ ){
1484 float_v dsdr[6] = {float_v(Vc::Zero),float_v(Vc::Zero),float_v(Vc::Zero),float_v(Vc::Zero),float_v(Vc::Zero),float_v(Vc::Zero)};
1492 float_v dsdr[6] = {float_v(Vc::Zero),float_v(Vc::Zero),float_v(Vc::Zero),float_v(Vc::Zero),float_v(Vc::Zero),float_v(Vc::Zero)};
1537 float_v
c[6] = {Vertex.
fC[0]+
fC[0], Vertex.
fC[1]+
fC[1], Vertex.
fC[2]+
fC[2],
1538 Vertex.
fC[3]+
fC[3], Vertex.
fC[4]+
fC[4], Vertex.
fC[5]+
fC[5]};
1540 float_v dx = (Vertex.
fP[0]-
fP[0]);
1541 float_v
dy = (Vertex.
fP[1]-
fP[1]);
1542 float_v
dz = (Vertex.
fP[2]-
fP[2]);
1544 l = sqrt( dx*dx + dy*dy + dz*dz );
1545 dl = c[0]*dx*dx + c[2]*dy*dy + c[5]*dz*dz + 2*(c[1]*dx*dy + c[3]*dx*dz + c[4]*dy*
dz);
1547 l(abs(l) < 1.
e-8
f) = 1.e-8
f;
1548 float_m ok = float_v(Vc::Zero)<=dl;
1550 dl(ok) = sqrt( dl )/l;
1552 if(isParticleFromVertex)
1554 *isParticleFromVertex = ok && ( l<float_v(3.
f*dl) );
1555 float_v cosV = dx*
fP[3] + dy*
fP[4] + dz*
fP[5];
1564 *isParticleFromVertex = (*isParticleFromVertex) || (!(*isParticleFromVertex) && (cosV<0.f) ) ;
1580 p2( p2 < float_v(1.
e-4
f) ) = float_v(1.
f);
1582 const float_v&
a = fP[3]*(xyz[0]-fP[0]) + fP[4]*(xyz[1]-fP[1]) + fP[5]*(xyz[2]-fP[2]);
1583 dsdr[0] = -fP[3]/p2;
1584 dsdr[1] = -fP[4]/p2;
1585 dsdr[2] = -fP[5]/p2;
1586 dsdr[3] = ((xyz[0]-fP[0])*p2 - 2.
f* fP[3]*a)/(p2*p2);
1587 dsdr[4] = ((xyz[1]-fP[1])*p2 - 2.
f* fP[4]*a)/(p2*p2);
1588 dsdr[5] = ((xyz[2]-fP[2])*p2 - 2.
f* fP[5]*a)/(p2*p2);
1611 const float_v&
x = param[0];
1612 const float_v&
y = param[1];
1613 const float_v&
z = param[2];
1614 const float_v& px = param[3];
1615 const float_v& py = param[4];
1616 const float_v& pz = param[5];
1618 const float_v kCLight = 0.000299792458f;
1619 float_v bq = B*simd_cast<float_v>(
fQ)*kCLight;
1620 float_v pt2 = param[3]*param[3] + param[4]*param[4];
1621 float_v p2 = pt2 + param[5]*param[5];
1623 float_v dx = xyz[0] - param[0];
1624 float_v
dy = xyz[1] - param[1];
1625 float_v
dz = xyz[2] - param[2];
1626 float_v
a = dx*param[3]+dy*param[4];
1627 float_v dS(Vc::Zero);
1631 const float_v LocalSmall = 1.e-8
f;
1632 float_m
mask = ( abs(bq)<LocalSmall );
1633 if( !( (!mask).isFull() ) )
1635 dS(mask && float_m(p2>1.
e-4
f)) = (a + dz*pz)/p2;
1637 dsdr[0](mask && float_m(p2>1.
e-4
f)) = -px/p2;
1638 dsdr[1](mask && float_m(p2>1.
e-4
f)) = -py/p2;
1639 dsdr[2](mask && float_m(p2>1.
e-4
f)) = -pz/p2;
1640 dsdr[3](mask && float_m(p2>1.
e-4
f)) = (dx*p2 - 2.
f* px *(a + dz *pz))/(p2*p2);
1641 dsdr[4](mask && float_m(p2>1.
e-4
f)) = (dy*p2 - 2.
f* py *(a + dz *pz))/(p2*p2);
1642 dsdr[5](mask && float_m(p2>1.
e-4
f)) = (dz*p2 - 2.
f* pz *(a + dz *pz))/(p2*p2);
1648 dS(!mask) = KFPMath::ATan2( abq, pt2 + bq*(dy*px -dx*py) )/bq;
1652 float_v
s = sin(bs),
c = cos(bs);
1654 bq(abs(bq) < LocalSmall) = LocalSmall;
1655 float_v bbq = bq*(dx*py - dy*px) - pt2;
1657 dsdr[0](!
mask) = (px*bbq - py*abq)/(abq*abq + bbq*bbq);
1658 dsdr[1](!
mask) = (px*abq + py*bbq)/(abq*abq + bbq*bbq);
1660 dsdr[3](!
mask) = -(dx*bbq + dy*abq + 2.
f*px*a)/(abq*abq + bbq*bbq);
1661 dsdr[4](!
mask) = (dx*abq - dy*bbq - 2.
f*py*a)/(abq*abq + bbq*bbq);
1664 float_v sz(Vc::Zero);
1665 float_v cCoeff = (bbq*
c - abq*
s) - pz*pz ;
1666 sz(abs(cCoeff) > 1.
e-8
f) = (dS*pz -
dz)*pz / cCoeff;
1668 float_v dcdr[6] = {0.f,0.f,0.f,0.f,0.f,0.f};
1669 dcdr[0] = -bq*py*
c - bbq*s*bq*dsdr[0] + px*bq*s - abq*
c*bq*dsdr[0];
1670 dcdr[1] = bq*px*
c - bbq*s*bq*dsdr[1] + py*bq*s - abq*
c*bq*dsdr[1];
1671 dcdr[3] = (-bq*dy-2*px)*
c - bbq*s*bq*dsdr[3] - dx*bq*s - abq*
c*bq*dsdr[3];
1672 dcdr[4] = ( bq*dx-2*py)*
c - bbq*s*bq*dsdr[4] - dy*bq*s - abq*
c*bq*dsdr[4];
1675 for(
int iP=0; iP<6; iP++)
1676 dsdr[iP](!mask) += pz*pz/cCoeff*dsdr[iP] - sz/cCoeff*dcdr[iP];
1678 dsdr[2](!
mask) += pz/cCoeff;
1679 dsdr[5](!
mask) += (2.
f*pz*dS - dz)/cCoeff;
1688 const float_v kOvSqr6 = 1.f/sqrt(float_v(6.
f));
1690 sB(LocalSmall < abs(bs)) = s/bq;
1691 sB(LocalSmall >= abs(bs)) = (1.f-bs*kOvSqr6)*(1.
f+bs*kOvSqr6)*dS;
1692 cB(LocalSmall < abs(bs)) = (1.f-
c)/bq;
1693 cB(LocalSmall >= abs(bs)) = .5f*sB*bs;
1696 p[0] = x + sB*px + cB*py;
1697 p[1] = y - cB*px + sB*py;
1700 p[4] = -s*px +
c*py;
1705 a = dx*p[3]+dy*p[4] + dz*pz;
1709 dS(!mask) += KFPMath::ATan2( abq, p2 + bq*(dy*p[3] -dx*p[4]) )/bq;
1730 const float_v param[6] = {
fP[0], -
fP[2], fP[1], fP[3], -fP[5], fP[4] };
1731 const float_v
point[3] = { xyz[0], -xyz[2], xyz[1] };
1733 float_v dsdrBz[6] = {0.f,0.f,0.f,0.f,0.f,0.f};
1736 dsdr[0] = dsdrBz[0];
1737 dsdr[1] = dsdrBz[2];
1738 dsdr[2] = -dsdrBz[1];
1739 dsdr[3] = dsdrBz[3];
1740 dsdr[4] = dsdrBz[5];
1741 dsdr[5] = -dsdrBz[4];
1759 float_v dS(Vc::Zero);
1765 dS(abs(dS)>1.E3f) = 0.f;
1771 float_v dS[2], float_v dsdr[4][6],
const float_v* param1,
const float_v* param2 )
const
1803 const float_v kOvSqr6 = 1.f/sqrt(float_v(6.
f));
1804 const float_v kCLight = 0.000299792458f;
1808 const float_v& bq1 = B*simd_cast<float_v>(
fQ)*kCLight;
1809 const float_v& bq2 = B*simd_cast<float_v>(p.
fQ)*kCLight;
1811 const float_m& isStraight1 = abs(bq1) < float_v(1.
e-8
f);
1812 const float_m& isStraight2 = abs(bq2) < float_v(1.
e-8
f);
1814 if( isStraight1.isFull() && isStraight2.isFull() )
1820 const float_v& px1 = param1[3];
1821 const float_v& py1 = param1[4];
1822 const float_v& pz1 = param1[5];
1824 const float_v& px2 = param2[3];
1825 const float_v& py2 = param2[4];
1826 const float_v& pz2 = param2[5];
1828 const float_v& pt12 = px1*px1 + py1*py1;
1829 const float_v& pt22 = px2*px2 + py2*py2;
1831 const float_v& x01 = param1[0];
1832 const float_v& y01 = param1[1];
1833 const float_v& z01 = param1[2];
1835 const float_v& x02 = param2[0];
1836 const float_v& y02 = param2[1];
1837 const float_v& z02 = param2[2];
1839 float_v dS1[2] = {0.f, 0.f}, dS2[2]={0.f, 0.f};
1841 const float_v& dx0 = (x01 - x02);
1842 const float_v& dy0 = (y01 - y02);
1843 const float_v& dr02 = dx0*dx0 + dy0*dy0;
1844 const float_v& drp1 = dx0*px1 + dy0*py1;
1845 const float_v& dxyp1 = dx0*py1 - dy0*px1;
1846 const float_v& drp2 = dx0*px2 + dy0*py2;
1847 const float_v& dxyp2 = dx0*py2 - dy0*px2;
1848 const float_v& p1p2 = px1*px2 + py1*py2;
1849 const float_v& dp1p2 = px1*py2 - px2*py1;
1851 const float_v& k11 = (bq2*drp1 - dp1p2);
1852 const float_v& k21 = (bq1*(bq2*dxyp1 - p1p2) + bq2*pt12);
1853 const float_v& k12 = ((bq1*drp2 - dp1p2));
1854 const float_v& k22 = (bq2*(bq1*dxyp2 + p1p2) - bq1*pt22);
1856 const float_v& kp = (dxyp1*bq2 - dxyp2*bq1 - p1p2);
1857 const float_v& kd = dr02/2.f*bq1*bq2 + kp;
1858 const float_v& c1 = -(bq1*kd + pt12*bq2);
1859 const float_v&
c2 = bq2*kd + pt22*bq1;
1861 float_v d1 = pt12*pt22 - kd*kd;
1862 d1(d1 < float_v(Vc::Zero)) = float_v(Vc::Zero);
1864 float_v d2 = pt12*pt22 - kd*kd;
1865 d2(d2 < float_v(Vc::Zero)) = float_v(Vc::Zero);
1868 float_v dS1dR1[2][6];
1869 float_v dS2dR2[2][6];
1871 float_v dS1dR2[2][6];
1872 float_v dS2dR1[2][6];
1874 float_v dk11dr1[6] = {bq2*px1, bq2*py1, 0.f, bq2*dx0 - py2, bq2*dy0 + px2, 0.f};
1875 float_v dk11dr2[6] = {-bq2*px1, -bq2*py1, 0.f, py1, -px1, 0.f};
1876 float_v dk12dr1[6] = {bq1*px2, bq1*py2, 0.f, -py2, px2, 0.f};
1877 float_v dk12dr2[6] = {-bq1*px2, -bq1*py2, 0.f, bq1*dx0 + py1, bq1*dy0 - px1, 0.f};
1878 float_v dk21dr1[6] = {bq1*bq2*py1, -bq1*bq2*px1, 0.f, 2.f*bq2*px1 + bq1*(-(bq2*dy0) - px2), 2.f*bq2*py1 + bq1*(bq2*dx0 - py2), 0.
f};
1879 float_v dk21dr2[6] = {-(bq1*bq2*py1), bq1*bq2*px1, 0.
f, -(bq1*px1), -(bq1*py1), 0.
f};
1880 float_v dk22dr1[6] = {bq1*bq2*py2, -(bq1*bq2*px2), 0.
f, bq2*px2, bq2*py2, 0.
f};
1881 float_v dk22dr2[6] = {-(bq1*bq2*py2), bq1*bq2*px2, 0.
f, bq2*(-(bq1*dy0) + px1) - 2.
f*bq1*px2, bq2*(bq1*dx0 + py1) - 2.f*bq1*py2, 0.f};
1883 float_v dkddr1[6] = {bq1*bq2*dx0 + bq2*py1 - bq1*py2, bq1*bq2*dy0 - bq2*px1 + bq1*px2, 0.f, -bq2*dy0 - px2, bq2*dx0 - py2, 0.f};
1884 float_v dkddr2[6] = {-bq1*bq2*dx0 - bq2*py1 + bq1*py2, -bq1*bq2*dy0 + bq2*px1 - bq1*px2, 0.f, bq1*dy0 - px1, -bq1*dx0 - py1, 0.f};
1886 float_v dc1dr1[6] = {-(bq1*(bq1*bq2*dx0 + bq2*py1 - bq1*py2)), -(bq1*(bq1*bq2*dy0 - bq2*px1 + bq1*px2)), 0.f, -2.f*bq2*px1 - bq1*(-(bq2*dy0) - px2), -2.f*bq2*py1 - bq1*(bq2*dx0 - py2), 0.
f};
1887 float_v dc1dr2[6] = {-(bq1*(-(bq1*bq2*dx0) - bq2*py1 + bq1*py2)), -(bq1*(-(bq1*bq2*dy0) + bq2*px1 - bq1*px2)), 0.f, -(bq1*(bq1*dy0 - px1)), -(bq1*(-(bq1*dx0) - py1)), 0.
f};
1889 float_v dc2dr1[6] = {bq2*(bq1*bq2*dx0 + bq2*py1 - bq1*py2), bq2*(bq1*bq2*dy0 - bq2*px1 + bq1*px2), 0.f, bq2*(-(bq2*dy0) - px2), bq2*(bq2*dx0 - py2), 0.
f};
1890 float_v dc2dr2[6] = {bq2*(-(bq1*bq2*dx0) - bq2*py1 + bq1*py2), bq2*(-(bq1*bq2*dy0) + bq2*px1 - bq1*px2), 0.f, bq2*(bq1*dy0 - px1) + 2.
f*bq1*px2, bq2*(-(bq1*dx0) - py1) + 2.
f*bq1*py2, 0.
f};
1892 float_v dd1dr1[6] = {0.f,0.f,0.f,0.f,0.f,0.f};
1893 float_v dd1dr2[6] = {0.f,0.f,0.f,0.f,0.f,0.f};
1895 for(
int i=0;
i<6;
i++)
1897 dd1dr1[
i](d1>0.f) = -kd/d1*dkddr1[
i];
1898 dd1dr2[
i](d1>0.f) = -kd/d1*dkddr2[
i];
1900 dd1dr1[3](d1>0.f) += px1/d1*pt22; dd1dr1[4](d1>0.f) += py1/d1*pt22;
1901 dd1dr2[3](d1>0.f) += px2/d1*pt12; dd1dr2[4](d1>0.f) += py2/d1*pt12;
1905 if( ! ( (!isStraight1).isEmpty() ) )
1907 dS1[0](!isStraight1) = KFPMath::ATan2( (bq1*k11*c1 + k21*d1*bq1), (bq1*k11*d1*bq1 - k21*c1) )/bq1;
1908 dS1[1](!isStraight1) = KFPMath::ATan2( (bq1*k11*c1 - k21*d1*bq1), (-bq1*k11*d1*bq1 - k21*c1) )/bq1;
1910 float_v
a = bq1*(k11*c1 + k21*d1);
1911 float_v
b = bq1*k11*d1*bq1 - k21*c1;
1912 for(
int iP=0; iP<6; iP++)
1914 const float_v dadr1 = bq1*( dk11dr1[iP]*c1 + k11*dc1dr1[iP] + dk21dr1[iP]*d1 + k21*dd1dr1[iP] );
1915 const float_v dadr2 = bq1*( dk11dr2[iP]*c1 + k11*dc1dr2[iP] + dk21dr2[iP]*d1 + k21*dd1dr2[iP] );
1916 const float_v dbdr1 = bq1*bq1*( dk11dr1[iP]*d1 + k11*dd1dr1[iP] ) - ( dk21dr1[iP]*c1 + k21*dc1dr1[iP] );
1917 const float_v dbdr2 = bq1*bq1*( dk11dr2[iP]*d1 + k11*dd1dr2[iP] ) - ( dk21dr2[iP]*c1 + k21*dc1dr2[iP] );
1919 dS1dR1[0][iP](!isStraight1) = 1/bq1 * 1/( b*b + a*a ) * ( dadr1*b - dbdr1*
a );
1920 dS1dR2[0][iP](!isStraight1) = 1/bq1 * 1/( b*b + a*a ) * ( dadr2*b - dbdr2*
a );
1923 a = bq1*(k11*c1 - k21*d1);
1924 b = -bq1*k11*d1*bq1 - k21*c1;
1925 for(
int iP=0; iP<6; iP++)
1927 const float_v dadr1 = bq1*( dk11dr1[iP]*c1 + k11*dc1dr1[iP] - (dk21dr1[iP]*d1 + k21*dd1dr1[iP]) );
1928 const float_v dadr2 = bq1*( dk11dr2[iP]*c1 + k11*dc1dr2[iP] - (dk21dr2[iP]*d1 + k21*dd1dr2[iP]) );
1929 const float_v dbdr1 = -bq1*bq1*( dk11dr1[iP]*d1 + k11*dd1dr1[iP] ) - ( dk21dr1[iP]*c1 + k21*dc1dr1[iP] );
1930 const float_v dbdr2 = -bq1*bq1*( dk11dr2[iP]*d1 + k11*dd1dr2[iP] ) - ( dk21dr2[iP]*c1 + k21*dc1dr2[iP] );
1932 dS1dR1[1][iP](!isStraight1) = 1/bq1 * 1/( b*b + a*a ) * ( dadr1*b - dbdr1*
a );
1933 dS1dR2[1][iP](!isStraight1) = 1/bq1 * 1/( b*b + a*a ) * ( dadr2*b - dbdr2*
a );
1936 if( ! ( (!isStraight2).isEmpty() ) )
1938 dS2[0](!isStraight2) = KFPMath::ATan2( (bq2*k12*c2 + k22*d2*bq2), (bq2*k12*d2*bq2 - k22*
c2) )/bq2;
1939 dS2[1](!isStraight2) = KFPMath::ATan2( (bq2*k12*c2 - k22*d2*bq2), (-bq2*k12*d2*bq2 - k22*
c2) )/bq2;
1941 float_v
a = bq2*(k12*c2 + k22*d2);
1942 float_v
b = bq2*k12*d2*bq2 - k22*
c2;
1943 for(
int iP=0; iP<6; iP++)
1945 const float_v dadr1 = bq2*( dk12dr1[iP]*c2 + k12*dc2dr1[iP] + dk22dr1[iP]*d1 + k22*dd1dr1[iP] );
1946 const float_v dadr2 = bq2*( dk12dr2[iP]*c2 + k12*dc2dr2[iP] + dk22dr2[iP]*d1 + k22*dd1dr2[iP] );
1947 const float_v dbdr1 = bq2*bq2*( dk12dr1[iP]*d1 + k12*dd1dr1[iP] ) - (dk22dr1[iP]*c2 + k22*dc2dr1[iP]);
1948 const float_v dbdr2 = bq2*bq2*( dk12dr2[iP]*d1 + k12*dd1dr2[iP] ) - (dk22dr2[iP]*c2 + k22*dc2dr2[iP]);
1950 dS2dR1[0][iP](!isStraight2) = 1/bq2 * 1/( b*b + a*a ) * ( dadr1*b - dbdr1*
a );
1951 dS2dR2[0][iP](!isStraight2) = 1/bq2 * 1/( b*b + a*a ) * ( dadr2*b - dbdr2*
a );
1954 a = bq2*(k12*c2 - k22*d2);
1955 b = -bq2*k12*d2*bq2 - k22*
c2;
1956 for(
int iP=0; iP<6; iP++)
1958 const float_v dadr1 = bq2*( dk12dr1[iP]*c2 + k12*dc2dr1[iP] - (dk22dr1[iP]*d1 + k22*dd1dr1[iP]) );
1959 const float_v dadr2 = bq2*( dk12dr2[iP]*c2 + k12*dc2dr2[iP] - (dk22dr2[iP]*d1 + k22*dd1dr2[iP]) );
1960 const float_v dbdr1 = -bq2*bq2*( dk12dr1[iP]*d1 + k12*dd1dr1[iP] ) - (dk22dr1[iP]*c2 + k22*dc2dr1[iP]);
1961 const float_v dbdr2 = -bq2*bq2*( dk12dr2[iP]*d1 + k12*dd1dr2[iP] ) - (dk22dr2[iP]*c2 + k22*dc2dr2[iP]);
1963 dS2dR1[1][iP](!isStraight2) = 1/bq2 * 1/( b*b + a*a ) * ( dadr1*b - dbdr1*
a );
1964 dS2dR2[1][iP](!isStraight2) = 1/bq2 * 1/( b*b + a*a ) * ( dadr2*b - dbdr2*
a );
1967 if( ! ( isStraight1.isEmpty() ) )
1969 dS1[0](isStraight1 && (pt12>float_v(Vc::Zero)) ) = (k11*c1 + k21*d1)/(- k21*c1);
1970 dS1[1](isStraight1 && (pt12>float_v(Vc::Zero)) ) = (k11*c1 - k21*d1)/(- k21*c1);
1972 float_v
a = k11*c1 + k21*d1;
1973 float_v
b = -k21*c1;
1975 for(
int iP=0; iP<6; iP++)
1977 const float_v dadr1 = ( dk11dr1[iP]*c1 + k11*dc1dr1[iP] + dk21dr1[iP]*d1 + k21*dd1dr1[iP] );
1978 const float_v dadr2 = ( dk11dr2[iP]*c1 + k11*dc1dr2[iP] + dk21dr2[iP]*d1 + k21*dd1dr2[iP] );
1979 const float_v dbdr1 = -( dk21dr1[iP]*c1 + k21*dc1dr1[iP] );
1980 const float_v dbdr2 = -( dk21dr2[iP]*c1 + k21*dc1dr2[iP] );
1982 dS1dR1[0][iP](isStraight1 && (pt12>float_v(Vc::Zero)) ) = dadr1/b - dbdr1*a/(b*
b) ;
1983 dS1dR2[0][iP](isStraight1 && (pt12>float_v(Vc::Zero)) ) = dadr2/b - dbdr2*a/(b*
b) ;
1986 a = k11*c1 - k21*d1;
1987 for(
int iP=0; iP<6; iP++)
1989 const float_v dadr1 = ( dk11dr1[iP]*c1 + k11*dc1dr1[iP] - dk21dr1[iP]*d1 - k21*dd1dr1[iP] );
1990 const float_v dadr2 = ( dk11dr2[iP]*c1 + k11*dc1dr2[iP] - dk21dr2[iP]*d1 - k21*dd1dr2[iP] );
1991 const float_v dbdr1 = -( dk21dr1[iP]*c1 + k21*dc1dr1[iP] );
1992 const float_v dbdr2 = -( dk21dr2[iP]*c1 + k21*dc1dr2[iP] );
1994 dS1dR1[1][iP](isStraight1 && (pt12>float_v(Vc::Zero)) ) = dadr1/b - dbdr1*a/(b*
b) ;
1995 dS1dR2[1][iP](isStraight1 && (pt12>float_v(Vc::Zero)) ) = dadr2/b - dbdr2*a/(b*
b) ;
1998 if( ! ( isStraight2.isEmpty() ) )
2000 dS2[0](isStraight2 && (pt22>float_v(Vc::Zero)) ) = (k12*c2 + k22*d2)/(- k22*c2);
2001 dS2[1](isStraight2 && (pt22>float_v(Vc::Zero)) ) = (k12*c2 - k22*d2)/(- k22*c2);
2003 float_v
a = k12*c2 + k22*d1;
2004 float_v
b = -k22*
c2;
2006 for(
int iP=0; iP<6; iP++)
2008 const float_v dadr1 = ( dk12dr1[iP]*c2 + k12*dc2dr1[iP] + dk22dr1[iP]*d1 + k22*dd1dr1[iP] );
2009 const float_v dadr2 = ( dk12dr2[iP]*c2 + k12*dc2dr2[iP] + dk22dr2[iP]*d1 + k22*dd1dr2[iP] );
2010 const float_v dbdr1 = -( dk22dr1[iP]*c2 + k22*dc2dr1[iP] );
2011 const float_v dbdr2 = -( dk22dr2[iP]*c2 + k22*dc2dr2[iP] );
2013 dS2dR1[0][iP](isStraight2 && (pt22>float_v(Vc::Zero)) ) = dadr1/b - dbdr1*a/(b*
b) ;
2014 dS2dR2[0][iP](isStraight2 && (pt22>float_v(Vc::Zero)) ) = dadr2/b - dbdr2*a/(b*
b) ;
2017 a = k12*c2 - k22*d1;
2018 for(
int iP=0; iP<6; iP++)
2020 const float_v dadr1 = ( dk12dr1[iP]*c2 + k12*dc2dr1[iP] - dk22dr1[iP]*d1 - k22*dd1dr1[iP] );
2021 const float_v dadr2 = ( dk12dr2[iP]*c2 + k12*dc2dr2[iP] - dk22dr2[iP]*d1 - k22*dd1dr2[iP] );
2022 const float_v dbdr1 = -( dk22dr1[iP]*c2 + k22*dc2dr1[iP] );
2023 const float_v dbdr2 = -( dk22dr2[iP]*c2 + k22*dc2dr2[iP] );
2025 dS2dR1[1][iP](isStraight2 && (pt22>float_v(Vc::Zero)) ) = dadr1/b - dbdr1*a/(b*
b) ;
2026 dS2dR2[1][iP](isStraight2 && (pt22>float_v(Vc::Zero)) ) = dadr2/b - dbdr2*a/(b*
b) ;
2033 for(
int iP = 0; iP<2; iP++)
2035 const float_v& bs1 = bq1*dS1[iP];
2036 const float_v& bs2 = bq2*dS2[iP];
2037 float_v sss = sin(bs1), ccc = cos(bs1);
2039 const float_m& bs1Big = abs(bs1) > 1.e-8
f;
2040 const float_m& bs2Big = abs(bs2) > 1.e-8
f;
2042 float_v sB(Vc::Zero), cB(Vc::Zero);
2043 sB(bs1Big) = sss/bq1;
2044 sB(!bs1Big) = ((1.f-bs1*kOvSqr6)*(1.
f+bs1*kOvSqr6)*dS1[iP]);
2045 cB(bs1Big) = (1.f-ccc)/bq1;
2046 cB(!bs1Big) = .5f*sB*bs1;
2048 const float_v& x1 = param1[0] + sB*px1 + cB*py1;
2049 const float_v& y1 = param1[1] - cB*px1 + sB*py1;
2050 const float_v& z1 = param1[2] + dS1[iP]*param1[5];
2052 sss = sin(bs2); ccc = cos(bs2);
2054 sB(bs2Big) = sss/bq2;
2055 sB(!bs2Big) = ((1.f-bs2*kOvSqr6)*(1.
f+bs2*kOvSqr6)*dS2[iP]);
2056 cB(bs2Big) = (1.f-ccc)/bq2;
2057 cB(!bs2Big) = .5f*sB*bs2;
2059 const float_v& x2 = param2[0] + sB*px2 + cB*py2;
2060 const float_v& y2 = param2[1] - cB*px2 + sB*py2;
2061 const float_v& z2 = param2[2] + dS2[iP]*param2[5];
2063 float_v dx = (x1-x2);
2064 float_v
dy = (y1-y2);
2065 float_v
dz = (z1-z2);
2067 dr2[iP] = dx*dx + dy*dy + dz*
dz;
2070 float_v pointParam[2][8];
2071 float_v pointCov[2][36];
2073 float_v dsdrM1[6] = {0.f,0.f,0.f,0.f,0.f,0.f};
2074 for(
int iP=0; iP<6; iP++)
2075 dsdrM1[iP] = (dS1dR1[0][iP] + dS1dR1[1][iP])/2.f;
2076 Transport((dS1[0] + dS1[1]) / 2.
f, dsdrM1, pointParam[0], pointCov[0]);
2077 float_v dsdrM2[6] = {0.f,0.f,0.f,0.f,0.f,0.f};
2078 for(
int iP=0; iP<6; iP++)
2079 dsdrM2[iP] = (dS2dR2[0][iP] + dS2dR2[1][iP])/2.f;
2080 p.
Transport((dS2[0] + dS2[1]) / 2.
f, dsdrM2, pointParam[1], pointCov[1]);
2082 const float_v drPoint[3] = { pointParam[0][0] - pointParam[1][0], pointParam[0][1] - pointParam[1][1], pointParam[0][2] - pointParam[1][2] } ;
2083 const float_v covPoint[6] = { pointCov[0][0] + pointCov[1][0],
2084 pointCov[0][1] + pointCov[1][1],
2085 pointCov[0][2] + pointCov[1][2],
2086 pointCov[0][3] + pointCov[1][3],
2087 pointCov[0][4] + pointCov[1][4],
2088 pointCov[0][5] + pointCov[1][5] };
2089 float_v dr2Points = drPoint[0]*drPoint[0] + drPoint[1]*drPoint[1] + drPoint[2]*drPoint[2];
2090 float_v dr2PointCov = drPoint[0]*drPoint[0]*covPoint[0] + drPoint[1]*drPoint[1]*covPoint[2] + drPoint[2]*drPoint[2]*covPoint[5] +
2091 2.f*( drPoint[0]*drPoint[1]*covPoint[1] + drPoint[0]*drPoint[2]*covPoint[3] + drPoint[1]*drPoint[2]*covPoint[4] );
2092 const float_m isMiddlePoint = (dr2Points*dr2Points < 25.f*dr2PointCov);
2093 const float_m isFirstRoot = (dr2[0] < dr2[1]) & (!isMiddlePoint);
2097 dS[0](isFirstRoot) = dS1[0];
2098 dS[1](isFirstRoot) = dS2[0];
2100 for(
int iP=0; iP<6; iP++)
2102 dsdr[0][iP](isFirstRoot) = dS1dR1[0][iP];
2103 dsdr[1][iP](isFirstRoot) = dS1dR2[0][iP];
2104 dsdr[2][iP](isFirstRoot) = dS2dR1[0][iP];
2105 dsdr[3][iP](isFirstRoot) = dS2dR2[0][iP];
2110 dS[0](!isFirstRoot) = dS1[1];
2111 dS[1](!isFirstRoot) = dS2[1];
2113 for(
int iP=0; iP<6; iP++)
2115 dsdr[0][iP](!isFirstRoot) = dS1dR1[1][iP];
2116 dsdr[1][iP](!isFirstRoot) = dS1dR2[1][iP];
2117 dsdr[2][iP](!isFirstRoot) = dS2dR1[1][iP];
2118 dsdr[3][iP](!isFirstRoot) = dS2dR2[1][iP];
2123 dS[0](isMiddlePoint) = (dS1[0] + dS1[1]) / 2.f;
2124 dS[1](isMiddlePoint) = (dS2[0] + dS2[1]) / 2.f;
2126 for(
int iP=0; iP<6; iP++)
2128 dsdr[0][iP](isMiddlePoint) = (dS1dR1[1][iP] + dS1dR1[0][iP])/2.f;
2129 dsdr[1][iP](isMiddlePoint) = (dS1dR2[1][iP] + dS1dR2[0][iP])/2.f;
2130 dsdr[2][iP](isMiddlePoint) = (dS2dR1[1][iP] + dS2dR1[0][iP])/2.f;
2131 dsdr[3][iP](isMiddlePoint) = (dS2dR2[1][iP] + dS2dR2[0][iP])/2.f;
2139 const float_v pi2(6.283185307
f);
2170 const float_v& bs1 = bq1*dS[0];
2171 const float_v& bs2 = bq2*dS[1];
2173 float_v sss = KFPMath::Sin(bs1), ccc = KFPMath::Cos(bs1);
2174 const float_v& xr1 = sss*px1 - ccc*py1;
2175 const float_v& yr1 = ccc*px1 + sss*py1;
2177 float_v sss1 = KFPMath::Sin(bs2), ccc1 = KFPMath::Cos(bs2);
2178 const float_v& xr2 = sss1*px2 - ccc1*py2;
2179 const float_v& yr2 = ccc1*px2 + sss1*py2;
2181 const float_v& br = xr1*xr2 + yr1*yr2;
2182 const float_v& dx0mod = dx0*bq1*bq2 + py1*bq2 - py2*bq1;
2183 const float_v& dy0mod = dy0*bq1*bq2 - px1*bq2 + px2*bq1;
2184 const float_v& ar1 = dx0mod*xr1 + dy0mod*yr1;
2185 const float_v& ar2 = dx0mod*xr2 + dy0mod*yr2;
2186 const float_v& cz = (z01 - z02) + dS[0]*pz1 - dS[1]*pz2;
2188 float_v kz11 = - ar1 + bq1*br + bq2*pz1*pz1;
2189 float_v kz12 = -bq2*(br+pz1*pz2);
2190 float_v kz21 = bq1*(br+pz1*pz2);
2191 float_v kz22 = - ar2 - bq2*br - bq1*pz2*pz2;
2193 kz11(isStraight2) = pz1*pz1 + (px1*px1+py1*py1)*ccc + bq1*( (px2*dS[1] - dx0)*xr1 + (py2*dS[1] - dy0)*yr1 );
2194 kz12(isStraight2) = -(br + pz1*pz2);
2195 kz21(isStraight1) = (br + pz1*pz2);
2196 kz22(isStraight1) = -pz2*pz2 - (px2*px2+py2*py2)*ccc1 - bq2*( (px1*dS[0] + dx0)*xr2 + (py1*dS[0] + dy0)*yr2 );
2198 const float_v&
delta = kz11*kz22 - kz12*kz21;
2199 float_v sz1(Vc::Zero);
2200 float_v sz2(Vc::Zero);
2203 float_v aaa1 = -cz*(pz1*bq2*kz22 - pz2*bq1*kz12);
2204 float_v aaa2 = -cz*(pz2*bq1*kz11 - pz1*bq2*kz21);
2206 aaa1(isStraight2) = -cz*(pz1*kz22 - pz2*bq1*kz12);
2207 aaa2(isStraight2) = -cz*(pz2*bq1*kz11 - pz1*kz21);
2209 aaa1(isStraight1) = -cz*(pz1*bq2*kz22 - pz2*kz12);
2210 aaa2(isStraight1) = -cz*(pz2*kz11 - pz1*bq2*kz21);
2212 sz1( abs(delta) > 1.
e-16
f ) = aaa1 /
delta;
2213 sz2( abs(delta) > 1.
e-16
f ) = aaa2 /
delta;
2215 float_v dkz11dr1[6] = {-(bq1*bq2*xr1), -(bq1*bq2*yr1), 0.f,
2216 -ccc*dy0mod - dx0mod*sss + bq2*yr1 + bq1*(sss*xr2 + ccc*yr2),
2217 ccc*dx0mod - dy0mod*sss - bq2*xr1 + bq1*(-ccc*xr2 + sss*yr2), 2.f*bq2*pz1};
2218 dkz11dr1[0](isStraight2) = -bq1*xr1;
2219 dkz11dr1[1](isStraight2) = -bq1*yr1;
2220 dkz11dr1[3](isStraight2) = 2.
f*ccc*px1 + bq1*(sss*(dS[1]*px2 - x01 + x02) + ccc*(dS[1]*py2 - y01 + y02));
2221 dkz11dr1[4](isStraight2) = 2.
f*ccc*py1 + bq1*(-(ccc*(dS[1]*px2 - x01 + x02)) + sss*(dS[1]*py2 - y01 + y02));
2222 dkz11dr1[5](isStraight2) = 2.
f*pz1;
2223 float_v dkz11dr2[6] = {bq1*bq2*xr1, bq1*bq2*yr1, 0.f, -bq1*yr1 + bq1*(sss1*xr1 + ccc1*yr1), bq1*xr1 + bq1*(-ccc1*xr1 + sss1*yr1), 0.f};
2224 dkz11dr2[0](isStraight2) = bq1*xr1;
2225 dkz11dr2[1](isStraight2) = bq1*yr1;
2226 dkz11dr2[3](isStraight2) = bq1*dS[1]*xr1;
2227 dkz11dr2[4](isStraight2) = bq1*dS[1]*yr1;
2229 float_v dkz12dr1[6] = {0.f, 0.f, 0.f, -bq2*(sss*xr2 + ccc*yr2), -bq2*(-ccc*xr2 + sss*yr2), -bq2*pz2};
2230 dkz12dr1[3](isStraight2) = -(sss*xr2 + ccc*yr2);
2231 dkz12dr1[4](isStraight2) = -(-ccc*xr2 + sss*yr2);
2232 dkz12dr1[5](isStraight2) = -pz2;
2233 float_v dkz12dr2[6] = {0.f, 0.f, 0.f, -bq2*(sss1*xr1 + ccc1*yr1), -bq2*(-ccc1*xr1 + sss1*yr1), -bq2*pz1};
2234 dkz12dr2[3](isStraight2) = -(sss1*xr1 + ccc1*yr1);
2235 dkz12dr2[4](isStraight2) = -(-ccc1*xr1 + sss1*yr1);
2236 dkz12dr2[5](isStraight2) = -pz1;
2237 float_v dkz21dr1[6] = {0.f, 0.f, 0.f, bq1*(sss*xr2 + ccc*yr2), bq1*(-ccc*xr2 + sss*yr2), bq1*pz2};
2238 dkz21dr1[3](isStraight1) = yr2;
2239 dkz21dr1[4](isStraight1) = -xr2;
2240 dkz21dr1[5](isStraight1) = pz2;
2241 float_v dkz21dr2[6] = {0.f, 0.f, 0.f, bq1*(sss1*xr1 + ccc1*yr1), bq1*(-ccc1*xr1 + sss1*yr1), bq1*pz1};
2242 dkz21dr2[3](isStraight1) = (sss1*xr1 + ccc1*yr1);
2243 dkz21dr2[4](isStraight1) = (-ccc1*xr1 + sss1*yr1);
2244 dkz21dr2[5](isStraight1) = pz1;
2245 float_v dkz22dr1[6] = {-bq1*bq2*xr2, -bq1*bq2*yr2, 0.f, bq2*yr2 - bq2*(sss*xr2 + ccc*yr2), -bq2*xr2 - bq2*(-ccc*xr2 + sss*yr2), 0.f};
2246 dkz22dr1[0](isStraight1) = -(bq2*xr2);
2247 dkz22dr1[1](isStraight1) = -(bq2*yr2);
2248 dkz22dr1[3](isStraight1) = -(bq2*dS[0]*xr2);
2249 dkz22dr1[4](isStraight1) = -(bq2*dS[0]*yr2);
2250 float_v dkz22dr2[6] = {bq1*bq2*xr2, bq1*bq2*yr2, 0.f,
2251 -ccc1*dy0mod - dx0mod*sss1 - bq2*(sss1*xr1 + ccc1*yr1) - bq1*yr2,
2252 ccc1*dx0mod - dy0mod*sss1 + bq1*xr2 - bq2*(-ccc1*xr1 + sss1*yr1), -2.f*bq1*pz2};
2253 dkz22dr2[0](isStraight1) = bq2*xr2;
2254 dkz22dr2[1](isStraight1) = bq2*yr2;
2255 dkz22dr2[3](isStraight1) = -2.
f*ccc1*px2 - bq2*(ccc1*(dy0 + dS[0]*py1) + (dx0 + dS[0]*px1)*sss1);
2256 dkz22dr2[4](isStraight1) = -2.
f*ccc1*py2 - bq2*(-(ccc1*(dx0 + dS[0]*px1)) + (dy0 + dS[0]*py1)*sss1);
2257 dkz22dr2[5](isStraight1) = -2.
f*pz2;
2259 float_v dczdr1[6] = {0.f, 0.f, 1.f, 0.f, 0.f, dS[0]};
2260 float_v dczdr2[6] = {0.f, 0.f, -1.f, 0.f, 0.f, -dS[1]};
2262 float_v daaa1dr1[6];
2263 float_v daaa1dr2[6];
2264 float_v daaa2dr2[6];
2265 float_v daaa2dr1[6];
2266 float_v dDeltadr1[6];
2267 float_v dDeltadr2[6];
2268 for(
int iP=0; iP<6; iP++)
2270 daaa1dr1[iP] = -( dczdr1[iP]*(pz1*bq2*kz22 - pz2*bq1*kz12) + cz*( bq2*pz1*dkz22dr1[iP] - bq1*pz2*dkz12dr1[iP] ) );
2271 daaa1dr2[iP] = -( dczdr2[iP]*(pz1*bq2*kz22 - pz2*bq1*kz12) + cz*( bq2*pz1*dkz22dr2[iP] - bq1*pz2*dkz12dr2[iP] ) );
2273 daaa2dr2[iP] = -( dczdr2[iP]*(pz2*bq1*kz11 - pz1*bq2*kz21) + cz*( bq1*pz2*dkz11dr2[iP] - bq2*pz1*dkz21dr2[iP] ) );
2274 daaa2dr1[iP] = -( dczdr1[iP]*(pz2*bq1*kz11 - pz1*bq2*kz21) + cz*( bq1*pz2*dkz11dr1[iP] - bq2*pz1*dkz21dr1[iP] ) );
2276 dDeltadr1[iP] = kz11*dkz22dr1[iP] + dkz11dr1[iP]*kz11 - kz12*dkz21dr1[iP] - dkz12dr1[iP]*kz21;
2277 dDeltadr2[iP] = kz11*dkz22dr2[iP] + dkz11dr2[iP]*kz11 - kz12*dkz21dr2[iP] - dkz12dr2[iP]*kz21;
2279 daaa1dr1[5] -= cz*bq2*kz22;
2280 daaa1dr2[5] += cz*bq1*kz12;
2281 daaa2dr2[5] -= cz*bq1*kz11;
2282 daaa2dr1[5] += cz*bq2*kz21;
2285 float_v dkz11ds0 = bq1*(dy0mod*xr1 - dx0mod*yr1 + bq1*(xr2*yr1 - xr1*yr2));
2286 dkz11ds0(isStraight2) = -(bq1*(px1*px1 + py1*py1)*sss) + bq1*(bq1*yr1*(dS[1]*px2 - x01 + x02) -bq1*xr1*(dS[1]*py2 - y01 + y02));
2287 float_v dkz11ds1 = bq1*bq2*( xr1*yr2 - xr2*yr1 );
2288 dkz11ds1(isStraight2) = bq1*(px2*xr1 + py2*yr1);
2289 float_v dkz12ds0 = bq2*bq1*( xr1*yr2 - xr2*yr1 );
2290 dkz12ds0(isStraight2) = bq1*( xr1*yr2 - xr2*yr1 );
2291 float_v dkz12ds1 = bq2*bq2*( xr2*yr1 - xr1*yr2 );
2292 dkz12ds1(isStraight2) = 0;
2293 float_v dkz21ds0 = bq1*bq1*( xr2*yr1 - xr1*yr2 );
2294 dkz21ds0(isStraight1) = 0.f;
2295 float_v dkz21ds1 = bq1*bq2*( xr1*yr2 - xr2*yr1 );
2296 dkz21ds1(isStraight1) = px1*(bq2*ccc1*py2 - bq2*px2*sss1) - py1*(bq2*ccc1*px2 + bq2*py2*sss1);
2297 float_v dkz22ds0 = bq1*bq2*( xr1*yr2 - xr2*yr1 );
2298 dkz22ds0(isStraight1) = -bq2*(px1*xr2 + py1*yr2);
2299 float_v dkz22ds1 = -bq2*( dy0mod*xr2 - dx0mod*yr2 - bq2*(xr2*yr1 - xr1*yr2) );
2300 dkz22ds1(isStraight1) = bq2*(px2*px2 + py2*py2)*sss1 - bq2*((dy0 + dS[0]*py1)*(bq2*ccc1*py2 - bq2*px2*sss1) + (dx0 + dS[0]*px1)*(bq2*ccc1*px2 + bq2*py2*sss1));
2301 const float_v dczds0 = pz1;
2302 const float_v dczds1 = -pz2;
2303 const float_v da1ds0 = -( dczds0*(pz1*bq2*kz22 - pz2*bq1*kz12) + cz*(pz1*bq2*dkz22ds0 - pz2*bq1*dkz12ds0));
2304 const float_v da1ds1 = -( dczds1*(pz1*bq2*kz22 - pz2*bq1*kz12) + cz*(pz1*bq2*dkz22ds1 - pz2*bq1*dkz12ds1));
2305 const float_v da2ds0 = -( dczds0*(pz2*bq1*kz11 - pz1*bq2*kz21) + cz*(pz2*bq1*dkz11ds0 - pz1*bq2*dkz21ds0));
2306 const float_v da2ds1 = -( dczds1*(pz2*bq1*kz11 - pz1*bq2*kz21) + cz*(pz2*bq1*dkz11ds1 - pz1*bq2*dkz21ds1));
2307 const float_v dDeltads0 = kz11*dkz22ds0 + dkz11ds0*kz11 - kz12*dkz21ds0 - dkz12ds0*kz21;
2308 const float_v dDeltads1 = kz11*dkz22ds1 + dkz11ds1*kz11 - kz12*dkz21ds1 - dkz12ds1*kz21;
2310 const float_v dsz1ds0 = da1ds0/delta - aaa1*dDeltads0/(delta*
delta);
2311 const float_v dsz1ds1 = da1ds1/delta - aaa1*dDeltads1/(delta*
delta);
2312 const float_v dsz2ds0 = da2ds0/delta - aaa2*dDeltads0/(delta*
delta);
2313 const float_v dsz2ds1 = da2ds1/delta - aaa2*dDeltads1/(delta*
delta);
2315 float_v dszdr[4][6];
2316 for(
int iP=0; iP<6; iP++)
2318 dszdr[0][iP] = dsz1ds0*dsdr[0][iP] + dsz1ds1*dsdr[2][iP];
2319 dszdr[1][iP] = dsz1ds0*dsdr[1][iP] + dsz1ds1*dsdr[3][iP];
2320 dszdr[2][iP] = dsz2ds0*dsdr[0][iP] + dsz2ds1*dsdr[2][iP];
2321 dszdr[3][iP] = dsz2ds0*dsdr[1][iP] + dsz2ds1*dsdr[3][iP];
2324 for(
int iP=0; iP<6; iP++)
2326 dsdr[0][iP]( abs(delta) > 1.e-16
f ) += daaa1dr1[iP]/delta - aaa1*dDeltadr1[iP]/(delta*delta) + dszdr[0][iP];
2327 dsdr[1][iP]( abs(delta) > 1.e-16
f ) += daaa1dr2[iP]/delta - aaa1*dDeltadr2[iP]/(delta*delta) + dszdr[1][iP];
2328 dsdr[2][iP]( abs(delta) > 1.e-16
f ) += daaa2dr1[iP]/delta - aaa2*dDeltadr1[iP]/(delta*delta) + dszdr[2][iP];
2329 dsdr[3][iP]( abs(delta) > 1.e-16
f ) += daaa2dr2[iP]/delta - aaa2*dDeltadr2[iP]/(delta*delta) + dszdr[3][iP];
2340 const float_v& bs1 = bq1*dS[0];
2341 const float_v& bs2 = bq2*dS[1];
2342 float_v sss = sin(bs1), ccc = cos(bs1);
2344 const float_m& bs1Big = abs(bs1) > 1.e-8
f;
2345 const float_m& bs2Big = abs(bs2) > 1.e-8
f;
2347 float_v sB(0.
f), cB(0.
f);
2348 sB(bs1Big) = sss/bq1;
2349 cB(bs1Big) = (1.f-ccc)/bq1;
2350 sB(!bs1Big) = ((1.f-bs1*kOvSqr6)*(1.
f+bs1*kOvSqr6)*dS[0]);
2351 cB(!bs1Big) = .5f*sB*bs1;
2353 const float_v& x1 = x01 + sB*px1 + cB*py1;
2354 const float_v& y1 = y01 - cB*px1 + sB*py1;
2355 const float_v& z1 = z01 + dS[0]*pz1;
2356 const float_v& ppx1 = ccc*px1 + sss*py1;
2357 const float_v& ppy1 = -sss*px1 + ccc*py1;
2358 const float_v& ppz1 = pz1;
2360 float_v sss1 = sin(bs2), ccc1 = cos(bs2);
2362 float_v sB1(0.
f), cB1(0.
f);
2363 sB1(bs2Big) = sss1/bq2;
2364 cB1(bs2Big) = (1.f-ccc1)/bq2;
2365 sB1(!bs2Big) = ((1.f-bs2*kOvSqr6)*(1.
f+bs2*kOvSqr6)*dS[1]);
2366 cB1(!bs2Big) = .5f*sB1*bs2;
2368 const float_v& x2 = x02 + sB1*px2 + cB1*py2;
2369 const float_v& y2 = y02 - cB1*px2 + sB1*py2;
2370 const float_v& z2 = z02 + dS[1]*pz2;
2371 const float_v& ppx2 = ccc1*px2 + sss1*py2;
2372 const float_v& ppy2 = -sss1*px2 + ccc1*py2;
2373 const float_v& ppz2 = pz2;
2375 const float_v& p12 = ppx1*ppx1 + ppy1*ppy1 + ppz1*ppz1;
2376 const float_v& p22 = ppx2*ppx2 + ppy2*ppy2 + ppz2*ppz2;
2377 const float_v& lp1p2 = ppx1*ppx2 + ppy1*ppy2 + ppz1*ppz2;
2379 const float_v& dx = (x2 - x1);
2380 const float_v&
dy = (y2 - y1);
2381 const float_v&
dz = (z2 - z1);
2383 const float_v& ldrp1 = ppx1*dx + ppy1*dy + ppz1*
dz;
2384 const float_v& ldrp2 = ppx2*dx + ppy2*dy + ppz2*
dz;
2386 float_v detp = lp1p2*lp1p2 - p12*p22;
2387 detp(abs(detp)<1.
e-4
f) = 1;
2390 const float_v a1 = ldrp2*lp1p2 - ldrp1*p22;
2391 const float_v
a2 = ldrp2*p12 - ldrp1*lp1p2;
2392 const float_v lp1p2_ds0 = bq1*( ppx2*ppy1 - ppy2*ppx1);
2393 const float_v lp1p2_ds1 = bq2*( ppx1*ppy2 - ppy1*ppx2);
2394 const float_v ldrp1_ds0 = -p12 + bq1*(ppy1*dx - ppx1*
dy);
2395 const float_v ldrp1_ds1 = lp1p2;
2396 const float_v ldrp2_ds0 = -lp1p2;
2397 const float_v ldrp2_ds1 = p22 + bq2*(ppy2*dx - ppx2*
dy);
2398 const float_v detp_ds0 = 2.f*lp1p2*lp1p2_ds0;
2399 const float_v detp_ds1 = 2.f*lp1p2*lp1p2_ds1;
2400 const float_v a1_ds0 = ldrp2_ds0*lp1p2 + ldrp2*lp1p2_ds0 - ldrp1_ds0*p22;
2401 const float_v a1_ds1 = ldrp2_ds1*lp1p2 + ldrp2*lp1p2_ds1 - ldrp1_ds1*p22;
2402 const float_v a2_ds0 = ldrp2_ds0*p12 - ldrp1_ds0*lp1p2 - ldrp1*lp1p2_ds0;
2403 const float_v a2_ds1 = ldrp2_ds1*p12 - ldrp1_ds1*lp1p2 - ldrp1*lp1p2_ds1;
2405 const float_v dsl1ds0 = a1_ds0/detp - a1*detp_ds0/(detp*detp);
2406 const float_v dsl1ds1 = a1_ds1/detp - a1*detp_ds1/(detp*detp);
2407 const float_v dsl2ds0 = a2_ds0/detp - a2*detp_ds0/(detp*detp);
2408 const float_v dsl2ds1 = a2_ds1/detp - a2*detp_ds1/(detp*detp);
2410 float_v dsldr[4][6];
2411 for(
int iP=0; iP<6; iP++)
2413 dsldr[0][iP] = dsl1ds0*dsdr[0][iP] + dsl1ds1*dsdr[2][iP];
2414 dsldr[1][iP] = dsl1ds0*dsdr[1][iP] + dsl1ds1*dsdr[3][iP];
2415 dsldr[2][iP] = dsl2ds0*dsdr[0][iP] + dsl2ds1*dsdr[2][iP];
2416 dsldr[3][iP] = dsl2ds0*dsdr[1][iP] + dsl2ds1*dsdr[3][iP];
2419 for(
int iDS=0; iDS<4; iDS++)
2420 for(
int iP=0; iP<6; iP++)
2421 dsdr[iDS][iP] += dsldr[iDS][iP];
2423 const float_v lp1p2_dr0[6] = {0.f, 0.f, 0.f, ccc*ppx2 - ppy2*sss, ccc*ppy2 + ppx2*sss, pz2};
2424 const float_v lp1p2_dr1[6] = {0.f, 0.f, 0.f, ccc1*ppx1 - ppy1*sss1, ccc1*ppy1 + ppx1*sss1, pz1};
2425 const float_v ldrp1_dr0[6] = {-ppx1, -ppy1, -pz1, cB*ppy1 - ppx1*sB + ccc*dx - sss*
dy, -cB*ppx1-ppy1*sB + sss*dx + ccc*
dy, -dS[0]*pz1 + dz};
2426 const float_v ldrp1_dr1[6] = { ppx1, ppy1, pz1, -cB1*ppy1 + ppx1*sB1, cB1*ppx1 + ppy1*sB1, dS[1]*pz1};
2427 const float_v ldrp2_dr0[6] = {-ppx2, -ppy2, -pz2, cB*ppy2 - ppx2*sB, -cB*ppx2-ppy2*sB, -dS[0]*pz2};
2428 const float_v ldrp2_dr1[6] = { ppx2, ppy2, pz2, -cB1*ppy2 + ppx2*sB1 + ccc1*dx- sss1*
dy, cB1*ppx2 + ppy2*sB1 + sss1*dx + ccc1*
dy, dz + dS[1]*pz2};
2429 const float_v p12_dr0[6] = {0.f, 0.f, 0.f, 2.f*px1, 2.f*py1, 2.f*pz1};
2430 const float_v p22_dr1[6] = {0.f, 0.f, 0.f, 2.f*px2, 2.f*py2, 2.f*pz2};
2431 float_v a1_dr0[6], a1_dr1[6], a2_dr0[6], a2_dr1[6], detp_dr0[6], detp_dr1[6];
2432 for(
int iP=0; iP<6; iP++)
2434 a1_dr0[iP] = ldrp2_dr0[iP]*lp1p2 + ldrp2*lp1p2_dr0[iP] - ldrp1_dr0[iP]*p22;
2435 a1_dr1[iP] = ldrp2_dr1[iP]*lp1p2 + ldrp2*lp1p2_dr1[iP] - ldrp1_dr1[iP]*p22 - ldrp1*p22_dr1[iP];
2436 a2_dr0[iP] = ldrp2_dr0[iP]*p12 + ldrp2*p12_dr0[iP] - ldrp1_dr0[iP]*lp1p2 - ldrp1*lp1p2_dr0[iP];
2437 a2_dr1[iP] = ldrp2_dr1[iP]*p12 - ldrp1_dr1[iP]*lp1p2 - ldrp1*lp1p2_dr1[iP];
2438 detp_dr0[iP] = 2.f*lp1p2*lp1p2_dr0[iP] - p12_dr0[iP]*p22;
2439 detp_dr1[iP] = 2.f*lp1p2*lp1p2_dr1[iP] - p12*p22_dr1[iP];
2441 dsdr[0][iP] += a1_dr0[iP]/detp - a1*detp_dr0[iP]/(detp*detp);
2442 dsdr[1][iP] += a1_dr1[iP]/detp - a1*detp_dr1[iP]/(detp*detp);
2443 dsdr[2][iP] += a2_dr0[iP]/detp - a2*detp_dr0[iP]/(detp*detp);
2444 dsdr[3][iP] += a2_dr1[iP]/detp - a2*detp_dr1[iP]/(detp*detp);
2447 dS[0] += (ldrp2*lp1p2 - ldrp1*p22) /detp;
2448 dS[1] += (ldrp2*p12 - ldrp1*lp1p2)/detp;
2453 float_v dS[2],
const float_v* param1,
const float_v* param2 )
const
2477 const float_v kOvSqr6 = 1.f/sqrt(float_v(6.
f));
2478 const float_v kCLight = 0.000299792458f;
2482 const float_v& bq1 = B*simd_cast<float_v>(
fQ)*kCLight;
2483 const float_v& bq2 = B*simd_cast<float_v>(p.
fQ)*kCLight;
2485 const float_m& isStraight1 = abs(bq1) < float_v(1.
e-8
f);
2486 const float_m& isStraight2 = abs(bq2) < float_v(1.
e-8
f);
2488 if( isStraight1.isFull() && isStraight2.isFull() )
2494 const float_v& px1 = param1[3];
2495 const float_v& py1 = param1[4];
2496 const float_v& pz1 = param1[5];
2498 const float_v& px2 = param2[3];
2499 const float_v& py2 = param2[4];
2500 const float_v& pz2 = param2[5];
2502 const float_v& pt12 = px1*px1 + py1*py1;
2503 const float_v& pt22 = px2*px2 + py2*py2;
2505 const float_v& x01 = param1[0];
2506 const float_v& y01 = param1[1];
2507 const float_v& z01 = param1[2];
2509 const float_v& x02 = param2[0];
2510 const float_v& y02 = param2[1];
2511 const float_v& z02 = param2[2];
2513 float_v dS1[2] = {0.f, 0.f}, dS2[2]={0.f, 0.f};
2515 const float_v& dx0 = (x01 - x02);
2516 const float_v& dy0 = (y01 - y02);
2517 const float_v& dr02 = dx0*dx0 + dy0*dy0;
2518 const float_v& drp1 = dx0*px1 + dy0*py1;
2519 const float_v& dxyp1 = dx0*py1 - dy0*px1;
2520 const float_v& drp2 = dx0*px2 + dy0*py2;
2521 const float_v& dxyp2 = dx0*py2 - dy0*px2;
2522 const float_v& p1p2 = px1*px2 + py1*py2;
2523 const float_v& dp1p2 = px1*py2 - px2*py1;
2525 const float_v& k11 = (bq2*drp1 - dp1p2);
2526 const float_v& k21 = (bq1*(bq2*dxyp1 - p1p2) + bq2*pt12);
2527 const float_v& k12 = ((bq1*drp2 - dp1p2));
2528 const float_v& k22 = (bq2*(bq1*dxyp2 + p1p2) - bq1*pt22);
2530 const float_v& kp = (dxyp1*bq2 - dxyp2*bq1 - p1p2);
2531 const float_v& kd = dr02/2.f*bq1*bq2 + kp;
2532 const float_v& c1 = -(bq1*kd + pt12*bq2);
2533 const float_v& c2 = bq2*kd + pt22*bq1;
2535 float_v d1 = pt12*pt22 - kd*kd;
2536 d1(d1 < float_v(Vc::Zero)) = float_v(Vc::Zero);
2538 float_v d2 = pt12*pt22 - kd*kd;
2539 d2(d2 < float_v(Vc::Zero)) = float_v(Vc::Zero);
2543 if( ! ( (!isStraight1).isEmpty() ) )
2545 dS1[0](!isStraight1) = KFPMath::ATan2( (bq1*k11*c1 + k21*d1*bq1), (bq1*k11*d1*bq1 - k21*c1) )/bq1;
2546 dS1[1](!isStraight1) = KFPMath::ATan2( (bq1*k11*c1 - k21*d1*bq1), (-bq1*k11*d1*bq1 - k21*c1) )/bq1;
2548 if( ! ( (!isStraight2).isEmpty() ) )
2550 dS2[0](!isStraight2) = KFPMath::ATan2( (bq2*k12*c2 + k22*d2*bq2), (bq2*k12*d2*bq2 - k22*
c2) )/bq2;
2551 dS2[1](!isStraight2) = KFPMath::ATan2( (bq2*k12*c2 - k22*d2*bq2), (-bq2*k12*d2*bq2 - k22*
c2) )/bq2;
2553 if( ! ( isStraight1.isEmpty() ) )
2555 dS1[0](isStraight1 && (pt12>float_v(Vc::Zero)) ) = (k11*c1 + k21*d1)/(- k21*c1);
2556 dS1[1](isStraight1 && (pt12>float_v(Vc::Zero)) ) = (k11*c1 - k21*d1)/(- k21*c1);
2558 if( ! ( isStraight2.isEmpty() ) )
2560 dS2[0](isStraight2 && (pt22>float_v(Vc::Zero)) ) = (k12*c2 + k22*d2)/(- k22*c2);
2561 dS2[1](isStraight2 && (pt22>float_v(Vc::Zero)) ) = (k12*c2 - k22*d2)/(- k22*c2);
2567 for(
int iP = 0; iP<2; iP++)
2569 const float_v& bs1 = bq1*dS1[iP];
2570 const float_v& bs2 = bq2*dS2[iP];
2571 float_v sss = KFPMath::Sin(bs1), ccc = KFPMath::Cos(bs1);
2573 const float_m& bs1Big = abs(bs1) > 1.e-8
f;
2574 const float_m& bs2Big = abs(bs2) > 1.e-8
f;
2576 float_v sB(Vc::Zero), cB(Vc::Zero);
2577 sB(bs1Big) = sss/bq1;
2578 sB(!bs1Big) = ((1.f-bs1*kOvSqr6)*(1.
f+bs1*kOvSqr6)*dS1[iP]);
2579 cB(bs1Big) = (1.f-ccc)/bq1;
2580 cB(!bs1Big) = .5f*sB*bs1;
2582 const float_v& x1 = param1[0] + sB*px1 + cB*py1;
2583 const float_v& y1 = param1[1] - cB*px1 + sB*py1;
2584 const float_v& z1 = param1[2] + dS1[iP]*param1[5];
2586 sss = KFPMath::Sin(bs2); ccc = KFPMath::Cos(bs2);
2588 sB(bs2Big) = sss/bq2;
2589 sB(!bs2Big) = ((1.f-bs2*kOvSqr6)*(1.
f+bs2*kOvSqr6)*dS2[iP]);
2590 cB(bs2Big) = (1.f-ccc)/bq2;
2591 cB(!bs2Big) = .5f*sB*bs2;
2593 const float_v& x2 = param2[0] + sB*px2 + cB*py2;
2594 const float_v& y2 = param2[1] - cB*px2 + sB*py2;
2595 const float_v& z2 = param2[2] + dS2[iP]*param2[5];
2597 float_v dx = (x1-x2);
2598 float_v
dy = (y1-y2);
2599 float_v
dz = (z1-z2);
2601 dr2[iP] = dx*dx + dy*dy + dz*
dz;
2605 const float_m isFirstRoot = (dr2[0] < dr2[1]);
2609 dS[0](isFirstRoot) = dS1[0];
2610 dS[1](isFirstRoot) = dS2[0];
2614 dS[0](!isFirstRoot) = dS1[1];
2615 dS[1](!isFirstRoot) = dS2[1];
2622 const float_v pi2(6.283185307
f);
2652 const float_v& bs1 = bq1*dS[0];
2653 const float_v& bs2 = bq2*dS[1];
2654 float_v sss = KFPMath::Sin(bs1), ccc = KFPMath::Cos(bs1);
2656 const float_m& bs1Big = abs(bs1) > 1.e-8
f;
2657 const float_m& bs2Big = abs(bs2) > 1.e-8
f;
2659 float_v sB(0.
f), cB(0.
f);
2660 sB(bs1Big) = sss/bq1;
2661 cB(bs1Big) = (1.f-ccc)/bq1;
2662 sB(!bs1Big) = ((1.f-bs1*kOvSqr6)*(1.
f+bs1*kOvSqr6)*dS[0]);
2663 cB(!bs1Big) = .5f*sB*bs1;
2665 const float_v& x1 = x01 + sB*px1 + cB*py1;
2666 const float_v& y1 = y01 - cB*px1 + sB*py1;
2667 const float_v& z1 = z01 + dS[0]*pz1;
2668 const float_v& ppx1 = ccc*px1 + sss*py1;
2669 const float_v& ppy1 = -sss*px1 + ccc*py1;
2670 const float_v& ppz1 = pz1;
2672 float_v sss1 = KFPMath::Sin(bs2), ccc1 = KFPMath::Cos(bs2);
2674 float_v sB1(0.
f), cB1(0.
f);
2675 sB1(bs2Big) = sss1/bq2;
2676 cB1(bs2Big) = (1.f-ccc1)/bq2;
2677 sB1(!bs2Big) = ((1.f-bs2*kOvSqr6)*(1.
f+bs2*kOvSqr6)*dS[1]);
2678 cB1(!bs2Big) = .5f*sB1*bs2;
2680 const float_v& x2 = x02 + sB1*px2 + cB1*py2;
2681 const float_v& y2 = y02 - cB1*px2 + sB1*py2;
2682 const float_v& z2 = z02 + dS[1]*pz2;
2683 const float_v& ppx2 = ccc1*px2 + sss1*py2;
2684 const float_v& ppy2 = -sss1*px2 + ccc1*py2;
2685 const float_v& ppz2 = pz2;
2687 const float_v& p12 = ppx1*ppx1 + ppy1*ppy1 + ppz1*ppz1;
2688 const float_v& p22 = ppx2*ppx2 + ppy2*ppy2 + ppz2*ppz2;
2689 const float_v& lp1p2 = ppx1*ppx2 + ppy1*ppy2 + ppz1*ppz2;
2691 const float_v& dx = (x2 - x1);
2692 const float_v&
dy = (y2 - y1);
2693 const float_v&
dz = (z2 - z1);
2695 const float_v& ldrp1 = ppx1*dx + ppy1*dy + ppz1*
dz;
2696 const float_v& ldrp2 = ppx2*dx + ppy2*dy + ppz2*
dz;
2698 float_v detp = lp1p2*lp1p2 - p12*p22;
2699 detp(abs(detp)<1.
e-4
f) = 1;
2701 dS[0] += (ldrp2*lp1p2 - ldrp1*p22) /detp;
2702 dS[1] += (ldrp2*p12 - ldrp1*lp1p2)/detp;
2729 const float_v param1[6] = {
fP[0], -
fP[2], fP[1], fP[3], -fP[5], fP[4] };
2730 const float_v param2[6] = { p.
fP[0], -p.
fP[2], p.
fP[1], p.
fP[3], -p.
fP[5], p.
fP[4] };
2732 float_v dsdrBz[4][6];
2733 for(
int i1=0; i1<4; i1++)
2734 for(
int i2=0; i2<6; i2++)
2735 dsdrBz[i1][i2] = 0.
f;
2739 for(
int iDs=0; iDs<4; iDs++)
2741 dsdr[iDs][0] = dsdrBz[iDs][0];
2742 dsdr[iDs][1] = dsdrBz[iDs][2];
2743 dsdr[iDs][2] = -dsdrBz[iDs][1];
2744 dsdr[iDs][3] = dsdrBz[iDs][3];
2745 dsdr[iDs][4] = dsdrBz[iDs][5];
2746 dsdr[iDs][5] = -dsdrBz[iDs][4];
2764 const float_v param1[6] = {
fP[0], -
fP[2], fP[1], fP[3], -fP[5], fP[4] };
2765 const float_v param2[6] = { p.
fP[0], -p.
fP[2], p.
fP[1], p.
fP[3], -p.
fP[5], p.
fP[4] };
2793 const float_v& Bx = B[0];
2794 const float_v& By = B[1];
2795 const float_v&
Bz = B[2];
2797 const float_v& Bxz = sqrt(Bx*Bx + Bz*Bz);
2798 const float_v& Br = sqrt(Bx*Bx + By*By + Bz*Bz);
2803 cosA( abs(Bxz) > 1.
e-8
f ) = Bz/Bxz;
2804 sinA( abs(Bxz) > 1.
e-8
f ) = Bx/Bxz;
2806 const float_v& sinP = By/Br;
2807 const float_v& cosP = Bxz/Br;
2810 const float_v param1[6] = { cosA*
fP[0] - sinA*
fP[2],
2811 -sinA*sinP*fP[0] + cosP*fP[1] - cosA*sinP*fP[2],
2812 cosP*sinA*fP[0] + sinP*fP[1] + cosA*cosP*fP[2],
2813 cosA*fP[3] - sinA*fP[5],
2814 -sinA*sinP*fP[3] + cosP*fP[4] - cosA*sinP*fP[5],
2815 cosP*sinA*fP[3] + sinP*fP[4] + cosA*cosP*fP[5]};
2816 const float_v param2[6] = { cosA*p.
fP[0] - sinA*p.
fP[2],
2817 -sinA*sinP*p.
fP[0] + cosP*p.
fP[1] - cosA*sinP*p.
fP[2],
2818 cosP*sinA*p.
fP[0] + sinP*p.
fP[1] + cosA*cosP*p.
fP[2],
2819 cosA*p.
fP[3] - sinA*p.
fP[5],
2820 -sinA*sinP*p.
fP[3] + cosP*p.
fP[4] - cosA*sinP*p.
fP[5],
2821 cosP*sinA*p.
fP[3] + sinP*p.
fP[4] + cosA*cosP*p.
fP[5]};
2823 float_v dsdrBz[4][6];
2824 for(
int i1=0; i1<4; i1++)
2825 for(
int i2=0; i2<6; i2++)
2826 dsdrBz[i1][i2] = 0.
f;
2830 for(
int iDs=0; iDs<4; iDs++)
2832 dsdr[iDs][0] = dsdrBz[iDs][0]*cosA - dsdrBz[iDs][1]*sinA*sinP + dsdrBz[iDs][2]*sinA*cosP;
2833 dsdr[iDs][1] = dsdrBz[iDs][1]*cosP + dsdrBz[iDs][2]*sinP;
2834 dsdr[iDs][2] = -dsdrBz[iDs][0]*sinA - dsdrBz[iDs][1]*cosA*sinP + dsdrBz[iDs][2]*cosA*cosP;
2835 dsdr[iDs][3] = dsdrBz[iDs][3]*cosA - dsdrBz[iDs][4]*sinA*sinP + dsdrBz[iDs][5]*sinA*cosP;
2836 dsdr[iDs][4] = dsdrBz[iDs][4]*cosP + dsdrBz[iDs][5]*sinP;
2837 dsdr[iDs][5] = -dsdrBz[iDs][3]*sinA - dsdrBz[iDs][4]*cosA*sinP + dsdrBz[iDs][5]*cosA*cosP;
2855 const float_v& Bx = B[0];
2856 const float_v& By = B[1];
2857 const float_v&
Bz = B[2];
2859 const float_v& Bxz = sqrt(Bx*Bx + Bz*Bz);
2860 const float_v& Br = sqrt(Bx*Bx + By*By + Bz*Bz);
2865 cosA( abs(Bxz) > 1.
e-8
f ) = Bz/Bxz;
2866 sinA( abs(Bxz) > 1.
e-8
f ) = Bx/Bxz;
2868 const float_v& sinP = By/Br;
2869 const float_v& cosP = Bxz/Br;
2872 const float_v param1[6] = { cosA*
fP[0] - sinA*
fP[2],
2873 -sinA*sinP*fP[0] + cosP*fP[1] - cosA*sinP*fP[2],
2874 cosP*sinA*fP[0] + sinP*fP[1] + cosA*cosP*fP[2],
2875 cosA*fP[3] - sinA*fP[5],
2876 -sinA*sinP*fP[3] + cosP*fP[4] - cosA*sinP*fP[5],
2877 cosP*sinA*fP[3] + sinP*fP[4] + cosA*cosP*fP[5]};
2878 const float_v param2[6] = { cosA*p.
fP[0] - sinA*p.
fP[2],
2879 -sinA*sinP*p.
fP[0] + cosP*p.
fP[1] - cosA*sinP*p.
fP[2],
2880 cosP*sinA*p.
fP[0] + sinP*p.
fP[1] + cosA*cosP*p.
fP[2],
2881 cosA*p.
fP[3] - sinA*p.
fP[5],
2882 -sinA*sinP*p.
fP[3] + cosP*p.
fP[4] - cosA*sinP*p.
fP[5],
2883 cosP*sinA*p.
fP[3] + sinP*p.
fP[4] + cosA*cosP*p.
fP[5]};
2908 float_v p22 = p.
fP[3]*p.
fP[3] + p.
fP[4]*p.
fP[4] + p.
fP[5]*p.
fP[5];
2909 float_v p1p2 = fP[3]*p.
fP[3] + fP[4]*p.
fP[4] + fP[5]*p.
fP[5];
2911 float_v drp1 = fP[3]*(p.
fP[0]-fP[0]) + fP[4]*(p.
fP[1]-fP[1]) + fP[5]*(p.
fP[2]-fP[2]);
2912 float_v drp2 = p.
fP[3]*(p.
fP[0]-fP[0]) + p.
fP[4]*(p.
fP[1]-fP[1]) + p.
fP[5]*(p.
fP[2]-fP[2]);
2914 float_v detp = p1p2*p1p2 - p12*p22;
2915 detp( abs(detp)<float_v(1.
e-4
f) ) = float_v(1.
f);
2917 dS[0] = (drp2*p1p2 - drp1*p22) /detp;
2918 dS[1] = (drp2*p12 - drp1*p1p2)/detp;
2920 const float_v x01 = fP[0];
2921 const float_v y01 = fP[1];
2922 const float_v z01 = fP[2];
2923 const float_v px1 = fP[3];
2924 const float_v py1 = fP[4];
2925 const float_v pz1 = fP[5];
2927 const float_v x02 = p.
fP[0];
2928 const float_v y02 = p.
fP[1];
2929 const float_v z02 = p.
fP[2];
2930 const float_v px2 = p.
fP[3];
2931 const float_v py2 = p.
fP[4];
2932 const float_v pz2 = p.
fP[5];
2934 const float_v drp1_dr1[6] = {-px1, -py1, -pz1, -x01 + x02, -y01 + y02, -z01 + z02};
2935 const float_v drp1_dr2[6] = {px1, py1, pz1, 0.f, 0.f, 0.f};
2936 const float_v drp2_dr1[6] = {-px2, -py2, -pz2, 0.f, 0.f, 0.f};
2937 const float_v drp2_dr2[6] = {px2, py2, pz2, -x01 + x02, -y01 + y02, -z01 + z02};
2938 const float_v dp1p2_dr1[6] = {0.f, 0.f, 0.f, px2, py2, pz2};
2939 const float_v dp1p2_dr2[6] = {0.f, 0.f, 0.f, px1, py1, pz1};
2940 const float_v dp12_dr1[6] = {0.f, 0.f, 0.f, 2.f*px1, 2.f*py1, 2.f*pz1};
2941 const float_v dp12_dr2[6] = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f};
2942 const float_v dp22_dr1[6] = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f};
2943 const float_v dp22_dr2[6] = {0.f, 0.f, 0.f, 2.f*px2, 2.f*py2, 2.f*pz2};
2944 const float_v ddetp_dr1[6] = {0.f, 0.f, 0.f, -2.f*p22*px1 + 2.f*p1p2*px2, -2.f*p22*py1 + 2.f*p1p2*py2, -2.f*p22*pz1 + 2.f*p1p2*pz2};
2945 const float_v ddetp_dr2[6] = {0.f, 0.f, 0.f, 2.f*p1p2*px1 - 2.f*p12*px2, 2.f*p1p2*py1 - 2.f*p12*py2, 2.f*p1p2*pz1 - 2.f*p12*pz2};
2948 float_v da1_dr1[6], da1_dr2[6], da2_dr1[6], da2_dr2[6];
2950 const float_v a1 = drp2*p1p2 - drp1*p22;
2951 const float_v
a2 = drp2*p12 - drp1*p1p2;
2952 for(
int i=0;
i<6;
i++)
2954 da1_dr1[
i] = drp2_dr1[
i]*p1p2 + drp2*dp1p2_dr1[
i] - drp1_dr1[
i]*p22 - drp1*dp22_dr1[
i];
2955 da1_dr2[
i] = drp2_dr2[
i]*p1p2 + drp2*dp1p2_dr2[
i] - drp1_dr2[
i]*p22 - drp1*dp22_dr2[
i];
2957 da2_dr1[
i] = drp2_dr1[
i]*p12 + drp2*dp12_dr1[
i] - drp1_dr1[
i]*p1p2 - drp1*dp1p2_dr1[
i];
2958 da2_dr2[
i] = drp2_dr2[
i]*p12 + drp2*dp12_dr2[
i] - drp1_dr2[
i]*p1p2 - drp1*dp1p2_dr2[
i];
2960 dsdr[0][
i] = da1_dr1[
i]/detp - a1/(detp*detp)*ddetp_dr1[
i];
2961 dsdr[1][
i] = da1_dr2[
i]/detp - a1/(detp*detp)*ddetp_dr2[
i];
2963 dsdr[2][
i] = da2_dr1[
i]/detp - a2/(detp*detp)*ddetp_dr1[
i];
2964 dsdr[3][
i] = da2_dr2[
i]/detp - a2/(detp*detp)*ddetp_dr2[
i];
2980 float_v p22 = p.
fP[3]*p.
fP[3] + p.
fP[4]*p.
fP[4] + p.
fP[5]*p.
fP[5];
2981 float_v p1p2 = fP[3]*p.
fP[3] + fP[4]*p.
fP[4] + fP[5]*p.
fP[5];
2983 float_v drp1 = fP[3]*(p.
fP[0]-fP[0]) + fP[4]*(p.
fP[1]-fP[1]) + fP[5]*(p.
fP[2]-fP[2]);
2984 float_v drp2 = p.
fP[3]*(p.
fP[0]-fP[0]) + p.
fP[4]*(p.
fP[1]-fP[1]) + p.
fP[5]*(p.
fP[2]-fP[2]);
2986 float_v detp = p1p2*p1p2 - p12*p22;
2987 detp( abs(detp)<float_v(1.
e-4
f) ) = float_v(1.
f);
2989 dS[0] = (drp2*p1p2 - drp1*p22) /detp;
2990 dS[1] = (drp2*p12 - drp1*p1p2)/detp;
3019 const float_v& bq1 = fld[1]*simd_cast<float_v>(
fQ);
3020 const float_v& bq2 = fld[1]*simd_cast<float_v>(p.
fQ);
3021 const float_m& isStraight1 = abs(bq1) < float_v(1.
e-8
f);
3022 const float_m& isStraight2 = abs(bq2) < float_v(1.
e-8
f);
3024 if( isStraight1.isFull() && isStraight2.isFull() )
3048 const float_v& bq1 = fld[1]*simd_cast<float_v>(
fQ);
3049 const float_v& bq2 = fld[1]*simd_cast<float_v>(p.
fQ);
3050 const float_m& isStraight1 = abs(bq1) < float_v(1.
e-8
f);
3051 const float_m& isStraight2 = abs(bq2) < float_v(1.
e-8
f);
3053 if( isStraight1.isFull() && isStraight2.isFull() )
3082 if( (
fQ == int_v(Vc::Zero)).isFull() ){
3087 const float_v kCLight = 0.000299792458f;
3089 float_v
c = simd_cast<float_v>(
fQ)*kCLight;
3098 float_v sx=0.f, sy=0.f, sz=0.f, syy=0.f, syz=0.f, syyy=0.f, ssx=0.f, ssy=0.f, ssz=0.f, ssyy=0.f, ssyz=0.f, ssyyy=0.f;
3103 float_v p0[3], p1[3], p2[3];
3111 p2[0] =
fP[0] + px*dS;
3112 p2[1] =
fP[1] + py*dS;
3113 p2[2] =
fP[2] + pz*dS;
3115 p1[0] = 0.5f*(p0[0]+p2[0]);
3116 p1[1] = 0.5f*(p0[1]+p2[1]);
3117 p1[2] = 0.5f*(p0[2]+p2[2]);
3125 float_v ssy1 = ( 7.f*fld[0][1] + 6.f*fld[1][1]-fld[2][1] )*c*dS*dS/96.
f;
3126 float_v ssy2 = ( fld[0][1] + 2.f*fld[1][1] )*c*dS*dS/6.
f;
3138 for(
int iF1=0; iF1<3; iF1++)
3139 for(
int iF2=0; iF2<3; iF2++)
3140 fld[iF1][iF2](abs(fld[iF1][iF2]) > float_v(100.
f)) = 0.f;
3142 sx = c*( fld[0][0] + 4*fld[1][0] + fld[2][0] )*dS/6.
f;
3143 sy = c*( fld[0][1] + 4*fld[1][1] + fld[2][1] )*dS/6.
f;
3144 sz = c*( fld[0][2] + 4*fld[1][2] + fld[2][2] )*dS/6.
f;
3146 ssx = c*( fld[0][0] + 2*fld[1][0])*dS*dS/6.
f;
3147 ssy = c*( fld[0][1] + 2*fld[1][1])*dS*dS/6.
f;
3148 ssz = c*( fld[0][2] + 2*fld[1][2])*dS*dS/6.
f;
3150 float_v c2[3][3] = { { 5.f, -4.f, -1.f},{ 44.f, 80.f, -4.f},{ 11.f, 44.f, 5.f} };
3151 float_v cc2[3][3] = { { 38.f, 8.f, -4.f},{ 148.f, 208.f, -20.f},{ 3.f, 36.f, 3.f} };
3152 for(Int_t
n=0;
n<3;
n++)
3153 for(Int_t
m=0;
m<3;
m++)
3155 syz += c2[
n][
m]*fld[
n][1]*fld[
m][2];
3156 ssyz += cc2[
n][
m]*fld[
n][1]*fld[
m][2];
3159 syz *= c*c*dS*dS/360.f;
3160 ssyz *= c*c*dS*dS*dS/2520.f;
3162 syy = c*( fld[0][1] + 4.f*fld[1][1] + fld[2][1] )*dS;
3163 syyy = syy*syy*syy / 1296.f;
3166 ssyy = ( fld[0][1]*( 38.f*fld[0][1] + 156.f*fld[1][1] - fld[2][1] )+
3167 fld[1][1]*( 208.
f*fld[1][1] +16.
f*fld[2][1] )+
3168 fld[2][1]*( 3.f*fld[2][1] )
3169 )*dS*dS*dS*c*c/2520.f;
3172 fld[0][1]*( fld[0][1]*( 85.f*fld[0][1] + 526.f*fld[1][1] - 7.f*fld[2][1] )+
3173 fld[1][1]*( 1376.
f*fld[1][1] +84.
f*fld[2][1] )+
3174 fld[2][1]*( 19.f*fld[2][1] ) )+
3175 fld[1][1]*( fld[1][1]*( 1376.f*fld[1][1] +256.f*fld[2][1] )+
3176 fld[2][1]*( 62.
f*fld[2][1] ) )+
3177 fld[2][1]*fld[2][1] *( 3.
f*fld[2][1] )
3178 )*dS*dS*dS*dS*c*c*c/90720.
f;
3210 for( Int_t
i=0;
i<8;
i++ )
for( Int_t
j=0;
j<8;
j++) mJ[
i][
j]=0;
3212 mJ[0][0]=1; mJ[0][1]=0; mJ[0][2]=0; mJ[0][3]=dS-ssyy; mJ[0][4]=ssx; mJ[0][5]=ssyyy-ssy;
3213 mJ[1][0]=0; mJ[1][1]=1; mJ[1][2]=0; mJ[1][3]=-ssz; mJ[1][4]=dS; mJ[1][5]=ssx+ssyz;
3214 mJ[2][0]=0; mJ[2][1]=0; mJ[2][2]=1; mJ[2][3]=ssy-ssyyy; mJ[2][4]=-ssx; mJ[2][5]=dS-ssyy;
3216 mJ[3][0]=0; mJ[3][1]=0; mJ[3][2]=0; mJ[3][3]=1-syy; mJ[3][4]=sx; mJ[3][5]=syyy-sy;
3217 mJ[4][0]=0; mJ[4][1]=0; mJ[4][2]=0; mJ[4][3]=-sz; mJ[4][4]=1; mJ[4][5]=sx+syz;
3218 mJ[5][0]=0; mJ[5][1]=0; mJ[5][2]=0; mJ[5][3]=sy-syyy; mJ[5][4]=-sx; mJ[5][5]=1-syy;
3219 mJ[6][6] = mJ[7][7] = 1;
3221 P[0] =
fP[0] + mJ[0][3]*px + mJ[0][4]*py + mJ[0][5]*pz;
3222 P[1] =
fP[1] + mJ[1][3]*px + mJ[1][4]*py + mJ[1][5]*pz;
3223 P[2] =
fP[2] + mJ[2][3]*px + mJ[2][4]*py + mJ[2][5]*pz;
3224 P[3] = mJ[3][3]*px + mJ[3][4]*py + mJ[3][5]*pz;
3225 P[4] = mJ[4][3]*px + mJ[4][4]*py + mJ[4][5]*pz;
3226 P[5] = mJ[5][3]*px + mJ[5][4]*py + mJ[5][5]*pz;
3231 for( Int_t
i=0;
i<6;
i++ )
for( Int_t
j=0;
j<6;
j++) mJds[
i][
j]=0;
3237 mJds[0][3](abs(dS)>0.f)= 1.
f - 3.
f*ssyy/dS; mJds[0][4](abs(dS)>0.f)= 2.
f*ssx/dS; mJds[0][5](abs(dS)>0.f)= (4.
f*ssyyy-2.
f*ssy)/dS;
3238 mJds[1][3](abs(dS)>0.f)= -2.
f*ssz/dS; mJds[1][4](abs(dS)>0.f)= 1.
f; mJds[1][5](abs(dS)>0.f)= (2.
f*ssx + 3.
f*ssyz)/dS;
3239 mJds[2][3](abs(dS)>0.f)= (2.
f*ssy-4.
f*ssyyy)/dS; mJds[2][4](abs(dS)>0.f)=-2.
f*ssx/dS; mJds[2][5](abs(dS)>0.f)= 1.
f - 3.
f*ssyy/dS;
3241 mJds[3][3](abs(dS)>0.f)= -2.
f*syy/dS; mJds[3][4](abs(dS)>0.f)= sx/dS; mJds[3][5](abs(dS)>0.f)= 3.
f*syyy/dS - sy/dS;
3242 mJds[4][3](abs(dS)>0.f)= -sz/dS; mJds[4][4](abs(dS)>0.f)=0.
f; mJds[4][5](abs(dS)>0.f) = sx/dS + 2.
f*syz/dS;
3243 mJds[5][3](abs(dS)>0.f)= sy/dS - 3.
f*syyy/dS; mJds[5][4](abs(dS)>0.f)=-sx/dS; mJds[5][5](abs(dS)>0.f)= -2.
f*syy/dS;
3245 for(
int i1=0; i1<6; i1++)
3246 for(
int i2=0; i2<6; i2++)
3247 mJ[i1][i2] += mJds[i1][3]*px*dsdr[i2] + mJds[i1][4]*py*dsdr[i2] + mJds[i1][5]*pz*dsdr[i2];
3253 for(
int i=0;
i<6;
i++)
3254 for(
int j=0;
j<6;
j++)
3255 F[
i*6+
j] = mJ[
i][
j];
3257 for(
int i1=0; i1<6; i1++)
3258 for(
int i2=0; i2<6; i2++)
3259 F1[i1*6 + i2] = mJds[i1][3]*px*dsdr1[i2] + mJds[i1][4]*py*dsdr1[i2] + mJds[i1][5]*pz*dsdr1[i2];
3273 if( (
fQ == int_v(Vc::Zero)).isFull() ){
3278 const float_v kCLight = 0.000299792458f;
3280 float_v
c = simd_cast<float_v>(
fQ)*kCLight;
3289 float_v sx=0.f, sy=0.f, sz=0.f, syy=0.f, syz=0.f, syyy=0.f, ssx=0.f, ssy=0.f, ssz=0.f, ssyy=0.f, ssyz=0.f, ssyyy=0.f;
3294 float_v p0[3], p1[3], p2[3];
3302 p2[0] =
fP[0] + px*dS;
3303 p2[1] =
fP[1] + py*dS;
3304 p2[2] =
fP[2] + pz*dS;
3306 p1[0] = 0.5f*(p0[0]+p2[0]);
3307 p1[1] = 0.5f*(p0[1]+p2[1]);
3308 p1[2] = 0.5f*(p0[2]+p2[2]);
3316 float_v ssy1 = ( 7.f*fld[0][1] + 6.f*fld[1][1]-fld[2][1] )*c*dS*dS/96.
f;
3317 float_v ssy2 = ( fld[0][1] + 2.f*fld[1][1] )*c*dS*dS/6.
f;
3329 for(
int iF1=0; iF1<3; iF1++)
3330 for(
int iF2=0; iF2<3; iF2++)
3331 fld[iF1][iF2](abs(fld[iF1][iF2]) > float_v(100.
f)) = 0.f;
3333 sx = c*( fld[0][0] + 4*fld[1][0] + fld[2][0] )*dS/6.
f;
3334 sy = c*( fld[0][1] + 4*fld[1][1] + fld[2][1] )*dS/6.
f;
3335 sz = c*( fld[0][2] + 4*fld[1][2] + fld[2][2] )*dS/6.
f;
3337 ssx = c*( fld[0][0] + 2*fld[1][0])*dS*dS/6.
f;
3338 ssy = c*( fld[0][1] + 2*fld[1][1])*dS*dS/6.
f;
3339 ssz = c*( fld[0][2] + 2*fld[1][2])*dS*dS/6.
f;
3341 float_v c2[3][3] = { { 5.f, -4.f, -1.f},{ 44.f, 80.f, -4.f},{ 11.f, 44.f, 5.f} };
3342 float_v cc2[3][3] = { { 38.f, 8.f, -4.f},{ 148.f, 208.f, -20.f},{ 3.f, 36.f, 3.f} };
3343 for(Int_t
n=0;
n<3;
n++)
3344 for(Int_t
m=0;
m<3;
m++)
3346 syz += c2[
n][
m]*fld[
n][1]*fld[
m][2];
3347 ssyz += cc2[
n][
m]*fld[
n][1]*fld[
m][2];
3350 syz *= c*c*dS*dS/360.f;
3351 ssyz *= c*c*dS*dS*dS/2520.f;
3353 syy = c*( fld[0][1] + 4.f*fld[1][1] + fld[2][1] )*dS;
3354 syyy = syy*syy*syy / 1296.f;
3357 ssyy = ( fld[0][1]*( 38.f*fld[0][1] + 156.f*fld[1][1] - fld[2][1] )+
3358 fld[1][1]*( 208.
f*fld[1][1] +16.
f*fld[2][1] )+
3359 fld[2][1]*( 3.f*fld[2][1] )
3360 )*dS*dS*dS*c*c/2520.f;
3363 fld[0][1]*( fld[0][1]*( 85.f*fld[0][1] + 526.f*fld[1][1] - 7.f*fld[2][1] )+
3364 fld[1][1]*( 1376.
f*fld[1][1] +84.
f*fld[2][1] )+
3365 fld[2][1]*( 19.f*fld[2][1] ) )+
3366 fld[1][1]*( fld[1][1]*( 1376.f*fld[1][1] +256.f*fld[2][1] )+
3367 fld[2][1]*( 62.
f*fld[2][1] ) )+
3368 fld[2][1]*fld[2][1] *( 3.
f*fld[2][1] )
3369 )*dS*dS*dS*dS*c*c*c/90720.
f;
3374 for( Int_t
i=0;
i<8;
i++ )
for( Int_t
j=0;
j<8;
j++) mJ[
i][
j]=0;
3376 mJ[0][0]=1; mJ[0][1]=0; mJ[0][2]=0; mJ[0][3]=dS-ssyy; mJ[0][4]=ssx; mJ[0][5]=ssyyy-ssy;
3377 mJ[1][0]=0; mJ[1][1]=1; mJ[1][2]=0; mJ[1][3]=-ssz; mJ[1][4]=dS; mJ[1][5]=ssx+ssyz;
3378 mJ[2][0]=0; mJ[2][1]=0; mJ[2][2]=1; mJ[2][3]=ssy-ssyyy; mJ[2][4]=-ssx; mJ[2][5]=dS-ssyy;
3380 mJ[3][0]=0; mJ[3][1]=0; mJ[3][2]=0; mJ[3][3]=1-syy; mJ[3][4]=sx; mJ[3][5]=syyy-sy;
3381 mJ[4][0]=0; mJ[4][1]=0; mJ[4][2]=0; mJ[4][3]=-sz; mJ[4][4]=1; mJ[4][5]=sx+syz;
3382 mJ[5][0]=0; mJ[5][1]=0; mJ[5][2]=0; mJ[5][3]=sy-syyy; mJ[5][4]=-sx; mJ[5][5]=1-syy;
3383 mJ[6][6] = mJ[7][7] = 1;
3385 P[0] =
fP[0] + mJ[0][3]*px + mJ[0][4]*py + mJ[0][5]*pz;
3386 P[1] =
fP[1] + mJ[1][3]*px + mJ[1][4]*py + mJ[1][5]*pz;
3387 P[2] =
fP[2] + mJ[2][3]*px + mJ[2][4]*py + mJ[2][5]*pz;
3388 P[3] = mJ[3][3]*px + mJ[3][4]*py + mJ[3][5]*pz;
3389 P[4] = mJ[4][3]*px + mJ[4][4]*py + mJ[4][5]*pz;
3390 P[5] = mJ[5][3]*px + mJ[5][4]*py + mJ[5][5]*pz;
3419 const float_v kCLight = 0.000299792458f;
3420 Bz = Bz*simd_cast<float_v>(
fQ)*kCLight;
3422 float_v
s = sin(bs),
c = cos(bs);
3424 float_v sB(Vc::Zero), cB(Vc::Zero);
3426 const float_v kOvSqr6 = 1.f/sqrt(float_v(6.
f));
3427 const float_v LocalSmall = 1.e-10
f;
3429 Bz(abs(bs) <= LocalSmall) = LocalSmall;
3430 sB(LocalSmall < abs(bs)) = s/
Bz;
3431 sB(LocalSmall >= abs(bs)) = (1.f-bs*kOvSqr6)*(1.
f+bs*kOvSqr6)*dS;
3432 cB(LocalSmall < abs(bs)) = (1.f-
c)/Bz;
3433 cB(LocalSmall >= abs(bs)) = .5f*sB*bs;
3439 P[0] =
fP[0] + sB*px + cB*py;
3440 P[1] =
fP[1] - cB*px + sB*py;
3441 P[2] =
fP[2] + dS*pz;
3443 P[4] = -s*px +
c*py;
3449 for( Int_t
i=0;
i<8;
i++ )
for( Int_t
j=0;
j<8;
j++) mJ[
i][
j]=0;
3451 for(
int i=0;
i<8;
i++) mJ[
i][
i]=1;
3452 mJ[0][3] = sB; mJ[0][4] = cB;
3453 mJ[1][3] = -cB; mJ[1][4] = sB;
3455 mJ[3][3] =
c; mJ[3][4] =
s;
3456 mJ[4][3] = -
s; mJ[4][4] =
c;
3460 for( Int_t
i=0;
i<6;
i++ )
for( Int_t
j=0;
j<6;
j++) mJds[
i][
j]=0;
3461 mJds[0][3] =
c; mJds[0][4] =
s;
3462 mJds[1][3] = -
s; mJds[1][4] =
c;
3464 mJds[3][3] = -Bz*
s; mJds[3][4] = Bz*
c;
3465 mJds[4][3] = -Bz*
c; mJds[4][4] = -Bz*
s;
3467 for(
int i1=0; i1<6; i1++)
3468 for(
int i2=0; i2<6; i2++)
3469 mJ[i1][i2] += mJds[i1][3]*px*dsdr[i2] + mJds[i1][4]*py*dsdr[i2] + mJds[i1][5]*pz*dsdr[i2];
3475 for(
int i=0;
i<6;
i++)
3476 for(
int j=0;
j<6;
j++)
3477 F[
i*6+
j] = mJ[
i][
j];
3479 for(
int i1=0; i1<6; i1++)
3480 for(
int i2=0; i2<6; i2++)
3481 F1[i1*6 + i2] = mJds[i1][3]*px*dsdr1[i2] + mJds[i1][4]*py*dsdr1[i2] + mJds[i1][5]*pz*dsdr1[i2];
3497 const float_v kCLight = 0.000299792458f;
3498 Bz = Bz*simd_cast<float_v>(
fQ)*kCLight;
3500 float_v
s = KFPMath::Sin(bs),
c = KFPMath::Cos(bs);
3502 float_v sB(Vc::Zero), cB(Vc::Zero);
3504 const float_v kOvSqr6 = 1.f/sqrt(float_v(6.
f));
3505 const float_v LocalSmall = 1.e-10
f;
3507 Bz(abs(bs) <= LocalSmall) = LocalSmall;
3508 sB(LocalSmall < abs(bs)) = s/
Bz;
3509 sB(LocalSmall >= abs(bs)) = (1.f-bs*kOvSqr6)*(1.
f+bs*kOvSqr6)*dS;
3510 cB(LocalSmall < abs(bs)) = (1.f-
c)/Bz;
3511 cB(LocalSmall >= abs(bs)) = .5f*sB*bs;
3517 P[0] =
fP[0] + sB*px + cB*py;
3518 P[1] =
fP[1] - cB*px + sB*py;
3519 P[2] =
fP[2] + dS*pz;
3521 P[4] = -s*px +
c*py;
3544 float_v mP[8], mC[36];
3545 float_v dsdr[6] = {0.f,0.f,0.f,0.f,0.f,0.f};
3548 float_v d[3]={ vtx[0]-mP[0], vtx[1]-mP[1], vtx[2]-mP[2]};
3549 return sqrt( d[0]*d[0]+d[1]*d[1]+d[2]*d[2] );
3560 float_v mP[8], mP1[8];
3563 float_v dx = mP[0]-mP1[0];
3564 float_v
dy = mP[1]-mP1[1];
3565 float_v
dz = mP[2]-mP1[2];
3566 return sqrt(dx*dx+dy*dy+dz*dz);
3588 float_v dsdr[6] = {0.f,0.f,0.f,0.f,0.f,0.f};
3590 float_v dsdp[6] = {-dsdr[0], -dsdr[1], -dsdr[2], 0.f, 0.f, 0.f};
3591 float_v
F[36],
F1[36];
3592 for(
int i2=0; i2<36; i2++)
3597 Transport( dS, dsdr, mP, mC, dsdp, F, F1 );
3602 for(
int i=0;
i<3;
i++)
3603 for(
int j=0;
j<6;
j++)
3606 for(
int k=0;
k<3;
k++)
3608 VFT[
i][
j] += Cv[
IJ(
i,
k)] * F1[
j*6+
k];
3613 for(
int i=0;
i<6;
i++)
3614 for(
int j=0;
j<6;
j++)
3617 for(
int k=0;
k<3;
k++)
3619 FVFT[
i][
j] += F1[
i*6+
k] * VFT[
k][
j];
3622 mC[0] += FVFT[0][0] + Cv[0];
3623 mC[1] += FVFT[1][0] + Cv[1];
3624 mC[2] += FVFT[1][1] + Cv[2];
3625 mC[3] += FVFT[2][0] + Cv[3];
3626 mC[4] += FVFT[2][1] + Cv[4];
3627 mC[5] += FVFT[2][2] + Cv[5];
3632 float_v d[3]={ v[0]-mP[0], v[1]-mP[1], v[2]-mP[2]};
3634 return ( ( mC[0]*d[0] + mC[1]*d[1] + mC[3]*d[2])*d[0]
3635 +(mC[1]*d[0] + mC[2]*d[1] + mC[4]*d[2])*d[1]
3636 +(mC[3]*d[0] + mC[4]*d[1] + mC[5]*d[2])*d[2] );
3645 float_v ds[2] = {0.f,0.f};
3647 float_v
F1[36],
F2[36],
F3[36],
F4[36];
3648 for(
int i1=0; i1<36; i1++)
3661 float_v mP1[8], mC1[36];
3662 float_v mP2[8], mC2[36];
3664 Transport(ds[0], dsdr[0], mP1, mC1, dsdr[1], F1, F2);
3665 p.
Transport(ds[1], dsdr[3], mP2, mC2, dsdr[2], F4, F3);
3670 for(
int iC=0; iC<6; iC++)
3671 mC1[iC] += V0Tmp[iC] + mC2[iC] + V1Tmp[iC];
3673 float_v d[3]={ mP2[0]-mP1[0], mP2[1]-mP1[1], mP2[2]-mP1[2]};
3675 return ( ( mC1[0]*d[0] + mC1[1]*d[1] + mC1[3]*d[2])*d[0]
3676 +(mC1[1]*d[0] + mC1[2]*d[1] + mC1[4]*d[2])*d[1]
3677 +(mC1[3]*d[0] + mC1[4]*d[1] + mC1[5]*d[2])*d[2] );
3692 float_v mS[6] = { mCm[0] - Vtx.
fC[0] + (D[0][0] + D[0][0]),
3693 mCm[1] - Vtx.
fC[1] + (D[1][0] + D[0][1]), mCm[2] - Vtx.
fC[2] + (D[1][1] + D[1][1]),
3694 mCm[3] - Vtx.
fC[3] + (D[2][0] + D[0][2]), mCm[4] - Vtx.
fC[4] + (D[1][2] + D[2][1]), mCm[5] - Vtx.
fC[5] + (D[2][2] + D[2][2]) };
3699 float_v zeta[3] = { m[0]-Vtx.
fP[0], m[1]-Vtx.
fP[1], m[2]-Vtx.
fP[2] };
3703 float_v mCHt0[3], mCHt1[3], mCHt2[3];
3705 mCHt0[0]=Vtx.
fC[ 0] ; mCHt1[0]=Vtx.
fC[ 1] ; mCHt2[0]=Vtx.
fC[ 3] ;
3706 mCHt0[1]=Vtx.
fC[ 1] ; mCHt1[1]=Vtx.
fC[ 2] ; mCHt2[1]=Vtx.
fC[ 4] ;
3707 mCHt0[2]=Vtx.
fC[ 3] ; mCHt1[2]=Vtx.
fC[ 4] ; mCHt2[2]=Vtx.
fC[ 5] ;
3711 float_v k0[3], k1[3], k2[3];
3713 for(Int_t
i=0;
i<3;++
i){
3714 k0[
i] = mCHt0[
i]*mS[0] + mCHt1[
i]*mS[1] + mCHt2[
i]*mS[3];
3715 k1[
i] = mCHt0[
i]*mS[1] + mCHt1[
i]*mS[2] + mCHt2[
i]*mS[4];
3716 k2[
i] = mCHt0[
i]*mS[3] + mCHt1[
i]*mS[4] + mCHt2[
i]*mS[5];
3721 float_v dChi2 = ((mS[0]*zeta[0] + mS[1]*zeta[1] + mS[3]*zeta[2])*zeta[0]
3722 + (mS[1]*zeta[0] + mS[2]*zeta[1] + mS[4]*zeta[2])*zeta[1]
3723 + (mS[3]*zeta[0] + mS[4]*zeta[1] + mS[5]*zeta[2])*zeta[2]);
3725 for(Int_t
i=0;
i<3;++
i)
3726 Vtx.
fP[
i] -= k0[
i]*zeta[0] + k1[
i]*zeta[1] + k2[
i]*zeta[2];
3730 for(Int_t
i=0,
k=0;
i<3;++
i){
3731 for(Int_t
j=0;
j<=
i;++
j,++
k)
3732 Vtx.
fC[
k] += k0[
i]*mCHt0[
j] + k1[
i]*mCHt1[
j] + k2[
i]*mCHt2[
j];
3754 float_v mS[6] = { mV[0] - Vtx.
fC[0] + (D[0][0] + D[0][0]),
3755 mV[1] - Vtx.
fC[1] + (D[1][0] + D[0][1]), mV[2] - Vtx.
fC[2] + (D[1][1] + D[1][1]),
3756 mV[3] - Vtx.
fC[3] + (D[2][0] + D[0][2]), mV[4] - Vtx.
fC[4] + (D[1][2] + D[2][1]), mV[5] - Vtx.
fC[5] + (D[2][2] + D[2][2]) };
3761 float_v zeta[3] = { m[0]-Vtx.
fP[0], m[1]-Vtx.
fP[1], m[2]-Vtx.
fP[2] };
3765 float_v mCHt0[7], mCHt1[7], mCHt2[7];
3767 mCHt0[0]=mV[ 0] ; mCHt1[0]=mV[ 1] ; mCHt2[0]=mV[ 3] ;
3768 mCHt0[1]=mV[ 1] ; mCHt1[1]=mV[ 2] ; mCHt2[1]=mV[ 4] ;
3769 mCHt0[2]=mV[ 3] ; mCHt1[2]=mV[ 4] ; mCHt2[2]=mV[ 5] ;
3770 mCHt0[3]=Vtx.
fC[ 6]-mV[ 6]; mCHt1[3]=Vtx.
fC[ 7]-mV[ 7]; mCHt2[3]=Vtx.
fC[ 8]-mV[ 8];
3771 mCHt0[4]=Vtx.
fC[10]-mV[10]; mCHt1[4]=Vtx.
fC[11]-mV[11]; mCHt2[4]=Vtx.
fC[12]-mV[12];
3772 mCHt0[5]=Vtx.
fC[15]-mV[15]; mCHt1[5]=Vtx.
fC[16]-mV[16]; mCHt2[5]=Vtx.
fC[17]-mV[17];
3773 mCHt0[6]=Vtx.
fC[21]-mV[21]; mCHt1[6]=Vtx.
fC[22]-mV[22]; mCHt2[6]=Vtx.
fC[23]-mV[23];
3777 float_v k0[7], k1[7], k2[7];
3779 for(Int_t
i=0;
i<7;++
i){
3780 k0[
i] = mCHt0[
i]*mS[0] + mCHt1[
i]*mS[1] + mCHt2[
i]*mS[3];
3781 k1[
i] = mCHt0[
i]*mS[1] + mCHt1[
i]*mS[2] + mCHt2[
i]*mS[4];
3782 k2[
i] = mCHt0[
i]*mS[3] + mCHt1[
i]*mS[4] + mCHt2[
i]*mS[5];
3787 Vtx.
fP[ 3] -= m[ 3];
3788 Vtx.
fP[ 4] -= m[ 4];
3789 Vtx.
fP[ 5] -= m[ 5];
3790 Vtx.
fP[ 6] -= m[ 6];
3792 Vtx.
fC[ 9] -= mV[ 9];
3793 Vtx.
fC[13] -= mV[13];
3794 Vtx.
fC[14] -= mV[14];
3795 Vtx.
fC[18] -= mV[18];
3796 Vtx.
fC[19] -= mV[19];
3797 Vtx.
fC[20] -= mV[20];
3798 Vtx.
fC[24] -= mV[24];
3799 Vtx.
fC[25] -= mV[25];
3800 Vtx.
fC[26] -= mV[26];
3801 Vtx.
fC[27] -= mV[27];
3805 for(Int_t
i=0;
i<3;++
i)
3806 Vtx.
fP[
i] = m[
i] - (k0[
i]*zeta[0] + k1[
i]*zeta[1] + k2[
i]*zeta[2]);
3807 for(Int_t
i=3;
i<7;++
i)
3808 Vtx.
fP[
i] = Vtx.
fP[
i] - (k0[
i]*zeta[0] + k1[
i]*zeta[1] + k2[
i]*zeta[2]);
3812 float_v ffC[28] = {-mV[ 0],
3814 -mV[ 3], -mV[ 4], -mV[ 5],
3815 mV[ 6], mV[ 7], mV[ 8], Vtx.
fC[ 9],
3816 mV[10], mV[11], mV[12], Vtx.
fC[13], Vtx.
fC[14],
3817 mV[15], mV[16], mV[17], Vtx.
fC[18], Vtx.
fC[19], Vtx.
fC[20],
3818 mV[21], mV[22], mV[23], Vtx.
fC[24], Vtx.
fC[25], Vtx.
fC[26], Vtx.
fC[27] };
3820 for(Int_t
i=0,
k=0;
i<7;++
i){
3821 for(Int_t
j=0;
j<=
i;++
j,++
k){
3822 Vtx.
fC[
k] = ffC[
k] + (k0[
i]*mCHt0[
j] + k1[
i]*mCHt1[
j] + k2[
i]*mCHt2[
j] );
3830 Vtx.
fChi2 -= ((mS[0]*zeta[0] + mS[1]*zeta[1] + mS[3]*zeta[2])*zeta[0]
3831 + (mS[1]*zeta[0] + mS[2]*zeta[1] + mS[4]*zeta[2])*zeta[1]
3832 + (mS[3]*zeta[0] + mS[4]*zeta[1] + mS[5]*zeta[2])*zeta[2]);
3859 for( Int_t
i=0;
i<8;
i++ )
for( Int_t
j=0;
j<8;
j++) mJ[
i][
j]=0;
3861 mJ[0][0]=1; mJ[0][1]=0; mJ[0][2]=0; mJ[0][3]=dS; mJ[0][4]=0; mJ[0][5]=0;
3862 mJ[1][0]=0; mJ[1][1]=1; mJ[1][2]=0; mJ[1][3]=0; mJ[1][4]=dS; mJ[1][5]=0;
3863 mJ[2][0]=0; mJ[2][1]=0; mJ[2][2]=1; mJ[2][3]=0; mJ[2][4]=0; mJ[2][5]=dS;
3865 mJ[3][0]=0; mJ[3][1]=0; mJ[3][2]=0; mJ[3][3]=1; mJ[3][4]=0; mJ[3][5]=0;
3866 mJ[4][0]=0; mJ[4][1]=0; mJ[4][2]=0; mJ[4][3]=0; mJ[4][4]=1; mJ[4][5]=0;
3867 mJ[5][0]=0; mJ[5][1]=0; mJ[5][2]=0; mJ[5][3]=0; mJ[5][4]=0; mJ[5][5]=1;
3868 mJ[6][6] = mJ[7][7] = 1;
3870 float_v px =
fP[3], py =
fP[4], pz =
fP[5];
3872 P[0] =
fP[0] + dS*
fP[3];
3873 P[1] = fP[1] + dS*fP[4];
3874 P[2] = fP[2] + dS*fP[5];
3882 for( Int_t
i=0;
i<6;
i++ )
for( Int_t
j=0;
j<6;
j++) mJds[
i][
j]=0;
3888 for(
int i1=0; i1<6; i1++)
3889 for(
int i2=0; i2<6; i2++)
3890 mJ[i1][i2] += mJds[i1][3]*px*dsdr[i2] + mJds[i1][4]*py*dsdr[i2] + mJds[i1][5]*pz*dsdr[i2];
3895 for(
int i=0;
i<6;
i++)
3896 for(
int j=0;
j<6;
j++)
3897 F[
i*6+
j] = mJ[
i][
j];
3899 for(
int i1=0; i1<6; i1++)
3900 for(
int i2=0; i2<6; i2++)
3901 F1[i1*6 + i2] = mJds[i1][3]*px*dsdr1[i2] + mJds[i1][4]*py*dsdr1[i2] + mJds[i1][5]*pz*dsdr1[i2];
3916 P[0] =
fP[0] + dS*
fP[3];
3917 P[1] = fP[1] + dS*fP[4];
3918 P[2] = fP[2] + dS*fP[5];
3945 float_v
alpha = 0.f, qt = 0.f;
3946 float_v spx = positive.
GetPx() + negative.
GetPx();
3947 float_v spy = positive.
GetPy() + negative.
GetPy();
3948 float_v spz = positive.
GetPz() + negative.
GetPz();
3949 float_v sp = sqrt(spx*spx + spy*spy + spz*spz);
3950 float_m
mask = float_m( abs(sp) < float_v(1.
e-10
f));
3951 float_v pn, pp, pln, plp;
3955 pln = (negative.
GetPx()*spx+negative.
GetPy()*spy+negative.
GetPz()*spz)/sp;
3956 plp = (positive.
GetPx()*spx+positive.
GetPy()*spy+positive.
GetPz()*spz)/sp;
3958 mask = float_m(mask & float_m( abs(pn) < float_v(1.
E-10
f)));
3959 float_v ptm = (1.f-((pln/pn)*(pln/pn)));
3960 qt(ptm >= 0.
f) = pn*sqrt(ptm);
3961 alpha = (plp-pln)/(plp+pln);
3963 QtAlfa[0](
mask) = qt;
3964 QtAlfa[1](
mask) = alpha;
3980 float_v
s = sin(angle);
3981 float_v
c = cos(angle);
3984 for( Int_t
i=0;
i<8;
i++ ){
3985 for( Int_t
j=0;
j<8;
j++){
3989 for(
int i=0;
i<8;
i++ ){
3992 mA[0][0] =
c; mA[0][1] =
s;
3993 mA[1][0] = -
s; mA[1][1] =
c;
3994 mA[3][3] =
c; mA[3][4] =
s;
3995 mA[4][3] = -
s; mA[4][4] =
c;
4000 for( Int_t
i=0;
i<8;
i++ ){
4002 for( Int_t
k=0;
k<8;
k++){
4003 mAp[
i]+=mA[
i][
k] *
fP[
k];
4007 for( Int_t
i=0;
i<8;
i++){
4011 for( Int_t
i=0;
i<8;
i++ ){
4012 for( Int_t
j=0;
j<8;
j++ ){
4014 for( Int_t
k=0;
k<8;
k++ ){
4020 for( Int_t
i=0;
i<8;
i++ ){
4021 for( Int_t
j=0;
j<=
i;
j++ ){
4023 for( Int_t
k=0;
k<8;
k++){
4024 xx+= mAC[
i][
k]*mA[
j][
k];
4030 X() =
GetX() + Vtx[0];
4031 Y() =
GetY() + Vtx[1];
4032 Z() =
GetZ() + Vtx[2];
4041 float_v d[3], uud,
u[3][3];
4042 for(
int i=0;
i<3;
i++)
4045 for(
int j=0;
j<3;
j++)
4049 for(
int i=0;
i<3 ;
i++)
4052 for(
int j=0;
j<
i;
j++)
4053 uud += u[
j][i]*u[
j][i]*d[
j];
4054 uud = a[i*(i+3)/2] - uud;
4056 uud(abs(uud)<1.
e-8
f) = 1.e-8
f;
4057 d[
i] = uud/abs(uud);
4058 u[
i][
i] = sqrt(abs(uud));
4060 for(
int j=i+1;
j<3;
j++)
4063 for(
int k=0;
k<
i;
k++)
4064 uud += u[
k][i]*u[
k][
j]*d[
k];
4065 uud = a[
j*(
j+1)/2+i] - uud;
4066 u[
i][
j] = d[
i]/u[
i][
i]*uud;
4072 for(
int i=0;
i<3;
i++)
4075 u[
i][
i] = 1.f/u[
i][
i];
4077 for(
int i=0;
i<2;
i++)
4079 u[
i][
i+1] = - u[
i][
i+1]*u[
i][
i]*u[
i+1][
i+1];
4081 for(
int i=0;
i<1;
i++)
4083 u[
i][
i+2] = u[
i][
i+1]*u1[
i+1]*u[
i+1][
i+2]-u[
i][
i+2]*u[
i][
i]*u[
i+2][
i+2];
4086 for(
int i=0;
i<3;
i++)
4087 a[
i+3] = u[
i][2]*u[2][2]*d[2];
4088 for(
int i=0;
i<2;
i++)
4089 a[
i+1] = u[
i][1]*u[1][1]*d[1] + u[
i][2]*u[1][2]*d[2];
4090 a[0] = u[0][0]*u[0][0]*d[0] + u[0][1]*u[0][1]*d[1] + u[0][2]*u[0][2]*d[2];
4102 float_v* mA =
new float_v[kN*kN];
4104 for( Int_t
i=0, ij=0;
i<kN;
i++ ){
4105 for( Int_t
j=0;
j<kN;
j++, ++ij ){
4107 for( Int_t
k=0;
k<kN; ++
k ) mA[ij]+= S[(
k<=
i ) ?
i*(
i+1)/2+
k :
k*(
k+1)/2+
i] * Q[
j*kN+
k];
4111 for( Int_t
i=0;
i<kN;
i++ ){
4112 for( Int_t
j=0;
j<=
i;
j++ ){
4113 Int_t ij = (
j<=
i ) ?
i*(
i+1)/2+
j :
j*(
j+1)/2+
i;
4115 for( Int_t
k=0;
k<kN;
k++ ) SOut[ij] += Q[
i*kN+
k ] * mA[
k*kN+
j ];