1 #ifndef RecoPixelVertexing_PixelTriplets_plugins_GPUCACell_h
2 #define RecoPixelVertexing_PixelTriplets_plugins_GPUCACell_h
10 #include <cuda_runtime.h>
70 if (outerNeighbors().
empty()) {
71 auto i = cellNeighbors.
extend();
87 return outerNeighbors().push_back(t);
106 return tracks().push_back(t);
134 printf(
"printing cell: on layerPair: %d, innerHitId: %d, outerHitId: %d \n",
143 const float hardCurvCut,
144 const float caThetaCutBarrel,
145 const float caThetaCutForward,
146 const float dcaCutInnerTriplet,
147 const float dcaCutOuterTriplet)
const {
151 auto ri = inner_r(hh);
152 auto zi = inner_z(hh);
154 auto ro = outer_r(hh);
155 auto zo = outer_z(hh);
157 auto r1 = otherCell.inner_r(hh);
158 auto z1 = otherCell.inner_z(hh);
160 bool aligned = areAlignedRZ(
r1,
167 isBarrel ? caThetaCutBarrel : caThetaCutForward);
168 return (aligned && dcaCut(hh,
171 : dcaCutOuterTriplet,
177 float radius_diff =
std::abs(r1 - ro);
184 return tan_12_13_half_mul_distance_13_squared * pMin <= thetaCut * distance_13_squared * radius_diff;
189 const float region_origin_radius_plus_tolerance,
190 const float maxCurv)
const {
191 auto x1 = otherCell.inner_x(hh);
192 auto y1 = otherCell.inner_y(hh);
194 auto x2 = inner_x(hh);
195 auto y2 = inner_y(hh);
197 auto x3 = outer_x(hh);
198 auto y3 = outer_y(hh);
202 if (eq.curvature() > maxCurv)
205 return std::abs(eq.dca0()) < region_origin_radius_plus_tolerance *
std::abs(eq.curvature());
214 const float region_origin_radius_plus_tolerance,
215 const float maxCurv) {
218 if (eq.curvature() > maxCurv)
221 return std::abs(eq.dca0()) < region_origin_radius_plus_tolerance *
std::abs(eq.curvature());
229 int p = innerCell.inner_iphi(hh);
235 auto r0 = hh.averageGeometry().ladderR[il];
236 auto ri = innerCell.inner_r(hh);
237 auto zi = innerCell.inner_z(hh);
238 auto ro = outer_r(hh);
239 auto zo = outer_z(hh);
240 auto z0 = zi + (r0 -
ri) * (zo - zi) / (ro -
ri);
241 auto z_in_ladder =
std::abs(z0 - hh.averageGeometry().ladderZ[il]);
252 int p = outer_iphi(hh);
258 auto r4 = hh.averageGeometry().ladderR[il];
259 auto ri = innerCell.inner_r(hh);
260 auto zi = innerCell.inner_z(hh);
261 auto ro = outer_r(hh);
262 auto zo = outer_z(hh);
263 auto z4 = zo + (r4 -
ro) * (zo - zi) / (ro -
ri);
264 auto z_in_ladder =
std::abs(z4 - hh.averageGeometry().ladderZ[il]);
267 auto holeP = z4 > hh.averageGeometry().ladderMaxZ[il] && z4 < hh.averageGeometry().endCapZ[0];
268 auto holeN = z4 < hh.averageGeometry().ladderMinZ[il] && z4 > hh.averageGeometry().endCapZ[1];
269 return gap || holeP || holeN;
282 const unsigned int minHitsPerNtuplet,
283 bool startAt0)
const {
290 auto doubletId =
this -
cells;
291 tmpNtuplet.push_back_unsafe(doubletId);
292 assert(tmpNtuplet.size() <= 4);
295 for (
unsigned int otherCell : outerNeighbors()) {
296 if (cells[otherCell].isKilled())
299 cells[otherCell].find_ntuplets<DEPTH - 1>(
303 if ((
unsigned int)(tmpNtuplet.size()) >= minHitsPerNtuplet - 1) {
304 #ifdef ONLY_TRIPLETS_IN_HOLE
306 if (tmpNtuplet.size() >= 3 || (startAt0 && hole4(hh, cells[tmpNtuplet[0]])) ||
307 ((!startAt0) && hole0(hh, cells[tmpNtuplet[0]])))
312 constexpr
int maxFB = 2;
314 for (
auto c : tmpNtuplet) {
315 hits[
nh++] = cells[
c].theInnerHitId;
316 if (nfb < maxFB && cells[
c].hasFishbone()) {
318 hits[
nh++] = cells[
c].theFishboneId;
323 auto it = foundNtuplets.bulkFill(apc, hits,
nh + 1);
325 for (
auto c : tmpNtuplet)
326 cells[
c].addTrack(it, cellTracks);
332 tmpNtuplet.pop_back();
333 assert(tmpNtuplet.size() < 4);
366 __device__ inline void GPUCACell::find_ntuplets<0>(Hits
const&
hh,
372 TmpTuple& tmpNtuplet,
373 const unsigned int minHitsPerNtuplet,
374 bool startAt0)
const {
375 printf(
"ERROR: GPUCACell::find_ntuplets reached full depth!\n");
383 #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)
uint16_t *__restrict__ id
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
auto const & foundNtuplets
__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
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter * apc
__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
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::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 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