Skip to content

Commit

Permalink
Keep moving ACTL to ACADA
Browse files Browse the repository at this point in the history
  • Loading branch information
sfegan committed Sep 11, 2024
1 parent 1c1b72e commit 5bfadcf
Show file tree
Hide file tree
Showing 13 changed files with 119 additions and 139 deletions.
4 changes: 4 additions & 0 deletions include/iact_data/acada_event_decoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,9 @@ CALIN_TYPEALIAS(ACADACameraEventDecoder_R1v0,
*/

CALIN_TYPEALIAS(ACADACameraEventDecoder_R1v1,
ACADACameraEventDecoder<
calin::iact_data::acada_data_source::ACADA_EventMessage_R1v1,
calin::iact_data::acada_data_source::ACADA_HeaderMessage_R1v1>);

} } } // namespace calin::iact_data::acada_event_decoder
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
calin/iact_data/nectarcam_actl_event_decoder.hpp -- Stephen Fegan -- 2016-01-11
calin/iact_data/nectarcam_acada_event_decoder.hpp -- Stephen Fegan -- 2016-01-11
A supplier of single telescope data from NectarCam DAQ data files
Expand All @@ -27,11 +27,10 @@
#include <calin_global_definitions.hpp>
#include <calin_global_config.hpp>
#include <iact_data/nectarcam_data_source.pb.h>
#include <iact_data/zfits_data_source.hpp>
#include <iact_data/acada_data_source.hpp>
#include <iact_data/acada_event_decoder.hpp>

namespace calin { namespace iact_data { namespace nectarcam_actl_event_decoder {

#ifdef CALIN_HAVE_CTA_CAMERASTOACTL
namespace calin { namespace iact_data { namespace nectarcam_acada_event_decoder {

/*
Expand All @@ -54,56 +53,56 @@ namespace calin { namespace iact_data { namespace nectarcam_actl_event_decoder {
*/

class NectarCam_ACTL_L0_CameraEventDecoder:
public actl_event_decoder::ACTL_L0_CameraEventDecoder
class NectarCam_ACADACameraEventDecoder_L0:
public calin::iact_data::acada_event_decoder::ACADACameraEventDecoder_L0
{
public:
CALIN_TYPEALIAS(config_type, calin::ix::iact_data::
nectarcam_data_source::NectarCamCameraEventDecoderConfig);

NectarCam_ACTL_L0_CameraEventDecoder(const std::string& filename, unsigned run_number = 0,
using calin::iact_data::acada_event_decoder::ACADACameraEventDecoder_L0::event_type;
using calin::iact_data::acada_event_decoder::ACADACameraEventDecoder_L0::header_type;

NectarCam_ACADACameraEventDecoder_L0(const std::string& filename, unsigned run_number = 0,
const calin::ix::iact_data::nectarcam_data_source::NectarCamCameraEventDecoderConfig& config = default_config());

//void set_config(const config_type& config) { config_.CopyFrom(config); }
calin::ix::iact_data::nectarcam_data_source::NectarCamCameraEventDecoderConfig config() const { return config_; }
//config_type* mutable_config() { return &config_; }
static calin::ix::iact_data::nectarcam_data_source::NectarCamCameraEventDecoderConfig default_config() {
config_type config = config_type::default_instance();
config.set_nmc_xml_suffix(".NMC.xml");
config.set_separate_channel_waveforms(true);
return config;
}

virtual ~NectarCam_ACTL_L0_CameraEventDecoder();
virtual ~NectarCam_ACADACameraEventDecoder_L0();

bool decode(
calin::ix::iact_data::telescope_event::TelescopeEvent* event,
const DataModel::CameraEvent* cta_event) override;
const event_type* cta_event) override;

bool decode_run_config(
calin::ix::iact_data::telescope_run_configuration::
TelescopeRunConfiguration* run_config,
const DataModel::CameraRunHeader* cta_run_header,
const DataModel::CameraEvent* cta_event) override;
const header_type* cta_run_header, const event_type* cta_event) override;

NectarCam_ACTL_L0_CameraEventDecoder* clone() const override;
NectarCam_ACADACameraEventDecoder_L0* clone() const override;

protected:
void copy_single_gain_integrals(const DataModel::CameraEvent* cta_event,
void copy_single_gain_integrals(const event_type* cta_event,
const calin::ix::iact_data::telescope_event::TelescopeEvent* calin_event,
const DataModel::PixelsChannel& cta_image,
const ProtoDataModel::PixelsChannel& cta_image,
calin::ix::iact_data::telescope_event::DigitizedSkyImage* calin_image,
const std::string& which_gain,
calin::ix::iact_data::telescope_event::SignalType signal_type) const;

virtual void copy_single_gain_waveforms(const DataModel::CameraEvent* cta_event,
virtual void copy_single_gain_waveforms(const event_type* cta_event,
const calin::ix::iact_data::telescope_event::TelescopeEvent* calin_event,
const DataModel::PixelsChannel& cta_image,
const ProtoDataModel::PixelsChannel& cta_image,
calin::ix::iact_data::telescope_event::DigitizedSkyImage* calin_image,
const std::string& which_gain,
calin::ix::iact_data::telescope_event::SignalType signal_type) const;

unsigned get_nmod_from_event(const DataModel::CameraEvent* cta_event) const;
unsigned get_nmod_from_event(const ProtoDataModel::CameraEvent* cta_event) const;

config_type config_;
std::string filename_;
Expand Down Expand Up @@ -133,29 +132,31 @@ class NectarCam_ACTL_L0_CameraEventDecoder:
*/

class NectarCam_ACTL_R1_CameraEventDecoder:
public actl_event_decoder::ACTL_R1_CameraEventDecoder
class NectarCam_ACADACameraEventDecoder_R1v0:
public calin::iact_data::acada_event_decoder::ACADACameraEventDecoder_R1v0
{
public:
CALIN_TYPEALIAS(config_type, calin::ix::iact_data::
nectarcam_data_source::NectarCamCameraEventDecoderConfig);

NectarCam_ACTL_R1_CameraEventDecoder(const std::string& filename, unsigned run_number = 0,
using calin::iact_data::acada_event_decoder::ACADACameraEventDecoder_R1v0::event_type;
using calin::iact_data::acada_event_decoder::ACADACameraEventDecoder_R1v0::header_type;

NectarCam_ACADACameraEventDecoder_R1v0(const std::string& filename, unsigned run_number = 0,
const config_type& config = default_config());

~NectarCam_ACTL_R1_CameraEventDecoder();
~NectarCam_ACADACameraEventDecoder_R1v0();

virtual bool decode(
calin::ix::iact_data::telescope_event::TelescopeEvent* event,
const R1::CameraEvent* cta_event) override;
const event_type* cta_event) override;

virtual bool decode_run_config(
calin::ix::iact_data::telescope_run_configuration::
TelescopeRunConfiguration* run_config,
const R1::CameraConfiguration* cta_run_header,
const R1::CameraEvent* cta_event) override;
const header_type* cta_run_header, const event_type* cta_event) override;

NectarCam_ACTL_R1_CameraEventDecoder* clone() const override;
NectarCam_ACADACameraEventDecoder_R1v0* clone() const override;

calin::ix::iact_data::nectarcam_data_source::NectarCamCameraEventDecoderConfig config() const { return config_; }

Expand All @@ -167,17 +168,17 @@ class NectarCam_ACTL_R1_CameraEventDecoder:
}

protected:
void copy_single_gain_integrals(const DataModel::CameraEvent* cta_event,
void copy_single_gain_integrals(const event_type* cta_event,
const calin::ix::iact_data::telescope_event::TelescopeEvent* calin_event,
const DataModel::PixelsChannel& cta_image,
const int16_t* cta_charges, const uint8_t* cta_pixel_mask,
calin::ix::iact_data::telescope_event::DigitizedSkyImage* calin_image,
const std::string& which_gain) const;

void copy_single_gain_waveforms(
const calin::ix::iact_data::telescope_event::TelescopeEvent* calin_event,
const int16_t* cta_waveforms, const uint8_t* cta_pixel_mask,
calin::ix::iact_data::telescope_event::Waveforms* calin_waveforms,
uint8 has_gain_mask, const std::string& which_gain) const;
uint8_t has_gain_mask, const std::string& which_gain) const;

config_type config_;
std::string filename_;
Expand All @@ -189,6 +190,4 @@ class NectarCam_ACTL_R1_CameraEventDecoder:
int64_t run_start_time_ = 0;
};

#endif

} } } // namespace calin::iact_data::nectarcam_data_source
} } } // namespace calin::iact_data::nectarcam_acada_event_decoder
4 changes: 2 additions & 2 deletions include/iact_data/nectarcam_data_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include <calin_global_definitions.hpp>
#include <calin_global_config.hpp>
#include <iact_data/nectarcam_actl_event_decoder.hpp>
#include <iact_data/nectarcam_acada_event_decoder.hpp>
#include <iact_data/nectarcam_data_source.pb.h>
#include <iact_data/zfits_data_source.hpp>
#include <pattern/delegation.hpp>
Expand Down Expand Up @@ -173,7 +173,7 @@ class NectarCamZFITSDataSource:

static calin::ix::iact_data::zfits_data_source::ZFITSDataSourceConfig default_config() {
config_type config = NectarCamZFITSDataSource_R1::default_config();
config.set_data_model(calin::ix::iact_data::zfits_data_source::ACTL_DATA_MODEL_AUTO_DETECT);
config.set_data_model(calin::ix::iact_data::zfits_data_source::ACADA_DATA_MODEL_AUTO_DETECT);
config.set_run_header_table_name(""); // Differs between L0 and R1 so let downstream decode
return config;
}
Expand Down
2 changes: 1 addition & 1 deletion proto/iact_data/telescope_event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ enum ImageTreatmentMode {

enum SerializedRawEventType {
SERIALIZED_RAW_EVENT_NONE = 0;
SERIALIZED_RAW_EVENT_ACTL_PROTOBUF = 1;
SERIALIZED_RAW_EVENT_ACADA_PROTOBUF = 1;
};

message TelescopeEvent {
Expand Down
5 changes: 3 additions & 2 deletions proto/iact_data/telescope_run_configuration.proto
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ package calin.ix.iact_data.telescope_run_configuration;

enum SerializedRawHeaderType {
SERIALIZED_RAW_HEADER_NONE = 0;
SERIALIZED_RAW_HEADER_ACTL_L0_PROTOBUF = 1;
SERIALIZED_RAW_HEADER_ACTL_R1_PROTOBUF = 2;
SERIALIZED_RAW_HEADER_ACADA_L0_PROTOBUF = 1;
SERIALIZED_RAW_HEADER_ACADA_R1V0_PROTOBUF = 2;
SERIALIZED_RAW_HEADER_ACADA_R1V1_PROTOBUF = 3;
};

message TelescopeRunConfiguration {
Expand Down
6 changes: 4 additions & 2 deletions src/iact_data/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ set(CALIN_SOURCES algorithms.cpp
lstcam_layout.cpp
waveform_treatment_event_visitor.cpp waveform_treatment_event_visitor_impl.cpp
nectarcam_ancillary_data.cpp
acada_data_source.cpp zfits_acada_data_source.cpp acada_event_decoder.cpp
acada_data_source.cpp zfits_acada_data_source.cpp
acada_event_decoder.cpp
nectarcam_acada_event_decoder_r1v0.cpp
zfits_data_source.cpp)


if(CTA_CAMERASTOACTL_FOUND)
set(CALIN_SOURCES ${CALIN_SOURCES}
actl_event_decoder.cpp
nectarcam_actl_l0_event_decoder.cpp nectarcam_actl_r1_event_decoder.cpp
nectarcam_actl_l0_event_decoder.cpp
lstcam_actl_r1_event_decoder.cpp
cta_actl_r1_event_decoder.cpp
zfits_actl_l0_data_source.cpp zfits_actl_r1_data_source.cpp
Expand Down
Loading

0 comments on commit 5bfadcf

Please sign in to comment.