Files
Jungfraujoch/writer/HDF5DataFilePluginMX.h
T
leonarski_fandClaude Opus 5.5 dc784c073d Panel id on spots and the panel table in the start message
SpotToSave gains int16_t panel (-1 = no panel table). It sits in the padding
after the two bools, so sizeof(SpotToSave) stays 80. It is serialised only
where it is set: CBOR spot key "panel", HDF5 /entry/MX/peakPanel (data file,
plus a virtual dataset in a VDS master when the start message has panels),
read back by HDF5MetadataSource. For a flat detector none of these is written,
so files and streams for existing data are byte-for-byte unchanged.

The start message carries the panel table (detector_modules, CBOR key absent
when empty), filled from the experiment; JFJochHttpReader takes it, so a
stream viewer knows the panels too.

AssignModules takes the spot's panel id where it has one - the stored pixel box
it was found in - and falls back to the plane position otherwise (every spot
until per-panel spot finding sets the id).

Reflection deliberately gets no panel id (owner decision): it is needed only
between prediction and integration, and the struct feeds GPU layout and
memory budgets.

Tests: CBORSerialize_SpotPanelId, CBORSerialize_StartDetectorModules,
JFJochReader_PanelId (VDS/legacy/integrated, with and without panels).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu
2026-10-21 10:28:23 +02:00

75 lines
2.6 KiB
C++

// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include "HDF5DataFilePlugin.h"
#include "../common/AutoIncrVector.h"
class HDF5DataFilePluginMX : public HDF5DataFilePlugin {
const size_t max_spots;
const size_t max_extra_lattices;
const bool indexing;
// spots
std::vector<float> spot_x;
std::vector<float> spot_y;
std::vector<float> spot_int;
std::vector<int8_t> spot_indexed;
std::vector<int8_t> spot_ice_ring;
std::vector<int8_t> spot_lattice;
std::vector<int32_t> spot_h;
std::vector<int32_t> spot_k;
std::vector<int32_t> spot_l;
std::vector<float> spot_dist_ewald;
std::vector<int16_t> spot_panel;
bool spot_panel_present = false; // written only for a detector with a panel table
AutoIncrVector<float> beam_corr_x{NAN};
AutoIncrVector<float> beam_corr_y{NAN};
AutoIncrVector<uint32_t> npeaks;
AutoIncrVector<uint32_t> strong_pixel_count;
AutoIncrVector<uint32_t> spot_count_total;
AutoIncrVector<uint32_t> spot_count_ice;
AutoIncrVector<float> spot_count_ice_control{NAN};
AutoIncrVector<uint32_t> spot_count_indexed;
AutoIncrVector<uint32_t> spot_count_low_res;
// indexing
AutoIncrVector<uint8_t> indexed;
AutoIncrVector<uint32_t> indexing_lattice_count;
std::vector<float> indexed_lattice;
std::vector<float> extra_lattices; // [nimages, max_extra_lattices, 9], NaN-filled
// crystal
AutoIncrVector<float> profile_radius{NAN};
AutoIncrVector<float> mosaicity_deg{NAN};
AutoIncrVector<float> b_factor{NAN};
// bkg_estimate
AutoIncrVector<float> bkg_estimate{NAN};
AutoIncrVector<float> ice_ring_score{NAN};
// NaN = the frame had no value (CANNOT SAY), which is not a zero - see SpindleTrigger.
AutoIncrVector<float> spindle_blind_fraction{NAN};
// resolution_estimation
AutoIncrVector<float> resolution_estimate{NAN};
AutoIncrVector<uint32_t> niggli_class;
AutoIncrVector<std::string> bravais_lattice;
AutoIncrVector<int64_t> integrated_reflections;
// scaling
bool image_scale_present = false;
AutoIncrVector<float> image_scale_factor{NAN};
AutoIncrVector<float> image_scale_cc{NAN};
AutoIncrVector<float> image_scale_mosaicity{NAN};
public:
explicit HDF5DataFilePluginMX(const StartMessage& msg);
void OpenFile(HDF5File &data_file, const DataMessage& msg, size_t images_per_file) override;
void Write(const DataMessage& msg, uint64_t image_number) override;
void WriteFinal(HDF5File &data_file) override;
};