CMS 3D CMS Logo

RiemannFitOnGPU.cc
Go to the documentation of this file.
1 #include "RiemannFitOnGPU.h"
2 
3 template <typename TrackerTraits>
5  uint32_t nhits,
6  uint32_t maxNumberOfTuples) {
7  assert(tuples_);
8 
9  // Fit internals
10  auto hitsGPU =
11  std::make_unique<double[]>(maxNumberOfConcurrentFits_ * sizeof(riemannFit::Matrix3xNd<4>) / sizeof(double));
12  auto hits_geGPU =
13  std::make_unique<float[]>(maxNumberOfConcurrentFits_ * sizeof(riemannFit::Matrix6x4f) / sizeof(float));
14  auto fast_fit_resultsGPU =
15  std::make_unique<double[]>(maxNumberOfConcurrentFits_ * sizeof(riemannFit::Vector4d) / sizeof(double));
16  auto circle_fit_resultsGPU_holder =
17  std::make_unique<char[]>(maxNumberOfConcurrentFits_ * sizeof(riemannFit::CircleFit));
18  riemannFit::CircleFit *circle_fit_resultsGPU = (riemannFit::CircleFit *)(circle_fit_resultsGPU_holder.get());
19 
20  for (uint32_t offset = 0; offset < maxNumberOfTuples; offset += maxNumberOfConcurrentFits_) {
21  // triplets
22  kernel_FastFit<3, TrackerTraits>(
23  tuples_, tupleMultiplicity_, 3, hv, hitsGPU.get(), hits_geGPU.get(), fast_fit_resultsGPU.get(), offset);
24 
25  kernel_CircleFit<3, TrackerTraits>(tupleMultiplicity_,
26  3,
27  bField_,
28  hitsGPU.get(),
29  hits_geGPU.get(),
30  fast_fit_resultsGPU.get(),
31  circle_fit_resultsGPU,
32  offset);
33 
34  kernel_LineFit<3, TrackerTraits>(tupleMultiplicity_,
35  3,
36  bField_,
37  outputSoa_,
38  hitsGPU.get(),
39  hits_geGPU.get(),
40  fast_fit_resultsGPU.get(),
41  circle_fit_resultsGPU,
42  offset);
43 
44  // quads
45  kernel_FastFit<4, TrackerTraits>(
46  tuples_, tupleMultiplicity_, 4, hv, hitsGPU.get(), hits_geGPU.get(), fast_fit_resultsGPU.get(), offset);
47 
48  kernel_CircleFit<4, TrackerTraits>(tupleMultiplicity_,
49  4,
50  bField_,
51  hitsGPU.get(),
52  hits_geGPU.get(),
53  fast_fit_resultsGPU.get(),
54  circle_fit_resultsGPU,
55  offset);
56 
57  kernel_LineFit<4, TrackerTraits>(tupleMultiplicity_,
58  4,
59  bField_,
60  outputSoa_,
61  hitsGPU.get(),
62  hits_geGPU.get(),
63  fast_fit_resultsGPU.get(),
64  circle_fit_resultsGPU,
65  offset);
66 
67  if (fitNas4_) {
68  // penta
69  kernel_FastFit<4, TrackerTraits>(
70  tuples_, tupleMultiplicity_, 5, hv, hitsGPU.get(), hits_geGPU.get(), fast_fit_resultsGPU.get(), offset);
71 
72  kernel_CircleFit<4, TrackerTraits>(tupleMultiplicity_,
73  5,
74  bField_,
75  hitsGPU.get(),
76  hits_geGPU.get(),
77  fast_fit_resultsGPU.get(),
78  circle_fit_resultsGPU,
79  offset);
80 
81  kernel_LineFit<4, TrackerTraits>(tupleMultiplicity_,
82  5,
83  bField_,
84  outputSoa_,
85  hitsGPU.get(),
86  hits_geGPU.get(),
87  fast_fit_resultsGPU.get(),
88  circle_fit_resultsGPU,
89  offset);
90 
91  } else {
92  // penta all 5
93  kernel_FastFit<5, TrackerTraits>(
94  tuples_, tupleMultiplicity_, 5, hv, hitsGPU.get(), hits_geGPU.get(), fast_fit_resultsGPU.get(), offset);
95 
96  kernel_CircleFit<5, TrackerTraits>(tupleMultiplicity_,
97  5,
98  bField_,
99  hitsGPU.get(),
100  hits_geGPU.get(),
101  fast_fit_resultsGPU.get(),
102  circle_fit_resultsGPU,
103  offset);
104 
105  kernel_LineFit<5, TrackerTraits>(tupleMultiplicity_,
106  5,
107  bField_,
108  outputSoa_,
109  hitsGPU.get(),
110  hits_geGPU.get(),
111  fast_fit_resultsGPU.get(),
112  circle_fit_resultsGPU,
113  offset);
114  }
115  }
116 }
117 
Eigen::Vector4d Vector4d
Definition: FitResult.h:14
Eigen::Matrix< float, 6, 4 > Matrix6x4f
Definition: HelixFit.h:20
assert(be >=bs)
void launchRiemannKernelsOnCPU(const HitConstView &hv, uint32_t nhits, uint32_t maxNumberOfTuples)
Eigen::Matrix< double, 3, N > Matrix3xNd
Definition: HelixFit.h:25
typename TrackingRecHitSoA< TrackerTraits >::template TrackingRecHitSoALayout<>::ConstView TrackingRecHitSoAConstView