Read Xilinx CTB files (#271)
All checks were successful
Build on RHEL8 / build (push) Successful in 2m14s
Build on RHEL9 / build (push) Successful in 2m37s
Run tests using data on local RHEL8 / build (push) Successful in 3m16s

File content is the same as the normal ctb files so no changes needed
for reading.

- Accept DetectorType::Xilinx_ChipTestBoard in the CtbRawFile class
- Check if file is open in constructor
This commit is contained in:
2026-01-27 09:49:17 +01:00
committed by GitHub

View File

@@ -5,7 +5,9 @@
namespace aare { namespace aare {
CtbRawFile::CtbRawFile(const std::filesystem::path &fname) : m_master(fname) { CtbRawFile::CtbRawFile(const std::filesystem::path &fname) : m_master(fname) {
if (m_master.detector_type() != DetectorType::ChipTestBoard) { if( (m_master.detector_type() != DetectorType::ChipTestBoard) &&
(m_master.detector_type() != DetectorType::Xilinx_ChipTestBoard) )
{
throw std::runtime_error(LOCATION + "Not a Ctb file"); throw std::runtime_error(LOCATION + "Not a Ctb file");
} }
@@ -13,6 +15,8 @@ CtbRawFile::CtbRawFile(const std::filesystem::path &fname) : m_master(fname) {
// open the first subfile // open the first subfile
m_file.open(m_master.data_fname(0, 0), std::ios::binary); m_file.open(m_master.data_fname(0, 0), std::ios::binary);
if(!m_file)
throw std::runtime_error(LOCATION + "Could not open: " + m_master.data_fname(0, 0).string());
} }
void CtbRawFile::read_into(std::byte *image_buf, DetectorHeader *header) { void CtbRawFile::read_into(std::byte *image_buf, DetectorHeader *header) {
@@ -30,7 +34,6 @@ void CtbRawFile::read_into(std::byte *image_buf, DetectorHeader *header) {
} else { } else {
m_file.seekg(sizeof(DetectorHeader), std::ios::cur); m_file.seekg(sizeof(DetectorHeader), std::ios::cur);
} }
m_file.read(reinterpret_cast<char *>(image_buf), m_file.read(reinterpret_cast<char *>(image_buf),
m_master.image_size_in_bytes()); m_master.image_size_in_bytes());
m_current_frame++; m_current_frame++;