diff --git a/include/iact_data/acada_data_source.hpp b/include/iact_data/acada_data_source.hpp index cc5d9382..dd3b6145 100644 --- a/include/iact_data/acada_data_source.hpp +++ b/include/iact_data/acada_data_source.hpp @@ -51,33 +51,36 @@ class ACADACameraEventDataSource: virtual void release_borrowed_event(const EventMessage* event) = 0; }; -template +template class ACADACameraEventDataSourceWithRunHeader: public virtual ACADACameraEventDataSource { public: CALIN_TYPEALIAS(event_type, EventMessage); CALIN_TYPEALIAS(header_type, HeaderMessage); + CALIN_TYPEALIAS(data_stream_type, DataStreamMessage); ACADACameraEventDataSourceWithRunHeader(): ACADACameraEventDataSource() { /* nothing to see here */ } virtual ~ACADACameraEventDataSourceWithRunHeader(); virtual header_type* get_run_header() = 0; + virtual data_stream_type* get_data_stream() = 0; }; -template +template class ACADACameraEventRandomAccessDataSourceWithRunHeader: public virtual calin::io::data_source::RandomAccessDataSource, - public virtual ACADACameraEventDataSourceWithRunHeader + public virtual ACADACameraEventDataSourceWithRunHeader { public: CALIN_TYPEALIAS(event_type, EventMessage); CALIN_TYPEALIAS(header_type, HeaderMessage); + CALIN_TYPEALIAS(data_stream_type, DataStreamMessage); ACADACameraEventRandomAccessDataSourceWithRunHeader(): calin::io::data_source::RandomAccessDataSource(), - ACADACameraEventDataSourceWithRunHeader() { + ACADACameraEventDataSourceWithRunHeader() { /* nothing to see here */ } virtual ~ACADACameraEventRandomAccessDataSourceWithRunHeader(); }; diff --git a/include/iact_data/acada_event_decoder.hpp b/include/iact_data/acada_event_decoder.hpp index a9577580..ec9c5c09 100644 --- a/include/iact_data/acada_event_decoder.hpp +++ b/include/iact_data/acada_event_decoder.hpp @@ -44,12 +44,13 @@ calin::ix::iact_data::telescope_event::TriggerType determine_trigger_type( const calin::ix::iact_data::telescope_event::TIBData* calin_tib_data, const calin::ix::iact_data::telescope_event::CDTSData* calin_cdts_data); -template +template class ACADACameraEventDecoder { public: CALIN_TYPEALIAS(event_type, EventMessage); CALIN_TYPEALIAS(header_type, HeaderMessage); + CALIN_TYPEALIAS(data_stream_type, DataStreamMessage); virtual ~ACADACameraEventDecoder(); virtual bool decode( @@ -59,7 +60,8 @@ class ACADACameraEventDecoder calin::ix::iact_data::telescope_run_configuration:: TelescopeRunConfiguration* run_config, const HeaderMessage* cta_run_header, - const EventMessage* cta_event) = 0; + const EventMessage* cta_event, + const DataStreamMessage* cta_data_stream = nullptr) = 0; virtual ACADACameraEventDecoder* clone() const = 0; }; diff --git a/include/iact_data/nectarcam_acada_event_decoder.hpp b/include/iact_data/nectarcam_acada_event_decoder.hpp index 2c413717..44fa356e 100644 --- a/include/iact_data/nectarcam_acada_event_decoder.hpp +++ b/include/iact_data/nectarcam_acada_event_decoder.hpp @@ -62,6 +62,7 @@ class NectarCam_ACADACameraEventDecoder_L0: using calin::iact_data::acada_event_decoder::ACADACameraEventDecoder_L0::event_type; using calin::iact_data::acada_event_decoder::ACADACameraEventDecoder_L0::header_type; + using calin::iact_data::acada_event_decoder::ACADACameraEventDecoder_L0::data_stream_type; NectarCam_ACADACameraEventDecoder_L0(const std::string& filename, unsigned run_number = 0, const calin::ix::iact_data::nectarcam_data_source::NectarCamCameraEventDecoderConfig& config = default_config()); @@ -81,9 +82,9 @@ class NectarCam_ACADACameraEventDecoder_L0: const event_type* cta_event) override; bool decode_run_config( - calin::ix::iact_data::telescope_run_configuration:: - TelescopeRunConfiguration* run_config, - const header_type* cta_run_header, const event_type* cta_event) override; + calin::ix::iact_data::telescope_run_configuration:: TelescopeRunConfiguration* run_config, + const header_type* cta_run_header, const event_type* cta_event, + const data_stream_type* cta_data_stream = nullptr) override; NectarCam_ACADACameraEventDecoder_L0* clone() const override; @@ -141,6 +142,7 @@ class NectarCam_ACADACameraEventDecoder_R1v0: using calin::iact_data::acada_event_decoder::ACADACameraEventDecoder_R1v0::event_type; using calin::iact_data::acada_event_decoder::ACADACameraEventDecoder_R1v0::header_type; + using calin::iact_data::acada_event_decoder::ACADACameraEventDecoder_R1v0::data_stream_type; NectarCam_ACADACameraEventDecoder_R1v0(const std::string& filename, unsigned run_number = 0, const config_type& config = default_config()); @@ -151,10 +153,10 @@ class NectarCam_ACADACameraEventDecoder_R1v0: calin::ix::iact_data::telescope_event::TelescopeEvent* event, const event_type* cta_event) override; - virtual bool decode_run_config( - calin::ix::iact_data::telescope_run_configuration:: - TelescopeRunConfiguration* run_config, - const header_type* cta_run_header, const event_type* cta_event) override; + bool decode_run_config( + calin::ix::iact_data::telescope_run_configuration:: TelescopeRunConfiguration* run_config, + const header_type* cta_run_header, const event_type* cta_event, + const data_stream_type* cta_data_stream = nullptr) override; NectarCam_ACADACameraEventDecoder_R1v0* clone() const override; diff --git a/include/iact_data/zfits_acada_data_source.hpp b/include/iact_data/zfits_acada_data_source.hpp index e97d9c4b..4e6c81b8 100644 --- a/include/iact_data/zfits_acada_data_source.hpp +++ b/include/iact_data/zfits_acada_data_source.hpp @@ -43,13 +43,19 @@ class ZFITSSingleFileSingleMessageDataSource: public: CALIN_TYPEALIAS(message_type, Message); - ZFITSSingleFileSingleMessageDataSource(const std::string& filename, const std::string& tablename = {}); + ZFITSSingleFileSingleMessageDataSource(const std::string& filename, const std::string& tablename = {}, + bool suppress_file_record = false); virtual ~ZFITSSingleFileSingleMessageDataSource(); + const message_type* borrow_next_message(uint64_t& seq_index_out); + void release_borrowed_message(const message_type* message); + message_type* get_next(uint64_t& seq_index_out, google::protobuf::Arena** arena = nullptr) override; + uint64_t size() override; void set_next_index(uint64_t next_index) override; + uint64_t get_next_index() const { return next_message_index_; }; private: std::string filename_; @@ -59,16 +65,17 @@ class ZFITSSingleFileSingleMessageDataSource: uint64_t next_message_index_ = 0; }; -template +template class ZFITSSingleFileACADACameraEventDataSource: public calin::iact_data::acada_data_source:: - ACADACameraEventRandomAccessDataSourceWithRunHeader + ACADACameraEventRandomAccessDataSourceWithRunHeader { public: CALIN_TYPEALIAS(config_type, calin::ix::iact_data::zfits_data_source::ZFITSDataSourceConfig); CALIN_TYPEALIAS(event_type, EventMessage); CALIN_TYPEALIAS(header_type, HeaderMessage); + CALIN_TYPEALIAS(data_stream_type, DataStreamMessage); ZFITSSingleFileACADACameraEventDataSource(const std::string& filename, const config_type& config = default_config()); @@ -83,39 +90,41 @@ class ZFITSSingleFileACADACameraEventDataSource: void set_next_index(uint64_t next_index) override; header_type* get_run_header() override; + data_stream_type* get_data_stream() override; static config_type default_config(); const config_type& config() const { return config_; } private: std::string filename_; - ADH::IO::ProtobufIFits* zfits_ = nullptr; - calin::ix::provenance::chronicle::FileIORecord* file_record_ = nullptr; - uint64_t next_event_index_ = 0; + ZFITSSingleFileSingleMessageDataSource* zfits_; header_type* run_header_ = nullptr; + data_stream_type* data_stream_ = nullptr; config_type config_; }; -template +template class ZFITSACADACameraEventDataSource: public calin::io::data_source::BasicChainedRandomAccessDataSource< calin::iact_data::acada_data_source:: - ACADACameraEventRandomAccessDataSourceWithRunHeader > + ACADACameraEventRandomAccessDataSourceWithRunHeader > { public: CALIN_TYPEALIAS(config_type, calin::ix::iact_data::zfits_data_source::ZFITSDataSourceConfig); CALIN_TYPEALIAS(event_type, EventMessage); CALIN_TYPEALIAS(header_type, HeaderMessage); + CALIN_TYPEALIAS(data_stream_type, DataStreamMessage); CALIN_TYPEALIAS(BaseDataSource, calin::io::data_source::BasicChainedRandomAccessDataSource< calin::iact_data::acada_data_source:: - ACADACameraEventRandomAccessDataSourceWithRunHeader >); + ACADACameraEventRandomAccessDataSourceWithRunHeader >); ZFITSACADACameraEventDataSource(const std::string& filename, const config_type& config = default_config()); virtual ~ZFITSACADACameraEventDataSource(); header_type* get_run_header() override; + data_stream_type* get_data_stream() override; const event_type* borrow_next_event(uint64_t& seq_index_out) override; void release_borrowed_event(const event_type* event) override; @@ -138,26 +147,28 @@ class ZFITSACADACameraEventDataSource: private: config_type config_; header_type* run_header_ = nullptr; + data_stream_type* data_stream_ = nullptr; }; -template +template class ZFITSACADACameraEventDataSourceOpener: public calin::io::data_source::DataSourceOpener< calin::iact_data::acada_data_source:: - ACADACameraEventRandomAccessDataSourceWithRunHeader > + ACADACameraEventRandomAccessDataSourceWithRunHeader > { public: CALIN_TYPEALIAS(config_type, calin::ix::iact_data::zfits_data_source::ZFITSDataSourceConfig); CALIN_TYPEALIAS(event_type, EventMessage); CALIN_TYPEALIAS(header_type, HeaderMessage); + CALIN_TYPEALIAS(data_stream_type, DataStreamMessage); ZFITSACADACameraEventDataSourceOpener(std::string filename, const config_type& config = default_config()); virtual ~ZFITSACADACameraEventDataSourceOpener(); unsigned num_sources() const override; std::string source_name(unsigned isource) const override; - ZFITSSingleFileACADACameraEventDataSource* open(unsigned isource) override; + ZFITSSingleFileACADACameraEventDataSource* open(unsigned isource) override; bool has_opened_file() { return has_opened_file_; } static config_type default_config(); diff --git a/include/iact_data/zfits_data_source.hpp b/include/iact_data/zfits_data_source.hpp index 42918b5c..f6c9950b 100644 --- a/include/iact_data/zfits_data_source.hpp +++ b/include/iact_data/zfits_data_source.hpp @@ -39,6 +39,7 @@ namespace calin { namespace iact_data { namespace zfits_data_source { +#if 0 // UNUSED template class ZFITSSingleFileDataSource: public calin::iact_data::telescope_data_source:: @@ -85,8 +86,10 @@ class ZFITSSingleFileDataSource: calin::ix::iact_data::telescope_run_configuration:: TelescopeRunConfiguration* run_config_ = nullptr; }; +#endif // UNUSED -template + +template class ZFITSDataSource: public calin::iact_data::telescope_data_source:: TelescopeRandomAccessDataSourceWithRunConfig, @@ -98,12 +101,12 @@ class ZFITSDataSource: ZFITSDataSource(const std::string& filename, calin::iact_data::acada_event_decoder:: - ACADACameraEventDecoder* decoder, + ACADACameraEventDecoder* decoder, bool adopt_decoder = false, const config_type& config = default_config()); ZFITSDataSource(const std::string& filename, - ZFITSDataSource* base_datasource, + ZFITSDataSource* base_datasource, const config_type& config = default_config()); virtual ~ZFITSDataSource(); @@ -126,10 +129,10 @@ class ZFITSDataSource: protected: calin::iact_data::acada_event_decoder:: - ACADACameraEventDecoder* decoder_; + ACADACameraEventDecoder* decoder_; bool adopt_decoder_ = false; calin::iact_data::zfits_acada_data_source:: - ZFITSACADACameraEventDataSource* acada_zfits_ = nullptr; + ZFITSACADACameraEventDataSource* acada_zfits_ = nullptr; bool adopt_acada_zfits_ = false; calin::ix::iact_data::telescope_run_configuration:: TelescopeRunConfiguration* run_config_ = nullptr; diff --git a/proto/iact_data/zfits_data_source.proto b/proto/iact_data/zfits_data_source.proto index 177d9da8..f83eeca8 100644 --- a/proto/iact_data/zfits_data_source.proto +++ b/proto/iact_data/zfits_data_source.proto @@ -54,18 +54,13 @@ message ZFITSDataSourceConfig { (CFO).desc = "Maximum event sequence number. This effectively sets the " "number of events that can be read. Zero means there is no limit." ]; bool dont_read_run_header = 11 [ - (CFO).desc = "Don't read the run header." ]; + (CFO).desc = "Don't read the run header or data stream." ]; bool ignore_run_header_errors = 12 [ - (CFO).desc = "Don't log missing run header." ]; - bool verify_file_after_open = 20 [ - (CFO).desc = "Verify ZFits file consistency after opening it. This may " - "be slow." ]; - bool repair_broken_file = 21 [ - (CFO).desc = "Attempt to repair any files that fail the verification step. " - "If this is selected it implicitly means \"verify_file_after_open\" is " - "also." ]; - string run_header_table_name = 22 [ + (CFO).desc = "Don't log missing run header or data stream." ]; + string data_stream_table_name = 20 [ + (CFO).desc = "Name of the telescope data stream table in the ZFits file" ]; + string run_header_table_name = 21 [ (CFO).desc = "Name of the run header table in the ZFits file" ]; - string events_table_name = 23 [ + string events_table_name = 22 [ (CFO).desc = "Name of the events table in the ZFits file" ]; }; diff --git a/src/iact_data/acada_data_source.cpp b/src/iact_data/acada_data_source.cpp index 88e946c8..88f2e72f 100644 --- a/src/iact_data/acada_data_source.cpp +++ b/src/iact_data/acada_data_source.cpp @@ -31,15 +31,15 @@ ACADACameraEventDataSource:: // nothing to see here } -template -ACADACameraEventDataSourceWithRunHeader:: +template +ACADACameraEventDataSourceWithRunHeader:: ~ACADACameraEventDataSourceWithRunHeader() { // nothing to see here } -template -ACADACameraEventRandomAccessDataSourceWithRunHeader:: +template +ACADACameraEventRandomAccessDataSourceWithRunHeader:: ~ACADACameraEventRandomAccessDataSourceWithRunHeader() { // nothing to see here @@ -56,7 +56,9 @@ template class ACADACameraEventDataSourceWithRunHeader; template class ACADACameraEventDataSource; -template class ACADACameraEventDataSourceWithRunHeader; -template class ACADACameraEventRandomAccessDataSourceWithRunHeader; +template class ACADACameraEventDataSourceWithRunHeader< + ACADA_EventMessage_R1v1, ACADA_HeaderMessage_R1v1, ACADA_DataStreamMessage_R1v1>; +template class ACADACameraEventRandomAccessDataSourceWithRunHeader< + ACADA_EventMessage_R1v1, ACADA_HeaderMessage_R1v1, ACADA_DataStreamMessage_R1v1>; } } } // namespace calin::iact_data::acada_data_source diff --git a/src/iact_data/acada_event_decoder.cpp b/src/iact_data/acada_event_decoder.cpp index 915a147c..536d6b22 100644 --- a/src/iact_data/acada_event_decoder.cpp +++ b/src/iact_data/acada_event_decoder.cpp @@ -37,8 +37,9 @@ using calin::util::file::is_file; using calin::util::file::is_readable; using calin::util::file::expand_filename; -template -ACADACameraEventDecoder::~ACADACameraEventDecoder() +template +ACADACameraEventDecoder:: +~ACADACameraEventDecoder() { // nothing to see here } diff --git a/src/iact_data/nectarcam_acada_event_decoder_l0.cpp b/src/iact_data/nectarcam_acada_event_decoder_l0.cpp index 696782c6..c6bd3925 100644 --- a/src/iact_data/nectarcam_acada_event_decoder_l0.cpp +++ b/src/iact_data/nectarcam_acada_event_decoder_l0.cpp @@ -439,10 +439,10 @@ bool NectarCam_ACADACameraEventDecoder_L0::decode( } bool NectarCam_ACADACameraEventDecoder_L0::decode_run_config( - calin::ix::iact_data::telescope_run_configuration:: - TelescopeRunConfiguration* calin_run_config, + calin::ix::iact_data::telescope_run_configuration::TelescopeRunConfiguration* calin_run_config, const header_type* cta_run_header, - const event_type* cta_event) + const event_type* cta_event, + const data_stream_type* cta_data_stream) { calin_run_config->set_data_transcoder( "calin::iact_data::nectarcam_acada_event_decoder::NectarCam_ACADACameraEventDecoder_L0"); diff --git a/src/iact_data/nectarcam_acada_event_decoder_r1v0.cpp b/src/iact_data/nectarcam_acada_event_decoder_r1v0.cpp index 0cebc5d0..29a56eb8 100644 --- a/src/iact_data/nectarcam_acada_event_decoder_r1v0.cpp +++ b/src/iact_data/nectarcam_acada_event_decoder_r1v0.cpp @@ -549,9 +549,10 @@ bool NectarCam_ACADACameraEventDecoder_R1v0::decode( } bool NectarCam_ACADACameraEventDecoder_R1v0::decode_run_config( - calin::ix::iact_data::telescope_run_configuration:: - TelescopeRunConfiguration* calin_run_config, - const header_type* cta_run_header, const event_type* cta_event) + calin::ix::iact_data::telescope_run_configuration::TelescopeRunConfiguration* calin_run_config, + const header_type* cta_run_header, + const event_type* cta_event, + const data_stream_type* cta_data_stream) { calin_run_config->set_data_transcoder( "calin::iact_data::nectarcam_acada_event_decoder::NectarCam_ACADACameraEventDecoder_R1v0"); diff --git a/src/iact_data/zfits_acada_data_source.cpp b/src/iact_data/zfits_acada_data_source.cpp index 37dc5da2..0c2dc14a 100644 --- a/src/iact_data/zfits_acada_data_source.cpp +++ b/src/iact_data/zfits_acada_data_source.cpp @@ -60,6 +60,44 @@ namespace { template<> std::string default_message_table_name() { return "CameraConfiguration"; } template<> std::string default_message_table_name() { return "Events"; } template<> std::string default_message_table_name() { return "DataStream"; } + + template Message* read_one_message_from_zfits_table( + const std::string& filename, const std::string& tablename, bool suppress_file_record = false) + { + ZFITSSingleFileSingleMessageDataSource zfits(filename, tablename, suppress_file_record); + uint64_t seq_index_out; + return zfits.get_next(seq_index_out); + } + + template<> void* read_one_message_from_zfits_table( + const std::string& filename, const std::string& tablename, bool suppress_file_record) + { + return nullptr; + } + + template Message* copy_message(const Message* message) + { + if(message == nullptr)return nullptr; + Message* new_message = new Message; + new_message->CopyFrom(*message); + return new_message; + } + + template<> void* copy_message(const void*) + { + return nullptr; + } + + template void delete_message(Message* message) + { + delete message; + } + + template<> void delete_message(void*) + { + // nothing to see here + } + } // anonymous namespace std::vector calin::iact_data::zfits_acada_data_source:: @@ -149,7 +187,7 @@ get_zfits_table_key_values(std::string filename, std::string tablename) template ZFITSSingleFileSingleMessageDataSource:: ZFITSSingleFileSingleMessageDataSource( - const std::string& filename, const std::string& tablename): + const std::string& filename, const std::string& tablename, bool suppress_file_record): calin::io::data_source::RandomAccessDataSource(), filename_(expand_filename(filename)), tablename_(tablename.empty() ? default_message_table_name() : tablename) @@ -163,8 +201,10 @@ ZFITSSingleFileSingleMessageDataSource( if(zfits_->eof() && !zfits_->bad()) throw std::runtime_error("ZFits file " + filename_ + " has no table: " + tablename_); - file_record_ = calin::provenance::chronicle::register_file_open(filename_, - calin::ix::provenance::chronicle::AT_READ, __PRETTY_FUNCTION__); + if(not suppress_file_record) { + file_record_ = calin::provenance::chronicle::register_file_open(filename_, + calin::ix::provenance::chronicle::AT_READ, __PRETTY_FUNCTION__); + } } template ZFITSSingleFileSingleMessageDataSource:: @@ -174,6 +214,28 @@ template ZFITSSingleFileSingleMessageDataSource:: calin::provenance::chronicle::register_file_close(file_record_); } +template const Message* +ZFITSSingleFileSingleMessageDataSource:: +borrow_next_message(uint64_t& seq_index_out) +{ + uint64_t max_seq_index = zfits_->getNumMessagesInTable(); + if(next_message_index_ >= max_seq_index)return nullptr; + + seq_index_out = next_message_index_; + const Message* message { + zfits_->borrowTypedMessage(++next_message_index_) }; + if(message == nullptr)throw std::runtime_error("ZFits reader returned NULL"); + + return message; +} + +template void +ZFITSSingleFileSingleMessageDataSource:: +release_borrowed_message(const message_type* message) +{ + zfits_->returnBorrowedMessage(message); +} + template Message* ZFITSSingleFileSingleMessageDataSource::get_next(uint64_t& seq_index_out, google::protobuf::Arena** arena) @@ -225,12 +287,14 @@ set_next_index(uint64_t next_index) // ============================================================================= // ============================================================================= -template -ZFITSSingleFileACADACameraEventDataSource:: +template +ZFITSSingleFileACADACameraEventDataSource:: ZFITSSingleFileACADACameraEventDataSource(const std::string& filename, const config_type& config): - ACADACameraEventRandomAccessDataSourceWithRunHeader(), + ACADACameraEventRandomAccessDataSourceWithRunHeader(), filename_(expand_filename(filename)), config_(config) { + if(config_.data_stream_table_name().empty()) + config_.set_data_stream_table_name(default_message_table_name()); if(config_.run_header_table_name().empty()) config_.set_run_header_table_name(default_message_table_name()); if(config_.events_table_name().empty()) @@ -243,162 +307,89 @@ ZFITSSingleFileACADACameraEventDataSource(const std::string& filename, const con if(!config_.dont_read_run_header()) { - try - { - ADH::IO::ProtobufIFits rh_zfits(filename_.c_str(), - config_.run_header_table_name(), HeaderMessage::descriptor()); - if(rh_zfits.eof() && !rh_zfits.bad()) - throw std::runtime_error("ZFits reader found no table:" + - config_.run_header_table_name()); - if(config_.verify_file_after_open() or config_.repair_broken_file()) - { - try - { - rh_zfits.CheckIfFileIsConsistent(false); - } - catch (std::exception& e) - { - if(config_.repair_broken_file()) - { - LOG(WARNING) << "ZFits file " + filename_ + - ": integrity verification failed, attempting to repair."; - rh_zfits.CheckIfFileIsConsistent(true); - } - } - } - if(rh_zfits.getNumMessagesInTable() > 0) - { - HeaderMessage* run_header = - rh_zfits.readTypedMessage(1); - run_header_ = new HeaderMessage(*run_header); - rh_zfits.recycleMessage(run_header); - //LOG(INFO) << run_header_->DebugString(); - } - } - catch(...) - { + try { + run_header_ = read_one_message_from_zfits_table( + filename_, config_.run_header_table_name(), /* suppress_file_record = */true); + } catch(...) { if(!config_.ignore_run_header_errors()) LOG(WARNING) << "ZFITSSingleFileACADACameraEventDataSource: Could not read run header from " << filename_; } - } - - zfits_ = new ADH::IO::ProtobufIFits(filename_.c_str(), - config_.events_table_name(), EventMessage::descriptor()); - if(zfits_->eof() && !zfits_->bad()) - throw std::runtime_error("ZFits file " + filename_ + " has no table: " + - config_.events_table_name()); - - file_record_ = calin::provenance::chronicle::register_file_open(filename_, - calin::ix::provenance::chronicle::AT_READ, __PRETTY_FUNCTION__); - if(config_.verify_file_after_open() or config_.repair_broken_file()) - { - try - { - zfits_->CheckIfFileIsConsistent(false); - } - catch (std::exception& e) - { - if(config_.repair_broken_file()) - { - LOG(WARNING) << "ZFits file " + filename_ + - ": integrity verification failed, attempting to repair."; - zfits_->CheckIfFileIsConsistent(true); - } + try { + data_stream_ = read_one_message_from_zfits_table( + filename_, config_.data_stream_table_name(), /* suppress_file_record = */true); + } catch(...) { + if(!config_.ignore_run_header_errors()) + LOG(WARNING) + << "ZFITSSingleFileACADACameraEventDataSource: Could not read data stream from " + << filename_; } } + + zfits_ = new ZFITSSingleFileSingleMessageDataSource(filename_, config_.events_table_name()); } -template -ZFITSSingleFileACADACameraEventDataSource:: +template +ZFITSSingleFileACADACameraEventDataSource:: ~ZFITSSingleFileACADACameraEventDataSource() { delete zfits_; - calin::provenance::chronicle::register_file_close(file_record_); delete run_header_; + delete_message(data_stream_); } -template const EventMessage* -ZFITSSingleFileACADACameraEventDataSource:: +template const EventMessage* +ZFITSSingleFileACADACameraEventDataSource:: borrow_next_event(uint64_t& seq_index_out) { - if(zfits_ == nullptr) - throw std::runtime_error(std::string("File not open: ")+filename_); - - uint64_t max_seq_index = zfits_->getNumMessagesInTable(); - if(config_.max_seq_index()) - max_seq_index = std::min(max_seq_index, config_.max_seq_index()); - if(next_event_index_ >= max_seq_index)return nullptr; - - seq_index_out = next_event_index_; - const EventMessage* event { - zfits_->borrowTypedMessage(++next_event_index_) }; - if(!event)throw std::runtime_error("ZFits reader returned NULL"); - - return event; + if(config_.max_seq_index() and zfits_->get_next_index()>=config_.max_seq_index()) { + return nullptr; + } else { + return zfits_->borrow_next_message(seq_index_out); + } } -template -void ZFITSSingleFileACADACameraEventDataSource:: +template +void ZFITSSingleFileACADACameraEventDataSource:: release_borrowed_event(const EventMessage* event) { - zfits_->returnBorrowedMessage(event); + zfits_->release_borrowed_message(event); } -template -EventMessage* ZFITSSingleFileACADACameraEventDataSource:: +template +EventMessage* ZFITSSingleFileACADACameraEventDataSource:: get_next(uint64_t& seq_index_out, google::protobuf::Arena** arena) { - if(arena)*arena = nullptr; - const EventMessage* event = borrow_next_event(seq_index_out); - if(event == nullptr)return nullptr; - - EventMessage* event_copy = nullptr; -#if 0 - if(arena) { - if(!*arena)*arena = new google::protobuf::Arena; - event_copy = - google::protobuf::Arena::CreateMessage(*arena); + if(config_.max_seq_index() and zfits_->get_next_index()>=config_.max_seq_index()) { + return nullptr; + } else { + return zfits_->get_next(seq_index_out, arena); } - else event_copy = new EventMessage; -#else - if(arena && *arena) - throw std::runtime_error("ZFITSSingleFileACADACameraEventDataSource::get_next: " - " pre-allocated arena not supported."); - event_copy = new EventMessage; -#endif - event_copy->CopyFrom(*event); - release_borrowed_event(event); - - return event_copy; } -template -uint64_t ZFITSSingleFileACADACameraEventDataSource::size() +template +uint64_t ZFITSSingleFileACADACameraEventDataSource::size() { - uint64_t max_seq_index = zfits_->getNumMessagesInTable(); + uint64_t max_seq_index = zfits_->size(); if(config_.max_seq_index()) max_seq_index = std::min(max_seq_index, config_.max_seq_index()); return max_seq_index; } -template -void ZFITSSingleFileACADACameraEventDataSource:: +template +void ZFITSSingleFileACADACameraEventDataSource:: set_next_index(uint64_t next_index) { - if(zfits_ == nullptr)next_event_index_ = 0; - else { - uint64_t max_seq_index = zfits_->getNumMessagesInTable(); - if(config_.max_seq_index()) - max_seq_index = std::min(max_seq_index, config_.max_seq_index()); - next_event_index_ = std::min(next_index, max_seq_index); + if(config_.max_seq_index()) { + next_index = std::min(next_index, config_.max_seq_index()); } + zfits_->set_next_index(next_index); } -template -HeaderMessage* ZFITSSingleFileACADACameraEventDataSource:: +template +HeaderMessage* ZFITSSingleFileACADACameraEventDataSource:: get_run_header() { if(!run_header_)return nullptr; @@ -407,13 +398,22 @@ get_run_header() return run_header; } -template -typename ZFITSSingleFileACADACameraEventDataSource::config_type -ZFITSSingleFileACADACameraEventDataSource::default_config() +template +DataStreamMessage* ZFITSSingleFileACADACameraEventDataSource:: +get_data_stream() +{ + return copy_message(data_stream_); +} + + +template +typename ZFITSSingleFileACADACameraEventDataSource::config_type +ZFITSSingleFileACADACameraEventDataSource::default_config() { config_type config = config_type::default_instance(); config.set_data_model(default_data_model()); config.set_extension(".fits.fz"); + config.set_data_stream_table_name(default_message_table_name()); config.set_run_header_table_name(default_message_table_name()); config.set_events_table_name(default_message_table_name()); config.set_file_fragment_stride(1); @@ -430,12 +430,13 @@ ZFITSSingleFileACADACameraEventDataSource::default_c // ============================================================================= // ============================================================================= -template -ZFITSACADACameraEventDataSource:: +template +ZFITSACADACameraEventDataSource:: ZFITSACADACameraEventDataSource(const std::string& filename, const config_type& config): calin::io::data_source::BasicChainedRandomAccessDataSource< - ACADACameraEventRandomAccessDataSourceWithRunHeader >( - new ZFITSACADACameraEventDataSourceOpener(filename, config), true), + ACADACameraEventRandomAccessDataSourceWithRunHeader >( + new ZFITSACADACameraEventDataSourceOpener( + filename, config), true), config_(config), run_header_(nullptr) { if(source_) { @@ -457,15 +458,17 @@ ZFITSACADACameraEventDataSource(const std::string& filename, const config_type& } } -template -ZFITSACADACameraEventDataSource:: +template +ZFITSACADACameraEventDataSource:: ~ZFITSACADACameraEventDataSource() { delete run_header_; + delete_message(data_stream_); } -template -HeaderMessage* ZFITSACADACameraEventDataSource::get_run_header() +template +HeaderMessage* ZFITSACADACameraEventDataSource:: +get_run_header() { if(!run_header_)return nullptr; auto* run_header = new HeaderMessage(); @@ -473,8 +476,15 @@ HeaderMessage* ZFITSACADACameraEventDataSource::get_ return run_header; } -template -const EventMessage* ZFITSACADACameraEventDataSource:: +template +DataStreamMessage* ZFITSACADACameraEventDataSource:: +get_data_stream() +{ + return copy_message(data_stream_); +} + +template +const EventMessage* ZFITSACADACameraEventDataSource:: borrow_next_event(uint64_t& seq_index_out) { if(config_.max_seq_index() and seq_index_>=config_.max_seq_index()) @@ -494,8 +504,8 @@ borrow_next_event(uint64_t& seq_index_out) return nullptr; } -template -void ZFITSACADACameraEventDataSource:: +template +void ZFITSACADACameraEventDataSource:: release_borrowed_event(const EventMessage* event) { if(source_) @@ -504,44 +514,39 @@ release_borrowed_event(const EventMessage* event) delete event; } -template -EventMessage* ZFITSACADACameraEventDataSource:: +template +EventMessage* ZFITSACADACameraEventDataSource:: get_next(uint64_t& seq_index_out, google::protobuf::Arena** arena) { if(config_.max_seq_index() and seq_index_>=config_.max_seq_index()) return nullptr; else - return calin::io::data_source::BasicChainedRandomAccessDataSource< - ACADACameraEventRandomAccessDataSourceWithRunHeader >:: - get_next(seq_index_out, arena); + return BaseDataSource::get_next(seq_index_out, arena); } -template -uint64_t ZFITSACADACameraEventDataSource::size() +template +uint64_t ZFITSACADACameraEventDataSource::size() { - uint64_t max_seq_index = calin::io::data_source::BasicChainedRandomAccessDataSource< - ACADACameraEventRandomAccessDataSourceWithRunHeader >::size(); + uint64_t max_seq_index = BaseDataSource::size(); if(config_.max_seq_index() and max_seq_index>config_.max_seq_index()) max_seq_index = config_.max_seq_index(); return max_seq_index; } -template -void ZFITSACADACameraEventDataSource:: +template +void ZFITSACADACameraEventDataSource:: set_next_index(uint64_t next_index) { if(config_.max_seq_index() and next_index>config_.max_seq_index()) next_index = config_.max_seq_index(); - calin::io::data_source::BasicChainedRandomAccessDataSource< - ACADACameraEventRandomAccessDataSourceWithRunHeader >:: - set_next_index(next_index); + BaseDataSource::set_next_index(next_index); } -template -typename ZFITSACADACameraEventDataSource::config_type -ZFITSACADACameraEventDataSource::default_config() +template +typename ZFITSACADACameraEventDataSource::config_type +ZFITSACADACameraEventDataSource::default_config() { - return ZFITSSingleFileACADACameraEventDataSource::default_config(); + return ZFITSSingleFileACADACameraEventDataSource::default_config(); } // ============================================================================= @@ -554,11 +559,11 @@ ZFITSACADACameraEventDataSource::default_config() // ============================================================================= // ============================================================================= -template -ZFITSACADACameraEventDataSourceOpener:: +template +ZFITSACADACameraEventDataSourceOpener:: ZFITSACADACameraEventDataSourceOpener(std::string filename, const config_type& config): calin::io::data_source::DataSourceOpener< - ACADACameraEventRandomAccessDataSourceWithRunHeader >(), + ACADACameraEventRandomAccessDataSourceWithRunHeader >(), config_(config) { const unsigned istride = std::max(1U,config.file_fragment_stride()); @@ -608,30 +613,30 @@ ZFITSACADACameraEventDataSourceOpener(std::string filename, const config_type& c } } -template -ZFITSACADACameraEventDataSourceOpener:: +template +ZFITSACADACameraEventDataSourceOpener:: ~ZFITSACADACameraEventDataSourceOpener() { // nothing to see here } -template -unsigned ZFITSACADACameraEventDataSourceOpener::num_sources() const +template +unsigned ZFITSACADACameraEventDataSourceOpener::num_sources() const { return filenames_.size(); } -template -std::string ZFITSACADACameraEventDataSourceOpener:: +template +std::string ZFITSACADACameraEventDataSourceOpener:: source_name(unsigned isource) const { if(isource >= filenames_.size())return {}; return filenames_[isource]; } -template -ZFITSSingleFileACADACameraEventDataSource* -ZFITSACADACameraEventDataSourceOpener:: +template +ZFITSSingleFileACADACameraEventDataSource* +ZFITSACADACameraEventDataSourceOpener:: open(unsigned isource) { if(isource >= filenames_.size())return nullptr; @@ -641,14 +646,14 @@ open(unsigned isource) if(has_opened_file_)config.set_dont_read_run_header(true); config.set_max_seq_index(0); has_opened_file_ = true; - return new ZFITSSingleFileACADACameraEventDataSource(filenames_[isource], config); + return new ZFITSSingleFileACADACameraEventDataSource(filenames_[isource], config); } -template -typename ZFITSACADACameraEventDataSourceOpener::config_type -ZFITSACADACameraEventDataSourceOpener::default_config() +template +typename ZFITSACADACameraEventDataSourceOpener::config_type +ZFITSACADACameraEventDataSourceOpener::default_config() { - return ZFITSSingleFileACADACameraEventDataSource::default_config(); + return ZFITSSingleFileACADACameraEventDataSource::default_config(); } namespace calin { namespace iact_data { namespace zfits_acada_data_source { @@ -668,8 +673,11 @@ template class ZFITSACADACameraEventDataSourceOpener; template class ZFITSSingleFileSingleMessageDataSource; template class ZFITSSingleFileSingleMessageDataSource; -template class ZFITSSingleFileACADACameraEventDataSource; -template class ZFITSACADACameraEventDataSource; -template class ZFITSACADACameraEventDataSourceOpener; +template class ZFITSSingleFileACADACameraEventDataSource< + ACADA_EventMessage_R1v1, ACADA_HeaderMessage_R1v1, ACADA_DataStreamMessage_R1v1>; +template class ZFITSACADACameraEventDataSource< + ACADA_EventMessage_R1v1, ACADA_HeaderMessage_R1v1, ACADA_DataStreamMessage_R1v1>; +template class ZFITSACADACameraEventDataSourceOpener< + ACADA_EventMessage_R1v1, ACADA_HeaderMessage_R1v1, ACADA_DataStreamMessage_R1v1>; } } } // namespace calin::iact_data::zfits_acada_data_source diff --git a/src/iact_data/zfits_data_source.cpp b/src/iact_data/zfits_data_source.cpp index 0f86ef42..4a251eef 100644 --- a/src/iact_data/zfits_data_source.cpp +++ b/src/iact_data/zfits_data_source.cpp @@ -37,6 +37,20 @@ using calin::util::file::is_file; using calin::util::file::is_readable; using calin::util::file::expand_filename; +namespace { // anonymous + template void delete_message(Message* message) + { + delete message; + } + + template<> void delete_message(void*) + { + // nothing to see here + } +} // anonymous namespace + +#if 0 // UNUSED + // ============================================================================= // ZFITSSingleFileDataSource_R1 - single ZFits file with decoder // Uses ZFITSSingleFileACTL_R1_CameraEventDataSource to read events and @@ -169,25 +183,27 @@ ZFITSSingleFileDataSource::default_config() return calin::iact_data::zfits_acada_data_source:: ZFITSSingleFileACADACameraEventDataSource::default_config(); } +#endif // UNUSED // ============================================================================= // ZFITSDataSource - chained ZFits files with decoder // ============================================================================= -template -ZFITSDataSource:: +template +ZFITSDataSource:: ZFITSDataSource(const std::string& filename, calin::iact_data::acada_event_decoder:: - ACADACameraEventDecoder* decoder, + ACADACameraEventDecoder* decoder, bool adopt_decoder, const config_type& config): TelescopeRandomAccessDataSourceWithRunConfig(), decoder_(decoder), adopt_decoder_(adopt_decoder), acada_zfits_(new calin::iact_data::zfits_acada_data_source:: - ZFITSACADACameraEventDataSource(filename, config)), + ZFITSACADACameraEventDataSource(filename, config)), adopt_acada_zfits_(true) { const EventMessage* acada_sample_event = nullptr; const HeaderMessage* acada_run_header = nullptr; + const DataStreamMessage* acada_data_stream = nullptr; try { acada_zfits_->set_next_index(0); uint64_t unused_seq_index = 0; @@ -200,9 +216,15 @@ ZFITSDataSource(const std::string& filename, } catch(...) { // ignore errors that occur reading run header } + try { + acada_data_stream = acada_zfits_->get_data_stream(); + } catch(...) { + // ignore errors that occur reading run header + } run_config_ = new TelescopeRunConfiguration; - decoder_->decode_run_config(run_config_, acada_run_header, acada_sample_event); + decoder_->decode_run_config(run_config_, acada_run_header, acada_sample_event, acada_data_stream); delete acada_run_header; + delete_message(acada_data_stream); if(acada_sample_event)acada_zfits_->release_borrowed_event(acada_sample_event); run_config_->clear_fragment_filename(); for(const auto& ffn : acada_zfits_->all_fragment_names()) { @@ -213,31 +235,32 @@ ZFITSDataSource(const std::string& filename, acada_zfits_->set_next_index(0); } -template -ZFITSDataSource:: +template +ZFITSDataSource:: ZFITSDataSource(const std::string& filename, - ZFITSDataSource* base_datasource, const config_type& config): + ZFITSDataSource* base_datasource, + const config_type& config): TelescopeRandomAccessDataSourceWithRunConfig(), decoder_(base_datasource->decoder_->clone()), adopt_decoder_(true), acada_zfits_(new calin::iact_data::zfits_acada_data_source:: - ZFITSACADACameraEventDataSource(filename, config)), + ZFITSACADACameraEventDataSource(filename, config)), adopt_acada_zfits_(true), run_config_(base_datasource->get_run_configuration()) { // nothing to see here } -template -ZFITSDataSource::~ZFITSDataSource() +template +ZFITSDataSource::~ZFITSDataSource() { delete run_config_; if(adopt_acada_zfits_)delete acada_zfits_; if(adopt_decoder_)delete decoder_; } -template +template calin::ix::iact_data::telescope_event::TelescopeEvent* -ZFITSDataSource::get_next( +ZFITSDataSource::get_next( uint64_t& seq_index_out, google::protobuf::Arena** arena) { const EventMessage* cta_event = @@ -272,21 +295,22 @@ ZFITSDataSource::get_next( return event; } -template -uint64_t ZFITSDataSource::size() +template +uint64_t ZFITSDataSource::size() { return acada_zfits_->size(); } -template -void ZFITSDataSource::set_next_index(uint64_t next_index) +template +void ZFITSDataSource:: +set_next_index(uint64_t next_index) { acada_zfits_->set_next_index(next_index); } -template +template calin::ix::iact_data::telescope_run_configuration::TelescopeRunConfiguration* -ZFITSDataSource::get_run_configuration() +ZFITSDataSource::get_run_configuration() { if(!run_config_)return nullptr; auto* run_config = new TelescopeRunConfiguration(); @@ -294,33 +318,37 @@ ZFITSDataSource::get_run_configuration() return run_config; } -template -unsigned ZFITSDataSource::current_fragment_index() const +template +unsigned ZFITSDataSource:: +current_fragment_index() const { return acada_zfits_->current_fragment_index(); } -template -unsigned ZFITSDataSource::num_fragments() const +template +unsigned ZFITSDataSource:: +num_fragments() const { return acada_zfits_->num_fragments(); } -template -std::string ZFITSDataSource::fragment_name(unsigned index) const +template +std::string ZFITSDataSource:: +fragment_name(unsigned index) const { return acada_zfits_->fragment_name(index); } namespace calin { namespace iact_data { namespace zfits_data_source { -template class ZFITSSingleFileDataSource; +// template class ZFITSSingleFileDataSource; template class ZFITSDataSource; -template class ZFITSSingleFileDataSource; +// template class ZFITSSingleFileDataSource; template class ZFITSDataSource; -template class ZFITSSingleFileDataSource; -template class ZFITSDataSource; +// template class ZFITSSingleFileDataSource; +template class ZFITSDataSource< + ACADA_EventMessage_R1v1, ACADA_HeaderMessage_R1v1, ACADA_DataStreamMessage_R1v1>; } } } // namespace calin::iact_data::zfits_data_source diff --git a/src/provenance/chronicle.cpp b/src/provenance/chronicle.cpp index 1c4ed238..457aae74 100644 --- a/src/provenance/chronicle.cpp +++ b/src/provenance/chronicle.cpp @@ -112,8 +112,10 @@ register_file_open(const std::string& file_name, void calin::provenance::chronicle:: register_file_close(calin::ix::provenance::chronicle::FileIORecord* record) { - calin::util::timestamp::Timestamp ts = calin::util::timestamp::Timestamp::now(); - ts.as_proto(record->mutable_close_timestamp()); + if(record) { + calin::util::timestamp::Timestamp ts = calin::util::timestamp::Timestamp::now(); + ts.as_proto(record->mutable_close_timestamp()); + } } calin::ix::provenance::chronicle::NetworkIORecord* calin::provenance::chronicle:: @@ -139,10 +141,12 @@ void calin::provenance::chronicle:: register_network_close(calin::ix::provenance::chronicle::NetworkIORecord* record, int64_t nbytes_received, int64_t nbytes_sent) { - calin::util::timestamp::Timestamp ts = calin::util::timestamp::Timestamp::now(); - ts.as_proto(record->mutable_close_timestamp()); - if(nbytes_received>=0)record->set_nbytes_received(nbytes_received); - if(nbytes_sent>=0)record->set_nbytes_sent(nbytes_sent); + if(record) { + calin::util::timestamp::Timestamp ts = calin::util::timestamp::Timestamp::now(); + ts.as_proto(record->mutable_close_timestamp()); + if(nbytes_received>=0)record->set_nbytes_received(nbytes_received); + if(nbytes_sent>=0)record->set_nbytes_sent(nbytes_sent); + } } calin::ix::provenance::chronicle::RNGRecord* calin::provenance::chronicle:: @@ -221,9 +225,11 @@ register_external_rng_open(uint64_t seed, const std::string& rng_type, void calin::provenance::chronicle:: register_rng_close(calin::ix::provenance::chronicle::RNGRecord* record, uint64_t ncore_calls) { - calin::util::timestamp::Timestamp ts = calin::util::timestamp::Timestamp::now(); - ts.as_proto(record->mutable_close_timestamp()); - if(ncore_calls>=0)record->set_ncore_calls(ncore_calls); + if(record) { + calin::util::timestamp::Timestamp ts = calin::util::timestamp::Timestamp::now(); + ts.as_proto(record->mutable_close_timestamp()); + if(ncore_calls>=0)record->set_ncore_calls(ncore_calls); + } } calin::ix::provenance::chronicle::CommandLineProcessingRecord* @@ -271,6 +277,8 @@ calin::provenance::chronicle::register_processing_start( void calin::provenance::chronicle::register_processing_finish( calin::ix::provenance::chronicle::ProcessingRecord* record) { - calin::util::timestamp::Timestamp ts = calin::util::timestamp::Timestamp::now(); - ts.as_proto(record->mutable_close_timestamp()); + if(record) { + calin::util::timestamp::Timestamp ts = calin::util::timestamp::Timestamp::now(); + ts.as_proto(record->mutable_close_timestamp()); + } } diff --git a/swig/iact_data/acada_event_decoder.i b/swig/iact_data/acada_event_decoder.i index ca9b7677..496714ab 100644 --- a/swig/iact_data/acada_event_decoder.i +++ b/swig/iact_data/acada_event_decoder.i @@ -60,7 +60,8 @@ %template(ACADACameraEventDecoder_R1v1) calin::iact_data::acada_event_decoder::ACADACameraEventDecoder< calin::iact_data::acada_data_source::ACADA_EventMessage_R1v1, - calin::iact_data::acada_data_source::ACADA_HeaderMessage_R1v1>; + calin::iact_data::acada_data_source::ACADA_HeaderMessage_R1v1, + calin::iact_data::acada_data_source::ACADA_DataStreamMessage_R1v1>; %import %include diff --git a/swig/iact_data/raw_acada_event_data_source.i b/swig/iact_data/raw_acada_event_data_source.i index c6f5840b..52a855cb 100644 --- a/swig/iact_data/raw_acada_event_data_source.i +++ b/swig/iact_data/raw_acada_event_data_source.i @@ -469,43 +469,51 @@ namespace calin::iact_data::acada_data_source { %template(ACADACameraEventDataSourceWithRunHeader_R1v1) calin::iact_data::acada_data_source::ACADACameraEventDataSourceWithRunHeader< calin::iact_data::acada_data_source::ACADA_EventMessage_R1v1, - calin::iact_data::acada_data_source::ACADA_HeaderMessage_R1v1>; + calin::iact_data::acada_data_source::ACADA_HeaderMessage_R1v1, + calin::iact_data::acada_data_source::ACADA_DataStreamMessage_R1v1>; %template(ACADACameraEventRandomAccessDataSourceWithRunHeader_R1v1) calin::iact_data::acada_data_source::ACADACameraEventRandomAccessDataSourceWithRunHeader< calin::iact_data::acada_data_source::ACADA_EventMessage_R1v1, - calin::iact_data::acada_data_source::ACADA_HeaderMessage_R1v1>; + calin::iact_data::acada_data_source::ACADA_HeaderMessage_R1v1, + calin::iact_data::acada_data_source::ACADA_DataStreamMessage_R1v1>; %template(DataSourceOpener_R1v1) calin::io::data_source::DataSourceOpener< calin::iact_data::acada_data_source::ACADACameraEventRandomAccessDataSourceWithRunHeader< calin::iact_data::acada_data_source::ACADA_EventMessage_R1v1, - calin::iact_data::acada_data_source::ACADA_HeaderMessage_R1v1> >; + calin::iact_data::acada_data_source::ACADA_HeaderMessage_R1v1, + calin::iact_data::acada_data_source::ACADA_DataStreamMessage_R1v1> >; %template(BasicChainedDataSource_ACADACameraEventRandomAccessDataSourceWithRunHeader_R1v1) calin::io::data_source::BasicChainedDataSource< calin::iact_data::acada_data_source::ACADACameraEventRandomAccessDataSourceWithRunHeader< calin::iact_data::acada_data_source::ACADA_EventMessage_R1v1, - calin::iact_data::acada_data_source::ACADA_HeaderMessage_R1v1> >; + calin::iact_data::acada_data_source::ACADA_HeaderMessage_R1v1, + calin::iact_data::acada_data_source::ACADA_DataStreamMessage_R1v1> >; %template(BasicChainedRandomAccessDataSource_ACADACameraEventRandomAccessDataSourceWithRunHeader_R1v1) calin::io::data_source::BasicChainedRandomAccessDataSource< calin::iact_data::acada_data_source::ACADACameraEventRandomAccessDataSourceWithRunHeader< calin::iact_data::acada_data_source::ACADA_EventMessage_R1v1, - calin::iact_data::acada_data_source::ACADA_HeaderMessage_R1v1> >; + calin::iact_data::acada_data_source::ACADA_HeaderMessage_R1v1, + calin::iact_data::acada_data_source::ACADA_DataStreamMessage_R1v1> >; %template(ZFITSACADACameraEventDataSourceOpener_R1v1) calin::iact_data::zfits_acada_data_source::ZFITSACADACameraEventDataSourceOpener< calin::iact_data::acada_data_source::ACADA_EventMessage_R1v1, - calin::iact_data::acada_data_source::ACADA_HeaderMessage_R1v1>; + calin::iact_data::acada_data_source::ACADA_HeaderMessage_R1v1, + calin::iact_data::acada_data_source::ACADA_DataStreamMessage_R1v1>; %template(ZFITSSingleFileACADACameraEventDataSource_R1v1) calin::iact_data::zfits_acada_data_source::ZFITSSingleFileACADACameraEventDataSource< calin::iact_data::acada_data_source::ACADA_EventMessage_R1v1, - calin::iact_data::acada_data_source::ACADA_HeaderMessage_R1v1>; + calin::iact_data::acada_data_source::ACADA_HeaderMessage_R1v1, + calin::iact_data::acada_data_source::ACADA_DataStreamMessage_R1v1>; %template(ZFITSACADACameraEventDataSource_R1v1) calin::iact_data::zfits_acada_data_source::ZFITSACADACameraEventDataSource< calin::iact_data::acada_data_source::ACADA_EventMessage_R1v1, - calin::iact_data::acada_data_source::ACADA_HeaderMessage_R1v1>; + calin::iact_data::acada_data_source::ACADA_HeaderMessage_R1v1, + calin::iact_data::acada_data_source::ACADA_DataStreamMessage_R1v1>; %template(ZFITSSingleFileSingleMessageDataSource_ACADAEventMessage_R1v1) calin::iact_data::zfits_acada_data_source::