Skip to content
Snippets Groups Projects
Commit 263022d7 authored by Sergei Zharko's avatar Sergei Zharko
Browse files

ca: terminating track finder routine, if the input data contain no hits

parent 11f7f3d2
No related branches found
No related tags found
1 merge request!1748ca: new scheme of time window distribution over CPU threads
Pipeline #28525 failed
...@@ -46,6 +46,13 @@ TrackFinder::~TrackFinder() {} ...@@ -46,6 +46,13 @@ TrackFinder::~TrackFinder() {}
// //
void TrackFinder::FindTracks() void TrackFinder::FindTracks()
{ {
frAlgo.fRecoTracks.clear();
frAlgo.fRecoHits.clear();
if (frAlgo.GetInputData().GetNhits() < 1) {
LOG(warn) << "No hits were passed to the ca::TrackFinder. Stopping the routine";
return;
}
// //
// The main CaTrackFinder routine // The main CaTrackFinder routine
// It splits the input data into sub-timeslices // It splits the input data into sub-timeslices
...@@ -182,24 +189,29 @@ void TrackFinder::FindTracks() ...@@ -182,24 +189,29 @@ void TrackFinder::FindTracks()
if (fStatTsEnd < fStatTsStart) { // all hits belong to one sub-timeslice if (fStatTsEnd < fStatTsStart) { // all hits belong to one sub-timeslice
// statTsEnd = statTsStart; fStatTsEnd = fStatTsStart;
} }
if (fStatTsEnd > fStatTsStart + 500.e6) { // 500 ms maximal length of the TS if (fStatTsEnd > fStatTsStart + 500.e6) { // 500 ms maximal length of the TS
fStatTsEnd = fStatTsStart + 500.e6; fStatTsEnd = fStatTsStart + 500.e6;
} }
LOG(info) << "CA tracker process time slice " << fStatTsStart / 1.e6 << " ms ... " << fStatTsEnd / 1.e6 << " ms with " LOG(info) << "CA tracker process time slice " << fStatTsStart * 1.e-6 << " -- " << fStatTsEnd * 1.e-6 << " [ms] with "
<< fStatNhitsTotal << " hits"; << fStatNhitsTotal << " hits";
int nWindows = static_cast<int>((fStatTsEnd - fStatTsStart - fWindowOverlap - fWindowMargin) int nWindows = static_cast<int>((fStatTsEnd - fStatTsStart - fWindowOverlap - fWindowMargin)
/ (fWindowLength - fWindowOverlap - fWindowMargin)) / (fWindowLength - fWindowOverlap - fWindowMargin))
+ 1; + 1;
if (nWindows < 1) { // Situation, when fStatTsEnd == fStatTsStart
nWindows = 1;
}
int nWindowsThread = nWindows / frAlgo.GetNofThreads(); int nWindowsThread = nWindows / frAlgo.GetNofThreads();
float windowDelta = fWindowLength - fWindowOverlap - fWindowMargin; float windowDelta = fWindowLength - fWindowOverlap - fWindowMargin;
//LOG(info) << "CA: estimated number of time windows: " << nWindows; //LOG(info) << "CA: estimated number of time windows: " << nWindows;
fvWindowStartThread[0] = fStatTsStart;
{ // Estimation of number of hits in time windows { // Estimation of number of hits in time windows
//Timer time; //Timer time;
//time.Start(); //time.Start();
...@@ -247,7 +259,6 @@ void TrackFinder::FindTracks() ...@@ -247,7 +259,6 @@ void TrackFinder::FindTracks()
HitIndex_t nHitsPerThread = nHitsCollected / frAlgo.GetNofThreads(); HitIndex_t nHitsPerThread = nHitsCollected / frAlgo.GetNofThreads();
auto windowIt = nHitsWindow.begin(); auto windowIt = nHitsWindow.begin();
size_t iWbegin = 0; size_t iWbegin = 0;
fvWindowStartThread[0] = fStatTsStart;
for (int iTh = 1; iTh < frAlgo.GetNofThreads(); ++iTh) { for (int iTh = 1; iTh < frAlgo.GetNofThreads(); ++iTh) {
windowIt = std::lower_bound(windowIt, nHitsWindow.end(), iTh * nHitsPerThread); windowIt = std::lower_bound(windowIt, nHitsWindow.end(), iTh * nHitsPerThread);
iWbegin = std::distance(nHitsWindow.begin(), windowIt) + 1; iWbegin = std::distance(nHitsWindow.begin(), windowIt) + 1;
...@@ -277,8 +288,6 @@ void TrackFinder::FindTracks() ...@@ -277,8 +288,6 @@ void TrackFinder::FindTracks()
frAlgo.fMonitorData.StopTimer(ETimer::PrepareTimeslice); frAlgo.fMonitorData.StopTimer(ETimer::PrepareTimeslice);
// Save tracks // Save tracks
frAlgo.fRecoTracks.clear();
frAlgo.fRecoHits.clear();
if (frAlgo.GetNofThreads() == 1) { if (frAlgo.GetNofThreads() == 1) {
this->FindTracksThread(0); this->FindTracksThread(0);
frAlgo.fMonitorData.StartTimer(ETimer::StoreTracksFinal); frAlgo.fMonitorData.StartTimer(ETimer::StoreTracksFinal);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment