-
Notifications
You must be signed in to change notification settings - Fork 2
level_pedestals now has its daq format set by DAQ->SETTINGS->FORMAT #252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 246-econd-live-decoding
Are you sure you want to change the base?
level_pedestals now has its daq format set by DAQ->SETTINGS->FORMAT #252
Conversation
looking at templating over DaqRunConsumer derived classes, getting complicated quickly unfortunately
…replaced hardcoded SIMPLEROC with pftool::state.daq_format_mode, set by DAQ->SETTINGS->FORMAT
tomeichlersmith
left a comment
There was a problem hiding this 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:
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).
|
TLDR: we're going to use the These changes will make this branch and its base branch |
|
@tomeichlersmith do you prefer in that case that we close this branch and wait for your changes to make changes to |
|
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. |
29931a0 to
0e311b4
Compare
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)