@@ -456,299 +456,6 @@ static inline void helixAtPlane_impl(const Tf& __restrict__ inPar,
456456 parsAndErrPropFromPathL_impl(inPar, inChg, outPar, kinv, s, errorProp, nmin, nmax, N_proc, pf);
457457}
458458
459- /*
460- // this function just calculates the path length (using the iterative approach as before)
461- // and then calls parsAndErrPropFromPathL_impl for error propagation
462- template <typename Tf, typename Ti, typename TfLL1, typename Tf11, typename TfLLL>
463- static inline void helixAtRFromIterativeCCS_impl_new(const Tf& __restrict__ inPar,
464- const Ti& __restrict__ inChg,
465- const Tf11& __restrict__ msRad,
466- TfLL1& __restrict__ outPar,
467- TfLLL& __restrict__ errorProp,
468- Ti& __restrict__ outFailFlag, // expected to be initialized to 0
469- const int nmin,
470- const int nmax,
471- const int N_proc,
472- const PropagationFlags& pf) {
473-
474- #pragma omp simd
475- for (int n = nmin; n < nmax; ++n) {
476- //initialize erroProp to identity matrix
477- errorProp(n, 0, 0) = 1.f;
478- errorProp(n, 1, 1) = 1.f;
479- errorProp(n, 2, 2) = 1.f;
480- errorProp(n, 3, 3) = 1.f;
481- errorProp(n, 4, 4) = 1.f;
482- errorProp(n, 5, 5) = 1.f;
483- }
484- float r0[nmax - nmin];
485- #pragma omp simd
486- for (int n = nmin; n < nmax; ++n) {
487- //initialize erroProp to identity matrix
488- r0[n - nmin] = hipo(inPar(n, 0, 0), inPar(n, 1, 0));
489- }
490- float k[nmax - nmin];
491- if (pf.use_param_b_field) {
492- #pragma omp simd
493- for (int n = nmin; n < nmax; ++n) {
494- k[n - nmin] = inChg(n, 0, 0) * 100.f / (-Const::sol * Config::bFieldFromZR(inPar(n, 2, 0), r0[n - nmin]));
495- }
496- } else {
497- #pragma omp simd
498- for (int n = nmin; n < nmax; ++n) {
499- k[n - nmin] = inChg(n, 0, 0) * 100.f / (-Const::sol * Config::Bfield);
500- }
501- }
502- float r[nmax - nmin];
503- #pragma omp simd
504- for (int n = nmin; n < nmax; ++n) {
505- r[n - nmin] = msRad(n, 0, 0);
506- }
507- float xin[nmax - nmin];
508- float yin[nmax - nmin];
509- float ipt[nmax - nmin];
510- float phiin[nmax - nmin];
511- #pragma omp simd
512- for (int n = nmin; n < nmax; ++n) {
513- xin[n - nmin] = inPar(n, 0, 0);
514- yin[n - nmin] = inPar(n, 1, 0);
515- ipt[n - nmin] = inPar(n, 3, 0);
516- phiin[n - nmin] = inPar(n, 4, 0);
517- }
518-
519- for (int n = nmin; n < nmax; ++n) {
520- dprint_np(n,
521- "input parameters"
522- << " inPar(n, 0, 0)=" << std::setprecision(9) << inPar(n, 0, 0) << " inPar(n, 1, 0)="
523- << std::setprecision(9) << inPar(n, 1, 0) << " inPar(n, 2, 0)=" << std::setprecision(9)
524- << inPar(n, 2, 0) << " inPar(n, 3, 0)=" << std::setprecision(9) << inPar(n, 3, 0)
525- << " inPar(n, 4, 0)=" << std::setprecision(9) << inPar(n, 4, 0)
526- << " inPar(n, 5, 0)=" << std::setprecision(9) << inPar(n, 5, 0));
527- }
528-
529- float kinv[nmax - nmin];
530- float pt[nmax - nmin];
531- #pragma omp simd
532- for (int n = nmin; n < nmax; ++n) {
533- kinv[n - nmin] = 1.f / k[n - nmin];
534- pt[n - nmin] = 1.f / ipt[n - nmin];
535- }
536- float D[nmax - nmin];
537- float cosa[nmax - nmin];
538- float sina[nmax - nmin];
539- float cosah[nmax - nmin];
540- float sinah[nmax - nmin];
541- float id[nmax - nmin];
542-
543- #pragma omp simd
544- for (int n = nmin; n < nmax; ++n) {
545- D[n - nmin] = 0.;
546- }
547-
548- //no trig approx here, phi can be large
549- float cosPorT[nmax - nmin];
550- float sinPorT[nmax - nmin];
551- #pragma omp simd
552- for (int n = nmin; n < nmax; ++n) {
553- cosPorT[n - nmin] = std::cos(phiin[n - nmin]);
554- }
555- #pragma omp simd
556- for (int n = nmin; n < nmax; ++n) {
557- sinPorT[n - nmin] = std::sin(phiin[n - nmin]);
558- }
559-
560- float pxin[nmax - nmin];
561- float pyin[nmax - nmin];
562- #pragma omp simd
563- for (int n = nmin; n < nmax; ++n) {
564- pxin[n - nmin] = cosPorT[n - nmin] * pt[n - nmin];
565- pyin[n - nmin] = sinPorT[n - nmin] * pt[n - nmin];
566- }
567-
568- for (int n = nmin; n < nmax; ++n) {
569- dprint_np(n,
570- "k=" << std::setprecision(9) << k[n - nmin] << " pxin=" << std::setprecision(9) << pxin[n - nmin]
571- << " pyin=" << std::setprecision(9) << pyin[n - nmin] << " cosPorT=" << std::setprecision(9)
572- << cosPorT[n - nmin] << " sinPorT=" << std::setprecision(9) << sinPorT[n - nmin]
573- << " pt=" << std::setprecision(9) << pt[n - nmin]);
574- }
575-
576- float oodotp[nmax - nmin];
577- float pxinold[nmax - nmin];
578-
579- CMS_UNROLL_LOOP_COUNT(Config::Niter)
580- for (int i = 0; i < Config::Niter; ++i) {
581- #pragma omp simd
582- for (int n = nmin; n < nmax; ++n) {
583- //compute distance and path for the current iteration
584- r0[n - nmin] = hipo(xin[n - nmin], yin[n - nmin]);
585- }
586-
587- // Use one over dot product of transverse momentum and radial
588- // direction to scale the step. Propagation is prevented from reaching
589- // too close to the apex (dotp > 0.2).
590- // - Can / should we come up with a better approximation?
591- // - Can / should take +/- curvature into account?
592-
593- #pragma omp simd
594- for (int n = nmin; n < nmax; ++n) {
595- oodotp[n - nmin] =
596- r0[n - nmin] * pt[n - nmin] / (pxin[n - nmin] * xin[n - nmin] + pyin[n - nmin] * yin[n - nmin]);
597- }
598-
599- #pragma omp simd
600- for (int n = nmin; n < nmax; ++n) {
601- if (oodotp[n - nmin] > 5.0f || oodotp[n - nmin] < 0) // 0.2 is 78.5 deg
602- {
603- outFailFlag(n, 0, 0) = 1;
604- oodotp[n - nmin] = 0.0f;
605- } else if (r[n - nmin] - r0[n - nmin] < 0.0f && pt[n - nmin] < 1.0f) {
606- // Scale down the correction for low-pT ingoing tracks.
607- oodotp[n - nmin] = 1.0f + (oodotp[n - nmin] - 1.0f) * pt[n - nmin];
608- }
609- }
610-
611- #pragma omp simd
612- for (int n = nmin; n < nmax; ++n) {
613- // Can we come up with a better approximation?
614- // Should take +/- curvature into account.
615- id[n - nmin] = (r[n - nmin] - r0[n - nmin]) * oodotp[n - nmin];
616- }
617-
618- #pragma omp simd
619- for (int n = nmin; n < nmax; ++n) {
620- D[n - nmin] += id[n - nmin];
621- }
622-
623- if constexpr (Config::useTrigApprox) {
624- #if !defined(__INTEL_COMPILER)
625- #pragma omp simd
626- #endif
627- for (int n = nmin; n < nmax; ++n) {
628- sincos4(id[n - nmin] * ipt[n - nmin] * kinv[n - nmin] * 0.5f, sinah[n - nmin], cosah[n - nmin]);
629- }
630- } else {
631- #if !defined(__INTEL_COMPILER)
632- #pragma omp simd
633- #endif
634- for (int n = nmin; n < nmax; ++n) {
635- cosah[n - nmin] = std::cos(id[n - nmin] * ipt[n - nmin] * kinv[n - nmin] * 0.5f);
636- sinah[n - nmin] = std::sin(id[n - nmin] * ipt[n - nmin] * kinv[n - nmin] * 0.5f);
637- }
638- }
639-
640- #pragma omp simd
641- for (int n = nmin; n < nmax; ++n) {
642- cosa[n - nmin] = 1.f - 2.f * sinah[n - nmin] * sinah[n - nmin];
643- sina[n - nmin] = 2.f * sinah[n - nmin] * cosah[n - nmin];
644- }
645-
646- for (int n = nmin; n < nmax; ++n) {
647- dprint_np(n,
648- "Attempt propagation from r="
649- << r0[n - nmin] << " to r=" << r[n - nmin] << std::endl
650- << " x=" << xin[n - nmin] << " y=" << yin[n - nmin] << " z=" << inPar(n, 2, 0)
651- << " px=" << pxin[n - nmin] << " py=" << pyin[n - nmin]
652- << " pz=" << pt[n - nmin] / std::tan(inPar(n, 5, 0)) << " q=" << inChg(n, 0, 0) << std::endl
653- << " r=" << std::setprecision(9) << r[n - nmin] << " r0=" << std::setprecision(9) << r0[n - nmin]
654- << " id=" << std::setprecision(9) << id[n - nmin] << " dr=" << std::setprecision(9)
655- << r[n - nmin] - r0[n - nmin] << " cosa=" << cosa[n - nmin] << " sina=" << sina[n - nmin]
656- << " dir_cos(rad,pT)=" << 1.0f / oodotp[n - nmin]);
657- }
658-
659- #pragma omp simd
660- for (int n = nmin; n < nmax; ++n) {
661- //update parameters
662- xin[n - nmin] = xin[n - nmin] + 2.f * k[n - nmin] * sinah[n - nmin] *
663- (pxin[n - nmin] * cosah[n - nmin] - pyin[n - nmin] * sinah[n - nmin]);
664- yin[n - nmin] = yin[n - nmin] + 2.f * k[n - nmin] * sinah[n - nmin] *
665- (pyin[n - nmin] * cosah[n - nmin] + pxin[n - nmin] * sinah[n - nmin]);
666- pxinold[n - nmin] = pxin[n - nmin]; //copy before overwriting
667- pxin[n - nmin] = pxin[n - nmin] * cosa[n - nmin] - pyin[n - nmin] * sina[n - nmin];
668- pyin[n - nmin] = pyin[n - nmin] * cosa[n - nmin] + pxinold[n - nmin] * sina[n - nmin];
669- }
670- for (int n = nmin; n < nmax; ++n) {
671- dprint_np(n,
672- "outPar(n, 0, 0)=" << outPar(n, 0, 0) << " outPar(n, 1, 0)=" << outPar(n, 1, 0)
673- << " pxin=" << pxin[n - nmin] << " pyin=" << pyin[n - nmin]);
674- }
675- } // iteration loop
676-
677- //float s[nmax - nmin];
678- MPlexQF s;
679- for (int n = nmin; n < nmax; ++n) {
680- //s[n - nmin] = D[n - nmin]/std::sin(inPar(n, 5, 0));
681- s(n, 0, 0) = D[n - nmin]/std::sin(inPar(n, 5, 0));
682- }
683- parsAndErrPropFromPathL_impl(inPar, inChg, outPar, kinv, s, errorProp, nmin, nmax, N_proc, pf);
684-
685- for (int n = nmin; n < nmax; ++n) {
686- dprint_np(n,
687- "propagation to R end (NEW), dump parameters\n"
688- << " D = " << D[n - nmin] << " alpha = " << D[n - nmin] * inPar(n, 3, 0) * kinv[n - nmin] << " kinv = " << kinv[n - nmin] << std::endl
689- << " pos = " << outPar(n, 0, 0) << " " << outPar(n, 1, 0) << " " << outPar(n, 2, 0) << "\t\t r="
690- << std::sqrt(outPar(n, 0, 0) * outPar(n, 0, 0) + outPar(n, 1, 0) * outPar(n, 1, 0)) << std::endl
691- << " mom = " << outPar(n, 3, 0) << " " << outPar(n, 4, 0) << " " << outPar(n, 5, 0) << std::endl
692- << " cart= " << std::cos(outPar(n, 4, 0)) / outPar(n, 3, 0) << " "
693- << std::sin(outPar(n, 4, 0)) / outPar(n, 3, 0) << " " << 1. / (outPar(n, 3, 0) * tan(outPar(n, 5, 0)))
694- << "\t\tpT=" << 1. / std::abs(outPar(n, 3, 0)) << std::endl);
695- }
696-
697- #ifdef DEBUG
698- for (int n = nmin; n < nmax; ++n) {
699- if (debug && g_debug && n < N_proc) {
700- dmutex_guard;
701- std::cout << n << ": jacobian" << std::endl;
702- printf("%5f %5f %5f %5f %5f %5f\n",
703- errorProp(n, 0, 0),
704- errorProp(n, 0, 1),
705- errorProp(n, 0, 2),
706- errorProp(n, 0, 3),
707- errorProp(n, 0, 4),
708- errorProp(n, 0, 5));
709- printf("%5f %5f %5f %5f %5f %5f\n",
710- errorProp(n, 1, 0),
711- errorProp(n, 1, 1),
712- errorProp(n, 1, 2),
713- errorProp(n, 1, 3),
714- errorProp(n, 1, 4),
715- errorProp(n, 1, 5));
716- printf("%5f %5f %5f %5f %5f %5f\n",
717- errorProp(n, 2, 0),
718- errorProp(n, 2, 1),
719- errorProp(n, 2, 2),
720- errorProp(n, 2, 3),
721- errorProp(n, 2, 4),
722- errorProp(n, 2, 5));
723- printf("%5f %5f %5f %5f %5f %5f\n",
724- errorProp(n, 3, 0),
725- errorProp(n, 3, 1),
726- errorProp(n, 3, 2),
727- errorProp(n, 3, 3),
728- errorProp(n, 3, 4),
729- errorProp(n, 3, 5));
730- printf("%5f %5f %5f %5f %5f %5f\n",
731- errorProp(n, 4, 0),
732- errorProp(n, 4, 1),
733- errorProp(n, 4, 2),
734- errorProp(n, 4, 3),
735- errorProp(n, 4, 4),
736- errorProp(n, 4, 5));
737- printf("%5f %5f %5f %5f %5f %5f\n",
738- errorProp(n, 5, 0),
739- errorProp(n, 5, 1),
740- errorProp(n, 5, 2),
741- errorProp(n, 5, 3),
742- errorProp(n, 5, 4),
743- errorProp(n, 5, 5));
744- printf("\n");
745- }
746- }
747- #endif
748-
749- }
750- */
751-
752459template <typename Tf, typename Ti, typename TfLL1, typename Tf11, typename TfLLL>
753460static inline void helixAtRFromIterativeCCS_impl(const Tf& __restrict__ inPar,
754461 const Ti& __restrict__ inChg,
0 commit comments