7 #include <cuda_runtime.h>
26 double *__restrict__
phits,
30 constexpr uint32_t hitsInFit =
N;
32 assert(hitsInFit <= nHits);
43 printf(
"%d Ntuple of size %d for %d hits to fit\n", tupleMultiplicity->size(nHits),
nHits, hitsInFit);
48 auto tuple_idx = local_idx +
offset;
49 if (tuple_idx >= tupleMultiplicity->size(nHits))
53 auto tkid = *(tupleMultiplicity->begin(nHits) + tuple_idx);
54 assert(tkid < foundNtuplets->nOnes());
63 auto const *hitId = foundNtuplets->begin(tkid);
64 for (
unsigned int i = 0;
i < hitsInFit; ++
i) {
69 .detParams(hhp->detectorIndex(
hit))
70 .frame.toGlobal(hhp->xerrLocal(
hit), 0, hhp->yerrLocal(
hit), ge);
73 hits.col(
i) << hhp->xGlobal(
hit), hhp->yGlobal(
hit), hhp->zGlobal(
hit);
74 hits_ge.col(
i) << ge[0], ge[1], ge[2], ge[3], ge[4], ge[5];
79 assert(fast_fit(0) == fast_fit(0));
80 assert(fast_fit(1) == fast_fit(1));
81 assert(fast_fit(2) == fast_fit(2));
82 assert(fast_fit(3) == fast_fit(3));
90 double *__restrict__ phits,
91 float *__restrict__ phits_ge,
92 double *__restrict__ pfast_fit_input,
104 auto tuple_idx = local_idx +
offset;
105 if (tuple_idx >= tupleMultiplicity->size(nHits))
132 double *__restrict__ phits,
133 float *__restrict__ phits_ge,
134 double *__restrict__ pfast_fit_input,
147 auto tuple_idx = local_idx +
offset;
148 if (tuple_idx >= tupleMultiplicity->size(nHits))
152 auto tkid = *(tupleMultiplicity->begin(nHits) + tuple_idx);
158 auto const &line_fit =
riemannFit::lineFit(hits, hits_ge, circle_fit[local_idx], fast_fit, bField,
true);
163 circle_fit[local_idx].par, circle_fit[local_idx].cov, line_fit.par, line_fit.cov, 1.f /
float(bField), tkid);
164 results->
pt(tkid) = bField /
std::abs(circle_fit[local_idx].par(2));
165 results->
eta(tkid) = asinhf(line_fit.par(0));
166 results->
chi2(tkid) = (circle_fit[local_idx].chi2 + line_fit.chi2) / (2 *
N - 5);
169 printf(
"kernelLineFit size %d for %d hits circle.par(0,1,2): %d %f,%f,%f\n",
173 circle_fit[local_idx].par(0),
174 circle_fit[local_idx].par(1),
175 circle_fit[local_idx].par(2));
176 printf(
"kernelLineFit line.par(0,1): %d %f,%f\n", tkid, line_fit.par(0), line_fit.par(1));
177 printf(
"kernelLineFit chi2 cov %f/%f %e,%e,%e,%e,%e\n",
178 circle_fit[local_idx].
chi2,
180 circle_fit[local_idx].cov(0, 0),
181 circle_fit[local_idx].cov(1, 1),
182 circle_fit[local_idx].cov(2, 2),
caConstants::TupleMultiplicity const *__restrict__ HitsOnGPU const *__restrict__ tindex_type *__restrict__ double *__restrict__ float *__restrict__ phits_ge
__host__ __device__ LineFit lineFit(const M3xN &hits, const M6xN &hits_ge, const CircleFit &circle, const V4 &fast_fit, const double bField, const bool error)
Perform an ordinary least square fit in the s-z plane to compute the parameters cotTheta and Zip...
__host__ __device__ CircleFit circleFit(const M2xN &hits2D, const Matrix2Nd< N > &hits_cov2D, const V4 &fast_fit, const VectorNd< N > &rad, const double bField, const bool error)
Fit a generic number of 2D points with a circle using Riemann-Chernov algorithm. Covariance matrix of...
eigenSoA::ScalarSoA< float, S > pt
eigenSoA::ScalarSoA< float, S > chi2
Eigen::Matrix< double, N, 1 > VectorNd
auto const & foundNtuplets
Eigen::Map< Matrix3xNd< N >, 0, Eigen::Stride< 3 *stride, stride > > Map3xNd
caConstants::TupleMultiplicity const *__restrict__ tupleMultiplicity
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
TrajectoryStateSoAT< S > stateAtBS
Abs< T >::type abs(const T &t)
TrackSoA::HitContainer HitContainer
TrackSoAHeterogeneousT< maxNumber()> TrackSoA
Eigen::Map< Matrix6xNf< N >, 0, Eigen::Stride< 6 *stride, stride > > Map6xNf
caConstants::TupleMultiplicity const *__restrict__ HitsOnGPU const *__restrict__ tindex_type *__restrict__ double *__restrict__ float *__restrict__ double *__restrict__ pfast_fit
Eigen::Matrix< double, 2 *N, 2 *N > Matrix2Nd
caConstants::TupleMultiplicity const *__restrict__ HitsOnGPU const *__restrict__ hhp
Eigen::Map< Vector4d, 0, Eigen::InnerStride< stride > > Map4d
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits
__host__ __device__ void fromCircleToPerigee(CircleFit &circle)
Transform circle parameter from (X0,Y0,R) to (phi,Tip,q/R) and consequently covariance matrix...
__host__ __device__ void loadCovariance2D(M6xNf const &ge, M2Nd &hits_cov)
eigenSoA::ScalarSoA< float, S > eta
caConstants::TupleMultiplicity const *__restrict__ HitsOnGPU const *__restrict__ tindex_type *__restrict__ double *__restrict__ phits
__host__ __device__ void fastFit(const M3xN &hits, V4 &result)
A very fast helix fit: it fits a circle by three points (first, middle and last point) and a line by ...
constexpr uint32_t maxNumberOfConcurrentFits