Skip to content

Conversation

@tomeichlersmith
Copy link
Member

Reverts #339

This was already done for the MultiSampleECONDEventPacket

const std::string MultiSampleECONDEventPacket::to_csv_header =
"timestamp,orbit,bx,event,i_link,channel,i_sample,Tp,Tc,adc_tm1,adc,tot,"
"toa";
void MultiSampleECONDEventPacket::to_csv(std::ofstream& f) const {
/**
* The columns of the output CSV are
* ```
* timestamp,orbit,bx,event,i_link,channel,i_sample,Tp,Tc,adc_tm1,adc,tot,toa
* ```
*/
for (std::size_t i_sample{0}; i_sample < samples.size(); i_sample++) {
const auto& sample{samples[i_sample]};
for (std::size_t i_link{0}; i_link < sample.links.size(); i_link++) {
const auto& daq_link{sample.links[i_link]};
f << timestamp << ',' << daq_link.orbit << ',' << daq_link.bx << ','
<< daq_link.event << ',' << i_link << ',' << "calib," << i_sample
<< ',';
daq_link.calib.to_csv(f);
f << '\n';
for (std::size_t i_ch{0}; i_ch < 36; i_ch++) {
f << timestamp << ',' << daq_link.orbit << ',' << daq_link.bx << ','
<< daq_link.event << ',' << i_link << ',' << i_ch << ',' << i_sample
<< ',';
daq_link.channels[i_ch].to_csv(f);
f << '\n';
}
}
}
}

I would like to revert this because the ECONDEventPacket::to_csv function does not write a timestamp or i_sample since it doesn't have access to that information.

for (std::size_t i_link{0}; i_link < links.size(); i_link++) {
const auto &daq_link{links[i_link]};
f << i_link << ',' << daq_link.bx << ',' << daq_link.event << ','
<< daq_link.orbit << ',' << "calib,";
daq_link.calib.to_csv(f);
f << '\n';
for (std::size_t i_ch{0}; i_ch < 36; i_ch++) {
f << i_link << ',' << daq_link.bx << ',' << daq_link.event << ','
<< daq_link.orbit << ',' << i_ch << ',';
daq_link.channels[i_ch].to_csv(f);
f << '\n';
}
}
}

If the decoding is not writing out the timestamp or i_sample, then its probably because somewhere needs to use MultiSampleECONDEventPacket instead of just ECONDEventPacket.

@tvami
Copy link
Member

tvami commented Dec 13, 2025

See my comment in
#339 (comment)

@tomeichlersmith
Copy link
Member Author

Leaving this as draft since I'm not 100% confident and don't want to break decoding for folks while testbeam is going

@tomeichlersmith tomeichlersmith force-pushed the revert-339-fix_csv_header branch from 4257a95 to ecf4f60 Compare December 15, 2025 19:57
@tomeichlersmith
Copy link
Member Author

tomeichlersmith commented Dec 15, 2025

The issue was in econd_decoder.cxx which was using ECONDEventPacket::to_csv_header instead of MultiSampleECONDEventHeader::to_csv_header.

ecf4f60

Moreover, the current main gets the columns mixed up still. This only affects folks using econd-decoder with a RAW file. The live decoding and rogue decoding use the appropriate header.

eichl008@ldmxlab-Precision-3660:~/ldmx/pflib$ diff main.csv revert.csv 
1c1
< timestamp,i_link,bx,event,orbit,channel,i_sample,Tp,Tc,adc_tm1,adc,tot,toa
---
> timestamp,orbit,bx,event,i_link,channel,i_sample,Tp,Tc,adc_tm1,adc,tot,toa

@tomeichlersmith tomeichlersmith marked this pull request as ready for review December 15, 2025 20:00
Copy link
Member Author

@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.

After making this patch, I realized that there is no situation where folks should be using ECONDEventPacket::to_csv so I'm removing it. Similar to DAQLinkFrame, ECONDEventPacket is purely an intermediate structure to aid in the decoding and logical access of the decoded data.

@tomeichlersmith tomeichlersmith merged commit 795f46e into main Dec 15, 2025
3 checks passed
@tomeichlersmith tomeichlersmith deleted the revert-339-fix_csv_header branch December 15, 2025 20:24
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.

3 participants