CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Public Attributes | Static Public Attributes
GPUCACell Class Reference

#include <GPUCACell.h>

Public Types

using CellNeighbors = caConstants::CellNeighbors
 
using CellNeighborsVector = caConstants::CellNeighborsVector
 
using CellTracks = caConstants::CellTracks
 
using CellTracksVector = caConstants::CellTracksVector
 
using hindex_type = Hits::hindex_type
 
using HitContainer = pixelTrack::HitContainer
 
using Hits = TrackingRecHit2DSOAView
 
using OuterHitOfCell = caConstants::OuterHitOfCell
 
using PtrAsInt = unsigned long long
 
using Quality = pixelTrack::Quality
 
using TmpTuple = cms::cuda::VecArray< uint32_t, 6 >
 

Public Member Functions

__device__ __attribute__ ((always_inline)) auto inner_iphi(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) auto outer_iphi(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) CellNeighbors &outerNeighbors()
 
__device__ __attribute__ ((always_inline)) CellNeighbors const &outerNeighbors() const
 
__device__ __attribute__ ((always_inline)) CellTracks &tracks()
 
__device__ __attribute__ ((always_inline)) CellTracks const &tracks() const
 
__device__ __attribute__ ((always_inline)) float inner_detIndex(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) float inner_r(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) float inner_x(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) float inner_y(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) float inner_z(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) float outer_detIndex(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) float outer_r(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) float outer_x(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) float outer_y(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) float outer_z(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) int addOuterNeighbor(CellNeighbors
 
__device__ __attribute__ ((always_inline)) int addTrack(CellTracks
 
__device__ __attribute__ ((always_inline)) static bool areAlignedRZ(float r1
 
__device__ __attribute__ ((always_inline)) void init(CellNeighborsVector &cellNeighbors
 
 assert (outerNeighbors().empty())
 
 assert (tracks().empty())
 
__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
 
 GPUCACell ()=default
 
constexpr unsigned int inner_hit_id () const
 
constexpr unsigned int outer_hit_id () const
 
__device__ void print_cell () const
 

Public Attributes

__device__ CellTracksVectorcellTracks
 
float distance_13_squared = radius_diff * radius_diff + (z1 - zo) * (z1 - zo)
 
__device__ CellTracksVector Hits const int int doubletId
 
__device__ CellTracksVector Hits const & hh
 
__device__ CellTracksVector Hits const int int hindex_type innerHitId
 
__device__ CellTracksVector Hits const int layerPairId
 
__device__ CellTracksVector Hits const int int hindex_type hindex_type outerHitId
 
float pMin = ptmin * std::sqrt(distance_13_squared)
 
__device__ float float float float float const float ptmin
 
__device__ float float ri
 
__device__ float float float float ro
 
float tan_12_13_half_mul_distance_13_squared = fabs(z1 * (ri - ro) + zi * (ro - r1) + zo * (r1 - ri))
 
 theDoubletId_ = doubletId
 
 theInnerR = hh.rGlobal(innerHitId)
 
 theInnerZ = hh.zGlobal(innerHitId)
 
 theLayerPairId_ = layerPairId
 
 theOuterHitId = outerHitId
 
 theOuterNeighbors = &cellNeighbors[0]
 
__device__ float float float float float const float const float thetaCut
 
 theTracks = &cellTracks[0]
 
 theUsed_ = 0
 
__device__ float z1
 
__device__ float float float zi
 
__device__ float float float float float zo
 

Static Public Attributes

static constexpr auto bad = pixelTrack::Quality::bad
 
static constexpr auto maxCellsPerHit = caConstants::maxCellsPerHit
 

Detailed Description

Definition at line 20 of file GPUCACell.h.

Member Typedef Documentation

◆ CellNeighbors

Definition at line 26 of file GPUCACell.h.

◆ CellNeighborsVector

Definition at line 28 of file GPUCACell.h.

◆ CellTracks

Definition at line 27 of file GPUCACell.h.

◆ CellTracksVector

Definition at line 29 of file GPUCACell.h.

◆ hindex_type

Definition at line 32 of file GPUCACell.h.

◆ HitContainer

Definition at line 36 of file GPUCACell.h.

◆ Hits

Definition at line 31 of file GPUCACell.h.

◆ OuterHitOfCell

Definition at line 25 of file GPUCACell.h.

◆ PtrAsInt

using GPUCACell::PtrAsInt = unsigned long long

Definition at line 22 of file GPUCACell.h.

◆ Quality

Definition at line 37 of file GPUCACell.h.

◆ TmpTuple

Definition at line 34 of file GPUCACell.h.

Constructor & Destructor Documentation

◆ GPUCACell()

GPUCACell::GPUCACell ( )
default

Member Function Documentation

◆ __attribute__() [1/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 120 of file GPUCACell.h.

120 { return hh.iphi(theInnerHitId); }

References hh.

◆ __attribute__() [2/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 121 of file GPUCACell.h.

121 { return hh.iphi(theOuterHitId); }

References hh, and theOuterHitId.

◆ __attribute__() [3/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) &
inline

Definition at line 107 of file GPUCACell.h.

107 { return *theOuterNeighbors; }

References theOuterNeighbors.

◆ __attribute__() [4/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 108 of file GPUCACell.h.

108 { return *theOuterNeighbors; }

References theOuterNeighbors.

◆ __attribute__() [5/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) &
inline

Definition at line 105 of file GPUCACell.h.

105 { return *theTracks; }

References theTracks.

◆ __attribute__() [6/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 106 of file GPUCACell.h.

106 { return *theTracks; }

References theTracks.

◆ __attribute__() [7/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 123 of file GPUCACell.h.

123 { return hh.detectorIndex(theInnerHitId); }

References hh.

◆ __attribute__() [8/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 116 of file GPUCACell.h.

116 { return theInnerR; }

References theInnerR.

◆ __attribute__() [9/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 109 of file GPUCACell.h.

109 { return hh.xGlobal(theInnerHitId); }

References hh.

◆ __attribute__() [10/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 111 of file GPUCACell.h.

111 { return hh.yGlobal(theInnerHitId); }

References hh.

◆ __attribute__() [11/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 113 of file GPUCACell.h.

113 { return theInnerZ; }

References theInnerZ.

◆ __attribute__() [12/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 124 of file GPUCACell.h.

124 { return hh.detectorIndex(theOuterHitId); }

References hh, and theOuterHitId.

◆ __attribute__() [13/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 118 of file GPUCACell.h.

118 { return hh.rGlobal(theOuterHitId); }

References hh, and theOuterHitId.

◆ __attribute__() [14/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 110 of file GPUCACell.h.

110 { return hh.xGlobal(theOuterHitId); }

References hh, and theOuterHitId.

◆ __attribute__() [15/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 112 of file GPUCACell.h.

112 { return hh.yGlobal(theOuterHitId); }

References hh, and theOuterHitId.

◆ __attribute__() [16/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 115 of file GPUCACell.h.

115 { return hh.zGlobal(theOuterHitId); }

References hh, and theOuterHitId.

◆ __attribute__() [17/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  )
inline

Definition at line 66 of file GPUCACell.h.

66  {
67  // use smart cache
68  if (outerNeighbors().empty()) {
69  auto i = cellNeighbors.extend(); // maybe wasted....
70  if (i > 0) {
71  cellNeighbors[i].reset();
72 #ifdef __CUDACC__
73  auto zero = (PtrAsInt)(&cellNeighbors[0]);
75  zero,
76  (PtrAsInt)(&cellNeighbors[i])); // if fails we cannot give "i" back...
77 #else
79 #endif
80  } else
81  return -1;
82  }
83  __threadfence();
84  return outerNeighbors().push_back(t);
85  }

References cms::cudacompat::__threadfence(), cms::cudacompat::atomicCAS(), cellNeighbors, relativeConstraints::empty, mps_fire::i, submitPVValidationJobs::t, theOuterNeighbors, and SiPixelPI::zero.

◆ __attribute__() [18/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  )
inline

Definition at line 87 of file GPUCACell.h.

87  {
88  if (tracks().empty()) {
89  auto i = cellTracks.extend(); // maybe wasted....
90  if (i > 0) {
91  cellTracks[i].reset();
92 #ifdef __CUDACC__
93  auto zero = (PtrAsInt)(&cellTracks[0]);
94  atomicCAS((PtrAsInt*)(&theTracks), zero, (PtrAsInt)(&cellTracks[i])); // if fails we cannot give "i" back...
95 #else
97 #endif
98  } else
99  return -1;
100  }
101  __threadfence();
102  return tracks().push_back(t);
103  }

References cms::cudacompat::__threadfence(), cms::cudacompat::atomicCAS(), cellTracks, relativeConstraints::empty, cms::cuda::SimpleVector< T >::extend(), mps_fire::i, cms::cuda::SimpleVector< T >::reset(), submitPVValidationJobs::t, theTracks, tracks, and SiPixelPI::zero.

◆ __attribute__() [19/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  )
inline

◆ __attribute__() [20/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) &
inline

◆ assert() [1/2]

GPUCACell::assert ( outerNeighbors().empty()  )

◆ assert() [2/2]

GPUCACell::assert ( tracks().empty()  )

◆ check_alignment()

__device__ bool GPUCACell::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
inline

Definition at line 137 of file GPUCACell.h.

144  {
145  // detIndex of the layerStart for the Phase1 Pixel Detector:
146  // [BPX1, BPX2, BPX3, BPX4, FP1, FP2, FP3, FN1, FN2, FN3, LAST_VALID]
147  // [ 0, 96, 320, 672, 1184, 1296, 1408, 1520, 1632, 1744, 1856]
148  auto ri = inner_r(hh);
149  auto zi = inner_z(hh);
150 
151  auto ro = outer_r(hh);
152  auto zo = outer_z(hh);
153 
154  auto r1 = otherCell.inner_r(hh);
155  auto z1 = otherCell.inner_z(hh);
156  auto isBarrel = otherCell.outer_detIndex(hh) < caConstants::last_barrel_detIndex;
157  bool aligned = areAlignedRZ(r1,
158  z1,
159  ri,
160  zi,
161  ro,
162  zo,
163  ptmin,
164  isBarrel ? caThetaCutBarrel : caThetaCutForward); // 2.f*thetaCut); // FIXME tune cuts
165  return (aligned && dcaCut(hh,
166  otherCell,
167  otherCell.inner_detIndex(hh) < caConstants::last_bpix1_detIndex ? dcaCutInnerTriplet
168  : dcaCutOuterTriplet,
169  hardCurvCut)); // FIXME tune cuts
170  }

References particleFlowDisplacedVertexCandidate_cfi::dcaCut, hh, PixelPluginsPhase0_cfi::isBarrel, caConstants::last_barrel_detIndex, caConstants::last_bpix1_detIndex, ptmin, diffTwoXMLs::r1, ri, ro, z1, zi, and zo.

◆ inner_hit_id()

constexpr unsigned int GPUCACell::inner_hit_id ( ) const
inlineconstexpr

Definition at line 126 of file GPUCACell.h.

126 { return theInnerHitId; }

◆ outer_hit_id()

constexpr unsigned int GPUCACell::outer_hit_id ( ) const
inlineconstexpr

Definition at line 127 of file GPUCACell.h.

127 { return theOuterHitId; }

References theOuterHitId.

◆ print_cell()

__device__ void GPUCACell::print_cell ( ) const
inline

Definition at line 129 of file GPUCACell.h.

129  {
130  printf("printing cell: %d, on layerPair: %d, innerHitId: %d, outerHitId: %d \n",
133  theInnerHitId,
134  theOuterHitId);
135  }

References theDoubletId_, theLayerPairId_, and theOuterHitId.

Member Data Documentation

◆ bad

constexpr auto GPUCACell::bad = pixelTrack::Quality::bad
staticconstexpr

Definition at line 38 of file GPUCACell.h.

◆ cellTracks

__device__ CellTracksVector& GPUCACell::cellTracks

Definition at line 43 of file GPUCACell.h.

Referenced by __attribute__().

◆ distance_13_squared

float GPUCACell::distance_13_squared = radius_diff * radius_diff + (z1 - zo) * (z1 - zo)

Definition at line 175 of file GPUCACell.h.

◆ doubletId

__device__ CellTracksVector Hits const int int GPUCACell::doubletId

Definition at line 43 of file GPUCACell.h.

◆ hh

__device__ CellTracksVector Hits const& GPUCACell::hh

Definition at line 43 of file GPUCACell.h.

Referenced by __attribute__(), and check_alignment().

◆ innerHitId

__device__ CellTracksVector Hits const int int hindex_type GPUCACell::innerHitId

Definition at line 43 of file GPUCACell.h.

◆ layerPairId

__device__ CellTracksVector Hits const int GPUCACell::layerPairId

Definition at line 43 of file GPUCACell.h.

◆ maxCellsPerHit

constexpr auto GPUCACell::maxCellsPerHit = caConstants::maxCellsPerHit
staticconstexpr

Definition at line 24 of file GPUCACell.h.

Referenced by gpuPixelDoublets::__attribute__().

◆ outerHitId

__device__ CellTracksVector Hits const int int hindex_type hindex_type GPUCACell::outerHitId
Initial value:
{
theInnerHitId = innerHitId

Definition at line 48 of file GPUCACell.h.

◆ pMin

float GPUCACell::pMin = ptmin * std::sqrt(distance_13_squared)

Definition at line 177 of file GPUCACell.h.

◆ ptmin

__device__ float float float float float const float GPUCACell::ptmin

Definition at line 173 of file GPUCACell.h.

Referenced by check_alignment().

◆ ri

__device__ float float GPUCACell::ri

Definition at line 173 of file GPUCACell.h.

Referenced by check_alignment().

◆ ro

__device__ float float float float GPUCACell::ro

Definition at line 173 of file GPUCACell.h.

Referenced by check_alignment().

◆ tan_12_13_half_mul_distance_13_squared

float GPUCACell::tan_12_13_half_mul_distance_13_squared = fabs(z1 * (ri - ro) + zi * (ro - r1) + zo * (r1 - ri))

Definition at line 180 of file GPUCACell.h.

◆ theDoubletId_

GPUCACell::theDoubletId_ = doubletId

Definition at line 51 of file GPUCACell.h.

Referenced by print_cell().

◆ theInnerR

GPUCACell::theInnerR = hh.rGlobal(innerHitId)

Definition at line 57 of file GPUCACell.h.

Referenced by __attribute__().

◆ theInnerZ

GPUCACell::theInnerZ = hh.zGlobal(innerHitId)

Definition at line 56 of file GPUCACell.h.

Referenced by __attribute__().

◆ theLayerPairId_

GPUCACell::theLayerPairId_ = layerPairId

Definition at line 52 of file GPUCACell.h.

Referenced by print_cell().

◆ theOuterHitId

GPUCACell::theOuterHitId = outerHitId

Definition at line 50 of file GPUCACell.h.

Referenced by __attribute__(), outer_hit_id(), and print_cell().

◆ theOuterNeighbors

GPUCACell::theOuterNeighbors = &cellNeighbors[0]

Definition at line 60 of file GPUCACell.h.

Referenced by __attribute__().

◆ thetaCut

__device__ float float float float float const float const float GPUCACell::thetaCut
Initial value:
{
float radius_diff = std::abs(r1 - ro)

Definition at line 173 of file GPUCACell.h.

◆ theTracks

GPUCACell::theTracks = &cellTracks[0]

Definition at line 61 of file GPUCACell.h.

Referenced by __attribute__().

◆ theUsed_

GPUCACell::theUsed_ = 0

Definition at line 53 of file GPUCACell.h.

◆ z1

__device__ float GPUCACell::z1

Definition at line 173 of file GPUCACell.h.

Referenced by check_alignment().

◆ zi

__device__ float float float GPUCACell::zi

Definition at line 173 of file GPUCACell.h.

Referenced by check_alignment().

◆ zo

__device__ float float float float float GPUCACell::zo

Definition at line 173 of file GPUCACell.h.

Referenced by check_alignment().

cellNeighbors
const caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple cms::cuda::AtomicPairCounter const GPUCACell *__restrict__ const uint32_t *__restrict__ const gpuPixelDoublets::CellNeighborsVector * cellNeighbors
Definition: CAHitNtupletGeneratorKernelsImpl.h:33
mps_fire.i
i
Definition: mps_fire.py:428
GPUCACell::zi
__device__ float float float zi
Definition: GPUCACell.h:173
cms::cuda::SimpleVector::reset
constexpr void reset()
Definition: SimpleVector.h:108
caConstants::last_bpix1_detIndex
constexpr uint32_t last_bpix1_detIndex
Definition: CAConstants.h:62
GPUCACell::theDoubletId_
theDoubletId_
Definition: GPUCACell.h:51
cms::cudacompat::__threadfence
void __threadfence()
Definition: cudaCompat.h:78
GPUCACell::cellTracks
__device__ CellTracksVector & cellTracks
Definition: GPUCACell.h:43
SiPixelPI::zero
Definition: SiPixelPayloadInspectorHelper.h:39
GPUCACell::hh
__device__ CellTracksVector Hits const & hh
Definition: GPUCACell.h:43
GPUCACell::theLayerPairId_
theLayerPairId_
Definition: GPUCACell.h:52
caConstants::last_barrel_detIndex
constexpr uint32_t last_barrel_detIndex
Definition: CAConstants.h:63
GPUCACell::z1
__device__ float z1
Definition: GPUCACell.h:173
GPUCACell::zo
__device__ float float float float float zo
Definition: GPUCACell.h:173
particleFlowDisplacedVertexCandidate_cfi.dcaCut
dcaCut
Definition: particleFlowDisplacedVertexCandidate_cfi.py:17
PixelPluginsPhase0_cfi.isBarrel
isBarrel
Definition: PixelPluginsPhase0_cfi.py:17
GPUCACell::theInnerZ
theInnerZ
Definition: GPUCACell.h:56
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:159
GPUCACell::theTracks
theTracks
Definition: GPUCACell.h:61
GPUCACell::ro
__device__ float float float float ro
Definition: GPUCACell.h:173
GPUCACell::ri
__device__ float float ri
Definition: GPUCACell.h:173
cms::cudacompat::atomicCAS
T1 atomicCAS(T1 *address, T1 compare, T2 val)
Definition: cudaCompat.h:36
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
GPUCACell::PtrAsInt
unsigned long long PtrAsInt
Definition: GPUCACell.h:22
GPUCACell::theInnerR
theInnerR
Definition: GPUCACell.h:57
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
GPUCACell::theOuterNeighbors
theOuterNeighbors
Definition: GPUCACell.h:60
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
cms::cuda::SimpleVector::extend
__device__ int extend(int size=1)
Definition: SimpleVector.h:84
GPUCACell::ptmin
__device__ float float float float float const float ptmin
Definition: GPUCACell.h:173
GPUCACell::innerHitId
__device__ CellTracksVector Hits const int int hindex_type innerHitId
Definition: GPUCACell.h:43
GPUCACell::theOuterHitId
theOuterHitId
Definition: GPUCACell.h:50