@@ -82,6 +82,9 @@ void TrackerTraits<nLayers>::computeLayerTracklets(const int iteration, int iROF
8282 }
8383 const int startVtx{iVertex >= 0 ? iVertex : 0 };
8484 const int endVtx{iVertex >= 0 ? o2::gpu::CAMath::Min (iVertex + 1 , static_cast <int >(primaryVertices.size ())) : static_cast <int >(primaryVertices.size ())};
85+ if ((endVtx - startVtx) <= 0 ) {
86+ continue ;
87+ }
8588
8689 tbb::parallel_for (
8790 tbb::blocked_range<int >(0 , mTrkParams [iteration].TrackletsPerRoad ()),
@@ -115,7 +118,7 @@ void TrackerTraits<nLayers>::computeLayerTracklets(const int iteration, int iROF
115118 const float zAtRmin{tanLambda * (mTimeFrame ->getMinR (iLayer + 1 ) - currentCluster.radius ) + currentCluster.zCoordinate };
116119 const float zAtRmax{tanLambda * (mTimeFrame ->getMaxR (iLayer + 1 ) - currentCluster.radius ) + currentCluster.zCoordinate };
117120
118- const float sqInverseDeltaZ0{1 .f / (math_utils::Sq (currentCluster.zCoordinate - primaryVertex.getZ ()) + 2 . e - 8f )}; // / protecting from overflows adding the detector resolution
121+ const float sqInverseDeltaZ0{1 .f / (math_utils::Sq (currentCluster.zCoordinate - primaryVertex.getZ ()) + constants::Tolerance )}; // / protecting from overflows adding the detector resolution
119122 const float sigmaZ{o2::gpu::CAMath::Sqrt (math_utils::Sq (resolution) * math_utils::Sq (tanLambda) * ((math_utils::Sq (inverseR0) + sqInverseDeltaZ0) * math_utils::Sq (meanDeltaR) + 1 .f ) + math_utils::Sq (meanDeltaR * mTimeFrame ->getMSangle (iLayer)))};
120123
121124 const int4 selectedBinsRect{getBinsRect (currentCluster, iLayer + 1 , zAtRmin, zAtRmax, sigmaZ * mTrkParams [iteration].NSigmaCut , mTimeFrame ->getPhiCut (iLayer))};
@@ -130,7 +133,7 @@ void TrackerTraits<nLayers>::computeLayerTracklets(const int iteration, int iROF
130133 }
131134
132135 for (int rof1{minRof}; rof1 <= maxRof; ++rof1) {
133- if (!mTimeFrame ->mMultiplicityCutMask [rof1]) {
136+ if (!mTimeFrame ->mMultiplicityCutMask [rof1] || std::abs (rof0 - rof1) > mTrkParams [iteration]. DeltaROF ) {
134137 continue ;
135138 }
136139 auto layer1 = mTimeFrame ->getClustersOnLayer (rof1, iLayer + 1 );
@@ -235,30 +238,34 @@ void TrackerTraits<nLayers>::computeLayerTracklets(const int iteration, int iROF
235238 }
236239 }
237240 });
238- });
239241
240- // / Create tracklets labels
241- if (mTimeFrame ->hasMCinformation ()) {
242- for (int iLayer{0 }; iLayer < mTrkParams [iteration].TrackletsPerRoad (); ++iLayer) {
243- for (auto & trk : mTimeFrame ->getTracklets ()[iLayer]) {
244- MCCompLabel label;
245- int currentId{mTimeFrame ->getClusters ()[iLayer][trk.firstClusterIndex ].clusterId };
246- int nextId{mTimeFrame ->getClusters ()[iLayer + 1 ][trk.secondClusterIndex ].clusterId };
247- for (auto & lab1 : mTimeFrame ->getClusterLabels (iLayer, currentId)) {
248- for (auto & lab2 : mTimeFrame ->getClusterLabels (iLayer + 1 , nextId)) {
249- if (lab1 == lab2 && lab1.isValid ()) {
250- label = lab1;
251- break ;
242+ // / Create tracklets labels
243+ if (mTimeFrame ->hasMCinformation ()) {
244+ tbb::parallel_for (
245+ tbb::blocked_range<int >(0 , mTrkParams [iteration].TrackletsPerRoad ()),
246+ [&](const tbb::blocked_range<int >& Layers) {
247+ for (int iLayer = Layers.begin (); iLayer < Layers.end (); ++iLayer) {
248+ for (auto & trk : mTimeFrame ->getTracklets ()[iLayer]) {
249+ MCCompLabel label;
250+ int currentId{mTimeFrame ->getClusters ()[iLayer][trk.firstClusterIndex ].clusterId };
251+ int nextId{mTimeFrame ->getClusters ()[iLayer + 1 ][trk.secondClusterIndex ].clusterId };
252+ for (const auto & lab1 : mTimeFrame ->getClusterLabels (iLayer, currentId)) {
253+ for (const auto & lab2 : mTimeFrame ->getClusterLabels (iLayer + 1 , nextId)) {
254+ if (lab1 == lab2 && lab1.isValid ()) {
255+ label = lab1;
256+ break ;
257+ }
258+ }
259+ if (label.isValid ()) {
260+ break ;
261+ }
262+ }
263+ mTimeFrame ->getTrackletsLabel (iLayer).emplace_back (label);
252264 }
253265 }
254- if (label.isValid ()) {
255- break ;
256- }
257- }
258- mTimeFrame ->getTrackletsLabel (iLayer).emplace_back (label);
259- }
266+ });
260267 }
261- }
268+ });
262269}
263270
264271template <int nLayers>
0 commit comments