@@ -570,8 +570,9 @@ void TrackerTraits<NLayers>::findCellSeeds(const int iteration)
570570 int rof = mTimeFrame ->getClusterROF (i, cls[i]);
571571 int rofStartBC = mTimeFrame ->getROFOverlapTableView ().getLayer (i).getROFStartInBC (rof);
572572 int rofEndBC = mTimeFrame ->getROFOverlapTableView ().getLayer (i).getROFEndInBC (rof);
573- startBC = o2::gpu::CAMath::Min (startBC, rofStartBC);
574- endBC = o2::gpu::CAMath::Max (endBC, rofEndBC);
573+ // if the start/end of the cluster is after/before the current bracket need to enlarge
574+ startBC = (rofStartBC <= startBC) ? rofStartBC : o2::gpu::CAMath::Max (startBC, rofStartBC);
575+ endBC = (rofEndBC >= endBC) ? rofEndBC : o2::gpu::CAMath::Min (endBC, rofEndBC);
575576 }
576577 if (endBC - startBC < 0 ) { // this should not happen
577578 ltracks[iCell].markDead ();
@@ -1143,15 +1144,17 @@ void TrackerTraits<NLayers>::findRoads(const int iteration)
11431144 }
11441145
11451146 deepVectorClear (trackSeeds);
1147+ // sort tracks in quality (accounting for 1. length; 2. chi2)
1148+ // needed since then tracks with shared clusters can be marked/discarded
11461149 tbb::parallel_sort (tracks.begin (), tracks.end (), [](const auto & a, const auto & b) {
1147- return a.getChi2 () < b. getChi2 ( );
1150+ return a.isBetter (b );
11481151 });
11491152 });
11501153
11511154 for (auto & track : tracks) {
11521155 int nShared = 0 ;
11531156 bool isFirstShared{false };
1154- int firstLayer{- 1 }, firstCluster{- 1 };
1157+ int firstLayer{constants::UnusedIndex }, firstCluster{constants::UnusedIndex };
11551158 for (int iLayer{0 }; iLayer < mRecoParams [iteration].params .NLayers ; ++iLayer) {
11561159 if (track.getClusterIndex (iLayer) == constants::UnusedIndex) {
11571160 continue ;
@@ -1172,17 +1175,20 @@ void TrackerTraits<NLayers>::findRoads(const int iteration)
11721175
11731176 // here we can do the calculation of the time bracket simply
11741177 // by checkig in which rofs the clusters are
1178+ // also mark used clusters for the next iteration
11751179 int bcStart{0 }, bcEnd{std::numeric_limits<int >::max ()};
11761180 for (int iLayer{0 }; iLayer < mRecoParams [iteration].params .NLayers ; ++iLayer) {
11771181 if (track.getClusterIndex (iLayer) == constants::UnusedIndex) {
11781182 continue ;
11791183 }
11801184 mTimeFrame ->markUsedCluster (iLayer, track.getClusterIndex (iLayer));
11811185 int currentROF = mTimeFrame ->getClusterROF (iLayer, track.getClusterIndex (iLayer));
1182- int bcClsSta = mTimeFrame ->getROFOverlapTableView ().getLayer (iLayer).getROFStartInBC (currentROF);
1183- int bcClsEnd = mTimeFrame ->getROFOverlapTableView ().getLayer (iLayer).getROFEndInBC (currentROF);
1184- bcStart = std::max (bcStart, bcClsSta);
1185- bcEnd = std::min (bcEnd, bcClsEnd);
1186+ // need to account for the imposed delay
1187+ int bcClsSta = mTimeFrame ->getROFOverlapTableView ().getLayer (iLayer).getROFStartInBC (currentROF, true );
1188+ int bcClsEnd = mTimeFrame ->getROFOverlapTableView ().getLayer (iLayer).getROFEndInBC (currentROF, true );
1189+ // if the start/end of the cluster is after/before the current bracket need to enlarge
1190+ bcStart = (bcClsEnd <= bcStart) ? bcClsSta : o2::gpu::CAMath::Max (bcStart, bcClsSta);
1191+ bcEnd = (bcClsSta >= bcEnd) ? bcClsEnd : o2::gpu::CAMath::Min (bcEnd, bcClsEnd);
11861192 }
11871193 track.getTimeStamp ().setTimeStamp (bcStart);
11881194 track.getTimeStamp ().setTimeStampError (bcEnd - bcStart + 1 );
0 commit comments