CMS 3D CMS Logo

Classes | Typedefs | Functions | Variables
riemannFit Namespace Reference

Classes

struct  CircleFit
 
class  helixFit
 Helix fit by three step: -fast pre-fit (see Fast_fit() for further info);
-circle fit of hits projected in the transverse plane by Riemann-Chernov algorithm (see Circle_fit() for further info);
-line fit of hits projected on cylinder surface by orthogonal distance regression (see Line_fit for further info).
Points must be passed ordered (from inner to outer layer). More...
 
struct  HelixFit
 
struct  LineFit
 

Typedefs

template<int N>
using Array2xNd = Eigen::Array< double, 2, N >
 
template<int N>
using ArrayNd = Eigen::Array< double, N, N >
 
using Map3x4d = Eigen::Map< Matrix3x4d, 0, Eigen::Stride< 3 *stride, stride > >
 
template<int N>
using Map3xNd = Eigen::Map< Matrix3xNd< N >, 0, Eigen::Stride< 3 *stride, stride > >
 
using Map4d = Eigen::Map< Vector4d, 0, Eigen::InnerStride< stride > >
 
using Map6x4f = Eigen::Map< Matrix6x4f, 0, Eigen::Stride< 6 *stride, stride > >
 
template<int N>
using Map6xNf = Eigen::Map< Matrix6xNf< N >, 0, Eigen::Stride< 6 *stride, stride > >
 
using Matrix2d = Eigen::Matrix2d
 
template<int N>
using Matrix2Nd = Eigen::Matrix< double, 2 *N, 2 *N >
 
using Matrix2x3d = Eigen::Matrix< double, 2, 3 >
 
template<int N>
using Matrix2xNd = Eigen::Matrix< double, 2, N >
 
using Matrix3d = Eigen::Matrix3d
 
using Matrix3f = Eigen::Matrix3f
 
template<int N>
using Matrix3Nd = Eigen::Matrix< double, 3 *N, 3 *N >
 
using Matrix3x4d = Eigen::Matrix< double, 3, 4 >
 
template<int N>
using Matrix3xNd = Eigen::Matrix< double, 3, N >
 
using Matrix4d = Eigen::Matrix4d
 
using Matrix5d = Eigen::Matrix< double, 5, 5 >
 
using Matrix6d = Eigen::Matrix< double, 6, 6 >
 
using Matrix6x4f = Eigen::Matrix< float, 6, 4 >
 
template<int N>
using Matrix6xNf = Eigen::Matrix< float, 6, N >
 
template<int N>
using MatrixNd = Eigen::Matrix< double, N, N >
 
template<int N>
using MatrixNplusONEd = Eigen::Matrix< double, N+1, N+1 >
 
template<int N>
using MatrixNx3d = Eigen::Matrix< double, N, 3 >
 
template<int N>
using MatrixNx5d = Eigen::Matrix< double, N, 5 >
 
using MatrixXd = Eigen::MatrixXd
 
template<int N>
using RowVector2Nd = Eigen::Matrix< double, 1, 2 *N >
 
template<int N>
using RowVectorNd = Eigen::Matrix< double, 1, 1, N >
 
using Vector2d = Eigen::Vector2d
 
template<int N>
using Vector2Nd = Eigen::Matrix< double, 2 *N, 1 >
 
using Vector3d = Eigen::Vector3d
 
using Vector3f = Eigen::Vector3f
 
template<int N>
using Vector3Nd = Eigen::Matrix< double, 3 *N, 1 >
 
using Vector4d = Eigen::Vector4d
 
using Vector4f = Eigen::Vector4f
 
using Vector5d = Eigen::Matrix< double, 5, 1 >
 
using Vector6f = Eigen::Matrix< double, 6, 1 >
 
template<int N>
using VectorNd = Eigen::Matrix< double, N, 1 >
 
template<int N>
using VectorNplusONEd = Eigen::Matrix< double, N+1, 1 >
 
using VectorXd = Eigen::VectorXd
 

Functions

template<typename M2xN >
__host__ __device__ int32_t charge (const M2xN &p2D, const Vector3d &par_uvr)
 Find particle q considering the sign of cross product between particles velocity (estimated by the first 2 hits) and the vector radius between the first hit and the center of the fitted circle. More...
 
template<typename M2xN , typename V4 , int N>
__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 fitted parameter is optionally computed. Multiple scattering (currently only in barrel layer) is optionally handled. More...
 
template<typename VNd1 , typename VNd2 >
__host__ __device__ void computeRadLenUniformMaterial (const VNd1 &length_values, VNd2 &rad_lengths)
 
template<typename M2xN , int N>
__host__ __device__ VectorNd< Ncov_carttorad (const M2xN &p2D, const Matrix2Nd< N > &cov_cart, const VectorNd< N > &rad)
 Transform covariance matrix from Cartesian coordinates (only transverse plane component) to radial coordinates (both radial and tangential component but only diagonal terms, correlation between different point are not managed). More...
 
template<typename M2xN , typename V4 , int N>
__host__ __device__ VectorNd< Ncov_carttorad_prefit (const M2xN &p2D, const Matrix2Nd< N > &cov_cart, V4 &fast_fit, const VectorNd< N > &rad)
 Transform covariance matrix from Cartesian coordinates (only transverse plane component) to coordinates system orthogonal to the pre-fitted circle in each point. Further information in attached documentation. More...
 
template<typename M2xN , int N>
__host__ __device__ Matrix2Nd< Ncov_radtocart (const M2xN &p2D, const MatrixNd< N > &cov_rad, const VectorNd< N > &rad)
 Transform covariance matrix from radial (only tangential component) to Cartesian coordinates (only transverse plane component). More...
 
__host__ __device__ double cross2D (const Vector2d &a, const Vector2d &b)
 Compute cross product of two 2D vector (assuming z component 0), returning z component of the result. More...
 
template<typename M3xN , typename V4 >
__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 two points (first and last). More...
 
__host__ __device__ void fromCircleToPerigee (CircleFit &circle)
 Transform circle parameter from (X0,Y0,R) to (phi,Tip,q/R) and consequently covariance matrix. More...
 
template<int N>
HelixFit helixFit (const Matrix3xNd< N > &hits, const Eigen::Matrix< float, 6, N > &hits_ge, const double bField, const bool error)
 Helix fit by three step: -fast pre-fit (see Fast_fit() for further info);
-circle fit of hits projected in the transverse plane by Riemann-Chernov algorithm (see Circle_fit() for further info);
-line fit of hits projected on cylinder surface by orthogonal distance regression (see Line_fit for further info).
Points must be passed ordered (from inner to outer layer). More...
 
template<typename M3xN , typename M6xN , typename V4 >
__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. More...
 
template<typename M6xNf , typename M3xNd >
__host__ __device__ void loadCovariance (M6xNf const &ge, M3xNd &hits_cov)
 
template<typename M6xNf , typename M2Nd >
__host__ __device__ void loadCovariance2D (M6xNf const &ge, M2Nd &hits_cov)
 
__host__ __device__ Vector2d min_eigen2D (const Matrix2d &aMat, double &chi2)
 2D version of min_eigen3D(). More...
 
__host__ __device__ Vector3d min_eigen3D (const Matrix3d &A, double &chi2)
 Compute the eigenvector associated to the minimum eigenvalue. More...
 
__host__ __device__ Vector3d min_eigen3D_fast (const Matrix3d &A)
 A faster version of min_eigen3D() where double precision is not needed. More...
 
__host__ __device__ void par_uvrtopak (CircleFit &circle, const double B, const bool error)
 Transform circle parameter from (X0,Y0,R) to (phi,Tip,p_t) and consequently covariance matrix. More...
 
template<class C >
__host__ __device__ void printIt (C *m, const char *prefix="")
 
template<auto Start, auto End, auto Inc, class F >
constexpr void rolling_fits (F &&f)
 
template<typename M2xN , typename V4 , int N>
__host__ __device__ MatrixNd< Nscatter_cov_rad (const M2xN &p2D, const V4 &fast_fit, VectorNd< N > const &rad, double B)
 Compute the covariance matrix (in radial coordinates) of points in the transverse plane due to multiple Coulomb scattering. More...
 
template<typename V4 , typename VNd1 , typename VNd2 , int N>
__host__ __device__ auto scatterCovLine (Matrix2d const *cov_sz, const V4 &fast_fit, VNd1 const &s_arcs, VNd2 const &z_values, const double theta, const double bField, MatrixNd< N > &ret)
 Compute the covariance matrix along cartesian S-Z of points due to multiple Coulomb scattering to be used in the line_fit, for the barrel and forward cases. The input covariance matrix is in the variables s-z, original and unrotated. The multiple scattering component is computed in the usual linear approximation, using the 3D path which is computed as the squared root of the squared sum of the s and z components passed in. Internally a rotation by theta is performed and the covariance matrix returned is the one in the direction orthogonal to the rotated S3D axis, i.e. along the rotated Z axis. The choice of the rotation is not arbitrary, but derived from the fact that putting the horizontal axis along the S3D direction allows the usage of the ordinary least squared fitting techiques with the trivial parametrization y = mx + q, avoiding the patological case with m = +/- inf, that would correspond to the case at eta = 0. More...
 
template<typename T >
constexpr T sqr (const T a)
 raise to square. More...
 
template<typename VI5 , typename MI5 , typename VO5 , typename MO5 >
void transformToPerigeePlane (VI5 const &ip, MI5 const &icov, VO5 &op, MO5 &ocov)
 
template<typename VI5 , typename MI5 , typename VO5 , typename MO5 >
__host__ __device__ void transformToPerigeePlane (VI5 const &ip, MI5 const &icov, VO5 &op, MO5 &ocov)
 
template<int N>
__host__ __device__ VectorNd< NweightCircle (const MatrixNd< N > &cov_rad_inv)
 Compute the points' weights' vector for the circle fit when multiple scattering is managed. Further information in attached documentation. More...
 

Variables

constexpr double epsilon = 1.e-4
 used in numerical derivative (J2 in Circle_fit()) More...
 
constexpr uint32_t maxNumberOfConcurrentFits = 32 * 1024
 
constexpr uint32_t stride = maxNumberOfConcurrentFits
 

Typedef Documentation

◆ Array2xNd

template<int N>
using riemannFit::Array2xNd = typedef Eigen::Array<double, 2, N>

Definition at line 31 of file FitUtils.h.

◆ ArrayNd

template<int N>
using riemannFit::ArrayNd = typedef Eigen::Array<double, N, N>

Definition at line 23 of file FitUtils.h.

◆ Map3x4d

typedef Eigen::Map< Matrix3x4d, 0, Eigen::Stride< 3 *stride, stride > > riemannFit::Map3x4d

Definition at line 24 of file HelixFit.h.

◆ Map3xNd

template<int N>
using riemannFit::Map3xNd = typedef Eigen::Map<Matrix3xNd<N>, 0, Eigen::Stride<3 * stride, stride> >

Definition at line 32 of file HelixFit.h.

◆ Map4d

typedef Eigen::Map< Vector4d, 0, Eigen::InnerStride< stride > > riemannFit::Map4d

Definition at line 39 of file HelixFit.h.

◆ Map6x4f

typedef Eigen::Map< Matrix6x4f, 0, Eigen::Stride< 6 *stride, stride > > riemannFit::Map6x4f

Definition at line 26 of file HelixFit.h.

◆ Map6xNf

template<int N>
using riemannFit::Map6xNf = typedef Eigen::Map<Matrix6xNf<N>, 0, Eigen::Stride<6 * stride, stride> >

Definition at line 37 of file HelixFit.h.

◆ Matrix2d

typedef Eigen::Matrix2d riemannFit::Matrix2d

Definition at line 14 of file FitResult.h.

◆ Matrix2Nd

template<int N>
using riemannFit::Matrix2Nd = typedef Eigen::Matrix<double, 2 * N, 2 * N>

Definition at line 25 of file FitUtils.h.

◆ Matrix2x3d

typedef Eigen::Matrix< double, 2, 3 > riemannFit::Matrix2x3d

Definition at line 49 of file FitUtils.h.

◆ Matrix2xNd

template<int N>
using riemannFit::Matrix2xNd = typedef Eigen::Matrix<double, 2, N>

Definition at line 29 of file FitUtils.h.

◆ Matrix3d

typedef Eigen::Matrix3d riemannFit::Matrix3d

Definition at line 15 of file FitResult.h.

◆ Matrix3f

typedef Eigen::Matrix3f riemannFit::Matrix3f

Definition at line 51 of file FitUtils.h.

◆ Matrix3Nd

template<int N>
using riemannFit::Matrix3Nd = typedef Eigen::Matrix<double, 3 * N, 3 * N>

Definition at line 27 of file FitUtils.h.

◆ Matrix3x4d

typedef Eigen::Matrix< double, 3, 4 > riemannFit::Matrix3x4d

Definition at line 23 of file HelixFit.h.

◆ Matrix3xNd

template<int N>
using riemannFit::Matrix3xNd = typedef Eigen::Matrix<double, 3, N>

Definition at line 30 of file HelixFit.h.

◆ Matrix4d

typedef Eigen::Matrix4d riemannFit::Matrix4d

Definition at line 16 of file FitResult.h.

◆ Matrix5d

typedef Eigen::Matrix< double, 5, 5 > riemannFit::Matrix5d

Definition at line 17 of file FitResult.h.

◆ Matrix6d

typedef Eigen::Matrix< double, 6, 6 > riemannFit::Matrix6d

Definition at line 18 of file FitResult.h.

◆ Matrix6x4f

typedef Eigen::Matrix< float, 6, 4 > riemannFit::Matrix6x4f

Definition at line 25 of file HelixFit.h.

◆ Matrix6xNf

template<int N>
using riemannFit::Matrix6xNf = typedef Eigen::Matrix<float, 6, N>

Definition at line 35 of file HelixFit.h.

◆ MatrixNd

template<int N>
using riemannFit::MatrixNd = typedef Eigen::Matrix<double, N, N>

Definition at line 19 of file FitUtils.h.

◆ MatrixNplusONEd

template<int N>
using riemannFit::MatrixNplusONEd = typedef Eigen::Matrix<double, N + 1, N + 1>

Definition at line 21 of file FitUtils.h.

◆ MatrixNx3d

template<int N>
using riemannFit::MatrixNx3d = typedef Eigen::Matrix<double, N, 3>

Definition at line 33 of file FitUtils.h.

◆ MatrixNx5d

template<int N>
using riemannFit::MatrixNx5d = typedef Eigen::Matrix<double, N, 5>

Definition at line 35 of file FitUtils.h.

◆ MatrixXd

typedef Eigen::MatrixXd riemannFit::MatrixXd

Definition at line 17 of file FitUtils.h.

◆ RowVector2Nd

template<int N>
using riemannFit::RowVector2Nd = typedef Eigen::Matrix<double, 1, 2 * N>

Definition at line 47 of file FitUtils.h.

◆ RowVectorNd

template<int N>
using riemannFit::RowVectorNd = typedef Eigen::Matrix<double, 1, 1, N>

Definition at line 45 of file FitUtils.h.

◆ Vector2d

typedef Eigen::Vector2d riemannFit::Vector2d

Definition at line 10 of file FitResult.h.

◆ Vector2Nd

template<int N>
using riemannFit::Vector2Nd = typedef Eigen::Matrix<double, 2 * N, 1>

Definition at line 41 of file FitUtils.h.

◆ Vector3d

typedef Eigen::Vector3d riemannFit::Vector3d

Definition at line 11 of file FitResult.h.

◆ Vector3f

typedef Eigen::Vector3f riemannFit::Vector3f

Definition at line 52 of file FitUtils.h.

◆ Vector3Nd

template<int N>
using riemannFit::Vector3Nd = typedef Eigen::Matrix<double, 3 * N, 1>

Definition at line 43 of file FitUtils.h.

◆ Vector4d

typedef Eigen::Vector4d riemannFit::Vector4d

Definition at line 12 of file FitResult.h.

◆ Vector4f

typedef Eigen::Vector4f riemannFit::Vector4f

Definition at line 53 of file FitUtils.h.

◆ Vector5d

typedef Eigen::Matrix< double, 5, 1 > riemannFit::Vector5d

Definition at line 13 of file FitResult.h.

◆ Vector6f

typedef Eigen::Matrix< double, 6, 1 > riemannFit::Vector6f

Definition at line 54 of file FitUtils.h.

◆ VectorNd

template<int N>
using riemannFit::VectorNd = typedef Eigen::Matrix<double, N, 1>

Definition at line 37 of file FitUtils.h.

◆ VectorNplusONEd

template<int N>
using riemannFit::VectorNplusONEd = typedef Eigen::Matrix<double, N + 1, 1>

Definition at line 39 of file FitUtils.h.

◆ VectorXd

typedef Eigen::VectorXd riemannFit::VectorXd

Definition at line 16 of file FitUtils.h.

Function Documentation

◆ charge()

template<typename M2xN >
__host__ __device__ int32_t riemannFit::charge ( const M2xN &  p2D,
const Vector3d par_uvr 
)
inline

Find particle q considering the sign of cross product between particles velocity (estimated by the first 2 hits) and the vector radius between the first hit and the center of the fitted circle.

Parameters
p2D2D points in transverse plane.
par_uvrresult of the circle fit in this form: (X0,Y0,R).
Returns
q int 1 or -1.

Definition at line 291 of file RiemannFit.h.

Referenced by circleFit().

291  {
292  return ((p2D(0, 1) - p2D(0, 0)) * (par_uvr.y() - p2D(1, 0)) - (p2D(1, 1) - p2D(1, 0)) * (par_uvr.x() - p2D(0, 0)) >
293  0)
294  ? -1
295  : 1;
296  }

◆ circleFit()

template<typename M2xN , typename V4 , int N>
__host__ __device__ CircleFit riemannFit::circleFit ( const M2xN &  hits2D,
const Matrix2Nd< N > &  hits_cov2D,
const V4 &  fast_fit,
const VectorNd< N > &  rad,
const double  bField,
const bool  error 
)
inline

Fit a generic number of 2D points with a circle using Riemann-Chernov algorithm. Covariance matrix of fitted parameter is optionally computed. Multiple scattering (currently only in barrel layer) is optionally handled.

Parameters
hits2D2D points to be fitted.
hits_cov2Dcovariance matrix of 2D points.
fast_fitpre-fit result in this form: (X0,Y0,R,tan(theta)). (tan(theta) is not used).
bFieldmagnetic field
errorflag for error computation.
scatteringflag for multiple scattering
Returns
circle circle_fit: -par parameter of the fitted circle in this form (X0,Y0,R);
-cov covariance matrix of the fitted parameter (not initialized if error = false);
-q charge of the particle;
-chi2.
Warning
hits must be passed ordered from inner to outer layer (double hits on the same layer must be ordered too) so that multiple scattering is treated properly.
Multiple scattering for barrel is still not tested.
Multiple scattering for endcap hits is not handled (yet). Do not fit endcap hits with scattering = true !

Definition at line 458 of file RiemannFit.h.

References a, funct::abs(), b, Calorimetry_cff::bField, charge(), riemannFit::CircleFit::chi2, isoTrack_cff::chi2, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), riemannFit::CircleFit::cov, cov_carttorad_prefit(), cov_radtocart(), dumpMFGeometry_cfg::delta, epsilon, relativeConstraints::error, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::fast_fit, mps_fire::i, l1tstage2_dqm_sourceclient-live_cfg::invert, dqmiolumiharvest::j, isotrackApplyRegressor::k, MainPageGenerator::l, CaloTowersParam_cfi::mc, min_eigen3D(), min_eigen3D_fast(), N, create_idmaps::n, riemannFit::CircleFit::par, printIt(), riemannFit::CircleFit::qCharge, scatter_cov_rad(), Validation_hcalonly_cfi::sign, sqr(), mathSSE::sqrt(), submitPVValidationJobs::t, FrontierCondition_GT_autoExpress_cfi::t0, RandomServiceHelper::t1, createJobs::tmp, parallelization::uint, mps_merge::weight, and weightCircle().

Referenced by helixFit().

463  {
464 #ifdef RFIT_DEBUG
465  printf("circle_fit - enter\n");
466 #endif
467  // INITIALIZATION
468  Matrix2Nd<N> vMat = hits_cov2D;
469  constexpr uint n = N;
470  printIt(&hits2D, "circle_fit - hits2D:");
471  printIt(&hits_cov2D, "circle_fit - hits_cov2D:");
472 
473 #ifdef RFIT_DEBUG
474  printf("circle_fit - WEIGHT COMPUTATION\n");
475 #endif
476  // WEIGHT COMPUTATION
477  VectorNd<N> weight;
478  MatrixNd<N> gMat;
479  double renorm;
480  {
481  MatrixNd<N> cov_rad = cov_carttorad_prefit(hits2D, vMat, fast_fit, rad).asDiagonal();
482  MatrixNd<N> scatterCovRadMat = scatter_cov_rad(hits2D, fast_fit, rad, bField);
483  printIt(&scatterCovRadMat, "circle_fit - scatter_cov_rad:");
484  printIt(&hits2D, "circle_fit - hits2D bis:");
485 #ifdef RFIT_DEBUG
486  printf("Address of hits2D: a) %p\n", &hits2D);
487 #endif
488  vMat += cov_radtocart(hits2D, scatterCovRadMat, rad);
489  printIt(&vMat, "circle_fit - V:");
490  cov_rad += scatterCovRadMat;
491  printIt(&cov_rad, "circle_fit - cov_rad:");
492  math::cholesky::invert(cov_rad, gMat);
493  // gMat = cov_rad.inverse();
494  renorm = gMat.sum();
495  gMat *= 1. / renorm;
496  weight = weightCircle(gMat);
497  }
498  printIt(&weight, "circle_fit - weight:");
499 
500  // SPACE TRANSFORMATION
501 #ifdef RFIT_DEBUG
502  printf("circle_fit - SPACE TRANSFORMATION\n");
503 #endif
504 
505  // center
506 #ifdef RFIT_DEBUG
507  printf("Address of hits2D: b) %p\n", &hits2D);
508 #endif
509  const Vector2d hCentroid = hits2D.rowwise().mean(); // centroid
510  printIt(&hCentroid, "circle_fit - h_:");
511  Matrix3xNd<N> p3D;
512  p3D.block(0, 0, 2, n) = hits2D.colwise() - hCentroid;
513  printIt(&p3D, "circle_fit - p3D: a)");
514  Vector2Nd<N> mc; // centered hits, used in error computation
515  mc << p3D.row(0).transpose(), p3D.row(1).transpose();
516  printIt(&mc, "circle_fit - mc(centered hits):");
517 
518  // scale
519  const double tempQ = mc.squaredNorm();
520  const double tempS = sqrt(n * 1. / tempQ); // scaling factor
521  p3D.block(0, 0, 2, n) *= tempS;
522 
523  // project on paraboloid
524  p3D.row(2) = p3D.block(0, 0, 2, n).colwise().squaredNorm();
525  printIt(&p3D, "circle_fit - p3D: b)");
526 
527 #ifdef RFIT_DEBUG
528  printf("circle_fit - COST FUNCTION\n");
529 #endif
530  // COST FUNCTION
531 
532  // compute
533  Vector3d r0;
534  r0.noalias() = p3D * weight; // center of gravity
535  const Matrix3xNd<N> xMat = p3D.colwise() - r0;
536  Matrix3d aMat = xMat * gMat * xMat.transpose();
537  printIt(&aMat, "circle_fit - A:");
538 
539 #ifdef RFIT_DEBUG
540  printf("circle_fit - MINIMIZE\n");
541 #endif
542  // minimize
543  double chi2;
544  Vector3d vVec = min_eigen3D(aMat, chi2);
545 #ifdef RFIT_DEBUG
546  printf("circle_fit - AFTER MIN_EIGEN\n");
547 #endif
548  printIt(&vVec, "v BEFORE INVERSION");
549  vVec *= (vVec(2) > 0) ? 1 : -1; // TO FIX dovrebbe essere N(3)>0
550  printIt(&vVec, "v AFTER INVERSION");
551  // This hack to be able to run on GPU where the automatic assignment to a
552  // double from the vector multiplication is not working.
553 #ifdef RFIT_DEBUG
554  printf("circle_fit - AFTER MIN_EIGEN 1\n");
555 #endif
556  Eigen::Matrix<double, 1, 1> cm;
557 #ifdef RFIT_DEBUG
558  printf("circle_fit - AFTER MIN_EIGEN 2\n");
559 #endif
560  cm = -vVec.transpose() * r0;
561 #ifdef RFIT_DEBUG
562  printf("circle_fit - AFTER MIN_EIGEN 3\n");
563 #endif
564  const double tempC = cm(0, 0);
565 
566 #ifdef RFIT_DEBUG
567  printf("circle_fit - COMPUTE CIRCLE PARAMETER\n");
568 #endif
569  // COMPUTE CIRCLE PARAMETER
570 
571  // auxiliary quantities
572  const double tempH = sqrt(1. - sqr(vVec(2)) - 4. * tempC * vVec(2));
573  const double v2x2_inv = 1. / (2. * vVec(2));
574  const double s_inv = 1. / tempS;
575  Vector3d par_uvr; // used in error propagation
576  par_uvr << -vVec(0) * v2x2_inv, -vVec(1) * v2x2_inv, tempH * v2x2_inv;
577 
578  CircleFit circle;
579  circle.par << par_uvr(0) * s_inv + hCentroid(0), par_uvr(1) * s_inv + hCentroid(1), par_uvr(2) * s_inv;
580  circle.qCharge = charge(hits2D, circle.par);
581  circle.chi2 = abs(chi2) * renorm / sqr(2 * vVec(2) * par_uvr(2) * tempS);
582  printIt(&circle.par, "circle_fit - CIRCLE PARAMETERS:");
583  printIt(&circle.cov, "circle_fit - CIRCLE COVARIANCE:");
584 #ifdef RFIT_DEBUG
585  printf("circle_fit - CIRCLE CHARGE: %d\n", circle.qCharge);
586 #endif
587 
588 #ifdef RFIT_DEBUG
589  printf("circle_fit - ERROR PROPAGATION\n");
590 #endif
591  // ERROR PROPAGATION
592  if (error) {
593 #ifdef RFIT_DEBUG
594  printf("circle_fit - ERROR PRPAGATION ACTIVATED\n");
595 #endif
596  ArrayNd<N> vcsMat[2][2]; // cov matrix of center & scaled points
597  MatrixNd<N> cMat[3][3]; // cov matrix of 3D transformed points
598 #ifdef RFIT_DEBUG
599  printf("circle_fit - ERROR PRPAGATION ACTIVATED 2\n");
600 #endif
601  {
602  Eigen::Matrix<double, 1, 1> cm;
603  Eigen::Matrix<double, 1, 1> cm2;
604  cm = mc.transpose() * vMat * mc;
605  const double tempC2 = cm(0, 0);
606  Matrix2Nd<N> tempVcsMat;
607  tempVcsMat.template triangularView<Eigen::Upper>() =
608  (sqr(tempS) * vMat + sqr(sqr(tempS)) * 1. / (4. * tempQ * n) *
609  (2. * vMat.squaredNorm() + 4. * tempC2) * // mc.transpose() * V * mc) *
610  (mc * mc.transpose()));
611 
612  printIt(&tempVcsMat, "circle_fit - Vcs:");
613  cMat[0][0] = tempVcsMat.block(0, 0, n, n).template selfadjointView<Eigen::Upper>();
614  vcsMat[0][1] = tempVcsMat.block(0, n, n, n);
615  cMat[1][1] = tempVcsMat.block(n, n, n, n).template selfadjointView<Eigen::Upper>();
616  vcsMat[1][0] = vcsMat[0][1].transpose();
617  printIt(&tempVcsMat, "circle_fit - Vcs:");
618  }
619 
620  {
621  const ArrayNd<N> t0 = (VectorXd::Constant(n, 1.) * p3D.row(0));
622  const ArrayNd<N> t1 = (VectorXd::Constant(n, 1.) * p3D.row(1));
623  const ArrayNd<N> t00 = p3D.row(0).transpose() * p3D.row(0);
624  const ArrayNd<N> t01 = p3D.row(0).transpose() * p3D.row(1);
625  const ArrayNd<N> t11 = p3D.row(1).transpose() * p3D.row(1);
626  const ArrayNd<N> t10 = t01.transpose();
627  vcsMat[0][0] = cMat[0][0];
628  cMat[0][1] = vcsMat[0][1];
629  cMat[0][2] = 2. * (vcsMat[0][0] * t0 + vcsMat[0][1] * t1);
630  vcsMat[1][1] = cMat[1][1];
631  cMat[1][2] = 2. * (vcsMat[1][0] * t0 + vcsMat[1][1] * t1);
632  MatrixNd<N> tmp;
633  tmp.template triangularView<Eigen::Upper>() =
634  (2. * (vcsMat[0][0] * vcsMat[0][0] + vcsMat[0][0] * vcsMat[0][1] + vcsMat[1][1] * vcsMat[1][0] +
635  vcsMat[1][1] * vcsMat[1][1]) +
636  4. * (vcsMat[0][0] * t00 + vcsMat[0][1] * t01 + vcsMat[1][0] * t10 + vcsMat[1][1] * t11))
637  .matrix();
638  cMat[2][2] = tmp.template selfadjointView<Eigen::Upper>();
639  }
640  printIt(&cMat[0][0], "circle_fit - C[0][0]:");
641 
642  Matrix3d c0Mat; // cov matrix of center of gravity (r0.x,r0.y,r0.z)
643  for (uint i = 0; i < 3; ++i) {
644  for (uint j = i; j < 3; ++j) {
645  Eigen::Matrix<double, 1, 1> tmp;
646  tmp = weight.transpose() * cMat[i][j] * weight;
647  // Workaround to get things working in GPU
648  const double tempC = tmp(0, 0);
649  c0Mat(i, j) = tempC; //weight.transpose() * C[i][j] * weight;
650  c0Mat(j, i) = c0Mat(i, j);
651  }
652  }
653  printIt(&c0Mat, "circle_fit - C0:");
654 
655  const MatrixNd<N> wMat = weight * weight.transpose();
656  const MatrixNd<N> hMat = MatrixNd<N>::Identity().rowwise() - weight.transpose();
657  const MatrixNx3d<N> s_v = hMat * p3D.transpose();
658  printIt(&wMat, "circle_fit - W:");
659  printIt(&hMat, "circle_fit - H:");
660  printIt(&s_v, "circle_fit - s_v:");
661 
662  MatrixNd<N> dMat[3][3]; // cov(s_v)
663  dMat[0][0] = (hMat * cMat[0][0] * hMat.transpose()).cwiseProduct(wMat);
664  dMat[0][1] = (hMat * cMat[0][1] * hMat.transpose()).cwiseProduct(wMat);
665  dMat[0][2] = (hMat * cMat[0][2] * hMat.transpose()).cwiseProduct(wMat);
666  dMat[1][1] = (hMat * cMat[1][1] * hMat.transpose()).cwiseProduct(wMat);
667  dMat[1][2] = (hMat * cMat[1][2] * hMat.transpose()).cwiseProduct(wMat);
668  dMat[2][2] = (hMat * cMat[2][2] * hMat.transpose()).cwiseProduct(wMat);
669  dMat[1][0] = dMat[0][1].transpose();
670  dMat[2][0] = dMat[0][2].transpose();
671  dMat[2][1] = dMat[1][2].transpose();
672  printIt(&dMat[0][0], "circle_fit - D_[0][0]:");
673 
674  constexpr uint nu[6][2] = {{0, 0}, {0, 1}, {0, 2}, {1, 1}, {1, 2}, {2, 2}};
675 
676  Matrix6d eMat; // cov matrix of the 6 independent elements of A
677  for (uint a = 0; a < 6; ++a) {
678  const uint i = nu[a][0], j = nu[a][1];
679  for (uint b = a; b < 6; ++b) {
680  const uint k = nu[b][0], l = nu[b][1];
681  VectorNd<N> t0(n);
682  VectorNd<N> t1(n);
683  if (l == k) {
684  t0 = 2. * dMat[j][l] * s_v.col(l);
685  if (i == j)
686  t1 = t0;
687  else
688  t1 = 2. * dMat[i][l] * s_v.col(l);
689  } else {
690  t0 = dMat[j][l] * s_v.col(k) + dMat[j][k] * s_v.col(l);
691  if (i == j)
692  t1 = t0;
693  else
694  t1 = dMat[i][l] * s_v.col(k) + dMat[i][k] * s_v.col(l);
695  }
696 
697  if (i == j) {
698  Eigen::Matrix<double, 1, 1> cm;
699  cm = s_v.col(i).transpose() * (t0 + t1);
700  // Workaround to get things working in GPU
701  const double tempC = cm(0, 0);
702  eMat(a, b) = 0. + tempC;
703  } else {
704  Eigen::Matrix<double, 1, 1> cm;
705  cm = (s_v.col(i).transpose() * t0) + (s_v.col(j).transpose() * t1);
706  // Workaround to get things working in GPU
707  const double tempC = cm(0, 0);
708  eMat(a, b) = 0. + tempC; //(s_v.col(i).transpose() * t0) + (s_v.col(j).transpose() * t1);
709  }
710  if (b != a)
711  eMat(b, a) = eMat(a, b);
712  }
713  }
714  printIt(&eMat, "circle_fit - E:");
715 
716  Eigen::Matrix<double, 3, 6> j2Mat; // Jacobian of min_eigen() (numerically computed)
717  for (uint a = 0; a < 6; ++a) {
718  const uint i = nu[a][0], j = nu[a][1];
719  Matrix3d delta = Matrix3d::Zero();
720  delta(i, j) = delta(j, i) = abs(aMat(i, j) * epsilon);
721  j2Mat.col(a) = min_eigen3D_fast(aMat + delta);
722  const int sign = (j2Mat.col(a)(2) > 0) ? 1 : -1;
723  j2Mat.col(a) = (j2Mat.col(a) * sign - vVec) / delta(i, j);
724  }
725  printIt(&j2Mat, "circle_fit - J2:");
726 
727  Matrix4d cvcMat; // joint cov matrix of (v0,v1,v2,c)
728  {
729  Matrix3d t0 = j2Mat * eMat * j2Mat.transpose();
730  Vector3d t1 = -t0 * r0;
731  cvcMat.block(0, 0, 3, 3) = t0;
732  cvcMat.block(0, 3, 3, 1) = t1;
733  cvcMat.block(3, 0, 1, 3) = t1.transpose();
734  Eigen::Matrix<double, 1, 1> cm1;
735  Eigen::Matrix<double, 1, 1> cm3;
736  cm1 = (vVec.transpose() * c0Mat * vVec);
737  // cm2 = (c0Mat.cwiseProduct(t0)).sum();
738  cm3 = (r0.transpose() * t0 * r0);
739  // Workaround to get things working in GPU
740  const double tempC = cm1(0, 0) + (c0Mat.cwiseProduct(t0)).sum() + cm3(0, 0);
741  cvcMat(3, 3) = tempC;
742  // (v.transpose() * c0Mat * v) + (c0Mat.cwiseProduct(t0)).sum() + (r0.transpose() * t0 * r0);
743  }
744  printIt(&cvcMat, "circle_fit - Cvc:");
745 
746  Eigen::Matrix<double, 3, 4> j3Mat; // Jacobian (v0,v1,v2,c)->(X0,Y0,R)
747  {
748  const double t = 1. / tempH;
749  j3Mat << -v2x2_inv, 0, vVec(0) * sqr(v2x2_inv) * 2., 0, 0, -v2x2_inv, vVec(1) * sqr(v2x2_inv) * 2., 0,
750  vVec(0) * v2x2_inv * t, vVec(1) * v2x2_inv * t,
751  -tempH * sqr(v2x2_inv) * 2. - (2. * tempC + vVec(2)) * v2x2_inv * t, -t;
752  }
753  printIt(&j3Mat, "circle_fit - J3:");
754 
755  const RowVector2Nd<N> Jq = mc.transpose() * tempS * 1. / n; // var(q)
756  printIt(&Jq, "circle_fit - Jq:");
757 
758  Matrix3d cov_uvr = j3Mat * cvcMat * j3Mat.transpose() * sqr(s_inv) // cov(X0,Y0,R)
759  + (par_uvr * par_uvr.transpose()) * (Jq * vMat * Jq.transpose());
760 
761  circle.cov = cov_uvr;
762  }
763 
764  printIt(&circle.cov, "Circle cov:");
765 #ifdef RFIT_DEBUG
766  printf("circle_fit - exit\n");
767 #endif
768  return circle;
769  }
Eigen::Vector3d Vector3d
Definition: FitResult.h:11
Eigen::Matrix3d Matrix3d
Definition: FitResult.h:15
__host__ __device__ VectorNd< N > cov_carttorad_prefit(const M2xN &p2D, const Matrix2Nd< N > &cov_cart, V4 &fast_fit, const VectorNd< N > &rad)
Transform covariance matrix from Cartesian coordinates (only transverse plane component) to coordinat...
Definition: RiemannFit.h:242
Definition: weight.py:1
Eigen::Matrix< double, 6, 6 > Matrix6d
Definition: FitResult.h:18
T sqrt(T t)
Definition: SSEVec.h:23
Eigen::Matrix4d Matrix4d
Definition: FitResult.h:16
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
__host__ __device__ Vector3d min_eigen3D(const Matrix3d &A, double &chi2)
Compute the eigenvector associated to the minimum eigenvalue.
Definition: RiemannFit.h:313
Polynomial< 0 > Constant
Definition: Constant.h:6
ALPAKA_FN_ACC ALPAKA_FN_INLINE void const M3xN const V4 & fast_fit
Definition: BrokenLine.h:158
__host__ __device__ VectorNd< N > weightCircle(const MatrixNd< N > &cov_rad_inv)
Compute the points&#39; weights&#39; vector for the circle fit when multiple scattering is managed...
Definition: RiemannFit.h:278
__host__ __device__ Vector3d min_eigen3D_fast(const Matrix3d &A)
A faster version of min_eigen3D() where double precision is not needed.
Definition: RiemannFit.h:338
#define N
Definition: blowfish.cc:9
Eigen::Vector2d Vector2d
Definition: FitResult.h:10
ALPAKA_FN_ACC void printIt(const TAcc &acc, C *m, const char *prefix="")
Definition: FitUtils.h:90
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
Square< F >::type sqr(const F &f)
Definition: Square.h:14
__host__ __device__ MatrixNd< N > scatter_cov_rad(const M2xN &p2D, const V4 &fast_fit, VectorNd< N > const &rad, double B)
Compute the covariance matrix (in radial coordinates) of points in the transverse plane due to multip...
Definition: RiemannFit.h:126
__host__ __device__ Matrix2Nd< N > cov_radtocart(const M2xN &p2D, const MatrixNd< N > &cov_rad, const VectorNd< N > &rad)
Transform covariance matrix from radial (only tangential component) to Cartesian coordinates (only tr...
Definition: RiemannFit.h:174
__host__ __device__ int32_t charge(const M2xN &p2D, const Vector3d &par_uvr)
Find particle q considering the sign of cross product between particles velocity (estimated by the fi...
Definition: RiemannFit.h:291
tmp
align.sh
Definition: createJobs.py:716

◆ computeRadLenUniformMaterial()

template<typename VNd1 , typename VNd2 >
__host__ __device__ void riemannFit::computeRadLenUniformMaterial ( const VNd1 &  length_values,
VNd2 &  rad_lengths 
)
inline

Compute the Radiation length in the uniform hypothesis

The Pixel detector, barrel and forward, is considered as an homogeneous cylinder of material, whose radiation lengths has been derived from the TDR plot that shows that 16cm correspond to 0.06 radiation lengths. Therefore one radiation length corresponds to 16cm/0.06 =~ 267 cm. All radiation lengths are computed using this unique number, in both regions, barrel and endcap.

NB: no angle corrections nor projections are computed inside this routine. It is therefore the responsibility of the caller to supply the proper lengths in input. These lengths are the path traveled by the particle along its trajectory, namely the so called S of the helix in 3D space.

Parameters
length_valuesvector of incremental distances that will be translated into radiation length equivalent. Each radiation length i is computed incrementally with respect to the previous length i-1. The first length has no reference point (i.e. it has the dca).
Returns
incremental radiation lengths that correspond to each segment.

Definition at line 34 of file RiemannFit.h.

References funct::abs(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), dqmiolumiharvest::j, create_idmaps::n, and parallelization::uint.

Referenced by scatter_cov_rad(), and scatterCovLine().

34  {
35  // Radiation length of the pixel detector in the uniform assumption, with
36  // 0.06 rad_len at 16 cm
37  constexpr double xx_0_inv = 0.06 / 16.;
38  uint n = length_values.rows();
39  rad_lengths(0) = length_values(0) * xx_0_inv;
40  for (uint j = 1; j < n; ++j) {
41  rad_lengths(j) = std::abs(length_values(j) - length_values(j - 1)) * xx_0_inv;
42  }
43  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ cov_carttorad()

template<typename M2xN , int N>
__host__ __device__ VectorNd<N> riemannFit::cov_carttorad ( const M2xN &  p2D,
const Matrix2Nd< N > &  cov_cart,
const VectorNd< N > &  rad 
)
inline

Transform covariance matrix from Cartesian coordinates (only transverse plane component) to radial coordinates (both radial and tangential component but only diagonal terms, correlation between different point are not managed).

Parameters
p2D2D points in transverse plane.
cov_cartcovariance matrix in Cartesian coordinates.
Returns
cov_rad covariance matrix in raidal coordinate.
Warning
correlation between different point are not computed.

< in case you have (0,0) to avoid dividing by 0 radius

Definition at line 211 of file RiemannFit.h.

References ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), MillePedeFileConverter_cfg::e, mps_fire::i, N, create_idmaps::n, sqr(), and parallelization::uint.

213  {
214  constexpr uint n = N;
215  VectorNd<N> cov_rad;
216  const VectorNd<N> rad_inv2 = rad.cwiseInverse().array().square();
217  for (uint i = 0; i < n; ++i) {
219  if (rad(i) < 1.e-4)
220  cov_rad(i) = cov_cart(i, i);
221  else {
222  cov_rad(i) = rad_inv2(i) * (cov_cart(i, i) * sqr(p2D(1, i)) + cov_cart(i + n, i + n) * sqr(p2D(0, i)) -
223  2. * cov_cart(i, i + n) * p2D(0, i) * p2D(1, i));
224  }
225  }
226  return cov_rad;
227  }
#define N
Definition: blowfish.cc:9
Square< F >::type sqr(const F &f)
Definition: Square.h:14

◆ cov_carttorad_prefit()

template<typename M2xN , typename V4 , int N>
__host__ __device__ VectorNd<N> riemannFit::cov_carttorad_prefit ( const M2xN &  p2D,
const Matrix2Nd< N > &  cov_cart,
V4 &  fast_fit,
const VectorNd< N > &  rad 
)
inline

Transform covariance matrix from Cartesian coordinates (only transverse plane component) to coordinates system orthogonal to the pre-fitted circle in each point. Further information in attached documentation.

Parameters
p2D2D points in transverse plane.
cov_cartcovariance matrix in Cartesian coordinates.
fast_fitfast_fit Vector4d result of the previous pre-fit structured in this form:(X0, Y0, R, tan(theta))).
Returns
cov_rad covariance matrix in the pre-fitted circle's orthogonal system.

< in case you have (0,0) to avoid dividing by 0 radius

Definition at line 242 of file RiemannFit.h.

References a, b, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), cross2D(), MillePedeFileConverter_cfg::e, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::fast_fit, mps_fire::i, N, create_idmaps::n, sqr(), parallelization::uint, and testProducerWithPsetDescEmpty_cfi::y2.

Referenced by circleFit().

245  {
246  constexpr uint n = N;
247  VectorNd<N> cov_rad;
248  for (uint i = 0; i < n; ++i) {
250  if (rad(i) < 1.e-4)
251  cov_rad(i) = cov_cart(i, i); // TO FIX
252  else {
253  Vector2d a = p2D.col(i);
254  Vector2d b = p2D.col(i) - fast_fit.head(2);
255  const double x2 = a.dot(b);
256  const double y2 = cross2D(a, b);
257  const double tan_c = -y2 / x2;
258  const double tan_c2 = sqr(tan_c);
259  cov_rad(i) =
260  1. / (1. + tan_c2) * (cov_cart(i, i) + cov_cart(i + n, i + n) * tan_c2 + 2 * cov_cart(i, i + n) * tan_c);
261  }
262  }
263  return cov_rad;
264  }
ALPAKA_FN_ACC ALPAKA_FN_INLINE double cross2D(const TAcc &acc, const Vector2d &a, const Vector2d &b)
Compute cross product of two 2D vector (assuming z component 0), returning z component of the result...
Definition: FitUtils.h:117
ALPAKA_FN_ACC ALPAKA_FN_INLINE void const M3xN const V4 & fast_fit
Definition: BrokenLine.h:158
#define N
Definition: blowfish.cc:9
Eigen::Vector2d Vector2d
Definition: FitResult.h:10
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
Square< F >::type sqr(const F &f)
Definition: Square.h:14

◆ cov_radtocart()

template<typename M2xN , int N>
__host__ __device__ Matrix2Nd<N> riemannFit::cov_radtocart ( const M2xN &  p2D,
const MatrixNd< N > &  cov_rad,
const VectorNd< N > &  rad 
)
inline

Transform covariance matrix from radial (only tangential component) to Cartesian coordinates (only transverse plane component).

Parameters
p2D2D points in the transverse plane.
cov_radcovariance matrix in radial coordinate.
Returns
cov_cart covariance matrix in Cartesian coordinates.

Definition at line 174 of file RiemannFit.h.

References ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), mps_fire::i, dqmiolumiharvest::j, N, create_idmaps::n, printIt(), and parallelization::uint.

Referenced by circleFit().

176  {
177 #ifdef RFIT_DEBUG
178  printf("Address of p2D: %p\n", &p2D);
179 #endif
180  printIt(&p2D, "cov_radtocart - p2D:");
181  constexpr uint n = N;
182  Matrix2Nd<N> cov_cart = Matrix2Nd<N>::Zero();
183  VectorNd<N> rad_inv = rad.cwiseInverse();
184  printIt(&rad_inv, "cov_radtocart - rad_inv:");
185  for (uint i = 0; i < n; ++i) {
186  for (uint j = i; j < n; ++j) {
187  cov_cart(i, j) = cov_rad(i, j) * p2D(1, i) * rad_inv(i) * p2D(1, j) * rad_inv(j);
188  cov_cart(i + n, j + n) = cov_rad(i, j) * p2D(0, i) * rad_inv(i) * p2D(0, j) * rad_inv(j);
189  cov_cart(i, j + n) = -cov_rad(i, j) * p2D(1, i) * rad_inv(i) * p2D(0, j) * rad_inv(j);
190  cov_cart(i + n, j) = -cov_rad(i, j) * p2D(0, i) * rad_inv(i) * p2D(1, j) * rad_inv(j);
191  cov_cart(j, i) = cov_cart(i, j);
192  cov_cart(j + n, i + n) = cov_cart(i + n, j + n);
193  cov_cart(j + n, i) = cov_cart(i, j + n);
194  cov_cart(j, i + n) = cov_cart(i + n, j);
195  }
196  }
197  return cov_cart;
198  }
#define N
Definition: blowfish.cc:9
ALPAKA_FN_ACC void printIt(const TAcc &acc, C *m, const char *prefix="")
Definition: FitUtils.h:90

◆ cross2D()

__host__ __device__ double riemannFit::cross2D ( const Vector2d a,
const Vector2d b 
)
inline

Compute cross product of two 2D vector (assuming z component 0), returning z component of the result.

Parameters
afirst 2D vector in the product.
bsecond 2D vector in the product.
Returns
z component of the cross product.

Definition at line 79 of file FitUtils.h.

References a, and b.

Referenced by cov_carttorad_prefit(), brokenline::fastFit(), fastFit(), lineFit(), brokenline::prepareBrokenLineData(), and scatter_cov_rad().

79  {
80  return a.x() * b.y() - a.y() * b.x();
81  }
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121

◆ fastFit()

template<typename M3xN , typename V4 >
__host__ __device__ void riemannFit::fastFit ( const M3xN &  hits,
V4 &  result 
)
inline

A very fast helix fit: it fits a circle by three points (first, middle and last point) and a line by two points (first and last).

Parameters
hitspoints to be fitted
Returns
result in this form: (X0,Y0,R,tan(theta)).
Warning
points must be passed ordered (from internal layer to external) in order to maximize accuracy and do not mistake tan(theta) sign.

This fast fit is used as pre-fit which is needed for:

  • weights estimation and chi2 computation in line fit (fundamental);
  • weights estimation and chi2 computation in circle fit (useful);
  • computation of error due to multiple scattering.

< in case b.x is 0 (2 hits with same x)

Definition at line 378 of file RiemannFit.h.

References funct::abs(), b2, nano_mu_digi_cff::bx, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), cross2D(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::dVec, PVValHelper::dz, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::eVec, HLT_2024v14_cff::flip, hfClusterShapes_cfi::hits, N, create_idmaps::n, printIt(), mps_fire::result, sqr(), and mathSSE::sqrt().

Referenced by for(), and helixFit().

378  {
379  constexpr uint32_t N = M3xN::ColsAtCompileTime;
380  constexpr auto n = N; // get the number of hits
381  printIt(&hits, "Fast_fit - hits: ");
382 
383  // CIRCLE FIT
384  // Make segments between middle-to-first(b) and last-to-first(c) hits
385  const Vector2d bVec = hits.block(0, n / 2, 2, 1) - hits.block(0, 0, 2, 1);
386  const Vector2d cVec = hits.block(0, n - 1, 2, 1) - hits.block(0, 0, 2, 1);
387  printIt(&bVec, "Fast_fit - b: ");
388  printIt(&cVec, "Fast_fit - c: ");
389  // Compute their lengths
390  auto b2 = bVec.squaredNorm();
391  auto c2 = cVec.squaredNorm();
392  // The algebra has been verified (MR). The usual approach has been followed:
393  // * use an orthogonal reference frame passing from the first point.
394  // * build the segments (chords)
395  // * build orthogonal lines through mid points
396  // * make a system and solve for X0 and Y0.
397  // * add the initial point
398  bool flip = abs(bVec.x()) < abs(bVec.y());
399  auto bx = flip ? bVec.y() : bVec.x();
400  auto by = flip ? bVec.x() : bVec.y();
401  auto cx = flip ? cVec.y() : cVec.x();
402  auto cy = flip ? cVec.x() : cVec.y();
404  auto div = 2. * (cx * by - bx * cy);
405  // if aligned TO FIX
406  auto y0 = (cx * b2 - bx * c2) / div;
407  auto x0 = (0.5 * b2 - y0 * by) / bx;
408  result(0) = hits(0, 0) + (flip ? y0 : x0);
409  result(1) = hits(1, 0) + (flip ? x0 : y0);
410  result(2) = sqrt(sqr(x0) + sqr(y0));
411  printIt(&result, "Fast_fit - result: ");
412 
413  // LINE FIT
414  const Vector2d dVec = hits.block(0, 0, 2, 1) - result.head(2);
415  const Vector2d eVec = hits.block(0, n - 1, 2, 1) - result.head(2);
416  printIt(&eVec, "Fast_fit - e: ");
417  printIt(&dVec, "Fast_fit - d: ");
418  // Compute the arc-length between first and last point: L = R * theta = R * atan (tan (Theta) )
419  auto dr = result(2) * atan2(cross2D(dVec, eVec), dVec.dot(eVec));
420  // Simple difference in Z between last and first hit
421  auto dz = hits(2, n - 1) - hits(2, 0);
422 
423  result(3) = (dr / dz);
424 
425 #ifdef RFIT_DEBUG
426  printf("Fast_fit: [%f, %f, %f, %f]\n", result(0), result(1), result(2), result(3));
427 #endif
428  }
ALPAKA_FN_ACC ALPAKA_FN_INLINE double cross2D(const TAcc &acc, const Vector2d &a, const Vector2d &b)
Compute cross product of two 2D vector (assuming z component 0), returning z component of the result...
Definition: FitUtils.h:117
T sqrt(T t)
Definition: SSEVec.h:23
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bias2_t b2[25]
Definition: b2.h:9
#define N
Definition: blowfish.cc:9
Eigen::Vector2d Vector2d
Definition: FitResult.h:10
ALPAKA_FN_ACC void printIt(const TAcc &acc, C *m, const char *prefix="")
Definition: FitUtils.h:90
Square< F >::type sqr(const F &f)
Definition: Square.h:14

◆ fromCircleToPerigee()

__host__ __device__ void riemannFit::fromCircleToPerigee ( CircleFit circle)
inline

Transform circle parameter from (X0,Y0,R) to (phi,Tip,q/R) and consequently covariance matrix.

Parameters
circle_uvrparameter (X0,Y0,R), covariance matrix to be transformed and particle charge.

Definition at line 196 of file FitUtils.h.

References riemannFit::CircleFit::cov, riemannFit::CircleFit::par, riemannFit::CircleFit::qCharge, sqr(), and mathSSE::sqrt().

196  {
197  Vector3d par_pak;
198  const double temp0 = circle.par.head(2).squaredNorm();
199  const double temp1 = sqrt(temp0);
200  par_pak << atan2(circle.qCharge * circle.par(0), -circle.qCharge * circle.par(1)),
201  circle.qCharge * (temp1 - circle.par(2)), circle.qCharge / circle.par(2);
202 
203  const double temp2 = sqr(circle.par(0)) * 1. / temp0;
204  const double temp3 = 1. / temp1 * circle.qCharge;
205  Matrix3d j4Mat;
206  j4Mat << -circle.par(1) * temp2 * 1. / sqr(circle.par(0)), temp2 * 1. / circle.par(0), 0., circle.par(0) * temp3,
207  circle.par(1) * temp3, -circle.qCharge, 0., 0., -circle.qCharge / (circle.par(2) * circle.par(2));
208  circle.cov = j4Mat * circle.cov * j4Mat.transpose();
209 
210  circle.par = par_pak;
211  }
Eigen::Vector3d Vector3d
Definition: FitResult.h:11
Eigen::Matrix3d Matrix3d
Definition: FitResult.h:15
T sqrt(T t)
Definition: SSEVec.h:23
constexpr T sqr(const T a)
raise to square.
Definition: FitUtils.h:67

◆ helixFit()

template<int N>
HelixFit riemannFit::helixFit ( const Matrix3xNd< N > &  hits,
const Eigen::Matrix< float, 6, N > &  hits_ge,
const double  bField,
const bool  error 
)
inline

Helix fit by three step: -fast pre-fit (see Fast_fit() for further info);
-circle fit of hits projected in the transverse plane by Riemann-Chernov algorithm (see Circle_fit() for further info);
-line fit of hits projected on cylinder surface by orthogonal distance regression (see Line_fit for further info).
Points must be passed ordered (from inner to outer layer).

Parameters
hitsMatrix3xNd hits coordinates in this form:
|x0|x1|x2|...|xn|
|y0|y1|y2|...|yn|
|z0|z1|z2|...|zn|
hits_covMatrix3Nd covariance matrix in this form (()->cov()):
|(x0,x0)|(x1,x0)|(x2,x0)|.|(y0,x0)|(y1,x0)|(y2,x0)|.|(z0,x0)|(z1,x0)|(z2,x0)|
|(x0,x1)|(x1,x1)|(x2,x1)|.|(y0,x1)|(y1,x1)|(y2,x1)|.|(z0,x1)|(z1,x1)|(z2,x1)|
|(x0,x2)|(x1,x2)|(x2,x2)|.|(y0,x2)|(y1,x2)|(y2,x2)|.|(z0,x2)|(z1,x2)|(z2,x2)|
. . . . . . . . . . .
|(x0,y0)|(x1,y0)|(x2,y0)|.|(y0,y0)|(y1,y0)|(y2,x0)|.|(z0,y0)|(z1,y0)|(z2,y0)|
|(x0,y1)|(x1,y1)|(x2,y1)|.|(y0,y1)|(y1,y1)|(y2,x1)|.|(z0,y1)|(z1,y1)|(z2,y1)|
|(x0,y2)|(x1,y2)|(x2,y2)|.|(y0,y2)|(y1,y2)|(y2,x2)|.|(z0,y2)|(z1,y2)|(z2,y2)|
. . . . . . . . . . .
|(x0,z0)|(x1,z0)|(x2,z0)|.|(y0,z0)|(y1,z0)|(y2,z0)|.|(z0,z0)|(z1,z0)|(z2,z0)|
|(x0,z1)|(x1,z1)|(x2,z1)|.|(y0,z1)|(y1,z1)|(y2,z1)|.|(z0,z1)|(z1,z1)|(z2,z1)|
|(x0,z2)|(x1,z2)|(x2,z2)|.|(y0,z2)|(y1,z2)|(y2,z2)|.|(z0,z2)|(z1,z2)|(z2,z2)|
bFieldmagnetic field in the center of the detector in Gev/cm/c unit, in order to perform pt calculation.
errorflag for error computation.
scatteringflag for multiple scattering treatment. (see Circle_fit() documentation for further info).
Warning
see Circle_fit(), Line_fit() and Fast_fit() warnings.

Definition at line 978 of file RiemannFit.h.

References Calorimetry_cff::bField, riemannFit::CircleFit::chi2, riemannFit::HelixFit::chi2_circle, riemannFit::HelixFit::chi2_line, circleFit(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), riemannFit::CircleFit::cov, riemannFit::HelixFit::cov, relativeConstraints::error, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::fast_fit, fastFit(), hfClusterShapes_cfi::hits, mps_splice::line, lineFit(), loadCovariance2D(), N, create_idmaps::n, riemannFit::CircleFit::par, riemannFit::HelixFit::par, par_uvrtopak(), riemannFit::CircleFit::qCharge, riemannFit::HelixFit::qCharge, and parallelization::uint.

Referenced by PixelNtupletsFitter::run().

981  {
982  constexpr uint n = N;
983  VectorNd<4> rad = (hits.block(0, 0, 2, n).colwise().norm());
984 
985  // Fast_fit gives back (X0, Y0, R, theta) w/o errors, using only 3 points.
988  riemannFit::Matrix2Nd<N> hits_cov = MatrixXd::Zero(2 * n, 2 * n);
989  riemannFit::loadCovariance2D(hits_ge, hits_cov);
990  CircleFit circle = circleFit(hits.block(0, 0, 2, n), hits_cov, fast_fit, rad, bField, error);
991  LineFit line = lineFit(hits, hits_ge, circle, fast_fit, bField, error);
992 
993  par_uvrtopak(circle, bField, error);
994 
995  HelixFit helix;
996  helix.par << circle.par, line.par;
997  if (error) {
998  helix.cov = MatrixXd::Zero(5, 5);
999  helix.cov.block(0, 0, 3, 3) = circle.cov;
1000  helix.cov.block(3, 3, 2, 2) = line.cov;
1001  }
1002  helix.qCharge = circle.qCharge;
1003  helix.chi2_circle = circle.chi2;
1004  helix.chi2_line = line.chi2;
1005 
1006  return helix;
1007  }
Eigen::Vector4d Vector4d
Definition: FitResult.h:12
ALPAKA_FN_ACC ALPAKA_FN_INLINE void par_uvrtopak(const TAcc &acc, CircleFit &circle, const double B, const bool error)
Transform circle parameter from (X0,Y0,R) to (phi,Tip,p_t) and consequently covariance matrix...
Definition: FitUtils.h:212
__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...
Definition: RiemannFit.h:788
__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...
Definition: RiemannFit.h:458
ALPAKA_FN_ACC ALPAKA_FN_INLINE void const M3xN const V4 & fast_fit
Definition: BrokenLine.h:158
Eigen::Matrix< double, 2 *N, 2 *N > Matrix2Nd
Definition: FitUtils.h:25
#define N
Definition: blowfish.cc:9
__host__ __device__ void loadCovariance2D(M6xNf const &ge, M2Nd &hits_cov)
Definition: FitUtils.h:88
__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 ...
Definition: RiemannFit.h:378

◆ lineFit()

template<typename M3xN , typename M6xN , typename V4 >
__host__ __device__ LineFit riemannFit::lineFit ( const M3xN &  hits,
const M6xN &  hits_ge,
const CircleFit circle,
const V4 &  fast_fit,
const double  bField,
const bool  error 
)
inline

Perform an ordinary least square fit in the s-z plane to compute the parameters cotTheta and Zip.

The fit is performed in the rotated S3D-Z' plane, following the formalism of Frodesen, Chapter 10, p. 259.

The system has been rotated to both try to use the combined errors in s-z along Z', as errors in the Y direction and to avoid the patological case of degenerate lines with angular coefficient m = +/- inf.

The rotation is using the information on the theta angle computed in the fast fit. The rotation is such that the S3D axis will be the X-direction, while the rotated Z-axis will be the Y-direction. This pretty much follows what is done in the same fit in the Broken Line approach.

Definition at line 788 of file RiemannFit.h.

References Calorimetry_cff::bField, isoTrack_cff::chi2, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), funct::cos(), riemannFit::CircleFit::cov, cross(), cross2D(), alignCSCRings::d_x, alignCSCRings::d_y, dot(), relativeConstraints::error, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::fast_fit, hfClusterShapes_cfi::hits, mps_fire::i, l1tstage2_dqm_sourceclient-live_cfg::invert, mps_splice::line, M_PI, N, create_idmaps::n, riemannFit::CircleFit::par, printIt(), riemannFit::CircleFit::qCharge, makeMuonMisalignmentScenario::rot, scatterCovLine(), funct::sin(), mkfit::Const::sol, sqr(), tauSpinnerTable_cfi::theta, createJobs::tmp, and parallelization::uint.

Referenced by helixFit().

793  {
794  constexpr uint32_t N = M3xN::ColsAtCompileTime;
795  constexpr auto n = N;
796  double theta = -circle.qCharge * atan(fast_fit(3));
797  theta = theta < 0. ? theta + M_PI : theta;
798 
799  // Prepare the Rotation Matrix to rotate the points
800  Eigen::Matrix<double, 2, 2> rot;
801  rot << sin(theta), cos(theta), -cos(theta), sin(theta);
802 
803  // PROJECTION ON THE CILINDER
804  //
805  // p2D will be:
806  // [s1, s2, s3, ..., sn]
807  // [z1, z2, z3, ..., zn]
808  // s values will be ordinary x-values
809  // z values will be ordinary y-values
810 
811  Matrix2xNd<N> p2D = Matrix2xNd<N>::Zero();
812  Eigen::Matrix<double, 2, 6> jxMat;
813 
814 #ifdef RFIT_DEBUG
815  printf("Line_fit - B: %g\n", bField);
816  printIt(&hits, "Line_fit points: ");
817  printIt(&hits_ge, "Line_fit covs: ");
818  printIt(&rot, "Line_fit rot: ");
819 #endif
820  // x & associated Jacobian
821  // cfr https://indico.cern.ch/event/663159/contributions/2707659/attachments/1517175/2368189/Riemann_fit.pdf
822  // Slide 11
823  // a ==> -o i.e. the origin of the circle in XY plane, negative
824  // b ==> p i.e. distances of the points wrt the origin of the circle.
825  const Vector2d oVec(circle.par(0), circle.par(1));
826 
827  // associated Jacobian, used in weights and errors computation
828  Matrix6d covMat = Matrix6d::Zero();
829  Matrix2d cov_sz[N];
830  for (uint i = 0; i < n; ++i) {
831  Vector2d pVec = hits.block(0, i, 2, 1) - oVec;
832  const double cross = cross2D(-oVec, pVec);
833  const double dot = (-oVec).dot(pVec);
834  // atan2(cross, dot) give back the angle in the transverse plane so tha the
835  // final equation reads: x_i = -q*R*theta (theta = angle returned by atan2)
836  const double tempQAtan2 = -circle.qCharge * atan2(cross, dot);
837  // p2D.coeffRef(1, i) = atan2_ * circle.par(2);
838  p2D(0, i) = tempQAtan2 * circle.par(2);
839 
840  // associated Jacobian, used in weights and errors- computation
841  const double temp0 = -circle.qCharge * circle.par(2) * 1. / (sqr(dot) + sqr(cross));
842  double d_X0 = 0., d_Y0 = 0., d_R = 0.; // good approximation for big pt and eta
843  if (error) {
844  d_X0 = -temp0 * ((pVec(1) + oVec(1)) * dot - (pVec(0) - oVec(0)) * cross);
845  d_Y0 = temp0 * ((pVec(0) + oVec(0)) * dot - (oVec(1) - pVec(1)) * cross);
846  d_R = tempQAtan2;
847  }
848  const double d_x = temp0 * (oVec(1) * dot + oVec(0) * cross);
849  const double d_y = temp0 * (-oVec(0) * dot + oVec(1) * cross);
850  jxMat << d_X0, d_Y0, d_R, d_x, d_y, 0., 0., 0., 0., 0., 0., 1.;
851 
852  covMat.block(0, 0, 3, 3) = circle.cov;
853  covMat(3, 3) = hits_ge.col(i)[0]; // x errors
854  covMat(4, 4) = hits_ge.col(i)[2]; // y errors
855  covMat(5, 5) = hits_ge.col(i)[5]; // z errors
856  covMat(3, 4) = covMat(4, 3) = hits_ge.col(i)[1]; // cov_xy
857  covMat(3, 5) = covMat(5, 3) = hits_ge.col(i)[3]; // cov_xz
858  covMat(4, 5) = covMat(5, 4) = hits_ge.col(i)[4]; // cov_yz
859  Matrix2d tmp = jxMat * covMat * jxMat.transpose();
860  cov_sz[i].noalias() = rot * tmp * rot.transpose();
861  }
862  // Math of d_{X0,Y0,R,x,y} all verified by hand
863  p2D.row(1) = hits.row(2);
864 
865  // The following matrix will contain errors orthogonal to the rotated S
866  // component only, with the Multiple Scattering properly treated!!
867  MatrixNd<N> cov_with_ms;
868  scatterCovLine(cov_sz, fast_fit, p2D.row(0), p2D.row(1), theta, bField, cov_with_ms);
869 #ifdef RFIT_DEBUG
870  printIt(cov_sz, "line_fit - cov_sz:");
871  printIt(&cov_with_ms, "line_fit - cov_with_ms: ");
872 #endif
873 
874  // Rotate Points with the shape [2, n]
875  Matrix2xNd<N> p2D_rot = rot * p2D;
876 
877 #ifdef RFIT_DEBUG
878  printf("Fast fit Tan(theta): %g\n", fast_fit(3));
879  printf("Rotation angle: %g\n", theta);
880  printIt(&rot, "Rotation Matrix:");
881  printIt(&p2D, "Original Hits(s,z):");
882  printIt(&p2D_rot, "Rotated hits(S3D, Z'):");
883  printIt(&rot, "Rotation Matrix:");
884 #endif
885 
886  // Build the A Matrix
887  Matrix2xNd<N> aMat;
888  aMat << MatrixXd::Ones(1, n), p2D_rot.row(0); // rotated s values
889 
890 #ifdef RFIT_DEBUG
891  printIt(&aMat, "A Matrix:");
892 #endif
893 
894  // Build A^T V-1 A, where V-1 is the covariance of only the Y components.
895  MatrixNd<N> vyInvMat;
896  math::cholesky::invert(cov_with_ms, vyInvMat);
897  // MatrixNd<N> vyInvMat = cov_with_ms.inverse();
898  Eigen::Matrix<double, 2, 2> covParamsMat = aMat * vyInvMat * aMat.transpose();
899  // Compute the Covariance Matrix of the fit parameters
900  math::cholesky::invert(covParamsMat, covParamsMat);
901 
902  // Now Compute the Parameters in the form [2,1]
903  // The first component is q.
904  // The second component is m.
905  Eigen::Matrix<double, 2, 1> sol = covParamsMat * aMat * vyInvMat * p2D_rot.row(1).transpose();
906 
907 #ifdef RFIT_DEBUG
908  printIt(&sol, "Rotated solutions:");
909 #endif
910 
911  // We need now to transfer back the results in the original s-z plane
912  const auto sinTheta = sin(theta);
913  const auto cosTheta = cos(theta);
914  auto common_factor = 1. / (sinTheta - sol(1, 0) * cosTheta);
915  Eigen::Matrix<double, 2, 2> jMat;
916  jMat << 0., common_factor * common_factor, common_factor, sol(0, 0) * cosTheta * common_factor * common_factor;
917 
918  double tempM = common_factor * (sol(1, 0) * sinTheta + cosTheta);
919  double tempQ = common_factor * sol(0, 0);
920  auto cov_mq = jMat * covParamsMat * jMat.transpose();
921 
922  VectorNd<N> res = p2D_rot.row(1).transpose() - aMat.transpose() * sol;
923  double chi2 = res.transpose() * vyInvMat * res;
924 
925  LineFit line;
926  line.par << tempM, tempQ;
927  line.cov << cov_mq;
928  line.chi2 = chi2;
929 
930 #ifdef RFIT_DEBUG
931  printf("Common_factor: %g\n", common_factor);
932  printIt(&jMat, "Jacobian:");
933  printIt(&sol, "Rotated solutions:");
934  printIt(&covParamsMat, "Cov_params:");
935  printIt(&cov_mq, "Rotated Covariance Matrix:");
936  printIt(&(line.par), "Real Parameters:");
937  printIt(&(line.cov), "Real Covariance Matrix:");
938  printf("Chi2: %g\n", chi2);
939 #endif
940 
941  return line;
942  }
Basic3DVector cross(const Basic3DVector &v) const
Vector product, or "cross" product, with a vector of same type.
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
ALPAKA_FN_ACC ALPAKA_FN_INLINE double cross2D(const TAcc &acc, const Vector2d &a, const Vector2d &b)
Compute cross product of two 2D vector (assuming z component 0), returning z component of the result...
Definition: FitUtils.h:117
Definition: Electron.h:6
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
Eigen::Matrix< double, 6, 6 > Matrix6d
Definition: FitResult.h:18
Eigen::Matrix2d Matrix2d
Definition: FitResult.h:14
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
#define M_PI
ALPAKA_FN_ACC ALPAKA_FN_INLINE void const M3xN const V4 & fast_fit
Definition: BrokenLine.h:158
constexpr float sol
Definition: Config.h:13
#define N
Definition: blowfish.cc:9
Eigen::Vector2d Vector2d
Definition: FitResult.h:10
ALPAKA_FN_ACC void printIt(const TAcc &acc, C *m, const char *prefix="")
Definition: FitUtils.h:90
Square< F >::type sqr(const F &f)
Definition: Square.h:14
__host__ __device__ auto scatterCovLine(Matrix2d const *cov_sz, const V4 &fast_fit, VNd1 const &s_arcs, VNd2 const &z_values, const double theta, const double bField, MatrixNd< N > &ret)
Compute the covariance matrix along cartesian S-Z of points due to multiple Coulomb scattering to be ...
Definition: RiemannFit.h:65
tmp
align.sh
Definition: createJobs.py:716

◆ loadCovariance()

template<typename M6xNf , typename M3xNd >
__host__ __device__ void riemannFit::loadCovariance ( M6xNf const &  ge,
M3xNd &  hits_cov 
)

Definition at line 120 of file FitUtils.h.

References ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), mps_fire::i, dqmiolumiharvest::j, and MainPageGenerator::l.

120  {
121  // Index numerology:
122  // i: index of the hits/point (0,..,3)
123  // j: index of space component (x,y,z)
124  // l: index of space components (x,y,z)
125  // ge is always in sync with the index i and is formatted as:
126  // ge[] ==> [xx, xy, yy, xz, yz, zz]
127  // in (j,l) notation, we have:
128  // ge[] ==> [(0,0), (0,1), (1,1), (0,2), (1,2), (2,2)]
129  // so the index ge_idx corresponds to the matrix elements:
130  // | 0 1 3 |
131  // | 1 2 4 |
132  // | 3 4 5 |
133  constexpr uint32_t hits_in_fit = M6xNf::ColsAtCompileTime;
134  for (uint32_t i = 0; i < hits_in_fit; ++i) {
135  {
136  constexpr uint32_t ge_idx = 0, j = 0, l = 0;
137  hits_cov(i + j * hits_in_fit, i + l * hits_in_fit) = ge.col(i)[ge_idx];
138  }
139  {
140  constexpr uint32_t ge_idx = 2, j = 1, l = 1;
141  hits_cov(i + j * hits_in_fit, i + l * hits_in_fit) = ge.col(i)[ge_idx];
142  }
143  {
144  constexpr uint32_t ge_idx = 5, j = 2, l = 2;
145  hits_cov(i + j * hits_in_fit, i + l * hits_in_fit) = ge.col(i)[ge_idx];
146  }
147  {
148  constexpr uint32_t ge_idx = 1, j = 1, l = 0;
149  hits_cov(i + l * hits_in_fit, i + j * hits_in_fit) = hits_cov(i + j * hits_in_fit, i + l * hits_in_fit) =
150  ge.col(i)[ge_idx];
151  }
152  {
153  constexpr uint32_t ge_idx = 3, j = 2, l = 0;
154  hits_cov(i + l * hits_in_fit, i + j * hits_in_fit) = hits_cov(i + j * hits_in_fit, i + l * hits_in_fit) =
155  ge.col(i)[ge_idx];
156  }
157  {
158  constexpr uint32_t ge_idx = 4, j = 2, l = 1;
159  hits_cov(i + l * hits_in_fit, i + j * hits_in_fit) = hits_cov(i + j * hits_in_fit, i + l * hits_in_fit) =
160  ge.col(i)[ge_idx];
161  }
162  }
163  }

◆ loadCovariance2D()

template<typename M6xNf , typename M2Nd >
__host__ __device__ void riemannFit::loadCovariance2D ( M6xNf const &  ge,
M2Nd &  hits_cov 
)

load error in CMSSW format to our formalism

Definition at line 88 of file FitUtils.h.

References ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), mps_fire::i, dqmiolumiharvest::j, and MainPageGenerator::l.

Referenced by helixFit().

88  {
89  // Index numerology:
90  // i: index of the hits/point (0,..,3)
91  // j: index of space component (x,y,z)
92  // l: index of space components (x,y,z)
93  // ge is always in sync with the index i and is formatted as:
94  // ge[] ==> [xx, xy, yy, xz, yz, zz]
95  // in (j,l) notation, we have:
96  // ge[] ==> [(0,0), (0,1), (1,1), (0,2), (1,2), (2,2)]
97  // so the index ge_idx corresponds to the matrix elements:
98  // | 0 1 3 |
99  // | 1 2 4 |
100  // | 3 4 5 |
101  constexpr uint32_t hits_in_fit = M6xNf::ColsAtCompileTime;
102  for (uint32_t i = 0; i < hits_in_fit; ++i) {
103  {
104  constexpr uint32_t ge_idx = 0, j = 0, l = 0;
105  hits_cov(i + j * hits_in_fit, i + l * hits_in_fit) = ge.col(i)[ge_idx];
106  }
107  {
108  constexpr uint32_t ge_idx = 2, j = 1, l = 1;
109  hits_cov(i + j * hits_in_fit, i + l * hits_in_fit) = ge.col(i)[ge_idx];
110  }
111  {
112  constexpr uint32_t ge_idx = 1, j = 1, l = 0;
113  hits_cov(i + l * hits_in_fit, i + j * hits_in_fit) = hits_cov(i + j * hits_in_fit, i + l * hits_in_fit) =
114  ge.col(i)[ge_idx];
115  }
116  }
117  }

◆ min_eigen2D()

__host__ __device__ Vector2d riemannFit::min_eigen2D ( const Matrix2d aMat,
double &  chi2 
)
inline

2D version of min_eigen3D().

Parameters
aMatthe Matrix you want to know eigenvector and eigenvalue.
chi2the double were the chi2-related quantity will be stored
Returns
the eigenvector associated to the minimum eigenvalue. The computedDirect() method of SelfAdjointEigenSolver for 2x2 Matrix do not use special math function (just sqrt) therefore it doesn't speed up significantly in single precision.

Definition at line 356 of file RiemannFit.h.

References isoTrack_cff::chi2.

356  {
357  Eigen::SelfAdjointEigenSolver<Matrix2d> solver(2);
358  solver.computeDirect(aMat);
359  int min_index;
360  chi2 = solver.eigenvalues().minCoeff(&min_index);
361  return solver.eigenvectors().col(min_index);
362  }

◆ min_eigen3D()

__host__ __device__ Vector3d riemannFit::min_eigen3D ( const Matrix3d A,
double &  chi2 
)
inline

Compute the eigenvector associated to the minimum eigenvalue.

Parameters
Athe Matrix you want to know eigenvector and eigenvalue.
chi2the double were the chi2-related quantity will be stored.
Returns
the eigenvector associated to the minimum eigenvalue.
Warning
double precision is needed for a correct assessment of chi2.

The minimus eigenvalue is related to chi2. We exploit the fact that the matrix is symmetrical and small (2x2 for line fit and 3x3 for circle fit), so the SelfAdjointEigenSolver from Eigen library is used, with the computedDirect method (available only for 2x2 and 3x3 Matrix) wich computes eigendecomposition of given matrix using a fast closed-form algorithm. For this optimization the matrix type must be known at compiling time.

Definition at line 313 of file RiemannFit.h.

References A, and isoTrack_cff::chi2.

Referenced by circleFit().

313  {
314 #ifdef RFIT_DEBUG
315  printf("min_eigen3D - enter\n");
316 #endif
317  Eigen::SelfAdjointEigenSolver<Matrix3d> solver(3);
318  solver.computeDirect(A);
319  int min_index;
320  chi2 = solver.eigenvalues().minCoeff(&min_index);
321 #ifdef RFIT_DEBUG
322  printf("min_eigen3D - exit\n");
323 #endif
324  return solver.eigenvectors().col(min_index);
325  }
Definition: APVGainStruct.h:7

◆ min_eigen3D_fast()

__host__ __device__ Vector3d riemannFit::min_eigen3D_fast ( const Matrix3d A)
inline

A faster version of min_eigen3D() where double precision is not needed.

Parameters
Athe Matrix you want to know eigenvector and eigenvalue.
chi2the double were the chi2-related quantity will be stored
Returns
the eigenvector associated to the minimum eigenvalue. The computedDirect() method of SelfAdjointEigenSolver for 3x3 Matrix indeed, use trigonometry function (it solves a third degree equation) which speed up in single precision.

Definition at line 338 of file RiemannFit.h.

References A.

Referenced by circleFit().

338  {
339  Eigen::SelfAdjointEigenSolver<Matrix3f> solver(3);
340  solver.computeDirect(A.cast<float>());
341  int min_index;
342  solver.eigenvalues().minCoeff(&min_index);
343  return solver.eigenvectors().col(min_index).cast<double>();
344  }
Definition: APVGainStruct.h:7

◆ par_uvrtopak()

__host__ __device__ void riemannFit::par_uvrtopak ( CircleFit circle,
const double  B,
const bool  error 
)
inline

Transform circle parameter from (X0,Y0,R) to (phi,Tip,p_t) and consequently covariance matrix.

Parameters
circle_uvrparameter (X0,Y0,R), covariance matrix to be transformed and particle charge.
Bmagnetic field in Gev/cm/c unit.
errorflag for errors computation.

Definition at line 173 of file FitUtils.h.

References B, riemannFit::CircleFit::cov, relativeConstraints::error, riemannFit::CircleFit::par, riemannFit::CircleFit::qCharge, sqr(), and mathSSE::sqrt().

Referenced by helixFit().

173  {
174  Vector3d par_pak;
175  const double temp0 = circle.par.head(2).squaredNorm();
176  const double temp1 = sqrt(temp0);
177  par_pak << atan2(circle.qCharge * circle.par(0), -circle.qCharge * circle.par(1)),
178  circle.qCharge * (temp1 - circle.par(2)), circle.par(2) * B;
179  if (error) {
180  const double temp2 = sqr(circle.par(0)) * 1. / temp0;
181  const double temp3 = 1. / temp1 * circle.qCharge;
182  Matrix3d j4Mat;
183  j4Mat << -circle.par(1) * temp2 * 1. / sqr(circle.par(0)), temp2 * 1. / circle.par(0), 0., circle.par(0) * temp3,
184  circle.par(1) * temp3, -circle.qCharge, 0., 0., B;
185  circle.cov = j4Mat * circle.cov * j4Mat.transpose();
186  }
187  circle.par = par_pak;
188  }
Eigen::Vector3d Vector3d
Definition: FitResult.h:11
Eigen::Matrix3d Matrix3d
Definition: FitResult.h:15
Definition: APVGainStruct.h:7
T sqrt(T t)
Definition: SSEVec.h:23
constexpr T sqr(const T a)
raise to square.
Definition: FitUtils.h:67

◆ printIt()

template<class C >
__host__ __device__ void riemannFit::printIt ( C *  m,
const char *  prefix = "" 
)

Definition at line 53 of file FitUtils.h.

References DummyCfis::c, visualization-live-secondInstance_cfg::m, ConfigBuilder::prefix, and parallelization::uint.

Referenced by circleFit(), cov_radtocart(), fastFit(), lineFit(), scatter_cov_rad(), and scatterCovLine().

53  {
54 #ifdef RFIT_DEBUG
55  for (uint r = 0; r < m->rows(); ++r) {
56  for (uint c = 0; c < m->cols(); ++c) {
57  printf("%s Matrix(%d,%d) = %g\n", prefix, r, c, (*m)(r, c));
58  }
59  }
60 #endif
61  }

◆ rolling_fits()

template<auto Start, auto End, auto Inc, class F >
constexpr void riemannFit::rolling_fits ( F &&  f)

Definition at line 42 of file HelixFit.h.

References ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), PixelRegions::End, and f.

42  {
43  if constexpr (Start < End) {
44  f(std::integral_constant<decltype(Start), Start>());
45  rolling_fits<Start + Inc, End, Inc>(f);
46  }
47  }
double f[11][100]

◆ scatter_cov_rad()

template<typename M2xN , typename V4 , int N>
__host__ __device__ MatrixNd<N> riemannFit::scatter_cov_rad ( const M2xN &  p2D,
const V4 &  fast_fit,
VectorNd< N > const &  rad,
double  B 
)
inline

Compute the covariance matrix (in radial coordinates) of points in the transverse plane due to multiple Coulomb scattering.

Parameters
p2D2D points in the transverse plane.
fast_fitfast_fit Vector4d result of the previous pre-fit structured in this form:(X0, Y0, R, Tan(Theta))).
Bmagnetic field use to compute p
Returns
scatter_cov_rad errors due to multiple scattering.
Warning
input points must be ordered radially from the detector center (from inner layer to outer ones; points on the same layer must ordered too).

Only the tangential component is computed (the radial one is negligible).

Definition at line 126 of file RiemannFit.h.

References funct::abs(), B, computeRadLenUniformMaterial(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), cross(), cross2D(), dot(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::fast_fit, mps_fire::i, isotrackApplyRegressor::k, MainPageGenerator::l, M_PI, SiStripPI::min, N, create_idmaps::n, printIt(), funct::sin(), sqr(), mathSSE::sqrt(), tauSpinnerTable_cfi::theta, and parallelization::uint.

Referenced by circleFit().

129  {
130  constexpr uint n = N;
131  double p_t = std::min(20., fast_fit(2) * B); // limit pt to avoid too small error!!!
132  double p_2 = p_t * p_t * (1. + 1. / sqr(fast_fit(3)));
133  double theta = atan(fast_fit(3));
134  theta = theta < 0. ? theta + M_PI : theta;
135  VectorNd<N> s_values;
136  VectorNd<N> rad_lengths;
137  const Vector2d oVec(fast_fit(0), fast_fit(1));
138 
139  // associated Jacobian, used in weights and errors computation
140  for (uint i = 0; i < n; ++i) { // x
141  Vector2d pVec = p2D.block(0, i, 2, 1) - oVec;
142  const double cross = cross2D(-oVec, pVec);
143  const double dot = (-oVec).dot(pVec);
144  const double tempAtan2 = atan2(cross, dot);
145  s_values(i) = std::abs(tempAtan2 * fast_fit(2));
146  }
147  computeRadLenUniformMaterial(s_values * sqrt(1. + 1. / sqr(fast_fit(3))), rad_lengths);
148  MatrixNd<N> scatter_cov_rad = MatrixNd<N>::Zero();
149  VectorNd<N> sig2 = (1. + 0.038 * rad_lengths.array().log()).abs2() * rad_lengths.array();
150  sig2 *= 0.000225 / (p_2 * sqr(sin(theta)));
151  for (uint k = 0; k < n; ++k) {
152  for (uint l = k; l < n; ++l) {
153  for (uint i = 0; i < std::min(k, l); ++i) {
154  scatter_cov_rad(k, l) += (rad(k) - rad(i)) * (rad(l) - rad(i)) * sig2(i);
155  }
157  }
158  }
159 #ifdef RFIT_DEBUG
160  riemannFit::printIt(&scatter_cov_rad, "Scatter_cov_rad - scatter_cov_rad: ");
161 #endif
162  return scatter_cov_rad;
163  }
Basic3DVector cross(const Basic3DVector &v) const
Vector product, or "cross" product, with a vector of same type.
Definition: APVGainStruct.h:7
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
ALPAKA_FN_ACC ALPAKA_FN_INLINE double cross2D(const TAcc &acc, const Vector2d &a, const Vector2d &b)
Compute cross product of two 2D vector (assuming z component 0), returning z component of the result...
Definition: FitUtils.h:117
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
T sqrt(T t)
Definition: SSEVec.h:23
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
__host__ __device__ void computeRadLenUniformMaterial(const VNd1 &length_values, VNd2 &rad_lengths)
Definition: RiemannFit.h:34
#define M_PI
ALPAKA_FN_ACC ALPAKA_FN_INLINE void const M3xN const V4 & fast_fit
Definition: BrokenLine.h:158
#define N
Definition: blowfish.cc:9
Eigen::Vector2d Vector2d
Definition: FitResult.h:10
Square< F >::type sqr(const F &f)
Definition: Square.h:14
__host__ __device__ MatrixNd< N > scatter_cov_rad(const M2xN &p2D, const V4 &fast_fit, VectorNd< N > const &rad, double B)
Compute the covariance matrix (in radial coordinates) of points in the transverse plane due to multip...
Definition: RiemannFit.h:126
__host__ __device__ void printIt(C *m, const char *prefix="")
Definition: FitUtils.h:53

◆ scatterCovLine()

template<typename V4 , typename VNd1 , typename VNd2 , int N>
__host__ __device__ auto riemannFit::scatterCovLine ( Matrix2d const *  cov_sz,
const V4 &  fast_fit,
VNd1 const &  s_arcs,
VNd2 const &  z_values,
const double  theta,
const double  bField,
MatrixNd< N > &  ret 
)
inline

Compute the covariance matrix along cartesian S-Z of points due to multiple Coulomb scattering to be used in the line_fit, for the barrel and forward cases. The input covariance matrix is in the variables s-z, original and unrotated. The multiple scattering component is computed in the usual linear approximation, using the 3D path which is computed as the squared root of the squared sum of the s and z components passed in. Internally a rotation by theta is performed and the covariance matrix returned is the one in the direction orthogonal to the rotated S3D axis, i.e. along the rotated Z axis. The choice of the rotation is not arbitrary, but derived from the fact that putting the horizontal axis along the S3D direction allows the usage of the ordinary least squared fitting techiques with the trivial parametrization y = mx + q, avoiding the patological case with m = +/- inf, that would correspond to the case at eta = 0.

Definition at line 65 of file RiemannFit.h.

References funct::abs(), Calorimetry_cff::bField, computeRadLenUniformMaterial(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::fast_fit, mps_fire::i, isotrackApplyRegressor::k, MainPageGenerator::l, SiStripPI::min, N, create_idmaps::n, printIt(), runTheMatrix::ret, sqr(), createJobs::tmp, and parallelization::uint.

Referenced by lineFit().

71  {
72 #ifdef RFIT_DEBUG
73  riemannFit::printIt(&s_arcs, "Scatter_cov_line - s_arcs: ");
74 #endif
75  constexpr uint n = N;
76  double p_t = std::min(20., fast_fit(2) * bField); // limit pt to avoid too small error!!!
77  double p_2 = p_t * p_t * (1. + 1. / sqr(fast_fit(3)));
78  VectorNd<N> rad_lengths_S;
79  // See documentation at http://eigen.tuxfamily.org/dox/group__TutorialArrayClass.html
80  // Basically, to perform cwise operations on Matrices and Vectors, you need
81  // to transform them into Array-like objects.
82  VectorNd<N> s_values = s_arcs.array() * s_arcs.array() + z_values.array() * z_values.array();
83  s_values = s_values.array().sqrt();
84  computeRadLenUniformMaterial(s_values, rad_lengths_S);
85  VectorNd<N> sig2_S;
86  sig2_S = .000225 / p_2 * (1. + 0.038 * rad_lengths_S.array().log()).abs2() * rad_lengths_S.array();
87 #ifdef RFIT_DEBUG
88  riemannFit::printIt(cov_sz, "Scatter_cov_line - cov_sz: ");
89 #endif
90  Matrix2Nd<N> tmp = Matrix2Nd<N>::Zero();
91  for (uint k = 0; k < n; ++k) {
92  tmp(k, k) = cov_sz[k](0, 0);
93  tmp(k + n, k + n) = cov_sz[k](1, 1);
94  tmp(k, k + n) = tmp(k + n, k) = cov_sz[k](0, 1);
95  }
96  for (uint k = 0; k < n; ++k) {
97  for (uint l = k; l < n; ++l) {
98  for (uint i = 0; i < std::min(k, l); ++i) {
99  tmp(k + n, l + n) += std::abs(s_values(k) - s_values(i)) * std::abs(s_values(l) - s_values(i)) * sig2_S(i);
100  }
101  tmp(l + n, k + n) = tmp(k + n, l + n);
102  }
103  }
104  // We are interested only in the errors orthogonal to the rotated s-axis
105  // which, in our formalism, are in the lower square matrix.
106 #ifdef RFIT_DEBUG
107  riemannFit::printIt(&tmp, "Scatter_cov_line - tmp: ");
108 #endif
109  ret = tmp.block(n, n, n, n);
110  }
ret
prodAgent to be discontinued
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
__host__ __device__ void computeRadLenUniformMaterial(const VNd1 &length_values, VNd2 &rad_lengths)
Definition: RiemannFit.h:34
ALPAKA_FN_ACC ALPAKA_FN_INLINE void const M3xN const V4 & fast_fit
Definition: BrokenLine.h:158
#define N
Definition: blowfish.cc:9
Square< F >::type sqr(const F &f)
Definition: Square.h:14
tmp
align.sh
Definition: createJobs.py:716
__host__ __device__ void printIt(C *m, const char *prefix="")
Definition: FitUtils.h:53

◆ sqr()

template<typename T >
constexpr T riemannFit::sqr ( const T  a)

◆ transformToPerigeePlane() [1/2]

template<typename VI5 , typename MI5 , typename VO5 , typename MO5 >
void riemannFit::transformToPerigeePlane ( VI5 const &  ip,
MI5 const &  icov,
VO5 &  op,
MO5 &  ocov 
)
inline

Definition at line 60 of file FitUtils.h.

References findAndChange::op, and mathSSE::sqrt().

Referenced by L2TauNNProducerAlpaka::impactParameter(), L2TauNNProducer::impactParameter(), SeedProducerFromSoAT< TrackerTraits >::produce(), PixelTrackProducerFromSoAAlpaka< TrackerTraits >::produce(), and PixelTrackProducerFromSoAT< TrackerTraits >::produce().

60  {
61  auto sinTheta2 = 1. / (1. + ip(3) * ip(3));
62  auto sinTheta = std::sqrt(sinTheta2);
63  auto cosTheta = ip(3) * sinTheta;
64 
65  op(0) = sinTheta * ip(2);
66  op(1) = 0.;
67  op(2) = -ip(3);
68  op(3) = ip(1);
69  op(4) = -ip(4);
70 
71  Matrix5d jMat = Matrix5d::Zero();
72 
73  jMat(0, 2) = sinTheta;
74  jMat(0, 3) = -sinTheta2 * cosTheta * ip(2);
75  jMat(1, 0) = 1.;
76  jMat(2, 3) = -1.;
77  jMat(3, 1) = 1.;
78  jMat(4, 4) = -1;
79 
80  ocov = jMat * icov * jMat.transpose();
81  }
Eigen::Matrix< double, 5, 5 > Matrix5d
Definition: FitResult.h:17
T sqrt(T t)
Definition: SSEVec.h:23

◆ transformToPerigeePlane() [2/2]

template<typename VI5 , typename MI5 , typename VO5 , typename MO5 >
__host__ __device__ void riemannFit::transformToPerigeePlane ( VI5 const &  ip,
MI5 const &  icov,
VO5 &  op,
MO5 &  ocov 
)
inline

Definition at line 218 of file FitUtils.h.

References findAndChange::op, and mathSSE::sqrt().

218  {
219  auto sinTheta2 = 1. / (1. + ip(3) * ip(3));
220  auto sinTheta = std::sqrt(sinTheta2);
221  auto cosTheta = ip(3) * sinTheta;
222 
223  op(0) = sinTheta * ip(2);
224  op(1) = 0.;
225  op(2) = -ip(3);
226  op(3) = ip(1);
227  op(4) = -ip(4);
228 
229  Matrix5d jMat = Matrix5d::Zero();
230 
231  jMat(0, 2) = sinTheta;
232  jMat(0, 3) = -sinTheta2 * cosTheta * ip(2);
233  jMat(1, 0) = 1.;
234  jMat(2, 3) = -1.;
235  jMat(3, 1) = 1.;
236  jMat(4, 4) = -1;
237 
238  ocov = jMat * icov * jMat.transpose();
239  }
Eigen::Matrix< double, 5, 5 > Matrix5d
Definition: FitResult.h:17
T sqrt(T t)
Definition: SSEVec.h:23

◆ weightCircle()

template<int N>
__host__ __device__ VectorNd<N> riemannFit::weightCircle ( const MatrixNd< N > &  cov_rad_inv)
inline

Compute the points' weights' vector for the circle fit when multiple scattering is managed. Further information in attached documentation.

Parameters
cov_rad_invcovariance matrix inverse in radial coordinated (or, beter, pre-fitted circle's orthogonal system).
Returns
weight VectorNd points' weights' vector.

Definition at line 278 of file RiemannFit.h.

Referenced by circleFit().

278  {
279  return cov_rad_inv.colwise().sum().transpose();
280  }

Variable Documentation

◆ epsilon

constexpr double riemannFit::epsilon = 1.e-4

used in numerical derivative (J2 in Circle_fit())

Definition at line 14 of file FitUtils.h.

Referenced by circleFit().

◆ maxNumberOfConcurrentFits

constexpr uint32_t riemannFit::maxNumberOfConcurrentFits = 32 * 1024

◆ stride

constexpr uint32_t riemannFit::stride = maxNumberOfConcurrentFits

Definition at line 22 of file HelixFit.h.

Referenced by caHitNtupletGeneratorKernels::__attribute__(), HcalDigisProducerGPU::acquire(), cms::rocmtest::add_vectors_d(), cms::rocmtest::add_vectors_f(), PhysicsPerformanceDBWriterFromFile_WPandPayload::beginJob(), PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV::beginJob(), ALPAKA_ACCELERATOR_NAMESPACE::CAHitNtupletGeneratorKernels< TTTraits >::buildDoublets(), cms::soa::SoAParametersImpl< SoAColumnType::eigen, T >::checkAlignment(), calo::multifit::compute_decomposition_unrolled(), cms::alpakatools::detail::UniformGroupsAlong< TAcc, Dim, typename >::const_iterator::const_iterator(), cms::alpakatools::detail::IndependentGroupsAlong< TAcc, Dim, typename >::const_iterator::const_iterator(), npstat::ArrayND< Numeric >::contract(), npstat::ArrayND< Numeric >::contractLoop(), npstat::ArrayND< Numeric >::convertToLastDimCdfLoop(), npstat::ArrayND< Numeric >::functorFillLoop(), ALPAKA_ACCELERATOR_NAMESPACE::hcalFastCluster_exotic(), ALPAKA_ACCELERATOR_NAMESPACE::hcalFastCluster_multiSeedIterative(), ALPAKA_ACCELERATOR_NAMESPACE::hcalFastCluster_multiSeedParallel(), npstat::ArrayND< Numeric >::jointSliceLoop(), ALPAKA_ACCELERATOR_NAMESPACE::CAHitNtupletGeneratorKernels< TTTraits >::launchKernels(), npstat::ArrayND< Numeric >::linearFillLoop(), npstat::ArrayND< Numeric >::makeUnit(), ALPAKA_ACCELERATOR_NAMESPACE::hcal::reconstruction::mahi::Kernel_prep1d_sameNumberOfSamples::operator()(), ALPAKA_ACCELERATOR_NAMESPACE::hcal::reconstruction::mahi::Kernel_minimize< NSAMPLES, NPULSES >::operator()(), npstat::ArrayND< Numeric >::processSubrangeLoop(), ALPAKA_ACCELERATOR_NAMESPACE::HcalDigisSoAProducer::produce(), npstat::ArrayND< Numeric >::projectInnerLoop(), npstat::ArrayND< Numeric >::projectInnerLoop2(), npstat::ArrayND< Numeric >::projectLoop(), npstat::ArrayND< Numeric >::projectLoop2(), npstat::ArrayND< Numeric >::scaleBySliceInnerLoop(), npstat::ArrayND< Numeric >::scaleBySliceLoop(), l1tVertexFinder::VertexFinder::strided_iota(), npstat::ArrayND< Numeric >::sumBelowLoop(), and ALPAKA_ACCELERATOR_NAMESPACE::testESAlgoAsync().