Skip to content

Commit 4829eb3

Browse files
authored
Merge pull request #35 from Mu2e/sweetmor/stm_develop
changes in the Mu2eSubRunReicever during the GR4
2 parents 52c2132 + 3aa6a75 commit 4829eb3

File tree

1 file changed

+26
-24
lines changed

1 file changed

+26
-24
lines changed

artdaq-mu2e/Generators/Mu2eSubEventReceiver_generator.cc

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ class Mu2eSubEventReceiver : public artdaq::CommandableFragmentGenerator
7979
};
8080
} // namespace mu2e
8181

82-
mu2e::Mu2eSubEventReceiver::~Mu2eSubEventReceiver()
83-
{
84-
}
82+
mu2e::Mu2eSubEventReceiver::~Mu2eSubEventReceiver() {}
8583

8684
bool mu2e::Mu2eSubEventReceiver::getNext_(artdaq::FragmentPtrs& frags)
8785
{
@@ -213,7 +211,7 @@ mu2e::Mu2eSubEventReceiver::Mu2eSubEventReceiver(fhicl::ParameterSet const& ps)
213211
else
214212
{
215213
theInterface_->ClearDetectorEmulatorInUse(); // Needed if we're doing ROC Emulator...make sure Detector Emulation
216-
// is disabled
214+
// is disabled
217215
theInterface_->ReleaseAllBuffers(DTC_DMA_Engine_DAQ);
218216
}
219217
}
@@ -239,6 +237,8 @@ void mu2e::Mu2eSubEventReceiver::stop()
239237

240238
void mu2e::Mu2eSubEventReceiver::start()
241239
{
240+
theInterface_->ReleaseAllBuffers(DTC_DMA_Engine_DAQ);
241+
242242
if (rawOutput_)
243243
{
244244
std::string fileName = rawOutputFile_;
@@ -361,29 +361,31 @@ bool mu2e::Mu2eSubEventReceiver::getNextDTCFragment(artdaq::FragmentPtrs& frags,
361361
// auto after_print = std::chrono::steady_clock::now();
362362

363363
auto fragment_timestamp = ts_out.GetEventWindowTag(true);
364-
auto timestamp_to_use = fragment_timestamp + current_timestamp_offset_;
365-
366-
if (last_fragment_timestamp_ != size_t(-1) && last_fragment_timestamp_ + 1 != timestamp_to_use)
367-
{
368-
TLOG(TLVL_DEBUG + 19) << "NOT INCREMENTAL timestamp new=" << timestamp_to_use << " vs old=" << last_fragment_timestamp_;
369-
}
370-
371-
if (first_timestamp_seen_ == size_t(-1)) // reset
372-
{
373-
first_timestamp_seen_ = fragment_timestamp;
374-
}
375-
376-
if (timestamp_to_use < last_fragment_timestamp_)
377-
{
378-
current_timestamp_offset_ = last_fragment_timestamp_ - fragment_timestamp + 1; // So that this == last_fragment_timestamp_ + 1
379-
timestamp_to_use = fragment_timestamp + current_timestamp_offset_;
380-
}
381-
last_fragment_timestamp_ = timestamp_to_use;
382-
TLOG(TLVL_TRACE + 24) << "fragment_timestamp=" << fragment_timestamp << " while timestamp_to_use=" << timestamp_to_use;
364+
// auto timestamp_to_use = fragment_timestamp + current_timestamp_offset_;
365+
metricMan->sendMetric("Last event window tag", fragment_timestamp, "status", 3, artdaq::MetricMode::LastPoint);
366+
367+
// if (last_fragment_timestamp_ != size_t(-1) && last_fragment_timestamp_ + 1 != timestamp_to_use)
368+
// {
369+
// TLOG(TLVL_DEBUG+19) << "NOT INCREMENTAL timestamp new=" << timestamp_to_use << " vs old=" << last_fragment_timestamp_;
370+
// }
371+
372+
// if (first_timestamp_seen_ == size_t(-1)) //reset
373+
// {
374+
// first_timestamp_seen_ = fragment_timestamp;
375+
// }
376+
377+
// if (timestamp_to_use < last_fragment_timestamp_)
378+
// {
379+
// current_timestamp_offset_ = last_fragment_timestamp_ - fragment_timestamp + 1; // So that this == last_fragment_timestamp_ + 1
380+
// timestamp_to_use = fragment_timestamp + current_timestamp_offset_;
381+
// }
382+
// last_fragment_timestamp_ = timestamp_to_use;
383+
// TLOG(TLVL_TRACE + 24) << "fragment_timestamp=" << fragment_timestamp << " while timestamp_to_use=" << timestamp_to_use;
383384

384385
// frags.emplace_back(new artdaq::Fragment(getCurrentSequenceID(), fragment_ids_[0], FragmentType::DTCEVT, fragment_timestamp));
385386
TLOG(TLVL_TRACE + 25) << "Creating Fragment, sz=" << evt->GetEventByteCount() << ", seqid=" << getCurrentSequenceID();
386-
frags.emplace_back(new artdaq::Fragment(timestamp_to_use, fragment_ids_[0], FragmentType::DTCEVT, fragment_timestamp));
387+
388+
frags.emplace_back(new artdaq::Fragment(fragment_timestamp, fragment_ids_[0], FragmentType::DTCEVT, fragment_timestamp));
387389
frags.back()->resizeBytes(evt->GetEventByteCount());
388390
memcpy(frags.back()->dataBegin(), evt->GetRawBufferPointer(), evt->GetEventByteCount());
389391
metricMan->sendMetric("Average Event Size", evt->GetEventByteCount(), "Bytes", 3, artdaq::MetricMode::Average);

0 commit comments

Comments
 (0)