@@ -117,7 +117,7 @@ void TimeFrame<NLayers>::resetROFrameData(size_t nRofs, int layer)
117117 deepVectorClear (mUnsortedClusters [iLayer], getMaybeExternalHostResource ());
118118 deepVectorClear (mTrackingFrameInfo [iLayer], getMaybeExternalHostResource ());
119119 deepVectorClear (mClusterExternalIndices [iLayer], mMemoryPool .get ());
120- clearResizeBoundedVector (mROFramesClusters [iLayer], nRofs, getMaybeExternalHostResource ());
120+ clearResizeBoundedVector (mROFramesClusters [iLayer], nRofs + 1 , getMaybeExternalHostResource ());
121121 }
122122}
123123
@@ -214,6 +214,7 @@ void TimeFrame<NLayers>::initialise(const RecoIteration& reco)
214214{
215215 const auto & trkParam = reco.params ;
216216 if (reco.steps [kInitMemory ]) {
217+ mBogusClusters .fill (0 ); // reset bogus counter for this TF
217218 clearResizeBoundedVector (mCells , trkParam.CellsPerRoad (), mMemoryPool .get ());
218219 clearResizeBoundedVector (mCellsLookupTable , trkParam.CellsPerRoad () - 1 , mMemoryPool .get ());
219220 clearResizeBoundedVector (mCellsNeighbours , trkParam.CellsPerRoad () - 1 , mMemoryPool .get ());
@@ -223,17 +224,14 @@ void TimeFrame<NLayers>::initialise(const RecoIteration& reco)
223224 clearResizeBoundedVector (mTrackletLabels , trkParam.TrackletsPerRoad (), mMemoryPool .get ());
224225 clearResizeBoundedVector (mTrackletsLookupTable , trkParam.TrackletsPerRoad (), mMemoryPool .get ());
225226 mIndexTableUtils .setTrackingParameters (trkParam);
226- clearResizeBoundedVector (mPositionResolution , trkParam.NLayers , mMemoryPool .get ());
227- clearResizeBoundedVector (mBogusClusters , trkParam.NLayers , mMemoryPool .get ());
228- for (unsigned int iLayer{0 }; iLayer < (int )mClusters .size (); ++iLayer) {
227+ for (int iLayer{0 }; iLayer < trkParam.NLayers ; ++iLayer) {
229228 clearResizeBoundedVector (mClusters [iLayer], mUnsortedClusters [iLayer].size (), getMaybeExternalHostResource ());
230229 clearResizeBoundedVector (mUsedClusters [iLayer], mUnsortedClusters [iLayer].size (), getMaybeExternalHostResource ());
231- mPositionResolution [iLayer] = o2::gpu::CAMath::Sqrt (0 .5f * (trkParam.SystErrorZ2 [iLayer] + trkParam.SystErrorY2 [iLayer]) + trkParam.LayerResolution [iLayer] * trkParam.LayerResolution [iLayer]);
232230 if (iLayer < (int )mCells .size ()) {
233231 mTrackletsLookupTable [iLayer].resize (mClusters [iLayer + 1 ].size () + 1 , 0 );
234232 }
235233 }
236- for (unsigned int iLayer{0 }; iLayer < ( int ) mClusters . size () ; ++iLayer) {
234+ for (int iLayer{0 }; iLayer < NLayers ; ++iLayer) {
237235 clearResizeBoundedVector (mIndexTables [iLayer], getNrof (iLayer) * ((trkParam.ZBins * trkParam.PhiBins ) + 1 ), getMaybeExternalHostResource ());
238236 }
239237 for (int iLayer{0 }; iLayer < trkParam.NLayers ; ++iLayer) {
@@ -251,13 +249,16 @@ void TimeFrame<NLayers>::initialise(const RecoIteration& reco)
251249 if (reco.steps [kUpdateClusters ]) {
252250 prepareClusters (trkParam, reco.params .NLayers );
253251 }
254- mMSangles .resize (trkParam.NLayers );
255- mPhiCuts .resize (mClusters .size () - 1 , 0 .f );
252+
253+ // these change dynamically with the given tracking parameters
254+ mMSangles .fill (0 .f );
255+ mPhiCuts .fill (0 .f );
256+ mPositionResolution .fill (0 .f );
256257 float oneOverR{0 .001f * 0 .3f * std::abs (mBz ) / trkParam.TrackletMinPt };
257- for (unsigned int iLayer{0 }; iLayer < NLayers; ++iLayer) {
258+ for (int iLayer{0 }; iLayer < trkParam. NLayers ; ++iLayer) {
258259 mMSangles [iLayer] = math_utils::MSangle (0 .14f , trkParam.TrackletMinPt , trkParam.LayerxX0 [iLayer]);
259260 mPositionResolution [iLayer] = o2::gpu::CAMath::Sqrt (0 .5f * (trkParam.SystErrorZ2 [iLayer] + trkParam.SystErrorY2 [iLayer]) + trkParam.LayerResolution [iLayer] * trkParam.LayerResolution [iLayer]);
260- if (iLayer < mClusters . size () - 1 ) {
261+ if (iLayer < trkParam. NLayers - 1 ) {
261262 const float r1 = trkParam.LayerRadii [iLayer];
262263 const float r2 = trkParam.LayerRadii [iLayer + 1 ];
263264 const float res1 = mPositionResolution [iLayer];
@@ -270,7 +271,8 @@ void TimeFrame<NLayers>::initialise(const RecoIteration& reco)
270271 }
271272 }
272273
273- if (reco.steps [kInitOnce ]) {
274+ if (static bool initOnce{false }; !initOnce) {
275+ initOnce = true ;
274276 // initialise the rolling vertex once with large weights
275277 mRollingVertex .setX (0 .f );
276278 mRollingVertex .setY (0 .f );
@@ -346,12 +348,8 @@ void TimeFrame<NLayers>::setMemoryPool(std::shared_ptr<BoundedMemoryResource> po
346348 initContainers (mClusterExternalIndices );
347349 initVector (mPrimaryVertices );
348350 initVector (mRoads );
349- initVector (mMSangles );
350- initVector (mPhiCuts );
351- initVector (mPositionResolution );
352351 initContainers (mClusterSize );
353352 initVector (mPValphaX );
354- initVector (mBogusClusters );
355353 initVector (mTracks );
356354 initContainers (mTracklets );
357355 initContainers (mCells );
@@ -383,12 +381,8 @@ void TimeFrame<NLayers>::wipe()
383381 deepVectorClear (mPrimaryVertices );
384382 deepVectorClear (mTrackletsLookupTable );
385383 deepVectorClear (mClusterExternalIndices );
386- deepVectorClear (mMSangles );
387- deepVectorClear (mPhiCuts );
388- deepVectorClear (mPositionResolution );
389384 deepVectorClear (mClusterSize );
390385 deepVectorClear (mPValphaX );
391- deepVectorClear (mBogusClusters );
392386 // if we use the external host allocator then the assumption is that we
393387 // don't clear the memory ourself
394388 if (!hasExternalHostAllocator ()) {
0 commit comments