1 #ifndef RecoPixelVertexing_PixelTriplets_plugins_gpuPixelDoubletsAlgos_h
2 #define RecoPixelVertexing_PixelTriplets_plugins_gpuPixelDoubletsAlgos_h
18 namespace gpuPixelDoublets {
33 int16_t
const* __restrict__
phicuts,
34 float const* __restrict__
minz,
35 float const* __restrict__
maxz,
36 float const* __restrict__
maxr,
44 constexpr
int minYsizeB1 = 36;
55 auto const& __restrict__
phiBinner = hh.phiBinner();
56 uint32_t
const* __restrict__
offsets = hh.hitsLayerStart();
59 auto layerSize = [=](uint8_t li) {
return offsets[li + 1] - offsets[li]; };
65 assert(nPairs <= nPairsMax);
69 innerLayerCumulativeSize[0] =
layerSize(layerPairs[0]);
71 innerLayerCumulativeSize[
i] = innerLayerCumulativeSize[
i - 1] +
layerSize(layerPairs[2 *
i]);
73 ntot = innerLayerCumulativeSize[nPairs - 1];
84 while (
j >= innerLayerCumulativeSize[pairLayerId++])
88 assert(pairLayerId < nPairs);
89 assert(
j < innerLayerCumulativeSize[pairLayerId]);
90 assert(0 == pairLayerId ||
j >= innerLayerCumulativeSize[pairLayerId - 1]);
93 uint8_t
outer = layerPairs[2 * pairLayerId + 1];
98 auto i = (0 ==
pairLayerId) ?
j :
j - innerLayerCumulativeSize[pairLayerId - 1];
104 assert(
i < offsets[inner + 1]);
107 auto mi = hh.detectorIndex(
i);
117 auto mez = hh.zGlobal(
i);
119 if (mez < minz[pairLayerId] || mez > maxz[pairLayerId])
127 isOuterLadder = ideal_cond ?
true : 0 == (mi / 8) % 2;
130 mes = inner > 0 || isOuterLadder ? hh.clusterSizeY(
i) : -1;
132 if (inner == 0 && outer > 3)
133 if (mes > 0 && mes < minYsizeB1)
135 if (inner == 1 && outer > 3)
136 if (mes > 0 && mes < minYsizeB2)
139 auto mep = hh.iphi(
i);
140 auto mer = hh.rGlobal(
i);
143 constexpr
float z0cut = 12.f;
144 constexpr
float hardPtCut = 0.5f;
146 constexpr
float minRadius = hardPtCut * 87.78f;
147 constexpr
float minRadius2T4 = 4.f * minRadius * minRadius;
148 auto ptcut = [&](
int j, int16_t idphi) {
149 auto r2t4 = minRadius2T4;
151 auto ro = hh.rGlobal(j);
153 return dphi * dphi * (r2t4 - ri * ro) > (ro - ri) * (ro - ri);
155 auto z0cutoff = [&](
int j) {
156 auto zo = hh.zGlobal(j);
157 auto ro = hh.rGlobal(j);
162 auto zsizeCut = [&](
int j) {
163 auto onlyBarrel = outer < 4;
164 auto so = hh.clusterSizeY(j);
169 auto zo = hh.zGlobal(j);
170 auto ro = hh.rGlobal(j);
171 return onlyBarrel ? mes > 0 && so > 0 &&
std::abs(so - mes) >
dy
172 : (inner < 4) && mes > 0 &&
190 for (
auto kk = kl;
kk != khh; incr(
kk)) {
192 if (
kk != kl &&
kk != kh)
193 nmin += phiBinner.size(
kk + hoff);
195 auto const* __restrict__
p = phiBinner.begin(
kk + hoff);
196 auto const* __restrict__
e = phiBinner.end(
kk + hoff);
200 assert(oi >= offsets[outer]);
201 assert(oi < offsets[outer + 1]);
202 auto mo = hh.detectorIndex(oi);
206 if (doZ0Cut && z0cutoff(oi))
209 auto mop = hh.iphi(oi);
214 if (doClusterCut && zsizeCut(oi))
216 if (doPtCut &&
ptcut(oi, idphi))
220 if (ind >= maxNumOfDoublets) {
225 cells[ind].init(*cellNeighbors, *cellTracks, hh, pairLayerId,
i, oi);
226 isOuterHitOfCell[oi].push_back(ind);
228 if (isOuterHitOfCell[oi].
full())
236 printf(
"OuterHitOfCell full for %d in layer %d/%d, %d,%d %d\n",
i, inner, outer, nmin, tot, tooMany);
243 #endif // RecoPixelVertexing_PixelTriplets_plugins_gpuPixelDoubletsAlgos_h
uint32_t CellNeighborsVector CellTracksVector * cellTracks
cms::cuda::VecArray< tindex_type, maxCellTracks > CellTracks
uint32_t CellNeighborsVector CellTracksVector TrackingRecHit2DSOAView const *__restrict__ GPUCACell::OuterHitOfCell int bool bool bool doZ0Cut
static constexpr auto histOff(uint32_t nh)
__constant__ const uint8_t layerPairs[2 *nPairs]
cms::cuda::SimpleVector< CellNeighbors > CellNeighborsVector
__device__ uint32_t GPUCACell * cells
caConstants::CellNeighborsVector CellNeighborsVector
T1 atomicSub(T1 *a, T2 b)
constexpr uint32_t maxNumberOfLayerPairs
uint32_t const *__restrict__ offsets
caConstants::CellNeighbors CellNeighbors
caConstants::CellTracks CellTracks
caConstants::CellTracksVector CellTracksVector
__constant__ float const minz[nPairs]
__constant__ const int16_t phicuts[nPairs]
uint32_t CellNeighborsVector CellTracksVector TrackingRecHit2DSOAView const *__restrict__ GPUCACell::OuterHitOfCell int bool bool doClusterCut
cms::cuda::SimpleVector< CellTracks > CellTracksVector
auto const &__restrict__ phiBinner
cms::cuda::HistoContainer< int16_t, 128,-1, 8 *sizeof(int16_t), hindex_type, 10 > PhiBinner
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
__shared__ uint32_t innerLayerCumulativeSize[nPairsMax]
Abs< T >::type abs(const T &t)
constexpr uint16_t maxNumModules
constexpr int maxDYsize12
Quality *__restrict__ uint16_t nmin
uint32_t CellNeighborsVector CellTracksVector TrackingRecHit2DSOAView const *__restrict__ GPUCACell::OuterHitOfCell int bool ideal_cond
__constant__ float const maxz[nPairs]
static constexpr uint32_t nbins()
static constexpr UT bin(T t)
constexpr float short2phi(short x)
uint32_t CellNeighborsVector CellTracksVector TrackingRecHit2DSOAView const *__restrict__ GPUCACell::OuterHitOfCell isOuterHitOfCell
__constant__ float const maxr[nPairs]
uint32_t CellNeighborsVector * cellNeighbors
uint32_t CellNeighborsVector CellTracksVector TrackingRecHit2DSOAView const *__restrict__ GPUCACell::OuterHitOfCell int bool bool bool bool doPtCut
__device__ uint32_t GPUCACell uint32_t CellNeighborsVector CellTracksVector TrackingRecHit2DSOAView const &__restrict__ hh
T1 atomicAdd(T1 *a, T2 b)
doubletsFromHisto(layerPairs, nActualPairs, cells, nCells, cellNeighbors, cellTracks, hh, isOuterHitOfCell, phicuts, minz, maxz, maxr, ideal_cond, doClusterCut, doZ0Cut, doPtCut, maxNumOfDoublets)
cms::cuda::VecArray< uint32_t, maxCellNeighbors > CellNeighbors
uint32_t CellNeighborsVector CellTracksVector TrackingRecHit2DSOAView const *__restrict__ GPUCACell::OuterHitOfCell int bool bool bool bool uint32_t maxNumOfDoublets