Skip to content

Commit

Permalink
Add r1v1 nectarcam decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
sfegan committed Sep 20, 2024
1 parent cb87c72 commit fb6e83f
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 7 deletions.
54 changes: 54 additions & 0 deletions include/iact_data/nectarcam_acada_event_decoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <iact_data/nectarcam_data_source.pb.h>
#include <iact_data/acada_data_source.hpp>
#include <iact_data/acada_event_decoder.hpp>
#include <iact_data/unified_acada_event_decoder.hpp>

namespace calin { namespace iact_data { namespace nectarcam_acada_event_decoder {

Expand Down Expand Up @@ -194,4 +195,57 @@ class NectarCam_ACADACameraEventDecoder_R1v0:
int64_t run_start_time_ = 0;
};

/*
RRRRRRRRRRRRRRRRR 1111111 1111111
R::::::::::::::::R 1::::::1 1::::::1
R::::::RRRRRR:::::R 1:::::::1 1:::::::1
RR:::::R R:::::R111:::::1 111:::::1
R::::R R:::::R 1::::1vvvvvvv vvvvvvv1::::1
R::::R R:::::R 1::::1 v:::::v v:::::v 1::::1
R::::RRRRRR:::::R 1::::1 v:::::v v:::::v 1::::1
R:::::::::::::RR 1::::l v:::::v v:::::v 1::::l
R::::RRRRRR:::::R 1::::l v:::::v v:::::v 1::::l
R::::R R:::::R 1::::l v:::::v v:::::v 1::::l
R::::R R:::::R 1::::l v:::::v:::::v 1::::l
R::::R R:::::R 1::::l v:::::::::v 1::::l
RR:::::R R:::::R111::::::111 v:::::::v 111::::::111
R::::::R R:::::R1::::::::::1 v:::::v 1::::::::::1
R::::::R R:::::R1::::::::::1 v:::v 1::::::::::1
RRRRRRRR RRRRRRR111111111111 vvv 111111111111
*/

class NectarCam_ACADACameraEventDecoder_R1v1:
public calin::iact_data::unified_acada_event_decoder::Unified_ACADACameraEventDecoder_R1v1
{
public:
CALIN_TYPEALIAS(config_type,
calin::iact_data::unified_acada_event_decoder::Unified_ACADACameraEventDecoder_R1v1::config_type);

CALIN_TYPEALIAS(message_set_type, calin::iact_data::acada_data_source::ACADA_MessageSet_R1v1);
CALIN_TYPEALIAS(event_type, calin::iact_data::acada_data_source::ACADA_MessageSet_R1v1::event_type);
CALIN_TYPEALIAS(header_type, calin::iact_data::acada_data_source::ACADA_MessageSet_R1v1::header_type);
CALIN_TYPEALIAS(data_stream_type, calin::iact_data::acada_data_source::ACADA_MessageSet_R1v1::data_stream_type);

NectarCam_ACADACameraEventDecoder_R1v1(const std::string& filename,
const config_type& config = default_config());

~NectarCam_ACADACameraEventDecoder_R1v1();

virtual bool decode(
calin::ix::iact_data::telescope_event::TelescopeEvent* event,
const calin::iact_data::acada_data_source::ACADA_MessageSet_R1v1& cta_messages) override;

bool decode_run_config(
calin::ix::iact_data::telescope_run_configuration:: TelescopeRunConfiguration* run_config,
const calin::iact_data::acada_data_source::ACADA_MessageSet_R1v1& cta_messages) override;

NectarCam_ACADACameraEventDecoder_R1v1* clone() const override;

protected:
};


} } } // namespace calin::iact_data::nectarcam_acada_event_decoder
8 changes: 1 addition & 7 deletions src/iact_data/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ set(CALIN_SOURCES algorithms.cpp
acada_event_decoder.cpp
nectarcam_acada_event_decoder_l0.cpp
nectarcam_acada_event_decoder_r1v0.cpp
nectarcam_acada_event_decoder_r1v1.cpp
lstcam_acada_event_decoder_r1v0.cpp
unified_acada_event_decoder_r1v1.cpp
cta_acada_event_decoder_r1v0.cpp
Expand All @@ -36,13 +37,6 @@ set(CALIN_SOURCES algorithms.cpp
lstcam_data_source.cpp
cta_data_source.cpp)


if(CTA_CAMERASTOACTL_FOUND)
set(CALIN_SOURCES ${CALIN_SOURCES}

)
endif()

add_library(${CALIN_TARGET_LIBRARY} SHARED ${CALIN_SOURCES})
target_link_libraries(${CALIN_TARGET_LIBRARY}
calin_proto_io calin_proto_iact_data calin_io calin_math calin_util)
Expand Down
107 changes: 107 additions & 0 deletions src/iact_data/nectarcam_acada_event_decoder_r1v1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*
calin/iact_data/nectarcam_acada_event_decoder_r1v0.cpp -- Stephen Fegan -- 2018-09-21
A decoder of NectarCAM ACADA data in prototype R1 format
Copyright 2016, Stephen Fegan <[email protected]>
Laboratoire Leprince-Ringuet, CNRS/IN2P3, Ecole Polytechnique, Institut Polytechnique de Paris
This file is part of "calin"
"calin" is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 or
later, as published by the Free Software Foundation.
"calin" is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
*/

#include <stdexcept>
#include <string>
#include <memory>
#include <numeric>

#include <util/log.hpp>
#include <util/file.hpp>
#include <iact_data/acada_data_source.hpp>
#include <iact_data/nectarcam_acada_event_decoder.hpp>
#include <iact_data/nectarcam_layout.hpp>
#include <iact_data/nectarcam_configuration.hpp>
#include <provenance/system_info.hpp>

using namespace calin::iact_data::acada_data_source;
using namespace calin::iact_data::nectarcam_acada_event_decoder;
using namespace calin::ix::iact_data::telescope_event;
using namespace calin::ix::iact_data::telescope_run_configuration;
using namespace calin::util::log;

/*
RRRRRRRRRRRRRRRRR 1111111 1111111
R::::::::::::::::R 1::::::1 1::::::1
R::::::RRRRRR:::::R 1:::::::1 1:::::::1
RR:::::R R:::::R111:::::1 111:::::1
R::::R R:::::R 1::::1vvvvvvv vvvvvvv1::::1
R::::R R:::::R 1::::1 v:::::v v:::::v 1::::1
R::::RRRRRR:::::R 1::::1 v:::::v v:::::v 1::::1
R:::::::::::::RR 1::::l v:::::v v:::::v 1::::l
R::::RRRRRR:::::R 1::::l v:::::v v:::::v 1::::l
R::::R R:::::R 1::::l v:::::v v:::::v 1::::l
R::::R R:::::R 1::::l v:::::v:::::v 1::::l
R::::R R:::::R 1::::l v:::::::::v 1::::l
RR:::::R R:::::R111::::::111 v:::::::v 111::::::111
R::::::R R:::::R1::::::::::1 v:::::v 1::::::::::1
R::::::R R:::::R1::::::::::1 v:::v 1::::::::::1
RRRRRRRR RRRRRRR111111111111 vvv 111111111111
*/

NectarCam_ACADACameraEventDecoder_R1v1::
NectarCam_ACADACameraEventDecoder_R1v1(const std::string& filename,
const config_type& config):
calin::iact_data::unified_acada_event_decoder::Unified_ACADACameraEventDecoder_R1v1(filename, config)
{
// nothing to see here
}

NectarCam_ACADACameraEventDecoder_R1v1::
~NectarCam_ACADACameraEventDecoder_R1v1()
{
// nothing to see here
}

bool NectarCam_ACADACameraEventDecoder_R1v1::decode(
calin::ix::iact_data::telescope_event::TelescopeEvent* event,
const calin::iact_data::acada_data_source::ACADA_MessageSet_R1v1& cta_messages)
{
if(not Unified_ACADACameraEventDecoder_R1v1::decode(event, cta_messages)) {
return false;
}

// do more work

return true;
}

bool NectarCam_ACADACameraEventDecoder_R1v1::decode_run_config(
calin::ix::iact_data::telescope_run_configuration:: TelescopeRunConfiguration* run_config,
const calin::iact_data::acada_data_source::ACADA_MessageSet_R1v1& cta_messages)
{
if(not Unified_ACADACameraEventDecoder_R1v1::decode_run_config(run_config, cta_messages)) {
return false;
}

// do more work

return true;
}

NectarCam_ACADACameraEventDecoder_R1v1* NectarCam_ACADACameraEventDecoder_R1v1::clone() const
{
return new NectarCam_ACADACameraEventDecoder_R1v1(*this);
}
3 changes: 3 additions & 0 deletions src/iact_data/unified_acada_event_decoder_r1v1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@ decode(calin::ix::iact_data::telescope_event::TelescopeEvent* calin_event,
calin_event->set_camera_clock_index(8,-1);
}

// **************************************************************************
// Clean up
// **************************************************************************

while(calin_event->camera_clock_size()>camera_clock_index) {
calin_event->mutable_camera_clock()->RemoveLast();
Expand Down

0 comments on commit fb6e83f

Please sign in to comment.