Skip to content

Commit

Permalink
sort pixel tracks from SoA by pt
Browse files Browse the repository at this point in the history
  • Loading branch information
silviodonato committed May 30, 2022
1 parent 3d2a0f9 commit 7efac99
Showing 1 changed file with 10 additions and 3 deletions.
Expand Up @@ -160,16 +160,23 @@ void PixelTrackProducerFromSoA::produce(edm::StreamID streamID,

int32_t nt = 0;

for (int32_t it = 0; it < nTracks; ++it) {
//sort index by pt
std::vector<int32_t> sortIdxs(nTracks);
std::iota(sortIdxs.begin(), sortIdxs.end(), 0);
std::sort(
sortIdxs.begin(), sortIdxs.end(), [&](int32_t const i1, int32_t const i2) { return tsoa.pt(i1) > tsoa.pt(i2); });

//store the index of the SoA: indToEdm[index_SoAtrack] -> index_edmTrack (if it exists)
indToEdm.resize(sortIdxs.size(), -1);
for (const auto &it : sortIdxs) {
auto nHits = tsoa.nHits(it);
assert(nHits >= 3);
indToEdm.push_back(-1);
auto q = quality[it];
if (q < minQuality_)
continue;
if (nHits < minNumberOfHits_)
continue;
indToEdm.back() = nt;
indToEdm[it] = nt;
++nt;

hits.resize(nHits);
Expand Down

0 comments on commit 7efac99

Please sign in to comment.