LCOV - code coverage report
Current view: top level - trigger/plugins - DataSubscriberModule.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 54 0
Test Date: 2025-12-21 13:07:08 Functions: 0.0 % 13 0

            Line data    Source code
       1              : /**
       2              :  * @file DataSubscriberModule.cpp DataSubscriberModule class implementation
       3              :  *
       4              :  * This is part of the DUNE DAQ , copyright 2020.
       5              :  * Licensing/copyright details are in the COPYING file that you should have
       6              :  * received with this code.
       7              :  */
       8              : #include "DataSubscriberModule.hpp"
       9              : #include "logging/Logging.hpp"
      10              : 
      11              : #include "datahandlinglibs/ReadoutLogging.hpp"
      12              : #include "datahandlinglibs/DataHandlingIssues.hpp"
      13              : #include "datahandlinglibs/models/DataSubscriberModel.hpp"
      14              : #include "trigger/HSISourceModel.hpp"
      15              : 
      16              : #include "appmodel/DataSubscriberModule.hpp"
      17              : 
      18              : #include "trigger/TriggerPrimitiveTypeAdapter.hpp"
      19              : #include "trigger/TAWrapper.hpp"
      20              : #include "trigger/TCWrapper.hpp"
      21              : #include "trigger/TPSet.hpp"
      22              : #include "trgdataformats/TriggerPrimitive.hpp"
      23              : #include "triggeralgs/TriggerActivity.hpp"
      24              : #include "triggeralgs/TriggerCandidate.hpp"
      25              : 
      26              : using namespace dunedaq::datahandlinglibs::logging;
      27              : 
      28              : namespace dunedaq {
      29              : 
      30              : 
      31              : //DUNE_DAQ_TYPESTRING(dunedaq::trigger::TPSet, "TPSet")
      32              : DUNE_DAQ_TYPESTRING(dunedaq::trigger::TriggerPrimitiveTypeAdapter, "TriggerPrimitive")
      33            0 : DUNE_DAQ_TYPESTRING(std::vector<dunedaq::trigger::TriggerPrimitiveTypeAdapter>, "TriggerPrimitiveVector")
      34              : DUNE_DAQ_TYPESTRING(dunedaq::trigger::TAWrapper, "TriggerActivity")
      35              : DUNE_DAQ_TYPESTRING(dunedaq::trigger::TCWrapper, "TriggerCandidate")
      36              : 
      37              : namespace trigger {
      38              : 
      39            0 : DataSubscriberModule::DataSubscriberModule(const std::string& name)
      40            0 :   : DAQModule(name), m_source_concept(nullptr)
      41              : {
      42              : 
      43            0 :   inherited_mod::register_command("start", &DataSubscriberModule::do_start);
      44            0 :   inherited_mod::register_command("stop_trigger_sources", &DataSubscriberModule::do_stop);
      45            0 : }
      46              : 
      47              : void
      48            0 : DataSubscriberModule::init(std::shared_ptr<appfwk::ConfigurationManager> cfg)
      49              : {
      50            0 :   TLOG_DEBUG(TLVL_ENTER_EXIT_METHODS) << get_name() << ": Entering init() method";
      51            0 :   auto ini = cfg->get_dal<confmodel::DaqModule>(get_name());
      52            0 :   if (ini->get_outputs().size() != 1) {
      53            0 :     throw datahandlinglibs::InitializationError(ERS_HERE, "Only 1 output supported for subscribers");
      54              :   }
      55            0 :   if (ini->get_inputs().size() != 1) {
      56            0 :     throw datahandlinglibs::InitializationError(ERS_HERE, "Only 1 input supported for subscribers");
      57              :   }
      58            0 :   m_source_concept = create_data_subscriber(ini);
      59            0 :   register_node(get_name(), m_source_concept); 
      60            0 :   m_source_concept->init(ini);
      61            0 :   TLOG_DEBUG(TLVL_ENTER_EXIT_METHODS) <<  ": Exiting init() method";
      62            0 : }
      63              : 
      64              : void
      65            0 : DataSubscriberModule::do_start(const CommandData_t& /*args*/)
      66              : {
      67            0 :   m_source_concept->start();
      68            0 : }
      69              : 
      70              : void
      71            0 : DataSubscriberModule::do_stop(const CommandData_t& /*args*/)
      72              : {
      73            0 :   m_source_concept->stop();
      74            0 : }
      75              : 
      76              : std::shared_ptr<datahandlinglibs::SourceConcept>
      77            0 : DataSubscriberModule::create_data_subscriber(const confmodel::DaqModule* cfg)
      78              : {
      79              :  
      80            0 :   auto datatypes = cfg->get_outputs()[0]->get_data_type();
      81            0 :   auto raw_dt = cfg->get_inputs()[0]->get_data_type();
      82              :   
      83            0 :   if (raw_dt == "TPSet") {
      84            0 :     TLOG_DEBUG(1) << "Creating trigger primitives subscriber";
      85            0 :     auto source_model =
      86            0 :       std::make_shared<datahandlinglibs::DataSubscriberModel<std::vector<TriggerPrimitiveTypeAdapter>>>();
      87            0 :     return source_model;
      88            0 :   }
      89              : 
      90            0 :   if (raw_dt == "TriggerActivity") {
      91            0 :     TLOG_DEBUG(1) << "Creating trigger activities subscriber";
      92            0 :     auto source_model =
      93            0 :       std::make_shared<datahandlinglibs::DataSubscriberModel<triggeralgs::TriggerActivity>>();
      94            0 :     return source_model;
      95            0 :   }
      96              : 
      97            0 :   if (raw_dt == "TriggerCandidate") {
      98            0 :     TLOG_DEBUG(1) << "Creating trigger candidates subscriber";
      99            0 :     auto source_model =
     100            0 :       std::make_shared<datahandlinglibs::DataSubscriberModel<triggeralgs::TriggerCandidate>>();
     101            0 :     return source_model;
     102            0 :   }
     103              : 
     104            0 :    if (raw_dt == "HSIEvent") {
     105            0 :     TLOG_DEBUG(1) << "Creating trigger candidates subscriber";
     106            0 :     auto source_model =
     107            0 :       std::make_shared<trigger::HSISourceModel>();
     108            0 :     return source_model;
     109            0 :   }
     110            0 :   return nullptr;
     111            0 : }
     112              : 
     113              : } // namespace trigger
     114              : } // namespace dunedaq
     115              : 
     116            0 : DEFINE_DUNE_DAQ_MODULE(dunedaq::trigger::DataSubscriberModule)
        

Generated by: LCOV version 2.0-1