28 #ifdef HomogeneousField
29 float_v KFParticleSIMD::fgBz = -5.f;
33 #ifdef NonhomogeneousField
67 for(
int i=0;
i<21;
i++ ) C[
i] = Cov[
i];
73 #ifdef NonhomogeneousField
85 for(Int_t iPart = 0; iPart<
float_vLen; iPart++)
88 for(Int_t
i=0;
i<3;
i++)
91 for(Int_t
i=0;
i<3;
i++)
92 fP[
i+3][iPart] = r[
i];
95 for(Int_t
i=0;
i<21;
i++)
102 for(Int_t iPart = 0; iPart<
float_vLen; iPart++)
110 #ifdef NonhomogeneousField
123 for(Int_t
i=0;
i<3;
i++)
126 for(Int_t
i=0;
i<3;
i++)
130 for(Int_t
i=0;
i<21;
i++)
141 #ifdef NonhomogeneousField
152 for(
int i=0;
i<6;
i++)
154 for(
int i=0;
i<21;
i++)
156 #ifdef NonhomogeneousField
157 for(
int i=0;
i<10;
i++)
158 fField.fField[
i] = track.FieldCoefficient(
i)[
n];
168 #ifdef NonhomogeneousField
177 Create(Track, NTracks, pdg);
191 for(Int_t iPart = 0; iPart<
float_vLen; iPart++)
193 Int_t iEntry = (iPart < NTracks) ? iPart : 0;
195 for(Int_t
i=0;
i<3;
i++)
196 fP[
i][iEntry] = r[
i];
198 for(Int_t
i=0;
i<3;
i++)
199 fP[
i+3][iEntry] = r[
i];
200 fQ[iEntry] = Track[iEntry]->
Charge();
202 for(Int_t
i=0;
i<21;
i++)
203 fC[
i][iEntry] = C[
i];
209 for(Int_t iPart = 0; iPart<
float_vLen; iPart++)
211 Int_t iEntry = (iPart < NTracks) ? iPart : 0;
218 #ifdef NonhomogeneousField
228 Create(track, index, pdg);
241 for(
int i=0;
i<6;
i++)
243 for(
int i=0;
i<21;
i++)
245 #ifdef NonhomogeneousField
246 for(
int i=0;
i<10;
i++)
247 fField.fField[
i].gather(&(track.FieldCoefficient(
i)[0]), index);
251 fQ.gather(&(track.
Q()[0]), index);
266 for(
int i=0;
i<6;
i++)
268 for(
int i=0;
i<21;
i++)
270 #ifdef NonhomogeneousField
271 for(
int i=0;
i<10;
i++)
272 fField.fField[
i] = reinterpret_cast<const float_v&>(track.FieldCoefficient(
i)[
index]);
276 fQ =
reinterpret_cast<const int_v&
>(track.
Q()[
index]);
286 for(
int i=0;
i<7;
i++)
288 for(
int i=0;
i<27;
i++)
290 #ifdef NonhomogeneousField
291 for(
int i=0;
i<10;
i++)
292 fField.fField[
i] = fField.fField[
i].rotated(1);
299 #ifdef NonhomogeneousField
310 Create(track, index, vertexGuess);
322 for(
int i=0;
i<3;
i++)
326 const float_v& dx =
fP[0] - vertexGuess.
fP[0];
327 const float_v&
dy =
fP[1] - vertexGuess.
fP[1];
328 const float_v&
dz =
fP[2] - vertexGuess.
fP[2];
329 const float_v& dl2 = dx*dx + dy*dy + dz*
dz;
330 const float_v& dl = sqrt(dl2);
332 fP[0] = vertexGuess.
fP[0];
333 fP[1] = vertexGuess.
fP[1];
334 fP[2] = vertexGuess.
fP[2];
336 fP[3] = dx/dl *
fP[6];
337 fP[4] = dy/dl * fP[6];
338 fP[5] = dz/dl * fP[6];
341 for(
int i=0;
i<10;
i++)
345 for(
int i=0;
i<7;
i++)
346 for(
int j=0;
j<4;
j++)
348 J[0][0] = 1.f; J[1][1] = 1.f; J[2][2] = 1.f; J[6][3] = 1.f;
349 J[3][0] = fP[6]/dl * (1.f - dx*dx/dl2); J[3][1] = -dx*dy*fP[6]/(dl*dl2); J[3][2] = -dx*dz*fP[6]/(dl*dl2); J[3][3] = dx/dl;
350 J[4][0] = -dx*dy*fP[6]/(dl*dl2); J[4][1] = fP[6]/dl * (1.f - dy*dy/dl2); J[4][2] = -dy*dz*fP[6]/(dl*dl2); J[4][3] = dy/dl;
351 J[5][0] = -dx*dz*fP[6]/(dl*dl2); J[5][1] = -dy*dz*fP[6]/(dl*dl2); J[5][2] = fP[6]/dl * (1.f - dz*dz/dl2); J[5][3] = dz/dl;
354 for(Int_t
i=0;
i<4;
i++)
356 for(Int_t
j=0;
j<7;
j++)
359 for(Int_t
k=0;
k<4;
k++)
364 for( Int_t
i=0;
i<36;
i++ )
fC[
i] = 0.
f;
366 for(Int_t
i=0;
i<7; ++
i)
367 for(Int_t
j=0;
j<=
i; ++
j)
368 for(Int_t l=0; l<4; l++)
372 fQ = int_v(Vc::Zero);
381 #ifdef NonhomogeneousField
392 Load(track, index, vertexGuess);
404 for(
int i=0;
i<3;
i++)
407 const float_v& dx =
fP[0] - vertexGuess.
fP[0];
408 const float_v&
dy =
fP[1] - vertexGuess.
fP[1];
409 const float_v&
dz =
fP[2] - vertexGuess.
fP[2];
410 const float_v& dl2 = dx*dx + dy*dy + dz*
dz;
411 const float_v& dl = sqrt(dl2);
413 fP[0] = vertexGuess.
fP[0];
414 fP[1] = vertexGuess.
fP[1];
415 fP[2] = vertexGuess.
fP[2];
417 fP[3] = dx/dl *
fP[6];
418 fP[4] = dy/dl * fP[6];
419 fP[5] = dz/dl * fP[6];
422 for(
int i=0;
i<10;
i++)
426 for(
int i=0;
i<7;
i++)
427 for(
int j=0;
j<4;
j++)
429 J[0][0] = 1.f; J[1][1] = 1.f; J[2][2] = 1.f; J[6][3] = 1.f;
430 J[3][0] = fP[6]/dl * (1.f - dx*dx/dl2); J[3][1] = -dx*dy*fP[6]/(dl*dl2); J[3][2] = -dx*dz*fP[6]/(dl*dl2); J[3][3] = dx/dl;
431 J[4][0] = -dx*dy*fP[6]/(dl*dl2); J[4][1] = fP[6]/dl * (1.f - dy*dy/dl2); J[4][2] = -dy*dz*fP[6]/(dl*dl2); J[4][3] = dy/dl;
432 J[5][0] = -dx*dz*fP[6]/(dl*dl2); J[5][1] = -dy*dz*fP[6]/(dl*dl2); J[5][2] = fP[6]/dl * (1.f - dz*dz/dl2); J[5][3] = dz/dl;
435 for(Int_t
i=0;
i<4;
i++)
437 for(Int_t
j=0;
j<7;
j++)
440 for(Int_t
k=0;
k<4;
k++)
445 for( Int_t
i=0;
i<36;
i++ )
fC[
i] = 0.
f;
447 for(Int_t
i=0;
i<7; ++
i)
448 for(Int_t
j=0;
j<=
i; ++
j)
449 for(Int_t l=0; l<4; l++)
453 fQ = int_v(Vc::Zero);
462 #ifdef NonhomogeneousField
474 for(Int_t
i=0;
i<3;
i++)
477 for(Int_t
i=0;
i<21;
i++)
481 fQ = int_v(Vc::Zero);
494 for(
int i = 0;
i < 7; ++
i )
496 for(
int i = 0;
i < 36; ++
i )
499 fQ[iEntry] = part.
Q()[iEntryPart];
500 fNDF[iEntry] = part.
NDF()[iEntryPart];
507 fId[iEntry] = part.
Id()[iEntryPart];
517 #ifdef NonhomogeneousField
518 fField.SetOneEntry( iEntry, part.fField, iEntryPart );
523 #ifdef NonhomogeneousField
536 for (
int ie = 1; ie < nPart; ie++ ) {
541 std::cout <<
" void CbmKFParticle_simd::Create(CbmKFParticle *parts[], int N) " << std::endl;
547 for (
int iPart = 0; iPart <
float_vLen; iPart++ ) {
548 Int_t iEntry = (iPart < nPart) ? iPart : 0;
551 fId[iEntry] = part.
Id();
557 for(
int i = 0;
i < 8; ++
i )
559 for(
int i = 0;
i < 36; ++
i )
566 #ifdef NonhomogeneousField
567 fField.SetOneEntry( part.GetFieldCoeff(), iEntry);
573 #ifdef NonhomogeneousField
593 for(
int i = 0;
i < 8; ++
i )
595 for(
int i = 0;
i < 36; ++
i )
598 #ifdef NonhomogeneousField
617 float_v dsdr[6] = {0.f,0.f,0.f,0.f,0.f,0.f};
621 float_v dx = mP[0] - vtx[0];
622 float_v
dy = mP[1] - vtx[1];
625 float_v
pt = sqrt(px*px + py*py);
626 float_v ex(Vc::Zero), ey(Vc::Zero);
627 float_m
mask = ( pt < float_v(1.
e-4) );
629 pt(mask) = float_v(1.
f);
632 val(mask) = float_v(1.e4);
633 val(!mask)= dy*ex - dx*ey;
637 float_v h3 = (dy*ey + dx*ex)*ey/pt;
638 float_v h4 = -(dy*ey + dx*ex)*ex/pt;
647 err+= h0*(h0*Cv[0] + h1*Cv[1] ) + h1*(h0*Cv[1] + h1*Cv[2] );
650 err = sqrt(abs(err));
679 #ifdef HomogeneousField
713 #ifdef HomogeneousField
733 float_v mP[8], mC[36], mP1[8], mC1[36];
736 float_v dx = mP[0]-mP1[0];
737 float_v
dy = mP[1]-mP1[1];
738 return sqrt(dx*dx+dy*dy);
747 float_v ds[2] = {0.f,0.f};
749 float_v
F1[36],
F2[36],
F3[36],
F4[36];
750 for(
int i1=0; i1<36; i1++)
763 float_v mP1[8], mC1[36];
764 float_v mP2[8], mC2[36];
766 Transport(ds[0], dsdr[0], mP1, mC1, dsdr[1], F1, F2);
767 p.
Transport(ds[1], dsdr[3], mP2, mC2, dsdr[2], F4, F3);
772 for(
int iC=0; iC<3; iC++)
773 mC1[iC] += V0Tmp[iC] + mC2[iC] + V1Tmp[iC];
775 float_v d[3]={ mP2[0]-mP1[0], mP2[1]-mP1[1], mP2[2]-mP1[2]};
777 return ( ( mC1[0]*d[0] + mC1[1]*d[1])*d[0]
778 +(mC1[1]*d[0] + mC1[2]*d[1])*d[1] );
791 float_v dsdr[6] = {0.f,0.f,0.f,0.f,0.f,0.f};
793 float_v dsdp[6] = {-dsdr[0], -dsdr[1], -dsdr[2], 0.f, 0.f, 0.f};
794 float_v
F[36],
F1[36];
795 for(
int i2=0; i2<36; i2++)
800 Transport( dS, dsdr, mP, mC, dsdp, F, F1 );
805 for(
int i=0;
i<3;
i++)
806 for(
int j=0;
j<6;
j++)
809 for(
int k=0;
k<3;
k++)
811 VFT[
i][
j] += Cv[
IJ(
i,
k)] * F1[
j*6+
k];
816 for(
int i=0;
i<6;
i++)
817 for(
int j=0;
j<6;
j++)
820 for(
int k=0;
k<3;
k++)
822 FVFT[
i][
j] += F1[
i*6+
k] * VFT[
k][
j];
825 mC[0] += FVFT[0][0] + Cv[0];
826 mC[1] += FVFT[1][0] + Cv[1];
827 mC[2] += FVFT[1][1] + Cv[2];
828 mC[3] += FVFT[2][0] + Cv[3];
829 mC[4] += FVFT[2][1] + Cv[4];
830 mC[5] += FVFT[2][2] + Cv[5];
835 float_v d[3]={ vtx[0]-mP[0], vtx[1]-mP[1], vtx[2]-mP[2]};
837 return ( ( mC[0]*d[0] + mC[1]*d[1] )*d[0]
838 +(mC[1]*d[0] + mC[2]*d[1] )*d[1] );
851 #ifdef HomogeneousField
869 float_v ds[2] = {0.f,0.f};
872 float_v mP[8], mC[36], mP1[8], mC1[36];
875 float_v
n = sqrt( mP[3]*mP[3] + mP[4]*mP[4] + mP[5]*mP[5] );
876 float_v n1= sqrt( mP1[3]*mP1[3] + mP1[4]*mP1[4] + mP1[5]*mP1[5] );
879 float_m
mask = (n>(1.e-8
f));
880 a(mask) = ( mP[3]*mP1[3] + mP[4]*mP1[4] + mP[5]*mP1[5] )/n;
881 mask = ( abs(a) < float_v(1.
f));
882 float_m aPos = (a>=float_v(Vc::Zero));
883 a(mask) = KFPMath::ACos(a);
884 a((!mask) && aPos) = float_v(Vc::Zero);
885 a((!mask) && (!aPos)) = 3.1415926535f;
895 float_v ds[2] = {0.f,0.f};
898 float_v mP[8], mC[36], mP1[8], mC1[36];
901 float_v
n = sqrt( mP[3]*mP[3] + mP[4]*mP[4] );
902 float_v n1= sqrt( mP1[3]*mP1[3] + mP1[4]*mP1[4] );
905 float_m
mask = (n>(1.e-8
f));
906 a = ( mP[3]*mP1[3] + mP[4]*mP1[4] )/n;
908 mask = ( abs(a) < float_v(1.
f));
909 float_m aPos = (a>=float_v(Vc::Zero));
910 a(mask) = KFPMath::ACos(a);
911 a((!mask) && aPos) = float_v(Vc::Zero);
912 a((!mask) && (!aPos)) = 3.1415926535f;
922 float_v ds[2] = {0.f,0.f};
925 float_v mP[8], mC[36], mP1[8], mC1[36];
928 float_v nr = sqrt( mP[3]*mP[3] + mP[4]*mP[4] );
929 float_v n1r= sqrt( mP1[3]*mP1[3] + mP1[4]*mP1[4] );
930 float_v
n = sqrt( nr*nr + mP[5]*mP[5] );
931 float_v n1= sqrt( n1r*n1r + mP1[5]*mP1[5] );
934 float_m
mask = (n>(1.e-8
f));
935 a(mask) = ( nr*n1r +mP[5]*mP1[5])/n;
936 mask = ( abs(a) < float_v(Vc::Zero));
937 float_m aPos = (a>=float_v(Vc::Zero));
938 a(mask) = KFPMath::ACos(a);
939 a((!mask) && aPos) = float_v(Vc::Zero);
940 a((!mask) && (!aPos)) = 3.1415926535f;
953 const float_v ipt2 = 1/(
Px()*
Px() +
Py()*
Py() );
954 const float_v mipt2 = mass*ipt2;
955 const float_v dx =
X() - pV.
X();
956 const float_v
dy =
Y() - pV.
Y();
967 const float_v f0 =
Px()*mipt2;
968 const float_v
f1 =
Py()*mipt2;
969 const float_v mipt2derivative = mipt2*(1-2*
Px()*
Px()*ipt2);
970 const float_v
f2 = dx*mipt2derivative;
971 const float_v
f3 = -dy*mipt2derivative;
972 const float_v
f4 = -f0;
973 const float_v
f5 = -
f1;
1004 return ( dx*
Px() + dy*
Py() )*mipt2;
1014 Part.
SetId(static_cast<int>(
Id()[iPart]));
1022 for(
int iP=0; iP<8; iP++)
1024 for(
int iC=0; iC<36; iC++)
1027 Part.
NDF() =
static_cast<int>(
GetNDF()[iPart]);
1029 Part.
Q() =
GetQ()[iPart];
1031 #ifdef NonhomogeneousField
1032 for(
int iF=0; iF<10; iF++)
1033 Part.SetFieldCoeff(fField.fField[iF][iPart], iF);
1044 for(
int i=0;
i<nPart;
i++)