Skip to content

Conversation

@joshgreaves332
Copy link
Contributor

added tasks/level_pedestals.h to algorithm/level_pedestals.cxx and replaced hardcoded SIMPLEROC with pftool::state.daq_format_mode, set by DAQ->SETTINGS->FORMAT (line 50 ish)

Copy link
Member

@tomeichlersmith tomeichlersmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, in order to get this to compile, you will need to update the stuff in algorithm and tasks that use the DecodeAnd* classes to create different ones depending on which type of format is being used. I did this as an example in daq.cxx:

pflib/app/tool/daq.cxx

Lines 352 to 380 in 29931a0

if (decoding) {
std::unique_ptr<DaqRunConsumer> consumer;
switch(pftool::state.daq_format_mode) {
case Target::DaqFormat::ECOND_SW_HEADERS:
consumer = std::make_unique<DecodeAndWriteToCSV<pflib::packing::SoftWrappedECONDEventPacket>>(
fname+".csv",
[](std::ofstream& f) {
f << std::boolalpha;
f << pflib::packing::SoftWrappedECONDEventPacket::to_csv_header << '\n';
},
[](std::ofstream& f, const pflib::packing::SoftWrappedECONDEventPacket& ep) {
ep.to_csv(f);
});
break;
case Target::DaqFormat::SIMPLEROC:
consumer = std::make_unique<DecodeAndWriteToCSV<pflib::packing::SingleROCEventPacket>>(
fname+".csv",
[](std::ofstream& f) {
f << std::boolalpha;
f << pflib::packing::SingleROCEventPacket::to_csv_header << '\n';
},
[](std::ofstream& f, const pflib::packing::SingleROCEventPacket& ep) {
ep.to_csv(f);
});
break;
default:
PFEXCEPTION_RAISE("BadConf", "Unable to do live decoding for the currently configured format.");
}
daq_run(pft, cmd, *consumer, nevents, pftool::state.daq_rate);

In order to avoid all this boilerplate, you can maybe use a helper function that implements the switch and exception for us. This helper function could live in daq_run.h (and daq_run.cxx).

@tomeichlersmith
Copy link
Member

⚠️ warning I am going to drop SoftWrapped* and just update MultiSample*, but I am going to wait until after the firmware changes I chatted with Jeremy about yesterday.

#246 (comment)

TLDR: we're going to use the SoftWrapped* header, but add a special trailer word to mark the end of a MultiSample*.

These changes will make this branch and its base branch 246-econd-live-decoding kinda obsolete. When I make these updates, I will work on updating the "live" decoding in the same way that I was planning with 246-econd-live-decoding but with MultiSample* and not SoftWrapped*.

@cmantill
Copy link
Contributor

@tomeichlersmith do you prefer in that case that we close this branch and wait for your changes to make changes to level_pedestals?

@tomeichlersmith
Copy link
Member

tomeichlersmith commented Nov 14, 2025

We definitely can, I just wasn't sure how much Josh had worked on it since I reviewed it yesterday.

Edit: While closing the PR would not delete the branch, I did not want to give the impression that the work should be discarded. It can still be helpful after the refactor I mention above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants