9 #include <cuda_runtime.h> 19 template <
typename TrackerTraits>
21 template <
typename TrackerTraits>
23 template <
typename TrackerTraits>
28 template <
int N,
typename TrackerTraits>
32 typename TrackerTraits::tindex_type *__restrict__
ptkids,
33 double *__restrict__
phits,
55 #ifdef BROKENLINE_DEBUG 58 printf(
"%d Ntuple of size %d/%d for %d hits to fit\n",
totTK,
nHitsL,
nHitsH, hitsInFit);
64 int tuple_idx = local_idx +
offset;
65 if (tuple_idx >=
totTK) {
97 auto dx =
hh[hitId[hitsInFit - 1]].xGlobal() -
hh[hitId[0]].xGlobal();
98 auto dy =
hh[hitId[hitsInFit - 1]].yGlobal() -
hh[hitId[0]].yGlobal();
99 auto dz =
hh[hitId[hitsInFit - 1]].zGlobal() -
hh[hitId[0]].zGlobal();
105 for (uint32_t
i = 0;
i < hitsInFit; ++
i) {
107 if (hitsInFit - 1 ==
i)
115 auto const &
dp =
hh.cpeParams().detParams(
hh.detectorIndex(
hit));
118 assert(qbin >= 0 && qbin < 5);
121 dp.frame.rotation().multiply(
dx,
dy,
dz, ux, uy, uz);
124 int(cb * (
float(phase1PixelTopology::pixelThickess) /
float(phase1PixelTopology::pixelPitchY)) * 8.
f) - 4;
128 bin = std::clamp(
bin, low_value, high_value);
129 float yerr =
dp.sigmay[
bin] * 1.e-4
f;
130 yerr *=
dp.yfact[qbin];
133 yerr = nok ?
hh[
hit].yerrLocal() : yerr;
134 dp.frame.toGlobal(
hh[
hit].xerrLocal(), 0, yerr, ge);
136 hh.cpeParams().detParams(
hh[
hit].detectorIndex()).frame.toGlobal(
hh[
hit].xerrLocal(), 0,
hh[
hit].yerrLocal(), ge);
142 printf(
"Track id %d %d Hit %d on %d\nGlobal: hits.col(%d) << %f,%f,%f\n",
146 hh[
hit].detectorIndex(),
151 printf(
"Error: hits_ge.col(%d) << %e,%e,%e,%e,%e,%e\n",
i, ge[0], ge[1], ge[2], ge[3], ge[4], ge[5]);
156 hits_ge.col(
i) << ge[0], ge[1], ge[2], ge[3], ge[4], ge[5];
168 template <
int N,
typename TrackerTraits>
172 typename TrackerTraits::tindex_type
const *__restrict__
ptkids,
173 double *__restrict__
phits,
189 auto tkid =
ptkids[local_idx];
191 assert(tkid < TrackerTraits::maxNumberOfTuples);
212 #ifdef BROKENLINE_DEBUG 213 if (!(circle.
chi2 >= 0) || !(
line.chi2 >= 0))
214 printf(
"kernelBLFit failed! %f/%f\n", circle.
chi2,
line.chi2);
215 printf(
"kernelBLFit size %d for %d hits circle.par(0,1,2): %d %f,%f,%f\n",
222 printf(
"kernelBLHits line.par(0,1): %d %f,%f\n", tkid,
line.par(0),
line.par(1));
223 printf(
"kernelBLHits chi2 cov %f/%f %e,%e,%e,%e,%e\n",
__host__ __device__ void lineFit(const M6xN &hits_ge, const V4 &fast_fit, const double bField, const PreparedBrokenLineData< n > &data, riemannFit::LineFit &line_results)
Performs the Broken Line fit in the straight track case (that is, the fit parameters are only the int...
constexpr int kGenErrorQBins
Vector3d par
parameter: (X0,Y0,R)
typename reco::TrackSoA< TrackerTraits >::HitContainer Tuples
TupleMultiplicity< TrackerTraits > const *__restrict__ tupleMultiplicity
__host__ __device__ void prepareBrokenLineData(const M3xN &hits, const V4 &fast_fit, const double bField, PreparedBrokenLineData< n > &results)
Computes the data needed for the Broken Line fit procedure that are mainly common for the circle and ...
TupleMultiplicity< TrackerTraits > const *__restrict__ TrackingRecHitSoAConstView< TrackerTraits > TrackerTraits::tindex_type *__restrict__ double *__restrict__ float *__restrict__ double *__restrict__ uint32_t nHitsL
TupleMultiplicity< TrackerTraits > const *__restrict__ TrackingRecHitSoAConstView< TrackerTraits > TrackerTraits::tindex_type *__restrict__ double *__restrict__ phits
Eigen::Map< Vector4d, 0, Eigen::InnerStride< stride > > Map4d
Eigen::Map< Matrix3xNd< N >, 0, Eigen::Stride< 3 *stride, stride > > Map3xNd
TupleMultiplicity< TrackerTraits > const *__restrict__ TrackingRecHitSoAConstView< TrackerTraits > TrackerTraits::tindex_type *__restrict__ ptkids
__host__ __device__ void fastFit(const M3xN &hits, V4 &result)
A very fast helix fit.
Abs< T >::type abs(const T &t)
double OutputSoAView< TrackerTraits > results_view
Eigen::Map< Matrix6xNf< N >, 0, Eigen::Stride< 6 *stride, stride > > Map6xNf
ALPAKA_FN_ACC ALPAKA_FN_INLINE void const M3xN const V4 & fast_fit
assert(hitsInFit<=nHitsL)
constexpr auto invalidTkId
typename TrackingRecHitSoA< TrackerTraits >::template TrackingRecHitSoALayout<>::ConstView TrackingRecHitSoAConstView
TupleMultiplicity< TrackerTraits > const *__restrict__ TrackingRecHitSoAConstView< TrackerTraits > TrackerTraits::tindex_type *__restrict__ double *__restrict__ float *__restrict__ double *__restrict__ uint32_t uint32_t nHitsH
auto const & foundNtuplets
char data[epos_bytes_allocation]
TupleMultiplicity< TrackerTraits > const *__restrict__ TrackingRecHitSoAConstView< TrackerTraits > TrackerTraits::tindex_type *__restrict__ double *__restrict__ float *__restrict__ double *__restrict__ uint32_t uint32_t int32_t offset
typename TrackSoA< TrackerTraits >::template TrackSoALayout<>::View TrackSoAView
static constexpr __host__ __device__ void copyFromCircle(TrackSoAView &tracks, V3 const &cp, M3 const &ccov, V2 const &lp, M2 const &lcov, float b, int32_t i)
TupleMultiplicity< TrackerTraits > const *__restrict__ TrackingRecHitSoAConstView< TrackerTraits > hh
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_t nHits
__host__ __device__ void circleFit(const M3xN &hits, const M6xN &hits_ge, const V4 &fast_fit, const double bField, PreparedBrokenLineData< n > &data, karimaki_circle_fit &circle_results)
Performs the Broken Line fit in the curved track case (that is, the fit parameters are the intercepti...
data needed for the Broken Line fit procedure.
TupleMultiplicity< TrackerTraits > const *__restrict__ TrackingRecHitSoAConstView< TrackerTraits > TrackerTraits::tindex_type *__restrict__ double *__restrict__ float *__restrict__ phits_ge
TupleMultiplicity< TrackerTraits > const *__restrict__ TrackingRecHitSoAConstView< TrackerTraits > TrackerTraits::tindex_type *__restrict__ double *__restrict__ float *__restrict__ double *__restrict__ pfast_fit
T1 atomicAdd(T1 *a, T2 b)
constexpr int kNumErrorBins
reco::TrackSoAView< TrackerTraits > OutputSoAView
constexpr uint32_t maxNumberOfConcurrentFits