CMS 3D CMS Logo

HelixFit.h
Go to the documentation of this file.
1 #ifndef RecoTracker_PixelSeeding_plugins_alpaka_HelixFit_h
2 #define RecoTracker_PixelSeeding_plugins_alpaka_HelixFit_h
3 
4 #include <alpaka/alpaka.hpp>
5 
6 #include <Eigen/Core>
7 
14 
15 #include "CAStructures.h"
16 
17 namespace riemannFit {
18 
19  // TODO: Can this be taken from TrackerTraits or somewhere else?
20  // in case of memory issue can be made smaller
21  constexpr uint32_t maxNumberOfConcurrentFits = 32 * 1024;
23  using Matrix3x4d = Eigen::Matrix<double, 3, 4>;
24  using Map3x4d = Eigen::Map<Matrix3x4d, 0, Eigen::Stride<3 * stride, stride> >;
25  using Matrix6x4f = Eigen::Matrix<float, 6, 4>;
26  using Map6x4f = Eigen::Map<Matrix6x4f, 0, Eigen::Stride<6 * stride, stride> >;
27 
28  // hits
29  template <int N>
30  using Matrix3xNd = Eigen::Matrix<double, 3, N>;
31  template <int N>
32  using Map3xNd = Eigen::Map<Matrix3xNd<N>, 0, Eigen::Stride<3 * stride, stride> >;
33  // errors
34  template <int N>
35  using Matrix6xNf = Eigen::Matrix<float, 6, N>;
36  template <int N>
37  using Map6xNf = Eigen::Map<Matrix6xNf<N>, 0, Eigen::Stride<6 * stride, stride> >;
38  // fast fit
39  using Map4d = Eigen::Map<Vector4d, 0, Eigen::InnerStride<stride> >;
40 
41  template <auto Start, auto End, auto Inc, class F> //a compile-time bounded for loop
43  if constexpr (Start < End) {
44  f(std::integral_constant<decltype(Start), Start>());
45  rolling_fits<Start + Inc, End, Inc>(f);
46  }
47  }
48 
49 } // namespace riemannFit
50 
52 
53  template <typename TrackerTraits>
54  class HelixFit {
55  public:
57 
60 
63 
65 
67 
68  explicit HelixFit(float bf, bool fitNas4) : bField_(bf), fitNas4_(fitNas4) {}
70 
71  void setBField(double bField) { bField_ = bField; }
72  void launchRiemannKernels(const HitConstView &hv,
73  ParamsOnDevice const *cpeParams,
74  uint32_t nhits,
75  uint32_t maxNumberOfTuples,
76  Queue &queue);
78  ParamsOnDevice const *cpeParams,
79  uint32_t nhits,
80  uint32_t maxNumberOfTuples,
81  Queue &queue);
82 
83  void allocate(TupleMultiplicity const *tupleMultiplicity, OutputSoAView &helix_fit_results);
84  void deallocate();
85 
86  private:
88 
89  // fowarded
90  Tuples const *tuples_ = nullptr;
93  float bField_;
94 
95  const bool fitNas4_;
96  };
97 
98 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
99 
100 #endif // RecoTracker_PixelSeeding_plugins_alpaka_HelixFit_h
Eigen::Matrix< double, 3, 4 > Matrix3x4d
Definition: HelixFit.h:23
Eigen::Map< Matrix3x4d, 0, Eigen::Stride< 3 *stride, stride > > Map3x4d
Definition: HelixFit.h:24
HelixFit(float bf, bool fitNas4)
Definition: HelixFit.h:68
reco::TrackSoAView< TrackerTraits > OutputSoAView
Definition: HelixFit.h:62
void launchBrokenLineKernels(const HitConstView &hv, ParamsOnDevice const *cpeParams, uint32_t nhits, uint32_t maxNumberOfTuples, Queue &queue)
TupleMultiplicity const * tupleMultiplicity_
Definition: HelixFit.h:91
Eigen::Matrix< float, 6, 4 > Matrix6x4f
Definition: HelixFit.h:25
TupleMultiplicity< TrackerTraits > const *__restrict__ tupleMultiplicity
constexpr uint32_t stride
Definition: HelixFit.h:22
ALPAKA_ACCELERATOR_NAMESPACE::Queue Queue
Definition: LSTEvent.dev.cc:14
Eigen::Matrix< float, 6, N > Matrix6xNf
Definition: HelixFit.h:35
constexpr void rolling_fits(F &&f)
Definition: HelixFit.h:42
Eigen::Map< Vector4d, 0, Eigen::InnerStride< stride > > Map4d
Definition: HelixFit.h:39
Eigen::Map< Matrix3xNd< N >, 0, Eigen::Stride< 3 *stride, stride > > Map3xNd
Definition: HelixFit.h:32
TrackingRecHitSoAConstView< TrackerTraits > HitConstView
Definition: HelixFit.h:59
Eigen::Map< Matrix6x4f, 0, Eigen::Stride< 6 *stride, stride > > Map6x4f
Definition: HelixFit.h:26
double f[11][100]
Eigen::Matrix< double, 3, N > Matrix3xNd
Definition: HelixFit.h:30
Eigen::Map< Matrix6xNf< N >, 0, Eigen::Stride< 6 *stride, stride > > Map6xNf
Definition: HelixFit.h:37
pixelCPEforDevice::ParamsOnDeviceT< TrackerTraits > ParamsOnDevice
Definition: HelixFit.h:66
TrackingRecHitSoAView< TrackerTraits > HitView
Definition: HelixFit.h:58
typename TrackingRecHitSoA< TrackerTraits >::template TrackingRecHitSoALayout<>::ConstView TrackingRecHitSoAConstView
typename reco::TrackSoA< TrackerTraits >::HitContainer Tuples
Definition: HelixFit.h:61
void launchRiemannKernels(const HitConstView &hv, ParamsOnDevice const *cpeParams, uint32_t nhits, uint32_t maxNumberOfTuples, Queue &queue)
void allocate(TupleMultiplicity const *tupleMultiplicity, OutputSoAView &helix_fit_results)
Definition: HelixFit.cc:6
typename TrackingRecHitSoA< TrackerTraits >::template TrackingRecHitSoALayout<>::View TrackingRecHitSoAView
static constexpr uint32_t maxNumberOfConcurrentFits_
Definition: HelixFit.h:87
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
reco::TrackSoAView< TrackerTraits > OutputSoAView
constexpr uint32_t maxNumberOfConcurrentFits
Definition: HelixFit.h:21
typename reco::TrackSoA< TrackerTraits >::template Layout<>::View TrackSoAView
Definition: TracksSoA.h:45