Skip to content

Commit db9cfc5

Browse files
committed
fix perVtx
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent 5a988b9 commit db9cfc5

1 file changed

Lines changed: 30 additions & 14 deletions

File tree

Detectors/ITSMFT/ITS/tracking/src/TrackerTraits.cxx

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void TrackerTraits<nLayers>::computeLayerTracklets(const int iteration, int iROF
8888
int localCount = 0;
8989
auto& tracklets = mTimeFrame->getTracklets()[iLayer];
9090
for (int targetROF0{minROF}; targetROF0 <= maxROF; ++targetROF0) {
91-
if (!mTimeFrame->mMultiplicityCutMask[targetROF0]) {
91+
if (!mTimeFrame->mMultiplicityCutMask[targetROF0] || (iLayer == 0 && targetROF0 != pivotROF)) {
9292
continue;
9393
}
9494
auto layer0 = mTimeFrame->getClustersOnLayer(targetROF0, iLayer);
@@ -201,24 +201,40 @@ void TrackerTraits<nLayers>::computeLayerTracklets(const int iteration, int iROF
201201
}
202202
}
203203
} else {
204-
bounded_vector<bounded_vector<int>> perCount(mTrkParams[iteration].TrackletsPerRoad(), bounded_vector<int>(endROF - startROF, 0, mMemoryPool.get()), mMemoryPool.get());
205-
auto perOffset = perCount;
204+
bounded_vector<bounded_vector<int>> perROFCount(mTrkParams[iteration].TrackletsPerRoad(), bounded_vector<int>(endROF - startROF + 1, 0, mMemoryPool.get()), mMemoryPool.get());
205+
tbb::parallel_for(
206+
tbb::blocked_range2d<int, int>(0, mTrkParams[iteration].TrackletsPerRoad(), 1,
207+
startROF, endROF, 1),
208+
[&](auto const& Range) {
209+
for (int iLayer{Range.rows().begin()}; iLayer < Range.rows().end(); ++iLayer) {
210+
for (int pivotROF = Range.cols().begin(); pivotROF < Range.cols().end(); ++pivotROF) {
211+
perROFCount[iLayer][pivotROF - startROF] = forTracklets(PassMode::TwoPassCount{}, iLayer, pivotROF, 0, dummy);
212+
}
213+
}
214+
});
215+
206216
tbb::parallel_for(
207217
tbb::blocked_range<int>(0, mTrkParams[iteration].TrackletsPerRoad()),
208218
[&](auto const& Layers) {
209219
for (int iLayer{Layers.begin()}; iLayer < Layers.end(); ++iLayer) {
210-
for (int pivotROF{startROF}; pivotROF < endROF; ++pivotROF) {
211-
perCount[iLayer][pivotROF - startROF] = forTracklets(PassMode::TwoPassCount{}, iLayer, pivotROF, 0, dummy);
212-
}
213-
214-
std::exclusive_scan(perCount[iLayer].begin(), perCount[iLayer].end(), perOffset[iLayer].begin(), 0);
215-
int total = perOffset[iLayer].back() + perCount[iLayer].back();
216-
auto& tracklets = mTimeFrame->getTracklets()[iLayer];
217-
tracklets.resize(total);
220+
std::exclusive_scan(perROFCount[iLayer].begin(), perROFCount[iLayer].end(), perROFCount[iLayer].begin(), 0);
221+
mTimeFrame->getTracklets()[iLayer].resize(perROFCount[iLayer].back());
222+
}
223+
});
218224

219-
auto& offsets = perOffset[iLayer];
220-
for (int pivotROF = startROF; pivotROF < endROF; ++pivotROF) {
221-
int baseIdx = offsets[pivotROF - startROF];
225+
tbb::parallel_for(
226+
tbb::blocked_range2d<int, int>(0, mTrkParams[iteration].TrackletsPerRoad(), 1,
227+
startROF, endROF, 1),
228+
[&](auto const& Range) {
229+
for (int iLayer{Range.rows().begin()}; iLayer < Range.rows().end(); ++iLayer) {
230+
if (perROFCount[iLayer].back() == 0) {
231+
continue;
232+
}
233+
for (int pivotROF = Range.cols().begin(); pivotROF < Range.cols().end(); ++pivotROF) {
234+
int baseIdx = perROFCount[iLayer][pivotROF - startROF];
235+
if (baseIdx == perROFCount[iLayer][pivotROF - startROF + 1]) {
236+
continue;
237+
}
222238
int localIdx = 0;
223239
forTracklets(PassMode::TwoPassInsert{}, iLayer, pivotROF, baseIdx, localIdx);
224240
}

0 commit comments

Comments
 (0)