12 #include <cuda_runtime.h> 38 constexpr
float nSigma2 = 25.f;
47 uint32_t
const *__restrict__
nCells,
68 printf(
"number of found cells %d, found tuples %d with total hits %d out of %d %d\n",
91 printf(
"Tuples overflow\n");
93 printf(
"Cells overflow\n");
95 printf(
"cellNeighbors overflow\n");
97 printf(
"cellTracks overflow\n");
104 if (thisCell.hasFishbone() && !thisCell.isKilled())
106 if (thisCell.outerNeighbors().full())
107 printf(
"OuterNeighbors overflow %d in %d\n",
idx, thisCell.layerPairId());
108 if (thisCell.tracks().full())
109 printf(
"Tracks overflow %d in %d\n",
idx, thisCell.layerPairId());
110 if (thisCell.isKilled())
112 if (!thisCell.unused())
114 if ((0 ==
hitToTuple->size(thisCell.inner_hit_id())) && (0 ==
hitToTuple->size(thisCell.outer_hit_id())))
120 printf(
"OuterHitOfCell overflow %d\n",
idx);
130 if (!thisCell.isKilled())
133 for (
auto it : thisCell.tracks())
155 if (thisCell.tracks().size() < 2)
161 for (
auto it : thisCell.tracks()) {
162 auto nl =
tracks.nLayers(it);
170 for (
auto it : thisCell.tracks()) {
171 if (
tracks.nLayers(it) < maxNl)
179 uint32_t
const *__restrict__
nCells,
191 if (thisCell.tracks().size() < 2)
195 uint16_t im = tkNotFound;
208 int ntr = thisCell.tracks().size();
209 for (
int i = 0;
i < ntr - 1; ++
i) {
210 auto it = thisCell.tracks()[
i];
211 auto qi =
tracks->quality(it);
214 auto opi =
tracks->stateAtBS.state(it)(2);
215 auto e2opi =
tracks->stateAtBS.covariance(it)(9);
216 auto cti =
tracks->stateAtBS.state(it)(3);
217 auto e2cti =
tracks->stateAtBS.covariance(it)(12);
218 for (
auto j =
i + 1;
j < ntr; ++
j) {
219 auto jt = thisCell.tracks()[
j];
220 auto qj =
tracks->quality(jt);
223 auto opj =
tracks->stateAtBS.state(jt)(2);
224 auto ctj =
tracks->stateAtBS.state(jt)(3);
225 auto dct = nSigma2 * (
tracks->stateAtBS.covariance(jt)(12) + e2cti);
226 if ((cti - ctj) * (cti - ctj) > dct)
228 auto dop = nSigma2 * (
tracks->stateAtBS.covariance(jt)(9) + e2opi);
229 if ((opi - opj) * (opi - opj) > dop)
231 if ((qj < qi) || (qj == qi &&
score(it) <
score(jt)))
242 for (
auto it : thisCell.tracks()) {
243 if (
tracks->quality(it) > maxQual)
244 maxQual =
tracks->quality(it);
247 if (maxQual <=
loose)
251 for (
auto it : thisCell.tracks()) {
258 if (tkNotFound == im)
262 for (
auto it : thisCell.tracks()) {
273 uint32_t
const *__restrict__
nCells,
282 auto const &
hh = *
hhp;
288 if (0 == (firstCellIndex +
first)) {
294 auto cellIndex =
idx;
296 auto innerHitId = thisCell.inner_hit_id();
302 auto ri = thisCell.inner_r(
hh);
303 auto zi = thisCell.inner_z(
hh);
305 auto ro = thisCell.outer_r(
hh);
306 auto zo = thisCell.outer_z(
hh);
310 auto otherCell =
__ldg(vi +
j);
311 auto &oc =
cells[otherCell];
312 auto r1 = oc.inner_r(
hh);
313 auto z1 = oc.inner_z(
hh);
314 bool aligned = GPUCACell::areAlignedRZ(
323 if (aligned && thisCell.dcaCut(
hh,
345 auto const &
hh = *
hhp;
350 if (thisCell.isKilled())
353 if (thisCell.outerNeighbors().empty())
355 auto pid = thisCell.layerPairId();
360 thisCell.find_ntuplets<6>(
372 if (!thisCell.tracks().empty())
389 printf(
"wrong mult %d %d\n", it,
nhits);
407 printf(
"wrong mult %d %d\n", it,
nhits);
435 for (
int i = 0;
i < 5; ++
i) {
440 printf(
"NaN in fit %d size %d chi2 %f\n", it,
tuples->size(it),
tracks->chi2(it));
449 auto roughLog = [](
float x) {
458 uint32_t
lsb = 1 < 21;
462 int ex =
int(
z.i >> 2) - 127;
466 const float frac[4] = {0.160497f, 0.452172f, 0.694562f, 0.901964f};
471 float pt = std::min<float>(
tracks->pt(it),
cuts.chi2MaxPt);
474 #ifdef NTUPLE_FIT_DEBUG 475 printf(
"Bad chi2 %d size %d pt %f eta %f chi2 %f\n",
585 __global__ void kernel_countSharedHit(
int *__restrict__ nshared,
621 __global__ void kernel_markSharedHit(
int const *__restrict__ nshared,
639 if (nshared[
idx] > 2)
675 auto opi =
tracks.stateAtBS.state(it)(2);
676 auto e2opi =
tracks.stateAtBS.covariance(it)(9);
677 auto cti =
tracks.stateAtBS.state(it)(3);
678 auto e2cti =
tracks.stateAtBS.covariance(it)(12);
679 auto nli =
tracks.nLayers(it);
685 auto opj =
tracks.stateAtBS.state(jt)(2);
686 auto ctj =
tracks.stateAtBS.state(jt)(3);
687 auto dct = nSigma2 * (
tracks.stateAtBS.covariance(jt)(12) + e2cti);
688 if ((cti - ctj) * (cti - ctj) > dct)
690 auto dop = nSigma2 * (
tracks.stateAtBS.covariance(jt)(9) + e2opi);
691 if ((opi - opj) * (opi - opj) > dop)
693 auto nlj =
tracks.nLayers(jt);
694 if (nlj < nli || (nlj == nli && (qj < qi || (qj == qi &&
score(it, nli) <
score(jt, nlj)))))
719 auto const &
hh = *
hhp;
734 auto nl =
tracks.nLayers(*it);
746 auto nl =
tracks.nLayers(*it);
749 if (idx < l1end and nl >
nmin)
777 uint16_t im = tkNotFound;
778 bool onlyTriplets =
true;
784 onlyTriplets &=
tracks.isTriplet(*it);
802 if (tkNotFound == im)
835 uint16_t im = tkNotFound;
846 if (tkNotFound == im)
868 auto const &
hh = *
hhp;
878 printf(
"TK: %d %d %d %d %f %f %f %f %f %f %f %.3f %.3f %.3f %.3f %.3f %.3f %.3f\n",
904 "||Counters | nEvents | nHits | nCells | nTuples | nFitTacks | nLooseTracks | nGoodTracks | nUsedHits | " 908 "nUsedCells | nZeroTrackCells ||\n");
909 printf(
"Counters Raw %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld\n",
923 printf(
"Counters Norm %lld || %.1f| %.1f| %.1f| %.1f| %.1f| %.1f| %.1f| %.1f| %.3f| %.3f| %.3f| %.3f||\n",
925 c.nHits /
double(
c.nEvents),
926 c.nCells /
double(
c.nEvents),
927 c.nTuples /
double(
c.nEvents),
928 c.nFitTracks /
double(
c.nEvents),
929 c.nLooseTracks /
double(
c.nEvents),
930 c.nGoodTracks /
double(
c.nEvents),
931 c.nUsedHits /
double(
c.nEvents),
932 c.nDupHits /
double(
c.nEvents),
933 c.nFishCells /
double(
c.nCells),
934 c.nKilledCells /
double(
c.nCells),
935 c.nEmptyCells /
double(
c.nCells),
936 c.nZeroTrackCells /
double(
c.nCells));
TrackingRecHit2DSOAView const *__restrict__ hhp
constexpr int32_t maxHitsOnTrack
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const * cellNeighbors
constexpr uint32_t maxNumberOfQuadruplets
TrackingRecHit2DHeterogeneous< cms::cudacompat::GPUTraits > TrackingRecHit2DGPU
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const * hitToTuple
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t uint32_t CAHitNtupletGeneratorKernelsGPU::Counters * counters
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ nCells
HitContainer const *__restrict__ Quality const *__restrict__ CAHitNtupletGeneratorKernelsGPU::HitToTuple const *__restrict__ phitToTuple
TkSoA const *__restrict__ CAHitNtupletGeneratorKernelsGPU::QualityCuts cuts
TrackingRecHit2DSOAView const *__restrict__ HitContainer *__restrict__ hitDetIndices
HitContainer const *__restrict__ tuples
Abs< T >::type abs(const T &t)
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const isOuterHitOfCell
TrackSoA::HitContainer HitContainer
HitContainer const *__restrict__ ptuples
uint32_t const *__restrict__ TkSoA const *__restrict__ ptracks
Quality *__restrict__ uint16_t nmin
TrackSoAHeterogeneousT< maxNumber()> TrackSoA
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t uint32_t maxNumberOfDoublets
caConstants::TupleMultiplicity const * tupleMultiplicity
constexpr auto nOnes() const
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ cells
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter * apc
auto const & tracks
cannot be loose
auto const good
min quality of good
HitContainer const *__restrict__ TkSoA const *__restrict__ Quality const *__restrict__ CAHitNtupletGeneratorKernelsGPU::HitToTuple const *__restrict__ int32_t firstPrint
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const * cellTracks
HitContainer const *__restrict__ TkSoA const *__restrict__ Quality const *__restrict__ CAHitNtupletGeneratorKernelsGPU::HitToTuple const *__restrict__ int32_t int32_t int iev
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits
uint32_t const *__restrict__ TkSoA const *__restrict__ Quality bool dupPassThrough
constexpr auto totOnes() const
cms::cuda::OneToManyAssoc< tindex_type, -1, 4 *maxTuples > HitToTuple
HitContainer const *__restrict__ TkSoA const *__restrict__ Quality const *__restrict__ CAHitNtupletGeneratorKernelsGPU::HitToTuple const *__restrict__ int32_t int32_t lastPrint
uint32_t const *__restrict__ Quality * quality
__host__ __device__ index_type const uint32_t n
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
constexpr uint32_t last_bpix1_detIndex
constexpr uint32_t last_barrel_detIndex
cms::cuda::OneToManyAssoc< tindex_type, maxHitsOnTrack+1, maxTuples > TupleMultiplicity
auto const & foundNtuplets
T1 atomicAdd(T1 *a, T2 b)