12 using namespace mkfit;
20 const T*
a =
A.fArray;
22 const T*
b =
B.fArray;
27 #include "MultHelixPropEndcap.ah" 36 const T*
a =
A.fArray;
38 const T*
b =
B.fArray;
43 #include "MultHelixPropTranspEndcap.ah" 75 helixAtZ(inPar, inChg, msZ, outPar, errorProp, outFailFlag, N_proc, pflags);
79 for (
int kk = 0;
kk < N_proc; ++
kk) {
81 for (
int i = 0;
i < 6; ++
i) {
87 for (
int i = 0;
i < 6; ++
i) {
88 for (
int j = 0;
j < 6; ++
j)
95 for (
int i = 0;
i < 6; ++
i) {
96 for (
int j = 0;
j < 6; ++
j)
107 for (
int kk = 0;
kk < N_proc; ++
kk) {
109 for (
int i = 0;
i < 6; ++
i) {
110 for (
int j = 0;
j < 6; ++
j)
121 MultHelixPropEndcap(errorProp, outErr,
temp);
122 MultHelixPropTranspEndcap(errorProp,
temp, outErr);
133 for (
int n = 0;
n <
NN; ++
n) {
134 if (
n >= N_proc || (noMatEffPtr && noMatEffPtr->constAt(
n, 0, 0))) {
135 hitsRl(
n, 0, 0) = 0.f;
136 hitsXi(
n, 0, 0) = 0.f;
138 const float hypo =
std::hypot(outPar(
n, 0, 0), outPar(
n, 1, 0));
140 hitsRl(
n, 0, 0) = mat.
radl;
141 hitsXi(
n, 0, 0) = mat.bbxi;
144 const float zout = msZ.constAt(
n, 0, 0);
145 const float zin = inPar.constAt(
n, 2, 0);
151 for (
int n = 0;
n <
NN; ++
n) {
152 plNrm(
n, 0, 0) = 0.f;
153 plNrm(
n, 1, 0) = 0.f;
154 plNrm(
n, 2, 0) = 1.f;
159 for (
int kk = 0;
kk < N_proc; ++
kk) {
161 for (
int i = 0;
i < 1; ++
i) {
166 for (
int i = 0;
i < 3; ++
i) {
170 dprintf(
"outErr(after material) %d\n",
kk);
171 for (
int i = 0;
i < 6; ++
i) {
172 for (
int j = 0;
j < 6; ++
j)
187 for (
int i = 0;
i < N_proc; ++
i) {
188 if (outFailFlag(
i, 0, 0)) {
189 outPar.copySlot(
i, inPar);
190 outErr.copySlot(
i, inErr);
204 errorProp.setVal(0.
f);
205 outFailFlag.setVal(0.
f);
209 for (
int n = 0;
n <
NN; ++
n) {
211 errorProp(
n, 0, 0) = 1.f;
212 errorProp(
n, 1, 1) = 1.f;
213 errorProp(
n, 3, 3) = 1.f;
214 errorProp(
n, 4, 4) = 1.f;
215 errorProp(
n, 5, 5) = 1.f;
223 for (
int n = 0;
n <
NN; ++
n) {
225 zout[
n] = msZ.constAt(
n, 0, 0);
226 zin[
n] = inPar.constAt(
n, 2, 0);
227 ipt[
n] = inPar.constAt(
n, 3, 0);
228 phiin[
n] = inPar.constAt(
n, 4, 0);
229 theta[
n] = inPar.constAt(
n, 5, 0);
235 for (
int n = 0;
n <
NN; ++
n) {
236 k[
n] = inChg.constAt(
n, 0, 0) * 100.f /
241 for (
int n = 0;
n <
NN; ++
n) {
248 for (
int n = 0;
n <
NN; ++
n) {
249 kinv[
n] = 1.f /
k[
n];
253 for (
int n = 0;
n <
NN; ++
n) {
256 <<
"input parameters" 257 <<
" inPar.constAt(n, 0, 0)=" << std::setprecision(9) << inPar.constAt(
n, 0, 0)
258 <<
" inPar.constAt(n, 1, 0)=" << std::setprecision(9) << inPar.constAt(
n, 1, 0)
259 <<
" inPar.constAt(n, 2, 0)=" << std::setprecision(9) << inPar.constAt(
n, 2, 0)
260 <<
" inPar.constAt(n, 3, 0)=" << std::setprecision(9) << inPar.constAt(
n, 3, 0)
261 <<
" inPar.constAt(n, 4, 0)=" << std::setprecision(9) << inPar.constAt(
n, 4, 0)
262 <<
" inPar.constAt(n, 5, 0)=" << std::setprecision(9) << inPar.constAt(
n, 5, 0)
263 <<
" inChg.constAt(n, 0, 0)=" << std::setprecision(9) << inChg.constAt(
n, 0, 0));
266 for (
int n = 0;
n <
NN; ++
n) {
268 "propagation start, dump parameters" 270 <<
"pos = " << inPar.constAt(
n, 0, 0) <<
" " << inPar.constAt(
n, 1, 0) <<
" " 271 << inPar.constAt(
n, 2, 0) << std::endl
272 <<
"mom (cart) = " <<
std::cos(inPar.constAt(
n, 4, 0)) / inPar.constAt(
n, 3, 0) <<
" " 273 <<
std::sin(inPar.constAt(
n, 4, 0)) / inPar.constAt(
n, 3, 0) <<
" " 274 << 1. / (inPar.constAt(
n, 3, 0) *
tan(inPar.constAt(
n, 5, 0))) <<
" r=" 275 <<
std::sqrt(inPar.constAt(
n, 0, 0) * inPar.constAt(
n, 0, 0) +
276 inPar.constAt(
n, 1, 0) * inPar.constAt(
n, 1, 0))
277 <<
" pT=" << 1. /
std::abs(inPar.constAt(
n, 3, 0)) <<
" q=" << inChg.constAt(
n, 0, 0)
278 <<
" targetZ=" << msZ.constAt(
n, 0, 0) << std::endl);
283 for (
int n = 0;
n <
NN; ++
n) {
284 pt[
n] = 1.f / ipt[
n];
291 for (
int n = 0;
n <
NN; ++
n) {
296 for (
int n = 0;
n <
NN; ++
n) {
303 for (
int n = 0;
n <
NN; ++
n) {
308 for (
int n = 0;
n <
NN; ++
n) {
317 for (
int n = 0;
n <
NN; ++
n) {
318 tanT[
n] = sinT[
n] / cosT[
n];
319 icos2T[
n] = 1.f / (cosT[
n] * cosT[
n]);
320 pxin[
n] = cosP[
n] *
pt[
n];
321 pyin[
n] = sinP[
n] *
pt[
n];
327 for (
int n = 0;
n <
NN; ++
n) {
335 #if !defined(__INTEL_COMPILER) 338 for (
int n = 0;
n <
NN; ++
n) {
342 #if !defined(__INTEL_COMPILER) 345 for (
int n = 0;
n <
NN; ++
n) {
348 #if !defined(__INTEL_COMPILER) 351 for (
int n = 0;
n <
NN; ++
n) {
361 for (
int n = 0;
n <
NN; ++
n) {
362 cosah[
n] = cosahTmp[
n];
363 sinah[
n] = sinahTmp[
n];
364 cosa[
n] = 1.f - 2.f * sinah[
n] * sinah[
n];
365 sina[
n] = 2.f * sinah[
n] * cosah[
n];
370 for (
int n = 0;
n <
NN; ++
n) {
371 outPar.At(
n, 0, 0) = outPar.At(
n, 0, 0) + 2.f *
k[
n] * sinah[
n] * (pxin[
n] * cosah[
n] - pyin[
n] * sinah[
n]);
372 outPar.At(
n, 1, 0) = outPar.At(
n, 1, 0) + 2.f *
k[
n] * sinah[
n] * (pyin[
n] * cosah[
n] + pxin[
n] * sinah[
n]);
373 outPar.At(
n, 2, 0) = zout[
n];
374 outPar.At(
n, 4, 0) = phiin[
n] +
alpha[
n];
378 for (
int n = 0;
n <
NN; ++
n) {
380 "propagation to Z end (OLD), dump parameters\n" 381 <<
" pos = " << outPar(
n, 0, 0) <<
" " << outPar(
n, 1, 0) <<
" " << outPar(
n, 2, 0) <<
"\t\t r=" 382 <<
std::sqrt(outPar(
n, 0, 0) * outPar(
n, 0, 0) + outPar(
n, 1, 0) * outPar(
n, 1, 0)) << std::endl
383 <<
" mom = " << outPar(
n, 3, 0) <<
" " << outPar(
n, 4, 0) <<
" " << outPar(
n, 5, 0) << std::endl
384 <<
" cart= " <<
std::cos(outPar(
n, 4, 0)) / outPar(
n, 3, 0) <<
" " 385 <<
std::sin(outPar(
n, 4, 0)) / outPar(
n, 3, 0) <<
" " 386 << 1. / (outPar(
n, 3, 0) *
tan(outPar(
n, 5, 0))) <<
"\t\tpT=" << 1. /
std::abs(outPar(
n, 3, 0))
392 for (
int n = 0;
n <
NN; ++
n) {
393 pxcaMpysa[
n] = pxin[
n] * cosa[
n] - pyin[
n] * sina[
n];
397 for (
int n = 0;
n <
NN; ++
n) {
398 errorProp(
n, 0, 2) = -tanT[
n] * ipt[
n] * pxcaMpysa[
n];
401 (cosP[
n] * (
alpha[
n] * cosa[
n] - sina[
n]) + sinP[
n] * 2.
f * sinah[
n] * (sinah[
n] -
alpha[
n] * cosah[
n]));
402 errorProp(
n, 0, 4) = -2.f *
k[
n] *
pt[
n] * sinah[
n] * (sinP[
n] * cosah[
n] + cosP[
n] * sinah[
n]);
403 errorProp(
n, 0, 5) =
deltaZ[
n] * ipt[
n] * pxcaMpysa[
n] * icos2T[
n];
408 for (
int n = 0;
n <
NN; ++
n) {
409 pycaPpxsa[
n] = pyin[
n] * cosa[
n] + pxin[
n] * sina[
n];
413 for (
int n = 0;
n <
NN; ++
n) {
414 errorProp(
n, 1, 2) = -tanT[
n] * ipt[
n] * pycaPpxsa[
n];
417 (sinP[
n] * (
alpha[
n] * cosa[
n] - sina[
n]) - cosP[
n] * 2.
f * sinah[
n] * (sinah[
n] -
alpha[
n] * cosah[
n]));
418 errorProp(
n, 1, 4) = 2.f *
k[
n] *
pt[
n] * sinah[
n] * (cosP[
n] * cosah[
n] - sinP[
n] * sinah[
n]);
419 errorProp(
n, 1, 5) =
deltaZ[
n] * ipt[
n] * pycaPpxsa[
n] * icos2T[
n];
423 for (
int n = 0;
n <
NN; ++
n) {
424 errorProp(
n, 4, 2) = -ipt[
n] * tanT[
n] * kinv[
n];
425 errorProp(
n, 4, 3) = tanT[
n] *
deltaZ[
n] * kinv[
n];
426 errorProp(
n, 4, 5) = ipt[
n] *
deltaZ[
n] * kinv[
n] * icos2T[
n];
430 for (
int n = 0;
n <
NN; ++
n) {
433 "propagation end, dump parameters" 435 <<
"pos = " << outPar.At(
n, 0, 0) <<
" " << outPar.At(
n, 1, 0) <<
" " << outPar.At(
n, 2, 0) << std::endl
436 <<
"mom (cart) = " <<
std::cos(outPar.At(
n, 4, 0)) / outPar.At(
n, 3, 0) <<
" " 437 <<
std::sin(outPar.At(
n, 4, 0)) / outPar.At(
n, 3, 0) <<
" " 438 << 1. / (outPar.At(
n, 3, 0) *
tan(outPar.At(
n, 5, 0)))
439 <<
" r=" <<
std::sqrt(outPar.At(
n, 0, 0) * outPar.At(
n, 0, 0) + outPar.At(
n, 1, 0) * outPar.At(
n, 1, 0))
440 <<
" pT=" << 1. /
std::abs(outPar.At(
n, 3, 0)) << std::endl);
468 for (
int n = 0;
n < N_proc; ++
n) {
471 printf(
"%5f %5f %5f %5f %5f %5f\n",
478 printf(
"%5f %5f %5f %5f %5f %5f\n",
485 printf(
"%5f %5f %5f %5f %5f %5f\n",
492 printf(
"%5f %5f %5f %5f %5f %5f\n",
499 printf(
"%5f %5f %5f %5f %5f %5f\n",
506 printf(
"%5f %5f %5f %5f %5f %5f\n",
Matriplex::Matriplex< float, LL, LL, NN > MPlexLL
MPlex< T, D1, D2, N > hypot(const MPlex< T, D1, D2, N > &a, const MPlex< T, D1, D2, N > &b)
Matriplex::Matriplex< float, HH, 1, NN > MPlexHV
Sin< T >::type sin(const T &t)
const TrackerInfo * tracker_info
void applyMaterialEffects(const MPlexQF &hitsRl, const MPlexQF &hitsXi, const MPlexQF &propSign, const MPlexHV &plNrm, MPlexLS &outErr, MPlexLV &outPar, const int N_proc)
Matriplex::Matriplex< float, LL, 1, NN > MPlexLV
void squashPhiMPlex(MPlexLV &par, const int N_proc)
void propagateHelixToZMPlex(const MPlexLS &inErr, const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msZ, MPlexLS &outErr, MPlexLV &outPar, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &pflags, const MPlexQI *noMatEffPtr=nullptr)
void helixAtZ(const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msZ, MPlexLV &outPar, MPlexLL &errorProp, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &pflags)
constexpr Matriplex::idx_t NN
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
constexpr bool useTrigApprox
Matriplex::Matriplex< int, 1, 1, NN > MPlexQI
Matriplex::Matriplex< float, 1, 1, NN > MPlexQF
float hipo(float x, float y)
float bFieldFromZR(const float z, const float r)
Matriplex::MatriplexSym< float, LL, NN > MPlexLS
Material material_checked(float z, float r) const
void sincos4(const float x, float &sin, float &cos)
#define ASSUME_ALIGNED(a, b)