1 #ifndef RecoPixelVertexing_PixelTriplets_plugins_GPUCACell_h
2 #define RecoPixelVertexing_PixelTriplets_plugins_GPUCACell_h
10 #include <cuda_runtime.h>
71 if (outerNeighbors().
empty()) {
72 auto i = cellNeighbors.
extend();
88 return outerNeighbors().push_back(t);
107 return tracks().push_back(t);
135 printf(
"printing cell: on layerPair: %d, innerHitId: %d, outerHitId: %d \n",
144 const float hardCurvCut,
145 const float caThetaCutBarrel,
146 const float caThetaCutForward,
147 const float dcaCutInnerTriplet,
148 const float dcaCutOuterTriplet)
const {
152 auto ri = inner_r(hh);
153 auto zi = inner_z(hh);
155 auto ro = outer_r(hh);
156 auto zo = outer_z(hh);
158 auto r1 = otherCell.inner_r(hh);
159 auto z1 = otherCell.inner_z(hh);
161 bool aligned = areAlignedRZ(
r1,
168 isBarrel ? caThetaCutBarrel : caThetaCutForward);
169 return (aligned && dcaCut(hh,
172 : dcaCutOuterTriplet,
178 float radius_diff =
std::abs(r1 - ro);
185 return tan_12_13_half_mul_distance_13_squared * pMin <= thetaCut * distance_13_squared * radius_diff;
190 const float region_origin_radius_plus_tolerance,
191 const float maxCurv)
const {
192 auto x1 = otherCell.inner_x(hh);
193 auto y1 = otherCell.inner_y(hh);
195 auto x2 = inner_x(hh);
196 auto y2 = inner_y(hh);
198 auto x3 = outer_x(hh);
199 auto y3 = outer_y(hh);
203 if (eq.curvature() > maxCurv)
206 return std::abs(eq.dca0()) < region_origin_radius_plus_tolerance *
std::abs(eq.curvature());
215 const float region_origin_radius_plus_tolerance,
216 const float maxCurv) {
219 if (eq.curvature() > maxCurv)
222 return std::abs(eq.dca0()) < region_origin_radius_plus_tolerance *
std::abs(eq.curvature());
230 int p = innerCell.inner_iphi(hh);
236 auto r0 = hh.averageGeometry().ladderR[il];
237 auto ri = innerCell.inner_r(hh);
238 auto zi = innerCell.inner_z(hh);
239 auto ro = outer_r(hh);
240 auto zo = outer_z(hh);
241 auto z0 = zi + (r0 -
ri) * (zo - zi) / (ro -
ri);
242 auto z_in_ladder =
std::abs(z0 - hh.averageGeometry().ladderZ[il]);
253 int p = outer_iphi(hh);
259 auto r4 = hh.averageGeometry().ladderR[il];
260 auto ri = innerCell.inner_r(hh);
261 auto zi = innerCell.inner_z(hh);
262 auto ro = outer_r(hh);
263 auto zo = outer_z(hh);
264 auto z4 = zo + (r4 -
ro) * (zo - zi) / (ro -
ri);
265 auto z_in_ladder =
std::abs(z4 - hh.averageGeometry().ladderZ[il]);
268 auto holeP = z4 > hh.averageGeometry().ladderMaxZ[il] && z4 < hh.averageGeometry().endCapZ[0];
269 auto holeN = z4 < hh.averageGeometry().ladderMinZ[il] && z4 > hh.averageGeometry().endCapZ[1];
270 return gap || holeP || holeN;
283 const unsigned int minHitsPerNtuplet,
284 bool startAt0)
const {
291 auto doubletId =
this -
cells;
292 tmpNtuplet.push_back_unsafe(doubletId);
293 assert(tmpNtuplet.size() <= 4);
296 for (
unsigned int otherCell : outerNeighbors()) {
297 if (cells[otherCell].isKilled())
300 cells[otherCell].find_ntuplets<DEPTH - 1>(
304 if ((
unsigned int)(tmpNtuplet.size()) >= minHitsPerNtuplet - 1) {
305 #ifdef ONLY_TRIPLETS_IN_HOLE
307 if (tmpNtuplet.size() >= 3 || (startAt0 && hole4(hh, cells[tmpNtuplet[0]])) ||
308 ((!startAt0) && hole0(hh, cells[tmpNtuplet[0]])))
313 constexpr
int maxFB = 2;
315 for (
auto c : tmpNtuplet) {
316 hits[
nh++] = cells[
c].theInnerHitId;
317 if (nfb < maxFB && cells[
c].hasFishbone()) {
319 hits[
nh++] = cells[
c].theFishboneId;
324 auto it = foundNtuplets.bulkFill(apc, hits,
nh + 1);
326 for (
auto c : tmpNtuplet)
327 cells[
c].addTrack(it, cellTracks);
333 tmpNtuplet.pop_back();
334 assert(tmpNtuplet.size() < 4);
374 __device__ inline void GPUCACell::find_ntuplets<0>(Hits
const&
hh,
380 TmpTuple& tmpNtuplet,
381 const unsigned int minHitsPerNtuplet,
382 bool startAt0)
const {
383 printf(
"ERROR: GPUCACell::find_ntuplets reached full depth!\n");
391 #endif // RecoPixelVertexing_PixelTriplets_plugins_GPUCACell_h
unsigned long long PtrAsInt
constexpr int32_t maxHitsOnTrack
cms::cuda::VecArray< tindex_type, maxCellTracks > CellTracks
TrackingRecHit2DSOAView Hits
cms::cuda::VecArray< uint32_t, 6 > TmpTuple
constexpr uint32_t first_ladder_bpx4
float tan_12_13_half_mul_distance_13_squared
const edm::EventSetup & c
cms::cuda::SimpleVector< CellNeighbors > CellNeighborsVector
T1 atomicCAS(T1 *address, T1 compare, T2 val)
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const * cellNeighbors
uint32_t const *__restrict__ Quality * quality
__device__ float float float float ro
__device__ float float float float float const float const float thetaCut
auto const & tracks
cannot be loose
Hits::hindex_type hindex_type
__device__ float float float float float zo
cms::cuda::VecArray< uint32_t, maxCellsPerHit > OuterHitOfCellContainer
constexpr uint32_t max_ladder_bpx4
__device__ float float float zi
auto const & foundNtuplets
float distance_13_squared
cms::cuda::SimpleVector< CellTracks > CellTracksVector
constexpr float module_length_bpx4
__device__ void print_cell() const
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
__device__ int extend(int size=1)
constexpr uint32_t max_ladder_bpx0
__device__ CellTracksVector Hits const int hindex_type innerHitId
Abs< T >::type abs(const T &t)
static constexpr auto bad
TrackSoA::HitContainer HitContainer
__device__ float float float float float const float ptmin
__device__ CellTracksVector Hits const int hindex_type hindex_type outerHitId
assert(outerNeighbors().empty())
constexpr float module_length_bpx0
caConstants::CellNeighbors CellNeighbors
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ cells
constexpr uint32_t first_ladder_bpx0
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter * apc
caConstants::CellTracks CellTracks
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const * cellTracks
static constexpr auto invalidHitId
static constexpr auto maxCellsPerHit
constexpr unsigned int outer_hit_id() const
caConstants::CellTracksVector CellTracksVector
__device__ CellTracksVector & cellTracks
constexpr float module_tolerance_bpx0
constexpr unsigned int inner_hit_id() const
constexpr uint32_t maxCellsPerHit
caConstants::CellNeighborsVector CellNeighborsVector
__device__ CellTracksVector Hits const & hh
constexpr uint32_t last_bpix1_detIndex
constexpr uint32_t last_barrel_detIndex
__device__ bool check_alignment(Hits const &hh, GPUCACell const &otherCell, const float ptmin, const float hardCurvCut, const float caThetaCutBarrel, const float caThetaCutForward, const float dcaCutInnerTriplet, const float dcaCutOuterTriplet) const
__device__ CellTracksVector Hits const int layerPairId
constexpr float module_tolerance_bpx4
__device__ float float ri
cms::cuda::VecArray< uint32_t, maxCellNeighbors > CellNeighbors