51 std::vector<const confmodel::DaqModule*> modules;
62 throw(BadConf(
ERS_HERE,
"No TPPM configuration in TPReplayApplication given"));
65 const std::string tprm_uid(tprm_conf->UID());
66 const std::string tprm_class = tprm_conf->get_template_for();
67 auto tpm_obj = obj_fac.
create(tprm_class, tprm_uid);
68 tpm_obj.
set_obj(
"configuration", &(tprm_conf->config_object()));
73 const int total_planes = tprm_conf->get_total_planes();
78 const auto plane_filtering = tprm_conf->get_filter_out_plane();
79 if (plane_filtering.size() >= 3) {
81 "TPReplayApplication: too many planes configured for filtering! At most 2 planes can be filtered!"));
89 throw(BadConf(
ERS_HERE,
"TP handler configuration object is missing"));
91 std::string tph_class =
"";
92 if (tph_conf !=
nullptr) {
93 tph_class = tph_conf->get_template_for();
97 std::vector<conffwk::ConfigObject> TPHs;
98 std::vector<std::string> TPHs_uids;
102 if (tpsrc_ids.size() <
static_cast<size_t>(total_planes)) {
103 throw(BadConf(
ERS_HERE,
"Not enough TP source IDs provided"));
106 const auto tph_conf_obj = tph_conf->config_object();
107 for (
int i = 0; i < total_planes; i++) {
108 std::string tp_uid =
"tphandler-tpreplay-" + std::to_string(i + 1);
109 TPHs_uids.push_back(tp_uid);
110 auto tph_obj = obj_fac.
create(tph_class, tp_uid);
111 tph_obj.
set_by_val<uint32_t>(
"source_id", tpsrc_ids[i]->get_sid());
112 tph_obj.set_by_val<uint32_t>(
"detector_id", 1);
113 tph_obj.set_by_val<
bool>(
"post_processing_enabled",
true);
114 tph_obj.set_obj(
"module_configuration", &tph_conf_obj);
115 TPHs.push_back(tph_obj);
125 auto destination_class = rule->get_destination_class();
126 auto data_type = rule->get_descriptor()->get_data_type();
127 if (destination_class ==
"TriggerDataHandlerModule" && data_type ==
"TriggerPrimitiveVector") {
128 tp_inputq_desc = rule->get_descriptor();
131 if (!tp_inputq_desc) {
132 throw(BadConf(
ERS_HERE,
"No matching queue descriptor found for TP input"));
136 std::vector<conffwk::ConfigObject> TP_queues;
137 for (
int i = 0; i < total_planes; i++) {
138 std::string tp_q_uid =
"tpinput-" + std::to_string(i + 1);
140 TP_queues.push_back(tp_q_obj);
150 auto endpoint_class = rule->get_endpoint_class();
151 auto data_type = rule->get_descriptor()->get_data_type();
152 if (data_type ==
"TriggerActivity") {
153 ta_net_desc = rule->get_descriptor();
154 }
else if (data_type ==
"DataRequest") {
155 dr_net_desc = rule->get_descriptor();
158 if (!ta_net_desc || !dr_net_desc) {
159 throw(BadConf(
ERS_HERE,
"Missing network descriptors for TA or DR"));
163 std::vector<conffwk::ConfigObject> ta_net_objects;
164 std::vector<conffwk::ConfigObject> dr_net_objects;
167 for (
int i = 0; i < total_planes; i++) {
169 const std::string ta_stream_uid = ta_net_desc->
get_uid_base() +
UID() +
"-" + std::to_string(i + 1);
170 auto ta_net_obj = obj_fac.
create_net_obj(ta_net_desc, ta_stream_uid);
171 ta_net_obj.
set_obj(
"associated_service", &ta_service_obj);
172 ta_net_objects.push_back(ta_net_obj);
176 for (
int i = 0; i < total_planes; i++) {
179 std::ostringstream oss;
180 oss <<
UID() <<
"-1000" << std::setfill(
'0') << std::setw(2)
182 const std::string dr_stream_uid = oss.str();
183 auto dr_net_obj = obj_fac.
create_net_obj(dr_net_desc, dr_stream_uid);
184 dr_net_obj.
set_obj(
"associated_service", &dr_service_obj);
185 dr_net_objects.push_back(dr_net_obj);
192 std::vector<const conffwk::ConfigObject*> raw_tp_queues;
193 for (
const auto& tp_queue : TP_queues) {
194 raw_tp_queues.push_back(&tp_queue);
196 tpm_obj.set_objs(
"outputs", raw_tp_queues);
198 for (
int i = 0; i < total_planes; i++) {
200 const std::vector<const conffwk::ConfigObject*> temp_inputs = { &TP_queues[i], &dr_net_objects[i] };
201 const std::vector<const conffwk::ConfigObject*> temp_outputs = { &ta_net_objects[i] };
202 TPHs[i].set_objs(
"inputs", temp_inputs);
203 TPHs[i].set_objs(
"outputs", temp_outputs);
208 for (
int i = 0; i < total_planes; i++) {