diff --git a/algo/ca/core/tracking/CaTrackFinder.cxx b/algo/ca/core/tracking/CaTrackFinder.cxx index 10b13bf4a8327870fceb583fdcd0aa038381b336..1575fccc67490844e2de373ccdc5656a6e44801d 100644 --- a/algo/ca/core/tracking/CaTrackFinder.cxx +++ b/algo/ca/core/tracking/CaTrackFinder.cxx @@ -133,8 +133,8 @@ void TrackFinder::FindTracks() } info.fMaxTimeBeforeHit = maxTimeBeforeHit; - if (fStatTsStart > info.fEventTimeMax - 5) { - fStatTsStart = info.fEventTimeMax - 5; // 5 ns margin (FIXME: define in constants!!!) + if (fStatTsStart > info.fEventTimeMax - fWindowMargin) { + fStatTsStart = info.fEventTimeMax - fWindowMargin; // 5 ns margin } if (fStatTsEnd < info.fEventTimeMin) { fStatTsEnd = info.fEventTimeMin; @@ -192,17 +192,23 @@ void TrackFinder::FindTracks() LOG(info) << "CA tracker process time slice " << fStatTsStart / 1.e6 << " ms ... " << fStatTsEnd / 1.e6 << " ms with " << fStatNhitsTotal << " hits"; + int nWindows = static_cast<int>((fStatTsEnd - fStatTsStart - fWindowOverlap - fWindowMargin) + / (fWindowLength - fWindowOverlap - fWindowMargin)) + + 1; + LOG(info) << "CA: estimated number of time windows: " << nWindows; + + int nWindowsThread = nWindows / frAlgo.GetNofThreads(); + float windowDelta = fWindowLength - fWindowOverlap - fWindowMargin; // cut data into sub-timeslices and process them one by one float threadDuration = (fStatTsEnd - fStatTsStart) / frAlgo.GetNofThreads(); for (int iThread = 0; iThread < frAlgo.GetNofThreads(); ++iThread) { - fvWindowStartThread[iThread] = fStatTsStart + iThread * threadDuration; - fvWindowEndThread[iThread] = fvWindowStartThread[iThread] + threadDuration; - if (iThread > 0) { - fvWindowStartThread[iThread] += 200; - } + fvWindowStartThread[iThread] = fStatTsStart + iThread * nWindowsThread * windowDelta; + fvWindowEndThread[iThread] = + fvWindowStartThread[iThread] + nWindowsThread * windowDelta + fWindowOverlap + fWindowMargin; LOG(info) << "Thread: " << iThread << " from " << fvWindowStartThread[iThread] / 1.e6 << " ms to " << fvWindowEndThread[iThread] / 1.e6 << " ms"; } + fvWindowEndThread[frAlgo.GetNofThreads() - 1] = fStatTsEnd; frAlgo.fMonitorData.StopTimer(ETimer::PrepareDataStreams); // Save tracks @@ -267,6 +273,13 @@ void TrackFinder::FindTracks() LOG(info) << "CA tracker: time slice finished. Reconstructed " << frAlgo.fRecoTracks.size() << " tracks with " << frAlgo.fRecoHits.size() << " hits. Processed " << statNhitsProcessedTotal << " hits in " << statNwindowsTotal << " time windows. Reco time " << frAlgo.fCaRecoTime / 1.e9 << " s"; + + int nWindowsReal = 0; + for (int iThread = 0; iThread < frAlgo.GetNofThreads(); ++iThread) { + LOG(info) << "Ca: thread " << iThread << ", " << fvStatNwindows[iThread] + << " windows processed, start window: " << nWindowsReal + << ", end window: " << ((nWindowsReal += fvStatNwindows[iThread]) - 1); + } } // --------------------------------------------------------------------------------------------------------------------- @@ -481,7 +494,7 @@ void TrackFinder::FindTracksThread(int iThread) break; } else { - fvWindowStartThread[iThread] -= 5; // do 5 ns margin + fvWindowStartThread[iThread] -= fWindowMargin; // do 5 ns margin } } frAlgo.fvMonitorDataThread[iThread].StopTimer(ETimer::FindTracksThread); diff --git a/algo/ca/core/tracking/CaTrackFinder.h b/algo/ca/core/tracking/CaTrackFinder.h index f6f7c5a99752e23d651023af34d8ce817c6748c2..ffe5a856a2c5d459243ddbebd0a55f4741ca8d40 100644 --- a/algo/ca/core/tracking/CaTrackFinder.h +++ b/algo/ca/core/tracking/CaTrackFinder.h @@ -76,8 +76,9 @@ namespace cbm::algo::ca std::vector<Vector<Track>> fvRecoTracks; ///< reconstructed tracks std::vector<Vector<HitIndex_t>> fvRecoHitIndices; ///< packed hits of reconstructed tracks - float fWindowLength = 0.; - float fWindowOverlap = 15.; // ns + float fWindowLength = 0.; ///< Time window length [ns] + float fWindowOverlap = 15.; ///< Time window overlap [ns] + float fWindowMargin = 5.; ///< Time window margin [ns] (TODO: Why cannot we include margin into the overlap?) float fStatTsStart = 0.; float fStatTsEnd = 0.;