DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::appmodel::TPReplayApplication Class Reference

#include <TPReplayApplication.hpp>

Inheritance diagram for dunedaq::appmodel::TPReplayApplication:
[legend]
Collaboration diagram for dunedaq::appmodel::TPReplayApplication:
[legend]

Public Member Functions

virtual void print (unsigned int offset, bool print_header, std::ostream &s) const
 Print details of the TPReplayApplication object.
 
virtual std::vector< const dunedaq::conffwk::DalObject * > get (const std::string &name, bool upcast_unregistered=true) const
 Get values of relationships and results of some algorithms as a vector of dunedaq::conffwk::DalObject pointers.
 
const std::string & get_application_name () const
 Get "application_name" attribute value.
 
void set_application_name (const std::string &value)
 Set "application_name" attribute value.
 
const std::vector< const dunedaq::appmodel::SourceIDConf * > & get_tp_source_ids () const
 Get "tp_source_ids" relationship value.
 
void set_tp_source_ids (const std::vector< const dunedaq::appmodel::SourceIDConf * > &value)
 Set "tp_source_ids" relationship value.
 
const dunedaq::appmodel::TPReplayModuleConfget_tprm_conf () const
 Get "tprm_conf" relationship value.
 
void set_tprm_conf (const dunedaq::appmodel::TPReplayModuleConf *value)
 Set "tprm_conf" relationship value.
 
const dunedaq::appmodel::DataHandlerConfget_tp_handler () const
 Get "tp_handler" relationship value.
 
void set_tp_handler (const dunedaq::appmodel::DataHandlerConf *value)
 Set "tp_handler" relationship value.
 
std::vector< const dunedaq::confmodel::DaqModule * > generate_modules (const confmodel::Session *) const override
 
virtual void print (unsigned int offset, bool print_header, std::ostream &s) const
 Print details of the TPReplayApplication object.
 
virtual std::vector< const dunedaq::conffwk::DalObject * > get (const std::string &name, bool upcast_unregistered=true) const
 Get values of relationships and results of some algorithms as a vector of dunedaq::conffwk::DalObject pointers.
 
const std::string & get_application_name () const
 Get "application_name" attribute value.
 
void set_application_name (const std::string &value)
 Set "application_name" attribute value.
 
const std::vector< const dunedaq::appmodel::SourceIDConf * > & get_tp_source_ids () const
 Get "tp_source_ids" relationship value.
 
void set_tp_source_ids (const std::vector< const dunedaq::appmodel::SourceIDConf * > &value)
 Set "tp_source_ids" relationship value.
 
const dunedaq::appmodel::TPReplayModuleConfget_tprm_conf () const
 Get "tprm_conf" relationship value.
 
void set_tprm_conf (const dunedaq::appmodel::TPReplayModuleConf *value)
 Set "tprm_conf" relationship value.
 
const dunedaq::appmodel::DataHandlerConfget_tp_handler () const
 Get "tp_handler" relationship value.
 
void set_tp_handler (const dunedaq::appmodel::DataHandlerConf *value)
 Set "tp_handler" relationship value.
 
std::vector< const dunedaq::confmodel::DaqModule * > generate_modules (const confmodel::Session *) const override
 
- Public Member Functions inherited from dunedaq::appmodel::SmartDaqApplication
const dunedaq::appmodel::SourceIDConfget_source_id () const
 Get "source_id" relationship value.
 
void set_source_id (const dunedaq::appmodel::SourceIDConf *value)
 Set "source_id" relationship value.
 
const std::vector< const dunedaq::appmodel::QueueConnectionRule * > & get_queue_rules () const
 Get "queue_rules" relationship value.
 
void set_queue_rules (const std::vector< const dunedaq::appmodel::QueueConnectionRule * > &value)
 Set "queue_rules" relationship value.
 
const std::vector< const dunedaq::appmodel::NetworkConnectionRule * > & get_network_rules () const
 Get "network_rules" relationship value.
 
void set_network_rules (const std::vector< const dunedaq::appmodel::NetworkConnectionRule * > &value)
 Set "network_rules" relationship value.
 
const std::vector< const dunedaq::confmodel::ActionPlan * > & get_action_plans () const
 Get "action_plans" relationship value.
 
void set_action_plans (const std::vector< const dunedaq::confmodel::ActionPlan * > &value)
 Set "action_plans" relationship value.
 
const std::vector< std::string > construct_commandline_parameters (const conffwk::Configuration &confdb, const dunedaq::confmodel::Session *session) const
 
const dunedaq::appmodel::SourceIDConfget_source_id () const
 Get "source_id" relationship value.
 
void set_source_id (const dunedaq::appmodel::SourceIDConf *value)
 Set "source_id" relationship value.
 
const std::vector< const dunedaq::appmodel::QueueConnectionRule * > & get_queue_rules () const
 Get "queue_rules" relationship value.
 
void set_queue_rules (const std::vector< const dunedaq::appmodel::QueueConnectionRule * > &value)
 Set "queue_rules" relationship value.
 
const std::vector< const dunedaq::appmodel::NetworkConnectionRule * > & get_network_rules () const
 Get "network_rules" relationship value.
 
void set_network_rules (const std::vector< const dunedaq::appmodel::NetworkConnectionRule * > &value)
 Set "network_rules" relationship value.
 
const std::vector< const dunedaq::confmodel::ActionPlan * > & get_action_plans () const
 Get "action_plans" relationship value.
 
void set_action_plans (const std::vector< const dunedaq::confmodel::ActionPlan * > &value)
 Set "action_plans" relationship value.
 
const std::vector< std::string > construct_commandline_parameters (const conffwk::Configuration &confdb, const dunedaq::confmodel::Session *session) const
 
- Public Member Functions inherited from dunedaq::confmodel::Application
const std::string & get_application_name () const
 Get "application_name" attribute value. Name of the application binary to run.
 
void set_application_name (const std::string &value)
 Set "application_name" attribute value. Name of the application binary to run.
 
const std::vector< std::string > & get_commandline_parameters () const
 Get "commandline_parameters" attribute value. command line parameters to add when starting the application.
 
void set_commandline_parameters (const std::vector< std::string > &value)
 Set "commandline_parameters" attribute value. command line parameters to add when starting the application.
 
const std::string & get_log_path () const
 Get "log_path" attribute value. Where the applications, controllers and infrastructure applications stdout/err go. This take precedence over the Session's log_path. If none of them is set, PWD is used.
 
void set_log_path (const std::string &value)
 Set "log_path" attribute value. Where the applications, controllers and infrastructure applications stdout/err go. This take precedence over the Session's log_path. If none of them is set, PWD is used.
 
const std::vector< const dunedaq::confmodel::VariableBase * > & get_application_environment () const
 Get "application_environment" relationship value. Define process environment for this application.
 
void set_application_environment (const std::vector< const dunedaq::confmodel::VariableBase * > &value)
 Set "application_environment" relationship value. Define process environment for this application.
 
const dunedaq::confmodel::VirtualHostget_runs_on () const
 Get "runs_on" relationship value. VirtualHost to run this application on.
 
void set_runs_on (const dunedaq::confmodel::VirtualHost *value)
 Set "runs_on" relationship value. VirtualHost to run this application on.
 
const std::vector< const dunedaq::confmodel::Service * > & get_exposes_service () const
 Get "exposes_service" relationship value. Services exposed i.e. provided by this application.
 
void set_exposes_service (const std::vector< const dunedaq::confmodel::Service * > &value)
 Set "exposes_service" relationship value. Services exposed i.e. provided by this application.
 
const dunedaq::confmodel::OpMonConfget_opmon_conf () const
 Get "opmon_conf" relationship value. description of the monitoring behaviour in the application.
 
void set_opmon_conf (const dunedaq::confmodel::OpMonConf *value)
 Set "opmon_conf" relationship value. description of the monitoring behaviour in the application.
 
const std::vector< std::string > parse_commandline_parameters () const
 
const std::string & get_application_name () const
 Get "application_name" attribute value. Name of the application binary to run.
 
void set_application_name (const std::string &value)
 Set "application_name" attribute value. Name of the application binary to run.
 
const std::vector< std::string > & get_commandline_parameters () const
 Get "commandline_parameters" attribute value. command line parameters to add when starting the application.
 
void set_commandline_parameters (const std::vector< std::string > &value)
 Set "commandline_parameters" attribute value. command line parameters to add when starting the application.
 
const std::string & get_log_path () const
 Get "log_path" attribute value. Where the applications, controllers and infrastructure applications stdout/err go. This take precedence over the Session's log_path. If none of them is set, PWD is used.
 
void set_log_path (const std::string &value)
 Set "log_path" attribute value. Where the applications, controllers and infrastructure applications stdout/err go. This take precedence over the Session's log_path. If none of them is set, PWD is used.
 
const std::vector< const dunedaq::confmodel::VariableBase * > & get_application_environment () const
 Get "application_environment" relationship value. Define process environment for this application.
 
void set_application_environment (const std::vector< const dunedaq::confmodel::VariableBase * > &value)
 Set "application_environment" relationship value. Define process environment for this application.
 
const dunedaq::confmodel::VirtualHostget_runs_on () const
 Get "runs_on" relationship value. VirtualHost to run this application on.
 
void set_runs_on (const dunedaq::confmodel::VirtualHost *value)
 Set "runs_on" relationship value. VirtualHost to run this application on.
 
const std::vector< const dunedaq::confmodel::Service * > & get_exposes_service () const
 Get "exposes_service" relationship value. Services exposed i.e. provided by this application.
 
void set_exposes_service (const std::vector< const dunedaq::confmodel::Service * > &value)
 Set "exposes_service" relationship value. Services exposed i.e. provided by this application.
 
const dunedaq::confmodel::OpMonConfget_opmon_conf () const
 Get "opmon_conf" relationship value. description of the monitoring behaviour in the application.
 
void set_opmon_conf (const dunedaq::confmodel::OpMonConf *value)
 Set "opmon_conf" relationship value. description of the monitoring behaviour in the application.
 
const std::vector< std::string > parse_commandline_parameters () const
 
- Public Member Functions inherited from dunedaq::conffwk::DalObject
const std::string & UID () const noexcept
 
const std::string & class_name () const noexcept
 
bool castable (const std::string &target) const noexcept
 
bool castable (const std::string *target) const noexcept
 
template<class TARGET >
const TARGET * cast () const noexcept
 Casts object to different class.
 
std::string full_name () const noexcept
 
const ConfigObjectconfig_object () const
 
DalRegistryregistry () const noexcept
 
Configurationconfiguration () const noexcept
 
void unread ()
 
void set (const ConfigObject &o) noexcept
 
void move (const std::string &at)
 
void rename (const std::string &new_id)
 
void p_hdr (std::ostream &s, unsigned int indent, const std::string &cl, const char *nm=nullptr) const
 print object headers
 
std::ostream & print_object (std::ostream &s) const
 print object details
 
void throw_init_ex (dunedaq::conffwk::Exception &ex)
 throw object initialisation exception (i.e.
 

Static Public Member Functions

static const std::string & __get_application_name_str () noexcept
 
static const std::string & __get_tp_source_ids_str () noexcept
 
static const std::string & __get_tprm_conf_str () noexcept
 
static const std::string & __get_tp_handler_str () noexcept
 
static const std::string & __get_application_name_str () noexcept
 
static const std::string & __get_tp_source_ids_str () noexcept
 
static const std::string & __get_tprm_conf_str () noexcept
 
static const std::string & __get_tp_handler_str () noexcept
 
- Static Public Member Functions inherited from dunedaq::appmodel::SmartDaqApplication
static const std::string & __get_source_id_str () noexcept
 
static const std::string & __get_queue_rules_str () noexcept
 
static const std::string & __get_network_rules_str () noexcept
 
static const std::string & __get_action_plans_str () noexcept
 
static const std::string & __get_source_id_str () noexcept
 
static const std::string & __get_queue_rules_str () noexcept
 
static const std::string & __get_network_rules_str () noexcept
 
static const std::string & __get_action_plans_str () noexcept
 
- Static Public Member Functions inherited from dunedaq::confmodel::Application
static const std::string & __get_application_name_str () noexcept
 
static const std::string & __get_commandline_parameters_str () noexcept
 
static const std::string & __get_log_path_str () noexcept
 
static const std::string & __get_application_environment_str () noexcept
 
static const std::string & __get_runs_on_str () noexcept
 
static const std::string & __get_exposes_service_str () noexcept
 
static const std::string & __get_opmon_conf_str () noexcept
 
static const std::string & __get_application_name_str () noexcept
 
static const std::string & __get_commandline_parameters_str () noexcept
 
static const std::string & __get_log_path_str () noexcept
 
static const std::string & __get_application_environment_str () noexcept
 
static const std::string & __get_runs_on_str () noexcept
 
static const std::string & __get_exposes_service_str () noexcept
 
static const std::string & __get_opmon_conf_str () noexcept
 
- Static Public Member Functions inherited from dunedaq::conffwk::DalObject
static void p_null (std::ostream &s)
 print "(null)"
 
static void p_rm (std::ostream &s)
 print "(deleted object)"
 
static void p_error (std::ostream &s, dunedaq::conffwk::Exception &ex)
 print error text
 
static void throw_get_ex (const std::string &what, const std::string &class_name, const DalObject *obj)
 throw exception in generated get method (i.e.
 
static bool is_null (const DalObject *ref) noexcept
 check a pointer on DAL object is null
 

Static Public Attributes

static const std::string & s_class_name
 
static const std::string s_application_name = "application_name"
 
static const std::string s_tp_source_ids = "tp_source_ids"
 
static const std::string s_tprm_conf = "tprm_conf"
 
static const std::string s_tp_handler = "tp_handler"
 
- Static Public Attributes inherited from dunedaq::appmodel::SmartDaqApplication
static const std::string & s_class_name
 
static const std::string s_source_id = "source_id"
 
static const std::string s_queue_rules = "queue_rules"
 
static const std::string s_network_rules = "network_rules"
 
static const std::string s_action_plans = "action_plans"
 
- Static Public Attributes inherited from dunedaq::confmodel::Application
static const std::string & s_class_name
 
static const std::string s_application_name = "application_name"
 
static const std::string s_commandline_parameters = "commandline_parameters"
 
static const std::string s_log_path = "log_path"
 
static const std::string s_application_environment = "application_environment"
 
static const std::string s_runs_on = "runs_on"
 
static const std::string s_exposes_service = "exposes_service"
 
static const std::string s_opmon_conf = "opmon_conf"
 

Protected Member Functions

 TPReplayApplication (conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
 
virtual ~TPReplayApplication () noexcept
 
virtual void init (bool init_children)
 
bool get (const std::string &name, std::vector< const dunedaq::conffwk::DalObject * > &vec, bool upcast_unregistered, bool first_call) const
 
 TPReplayApplication (conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
 
virtual ~TPReplayApplication () noexcept
 
virtual void init (bool init_children)
 
bool get (const std::string &name, std::vector< const dunedaq::conffwk::DalObject * > &vec, bool upcast_unregistered, bool first_call) const
 
- Protected Member Functions inherited from dunedaq::appmodel::SmartDaqApplication
 SmartDaqApplication (conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
 
virtual ~SmartDaqApplication () noexcept
 
bool get (const std::string &name, std::vector< const dunedaq::conffwk::DalObject * > &vec, bool upcast_unregistered, bool first_call) const
 
 SmartDaqApplication (conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
 
virtual ~SmartDaqApplication () noexcept
 
bool get (const std::string &name, std::vector< const dunedaq::conffwk::DalObject * > &vec, bool upcast_unregistered, bool first_call) const
 
- Protected Member Functions inherited from dunedaq::confmodel::Application
 Application (conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
 
virtual ~Application () noexcept
 
bool get (const std::string &name, std::vector< const dunedaq::conffwk::DalObject * > &vec, bool upcast_unregistered, bool first_call) const
 
 Application (conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
 
virtual ~Application () noexcept
 
bool get (const std::string &name, std::vector< const dunedaq::conffwk::DalObject * > &vec, bool upcast_unregistered, bool first_call) const
 
- Protected Member Functions inherited from dunedaq::conffwk::DalObject
 DalObject (DalRegistry &db, const ConfigObject &o) noexcept
 
virtual ~DalObject ()
 
void clear () noexcept
 
void check () const
 
bool is_deleted () const
 
void increment_created () noexcept
 
void increment_read () noexcept
 
void check_init () const
 Check and initialize object if necessary.
 
template<typename T >
void _set_object (const std::string &name, const T *value)
 Helper method for generated set single-value relationship methods.
 
template<typename T >
void _set_objects (const std::string &name, const std::vector< const T * > &value)
 Helper method for generated set multi-value relationship methods.
 
bool get_rel_objects (const std::string &name, bool upcast_unregistered, std::vector< const DalObject * > &objs) const
 Read relationship values as DAL objects using DAL factory.
 
bool get_algo_objects (const std::string &name, std::vector< const DalObject * > &objs) const
 Run algorithm and return result as DAL objects using DAL factory.
 

Private Attributes

std::string m_application_name
 
std::vector< const dunedaq::appmodel::SourceIDConf * > m_tp_source_ids
 
const dunedaq::appmodel::TPReplayModuleConfm_tprm_conf
 
const dunedaq::appmodel::DataHandlerConfm_tp_handler
 

Friends

class conffwk::Configuration
 
class conffwk::DalObject
 
class conffwk::DalFactory
 
class conffwk::DalRegistry
 

Additional Inherited Members

- Protected Attributes inherited from dunedaq::conffwk::DalObject
std::mutex m_mutex
 Used to protect changes of DAL object.
 
bool p_was_read
 is true, if the object was read
 
DalRegistryp_registry
 Configuration object.
 
ConfigObject p_obj
 Config object used by given template object.
 
std::string p_UID
 Is used for template objects (see dqm_conffwk)
 

Detailed Description

Definition at line 38 of file TPReplayApplication.hpp.

Constructor & Destructor Documentation

◆ TPReplayApplication() [1/2]

dunedaq::appmodel::TPReplayApplication::TPReplayApplication ( conffwk::DalRegistry & db,
const conffwk::ConfigObject & obj )
protectednoexcept

Definition at line 33 of file TPReplayApplication.cpp.

33 :
36 m_tprm_conf (nullptr),
37 m_tp_handler (nullptr)
38
39 {
40 ;
41 }
SmartDaqApplication(conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
const dunedaq::appmodel::DataHandlerConf * m_tp_handler
const dunedaq::appmodel::TPReplayModuleConf * m_tprm_conf
The base class for any generated DAL object.
Definition DalObject.hpp:45

◆ ~TPReplayApplication() [1/2]

dunedaq::appmodel::TPReplayApplication::~TPReplayApplication ( )
protectedvirtualnoexcept

Definition at line 94 of file TPReplayApplication.cpp.

95 {
96 }

◆ TPReplayApplication() [2/2]

dunedaq::appmodel::TPReplayApplication::TPReplayApplication ( conffwk::DalRegistry & db,
const conffwk::ConfigObject & obj )
protectednoexcept

◆ ~TPReplayApplication() [2/2]

virtual dunedaq::appmodel::TPReplayApplication::~TPReplayApplication ( )
protectedvirtualnoexcept

Member Function Documentation

◆ __get_application_name_str() [1/2]

static const std::string & dunedaq::appmodel::TPReplayApplication::__get_application_name_str ( )
inlinestaticnoexcept

Definition at line 101 of file TPReplayApplication.hpp.

101{ return s_application_name; }

◆ __get_application_name_str() [2/2]

static const std::string & dunedaq::appmodel::TPReplayApplication::__get_application_name_str ( )
inlinestaticnoexcept

Definition at line 101 of file TPReplayApplication.hpp.

101{ return s_application_name; }

◆ __get_tp_handler_str() [1/2]

static const std::string & dunedaq::appmodel::TPReplayApplication::__get_tp_handler_str ( )
inlinestaticnoexcept

Definition at line 143 of file TPReplayApplication.hpp.

143{ return s_tp_handler; }

◆ __get_tp_handler_str() [2/2]

static const std::string & dunedaq::appmodel::TPReplayApplication::__get_tp_handler_str ( )
inlinestaticnoexcept

Definition at line 143 of file TPReplayApplication.hpp.

143{ return s_tp_handler; }

◆ __get_tp_source_ids_str() [1/2]

static const std::string & dunedaq::appmodel::TPReplayApplication::__get_tp_source_ids_str ( )
inlinestaticnoexcept

Definition at line 141 of file TPReplayApplication.hpp.

141{ return s_tp_source_ids; }

◆ __get_tp_source_ids_str() [2/2]

static const std::string & dunedaq::appmodel::TPReplayApplication::__get_tp_source_ids_str ( )
inlinestaticnoexcept

Definition at line 141 of file TPReplayApplication.hpp.

141{ return s_tp_source_ids; }

◆ __get_tprm_conf_str() [1/2]

static const std::string & dunedaq::appmodel::TPReplayApplication::__get_tprm_conf_str ( )
inlinestaticnoexcept

Definition at line 142 of file TPReplayApplication.hpp.

142{ return s_tprm_conf; }

◆ __get_tprm_conf_str() [2/2]

static const std::string & dunedaq::appmodel::TPReplayApplication::__get_tprm_conf_str ( )
inlinestaticnoexcept

Definition at line 142 of file TPReplayApplication.hpp.

142{ return s_tprm_conf; }

◆ generate_modules() [1/2]

std::vector< const confmodel::DaqModule * > dunedaq::appmodel::TPReplayApplication::generate_modules ( const confmodel::Session * ) const
overridevirtual

Generate daq module dal objects for TPReplayApplication on the fly

Implements dunedaq::appmodel::SmartDaqApplication.

Definition at line 47 of file TPReplayApplication.cpp.

48{
49
50 std::vector<const confmodel::DaqModule*> modules;
51
52 ConfigObjectFactory obj_fac(this);
53
54 /**************************************************************
55 * Instantiate the Trigger Primitive Maker Module module
56 **************************************************************/
57
58 auto tprm_conf = get_tprm_conf();
59
60 if (!tprm_conf) {
61 throw(BadConf(ERS_HERE, "No TPPM configuration in TPReplayApplication given"));
62 }
63
64 const std::string tprm_uid(tprm_conf->UID());
65 const std::string tprm_class = tprm_conf->get_template_for();
66 auto tpm_obj = obj_fac.create(tprm_class, tprm_uid);
67 tpm_obj.set_obj("configuration", &(tprm_conf->config_object()));
68
69 /**************************************************************
70 * Get total planes from config
71 **************************************************************/
72 const int total_planes = tprm_conf->get_total_planes();
73
74 /**************************************************************
75 * Extract # of filtered planes
76 **************************************************************/
77 const auto plane_filtering = tprm_conf->get_filter_out_plane();
78 if (plane_filtering.size() >= 3) {
79 throw(BadConf(ERS_HERE,
80 "TPReplayApplication: too many planes configured for filtering! At most 2 planes can be filtered!"));
81 }
82
83 /**************************************************************
84 * Instantiate the TP Handler (TA Maker) module(s)
85 **************************************************************/
86 auto tph_conf = get_tp_handler();
87 if (!tph_conf) {
88 throw(BadConf(ERS_HERE, "TP handler configuration object is missing"));
89 }
90 std::string tph_class = "";
91 if (tph_conf != nullptr) {
92 tph_class = tph_conf->get_template_for();
93 }
94
95 // For now, have X (X=total_planes) identical config TP Handlers
96 std::vector<conffwk::ConfigObject> TPHs;
97 std::vector<std::string> TPHs_uids;
98
99 // Source IDs
100 auto tpsrc_ids = get_tp_source_ids();
101 if (tpsrc_ids.size() < static_cast<size_t>(total_planes)) {
102 throw(BadConf(ERS_HERE, "Not enough TP source IDs provided"));
103 }
104
105 const auto tph_conf_obj = tph_conf->config_object();
106 for (int i = 0; i < total_planes; i++) {
107 std::string tp_uid = "tphandler-tpreplay-" + std::to_string(i + 1);
108 TPHs_uids.push_back(tp_uid);
109 auto tph_obj = obj_fac.create(tph_class, tp_uid);
110 tph_obj.set_by_val<uint32_t>("source_id", tpsrc_ids[i]->get_sid());
111 tph_obj.set_by_val<uint32_t>("detector_id", 1); // 1 == kDAQ
112 tph_obj.set_by_val<bool>("post_processing_enabled", true);
113 tph_obj.set_obj("module_configuration", &tph_conf_obj);
114 TPHs.push_back(tph_obj);
115 }
116
117 /**************************************************************
118 * Deal with queues
119 **************************************************************/
120 // Load queue configurations
121 const QueueDescriptor* tp_inputq_desc = nullptr;
122
123 for (const auto& rule : get_queue_rules()) {
124 auto destination_class = rule->get_destination_class();
125 auto data_type = rule->get_descriptor()->get_data_type();
126 if (destination_class == "TriggerDataHandlerModule" && data_type == "TriggerPrimitiveVector") {
127 tp_inputq_desc = rule->get_descriptor();
128 }
129 }
130 if (!tp_inputq_desc) {
131 throw(BadConf(ERS_HERE, "No matching queue descriptor found for TP input"));
132 }
133
134 // Same as above (ROUs * planes queues), later dynamically
135 std::vector<conffwk::ConfigObject> TP_queues;
136 for (int i = 0; i < total_planes; i++) {
137 std::string tp_q_uid = "tpinput-" + std::to_string(i + 1);
138 auto tp_q_obj = obj_fac.create_queue_obj(tp_inputq_desc, tp_q_uid);
139 TP_queues.push_back(tp_q_obj);
140 }
141
142 /**************************************************************
143 * Deal with network connections
144 **************************************************************/
145 const NetworkConnectionDescriptor* ta_net_desc = nullptr;
146 const NetworkConnectionDescriptor* dr_net_desc = nullptr;
147
148 for (const auto& rule : get_network_rules()) {
149 auto endpoint_class = rule->get_endpoint_class();
150 auto data_type = rule->get_descriptor()->get_data_type();
151 if (data_type == "TriggerActivity") {
152 ta_net_desc = rule->get_descriptor();
153 } else if (data_type == "DataRequest") {
154 dr_net_desc = rule->get_descriptor();
155 }
156 }
157 if (!ta_net_desc || !dr_net_desc) {
158 throw(BadConf(ERS_HERE, "Missing network descriptors for TA or DR"));
159 }
160
161 // Create vectors for network connections
162 std::vector<conffwk::ConfigObject> ta_net_objects;
163 std::vector<conffwk::ConfigObject> dr_net_objects;
164
165 // Outputs for each handler
166 for (int i = 0; i < total_planes; i++) {
167 const auto ta_service_obj = ta_net_desc->get_associated_service()->config_object();
168 const std::string ta_stream_uid = ta_net_desc->get_uid_base() + UID() + "-" + std::to_string(i + 1);
169 auto ta_net_obj = obj_fac.create_net_obj(ta_net_desc, ta_stream_uid);
170 ta_net_obj.set_obj("associated_service", &ta_service_obj);
171 ta_net_objects.push_back(ta_net_obj);
172 }
173
174 // Data requests
175 for (int i = 0; i < total_planes; i++) {
176 const auto dr_service_obj = dr_net_desc->get_associated_service()->config_object();
177 // Format the integer with leading zeros to maintain consistent length
178 std::ostringstream oss;
179 oss << UID() << "-1000" << std::setfill('0') << std::setw(2) // Ensures at least 2 digits (e.g., 01, 10)
180 << (i + 1);
181 const std::string dr_stream_uid = oss.str();
182 auto dr_net_obj = obj_fac.create_net_obj(dr_net_desc, dr_stream_uid);
183 dr_net_obj.set_obj("associated_service", &dr_service_obj);
184 dr_net_objects.push_back(dr_net_obj);
185 }
186
187 /**************************************************************
188 * Finally set inputs & outputs
189 **************************************************************/
190 // Convert TP_queues to a vector of raw pointers
191 std::vector<const conffwk::ConfigObject*> raw_tp_queues;
192 for (const auto& tp_queue : TP_queues) {
193 raw_tp_queues.push_back(&tp_queue);
194 }
195 tpm_obj.set_objs("outputs", raw_tp_queues);
196
197 for (int i = 0; i < total_planes; i++) {
198 // Convert network objects to raw pointers
199 const std::vector<const conffwk::ConfigObject*> temp_inputs = { &TP_queues[i], &dr_net_objects[i] };
200 const std::vector<const conffwk::ConfigObject*> temp_outputs = { &ta_net_objects[i] };
201 TPHs[i].set_objs("inputs", temp_inputs);
202 TPHs[i].set_objs("outputs", temp_outputs);
203 }
204
205 // Store modules
206 modules.push_back(obj_fac.get_dal<confmodel::DaqModule>(tprm_conf->UID()));
207 for (int i = 0; i < total_planes; i++) {
208 modules.push_back(obj_fac.get_dal<confmodel::DaqModule>(TPHs_uids[i]));
209 }
210
211 return modules;
212}
#define ERS_HERE
const std::vector< const dunedaq::appmodel::NetworkConnectionRule * > & get_network_rules() const
Get "network_rules" relationship value.
const std::vector< const dunedaq::appmodel::QueueConnectionRule * > & get_queue_rules() const
Get "queue_rules" relationship value.
const std::vector< const dunedaq::appmodel::SourceIDConf * > & get_tp_source_ids() const
Get "tp_source_ids" relationship value.
const dunedaq::appmodel::DataHandlerConf * get_tp_handler() const
Get "tp_handler" relationship value.
const dunedaq::appmodel::TPReplayModuleConf * get_tprm_conf() const
Get "tprm_conf" relationship value.
const std::string & UID() const noexcept

◆ generate_modules() [2/2]

std::vector< const dunedaq::confmodel::DaqModule * > dunedaq::appmodel::TPReplayApplication::generate_modules ( const confmodel::Session * ) const
overridevirtual

Generate daq module dal objects for TPReplayApplication on the fly

Implements dunedaq::appmodel::SmartDaqApplication.

◆ get() [1/4]

std::vector< const dunedaq::conffwk::DalObject * > dunedaq::appmodel::TPReplayApplication::get ( const std::string & name,
bool upcast_unregistered = true ) const
virtual

Get values of relationships and results of some algorithms as a vector of dunedaq::conffwk::DalObject pointers.

Parameters are:

Parameters
namename of the relationship or algorithm
Returns
value of relationship or result of algorithm
Exceptions
std::exceptionif there is no relationship or algorithm with such name in this and base classes

Reimplemented from dunedaq::appmodel::SmartDaqApplication.

Definition at line 98 of file TPReplayApplication.cpp.

99 {
100 std::vector<const dunedaq::conffwk::DalObject *> vec;
101
102 if (!get(name, vec, upcast_unregistered, true))
103 throw_get_ex(name, s_class_name, this);
104
105 return vec;
106 }
virtual std::vector< const dunedaq::conffwk::DalObject * > get(const std::string &name, bool upcast_unregistered=true) const
Get values of relationships and results of some algorithms as a vector of dunedaq::conffwk::DalObject...
static void throw_get_ex(const std::string &what, const std::string &class_name, const DalObject *obj)
throw exception in generated get method (i.e.
Definition DalObject.cpp:82

◆ get() [2/4]

virtual std::vector< const dunedaq::conffwk::DalObject * > dunedaq::appmodel::TPReplayApplication::get ( const std::string & name,
bool upcast_unregistered = true ) const
virtual

Get values of relationships and results of some algorithms as a vector of dunedaq::conffwk::DalObject pointers.

Parameters are:

Parameters
namename of the relationship or algorithm
Returns
value of relationship or result of algorithm
Exceptions
std::exceptionif there is no relationship or algorithm with such name in this and base classes

Reimplemented from dunedaq::appmodel::SmartDaqApplication.

◆ get() [3/4]

bool dunedaq::appmodel::TPReplayApplication::get ( const std::string & name,
std::vector< const dunedaq::conffwk::DalObject * > & vec,
bool upcast_unregistered,
bool first_call ) const
protected

Definition at line 108 of file TPReplayApplication.cpp.

109 {
110 if (first_call)
111 {
112 std::lock_guard scoped_lock(m_mutex);
113
114 check();
115 check_init();
116
117 if (get_rel_objects(name, upcast_unregistered, vec))
118 return true;
119 }
120
121 if (SmartDaqApplication::get(name, vec, upcast_unregistered, false)) return true;
122
123 if (first_call)
124 return get_algo_objects(name, vec);
125
126 return false;
127 }
virtual std::vector< const dunedaq::conffwk::DalObject * > get(const std::string &name, bool upcast_unregistered=true) const
Get values of relationships and results of some algorithms as a vector of dunedaq::conffwk::DalObject...
bool get_rel_objects(const std::string &name, bool upcast_unregistered, std::vector< const DalObject * > &objs) const
Read relationship values as DAL objects using DAL factory.
Definition DalObject.cpp:8
std::mutex m_mutex
Used to protect changes of DAL object.
bool get_algo_objects(const std::string &name, std::vector< const DalObject * > &objs) const
Run algorithm and return result as DAL objects using DAL factory.
Definition DalObject.cpp:25
void check_init() const
Check and initialize object if necessary.

◆ get() [4/4]

bool dunedaq::appmodel::TPReplayApplication::get ( const std::string & name,
std::vector< const dunedaq::conffwk::DalObject * > & vec,
bool upcast_unregistered,
bool first_call ) const
protected

◆ get_application_name() [1/2]

const std::string & dunedaq::appmodel::TPReplayApplication::get_application_name ( ) const
inline

Get "application_name" attribute value.

Returns
the attribute value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 111 of file TPReplayApplication.hpp.

112 {
113 std::lock_guard scoped_lock(m_mutex);
114 check();
115 check_init();
116 return m_application_name;
117 }

◆ get_application_name() [2/2]

const std::string & dunedaq::appmodel::TPReplayApplication::get_application_name ( ) const
inline

Get "application_name" attribute value.

Returns
the attribute value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 111 of file TPReplayApplication.hpp.

112 {
113 std::lock_guard scoped_lock(m_mutex);
114 check();
115 check_init();
116 return m_application_name;
117 }

◆ get_tp_handler() [1/2]

const dunedaq::appmodel::DataHandlerConf * dunedaq::appmodel::TPReplayApplication::get_tp_handler ( ) const
inline

Get "tp_handler" relationship value.

Returns
the relationship value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 209 of file TPReplayApplication.hpp.

210 {
211 std::lock_guard scoped_lock(m_mutex);
212 check();
213 check_init();
214 if (!m_tp_handler)
215 {
216 std::ostringstream text;
217 text << "relationship \"" << s_tp_handler << "\" of object " << this << " is not set";
218 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
219 }
220 return m_tp_handler;
221 }
Generic configuration exception.

◆ get_tp_handler() [2/2]

const dunedaq::appmodel::DataHandlerConf * dunedaq::appmodel::TPReplayApplication::get_tp_handler ( ) const
inline

Get "tp_handler" relationship value.

Returns
the relationship value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 209 of file TPReplayApplication.hpp.

210 {
211 std::lock_guard scoped_lock(m_mutex);
212 check();
213 check_init();
214 if (!m_tp_handler)
215 {
216 std::ostringstream text;
217 text << "relationship \"" << s_tp_handler << "\" of object " << this << " is not set";
218 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
219 }
220 return m_tp_handler;
221 }

◆ get_tp_source_ids() [1/2]

const std::vector< const dunedaq::appmodel::SourceIDConf * > & dunedaq::appmodel::TPReplayApplication::get_tp_source_ids ( ) const
inline

Get "tp_source_ids" relationship value.

Returns
the relationship value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 153 of file TPReplayApplication.hpp.

154 {
155 std::lock_guard scoped_lock(m_mutex);
156 check();
157 check_init();
158 return m_tp_source_ids;
159 }
std::vector< const dunedaq::appmodel::SourceIDConf * > m_tp_source_ids

◆ get_tp_source_ids() [2/2]

const std::vector< const dunedaq::appmodel::SourceIDConf * > & dunedaq::appmodel::TPReplayApplication::get_tp_source_ids ( ) const
inline

Get "tp_source_ids" relationship value.

Returns
the relationship value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 153 of file TPReplayApplication.hpp.

154 {
155 std::lock_guard scoped_lock(m_mutex);
156 check();
157 check_init();
158 return m_tp_source_ids;
159 }

◆ get_tprm_conf() [1/2]

const dunedaq::appmodel::TPReplayModuleConf * dunedaq::appmodel::TPReplayApplication::get_tprm_conf ( ) const
inline

Get "tprm_conf" relationship value.

Returns
the relationship value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 178 of file TPReplayApplication.hpp.

179 {
180 std::lock_guard scoped_lock(m_mutex);
181 check();
182 check_init();
183 if (!m_tprm_conf)
184 {
185 std::ostringstream text;
186 text << "relationship \"" << s_tprm_conf << "\" of object " << this << " is not set";
187 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
188 }
189 return m_tprm_conf;
190 }

◆ get_tprm_conf() [2/2]

const dunedaq::appmodel::TPReplayModuleConf * dunedaq::appmodel::TPReplayApplication::get_tprm_conf ( ) const
inline

Get "tprm_conf" relationship value.

Returns
the relationship value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 178 of file TPReplayApplication.hpp.

179 {
180 std::lock_guard scoped_lock(m_mutex);
181 check();
182 check_init();
183 if (!m_tprm_conf)
184 {
185 std::ostringstream text;
186 text << "relationship \"" << s_tprm_conf << "\" of object " << this << " is not set";
187 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
188 }
189 return m_tprm_conf;
190 }

◆ init() [1/2]

void dunedaq::appmodel::TPReplayApplication::init ( bool init_children)
protectedvirtual

Initialize object (method generated by genconffwk)

Parameters
init_childrenif true, initialize referenced objects

Reimplemented from dunedaq::appmodel::SmartDaqApplication.

Definition at line 77 of file TPReplayApplication.cpp.

78 {
79 SmartDaqApplication::init(init_children);
80
81 TLOG_DEBUG(5) << "read object " << this << " (class " << s_class_name << ')';
82
83 try {
88 }
89 catch (dunedaq::conffwk::Exception & ex) {
90 throw_init_ex(ex);
91 }
92 }
virtual void init(bool init_children)
void get(const std::string &name, T &value)
Get value of object's attribute or relationship.
void throw_init_ex(dunedaq::conffwk::Exception &ex)
throw object initialisation exception (i.e.
Definition DalObject.cpp:74
DalRegistry & p_registry
Configuration object.
ConfigObject p_obj
Config object used by given template object.
const T * _ref(ConfigObject &obj, const std::string &name, bool read_children)
Get signle value of object's relation and instantiate result with it (multi-thread safe).
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:112

◆ init() [2/2]

virtual void dunedaq::appmodel::TPReplayApplication::init ( bool init_children)
protectedvirtual

Initialize object (method generated by genconffwk)

Parameters
init_childrenif true, initialize referenced objects

Reimplemented from dunedaq::appmodel::SmartDaqApplication.

◆ print() [1/2]

void dunedaq::appmodel::TPReplayApplication::print ( unsigned int offset,
bool print_header,
std::ostream & s ) const
virtual

Print details of the TPReplayApplication object.

Parameters are:

Parameters
offsetnumber of spaces to shift object right (useful to print nested objects)
print_headerif false, do not print object header (to print attributes of base classes)
soutput stream

Reimplemented from dunedaq::appmodel::SmartDaqApplication.

Definition at line 44 of file TPReplayApplication.cpp.

45 {
46 check_init();
47
48 try {
49 const std::string str(indent+2, ' ');
50
51 if (print_header)
52 p_hdr(s, indent, s_class_name, "dunedaq::appmodel");
53
54
55 // print direct super-classes
56
58
59
60 // print direct attributes
61
63
64
65 // print direct relationships
66
70 }
71 catch (dunedaq::conffwk::Exception & ex) {
73 }
74 }
virtual void print(unsigned int offset, bool print_header, std::ostream &s) const
Print details of the SmartDaqApplication object.
void p_hdr(std::ostream &s, unsigned int indent, const std::string &cl, const char *nm=nullptr) const
print object headers
Definition DalObject.cpp:65
static void p_error(std::ostream &s, dunedaq::conffwk::Exception &ex)
print error text
Definition DalObject.cpp:59
void p_sv_rel(std::ostream &s, const std::string &str, const std::string &name, const DalObject *obj)
print weak single-value relationship
void p_mv_rel(std::ostream &s, const std::string &str, const std::string &name, const T &objs) noexcept
print weak multi-value relationship
void p_sv_attr(std::ostream &s, const std::string &str, const std::string &name, const T &val) noexcept
print single-value attribute

◆ print() [2/2]

virtual void dunedaq::appmodel::TPReplayApplication::print ( unsigned int offset,
bool print_header,
std::ostream & s ) const
virtual

Print details of the TPReplayApplication object.

Parameters are:

Parameters
offsetnumber of spaces to shift object right (useful to print nested objects)
print_headerif false, do not print object header (to print attributes of base classes)
soutput stream

Reimplemented from dunedaq::appmodel::SmartDaqApplication.

◆ set_application_name() [1/2]

void dunedaq::appmodel::TPReplayApplication::set_application_name ( const std::string & value)
inline

Set "application_name" attribute value.

Parameters
valuenew attribute value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 126 of file TPReplayApplication.hpp.

127 {
128 std::lock_guard scoped_lock(m_mutex);
129 check();
130 clear();
132 }
void set_by_ref(const std::string &name, T &value)
Set attribute value.

◆ set_application_name() [2/2]

void dunedaq::appmodel::TPReplayApplication::set_application_name ( const std::string & value)
inline

Set "application_name" attribute value.

Parameters
valuenew attribute value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 126 of file TPReplayApplication.hpp.

127 {
128 std::lock_guard scoped_lock(m_mutex);
129 check();
130 clear();
132 }

◆ set_tp_handler() [1/2]

void dunedaq::appmodel::TPReplayApplication::set_tp_handler ( const dunedaq::appmodel::DataHandlerConf * value)

Set "tp_handler" relationship value.

Parameters
valuenew relationship value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 139 of file TPReplayApplication.cpp.

140 {
142 }
void _set_object(const std::string &name, const T *value)
Helper method for generated set single-value relationship methods.

◆ set_tp_handler() [2/2]

void dunedaq::appmodel::TPReplayApplication::set_tp_handler ( const dunedaq::appmodel::DataHandlerConf * value)

Set "tp_handler" relationship value.

Parameters
valuenew relationship value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

◆ set_tp_source_ids() [1/2]

void dunedaq::appmodel::TPReplayApplication::set_tp_source_ids ( const std::vector< const dunedaq::appmodel::SourceIDConf * > & value)

Set "tp_source_ids" relationship value.

Parameters
valuenew relationship value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 129 of file TPReplayApplication.cpp.

130 {
132 }
void _set_objects(const std::string &name, const std::vector< const T * > &value)
Helper method for generated set multi-value relationship methods.

◆ set_tp_source_ids() [2/2]

void dunedaq::appmodel::TPReplayApplication::set_tp_source_ids ( const std::vector< const dunedaq::appmodel::SourceIDConf * > & value)

Set "tp_source_ids" relationship value.

Parameters
valuenew relationship value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

◆ set_tprm_conf() [1/2]

void dunedaq::appmodel::TPReplayApplication::set_tprm_conf ( const dunedaq::appmodel::TPReplayModuleConf * value)

Set "tprm_conf" relationship value.

Parameters
valuenew relationship value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 134 of file TPReplayApplication.cpp.

135 {
136 _set_object(s_tprm_conf, value);
137 }

◆ set_tprm_conf() [2/2]

void dunedaq::appmodel::TPReplayApplication::set_tprm_conf ( const dunedaq::appmodel::TPReplayModuleConf * value)

Set "tprm_conf" relationship value.

Parameters
valuenew relationship value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Friends And Related Symbol Documentation

◆ conffwk::Configuration

Definition at line 40 of file TPReplayApplication.hpp.

◆ conffwk::DalFactory

conffwk::DalFactory
friend

Definition at line 42 of file TPReplayApplication.hpp.

◆ conffwk::DalObject

Definition at line 41 of file TPReplayApplication.hpp.

◆ conffwk::DalRegistry

Definition at line 43 of file TPReplayApplication.hpp.

Member Data Documentation

◆ m_application_name

std::string dunedaq::appmodel::TPReplayApplication::m_application_name
private

Definition at line 89 of file TPReplayApplication.hpp.

◆ m_tp_handler

const dunedaq::appmodel::DataHandlerConf * dunedaq::appmodel::TPReplayApplication::m_tp_handler
private

Definition at line 92 of file TPReplayApplication.hpp.

◆ m_tp_source_ids

std::vector< const dunedaq::appmodel::SourceIDConf * > dunedaq::appmodel::TPReplayApplication::m_tp_source_ids
private

Definition at line 90 of file TPReplayApplication.hpp.

◆ m_tprm_conf

const dunedaq::appmodel::TPReplayModuleConf * dunedaq::appmodel::TPReplayApplication::m_tprm_conf
private

Definition at line 91 of file TPReplayApplication.hpp.

◆ s_application_name

static const std::string dunedaq::appmodel::TPReplayApplication::s_application_name = "application_name"
inlinestatic

Definition at line 99 of file TPReplayApplication.hpp.

◆ s_class_name

static const std::string & dunedaq::appmodel::TPReplayApplication::s_class_name
static

The name of the configuration class.

Definition at line 55 of file TPReplayApplication.hpp.

◆ s_tp_handler

static const std::string dunedaq::appmodel::TPReplayApplication::s_tp_handler = "tp_handler"
inlinestatic

Definition at line 139 of file TPReplayApplication.hpp.

◆ s_tp_source_ids

static const std::string dunedaq::appmodel::TPReplayApplication::s_tp_source_ids = "tp_source_ids"
inlinestatic

Definition at line 137 of file TPReplayApplication.hpp.

◆ s_tprm_conf

static const std::string dunedaq::appmodel::TPReplayApplication::s_tprm_conf = "tprm_conf"
inlinestatic

Definition at line 138 of file TPReplayApplication.hpp.


The documentation for this class was generated from the following files: