@@ -216,16 +216,16 @@ void TimeFrame<nLayers>::prepareClusters(const TrackingParameters& trkParam, con
216216{
217217 bounded_vector<ClusterHelper> cHelper (mMemoryPool .get ());
218218 bounded_vector<int > clsPerBin (trkParam.PhiBins * trkParam.ZBins , 0 , mMemoryPool .get ());
219+ const int stride = trkParam.ZBins * trkParam.PhiBins + 1 ;
219220 for (int rof{0 }; rof < mNrof ; ++rof) {
220221 if ((int )mMultiplicityCutMask .size () == mNrof && !mMultiplicityCutMask [rof]) {
221222 continue ;
222223 }
223224 for (int iLayer{0 }; iLayer < std::min (trkParam.NLayers , maxLayers); ++iLayer) {
224- std::fill (clsPerBin.begin (), clsPerBin.end (), 0 );
225225 const auto unsortedClusters{getUnsortedClustersOnLayer (rof, iLayer)};
226226 const int clustersNum{static_cast <int >(unsortedClusters.size ())};
227+ auto * tableBase = mIndexTables [iLayer].data () + rof * stride;
227228
228- deepVectorClear (cHelper);
229229 cHelper.resize (clustersNum);
230230
231231 for (int iCluster{0 }; iCluster < clustersNum; ++iCluster) {
@@ -268,12 +268,11 @@ void TimeFrame<nLayers>::prepareClusters(const TrackingParameters& trkParam, con
268268 c.radius = h.r ;
269269 c.indexTableBinIndex = h.bin ;
270270 }
271- for (int iB{0 }; iB < (int )clsPerBin.size (); ++iB) {
272- mIndexTables [iLayer][rof * (trkParam.ZBins * trkParam.PhiBins + 1 ) + iB] = lutPerBin[iB];
273- }
274- for (auto iB{clsPerBin.size ()}; iB < (trkParam.ZBins * trkParam.PhiBins + 1 ); iB++) {
275- mIndexTables [iLayer][rof * (trkParam.ZBins * trkParam.PhiBins + 1 ) + iB] = clustersNum;
276- }
271+ std::copy_n (lutPerBin.data (), clsPerBin.size (), tableBase);
272+ std::fill_n (tableBase + clsPerBin.size (), stride - clsPerBin.size (), clustersNum);
273+
274+ std::fill (clsPerBin.begin (), clsPerBin.end (), 0 );
275+ deepVectorClear (cHelper);
277276 }
278277 }
279278}
0 commit comments