Skip to content

Commit

Permalink
last_fragment_timestamp consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
eflumerf committed Dec 20, 2024
1 parent c2d7881 commit 7eb7d19
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions artdaq-mu2e/Generators/Mu2eSubEventReceiver_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -362,24 +362,24 @@ bool mu2e::Mu2eSubEventReceiver::getNextDTCFragment(artdaq::FragmentPtrs& frags,
// auto after_print = std::chrono::steady_clock::now();

auto fragment_timestamp = ts_out.GetEventWindowTag(true);
auto timestamp_to_use = fragment_timestamp + current_timestamp_offset_;

if (last_fragment_timestamp != size_t(-1) && last_fragment_timestamp + 1 != fragment_timestamp)
if (last_fragment_timestamp_ != size_t(-1) && last_fragment_timestamp_ + 1 != timestamp_to_use)
{
TLOG(TLVL_DEBUG) << "NOT INCREMENTAL timestamp new=" << fragment_timestamp << " vs old=" << last_fragment_timestamp;
TLOG(TLVL_DEBUG) << "NOT INCREMENTAL timestamp new=" << timestamp_to_use << " vs old=" << last_fragment_timestamp_;
}

if (first_timestamp_seen_ == size_t(-1)) //reset
{
first_timestamp_seen_ = fragment_timestamp;
}

if (fragment_timestamp < last_fragment_timestamp_)
if (timestamp_to_use < last_fragment_timestamp_)
{
current_timestamp_offset_ = last_fragment_timestamp_ - fragment_timestamp + 1; // So that this == last_fragment_timestamp + 1
current_timestamp_offset_ = last_fragment_timestamp_ - fragment_timestamp + 1; // So that this == last_fragment_timestamp_ + 1
timestamp_to_use = fragment_timestamp + current_timestamp_offset_;
}

auto timestamp_to_use = fragment_timestamp + current_timestamp_offset_;
last_fragment_timestamp = timestamp_to_use;
last_fragment_timestamp_ = timestamp_to_use;
TLOG(TLVL_TRACE + 20) << "fragment_timestamp=" << fragment_timestamp << " while timestamp_to_use=" << timestamp_to_use;


Expand Down

0 comments on commit 7eb7d19

Please sign in to comment.