52std::vector<const confmodel::Resource*>
62 std::vector<const confmodel::DaqModule*> modules;
66 std::map<std::string, const DaphneV2BoardConf*> conf_map;
67 auto confs = daphne_conf->get_boards();
68 for (
const auto & c : confs ) {
69 conf_map[c->get_key()] = c->get_conf();
73 std::map<std::string, bool> v3_map;
74 std::map<std::string, const confmodel::NetworkInterface*> interfaces;
75 std::map<std::string, std::string> ctrl_hosts;
78 std::map<std::string, std::vector<const appmodel::HermesDataSender*> > hermes_senders;
83 if (helper->is_disabled(d2d_conn)) {
84 TLOG_DEBUG(7) <<
"Ignoring disabled DetectorToDaqConnection " << d2d_conn->UID();
88 TLOG_DEBUG(6) <<
"Processing DetectorToDaqConnection " << d2d_conn->UID();
92 if (d2d_conn->contained_resources().empty()) {
93 throw(BadConf(
ERS_HERE,
"DetectorToDaqConnection does not contain senders or receivers"));
99 if ( ! net_conn && ! flx_conn) {
100 throw BadConf(
ERS_HERE, d2d_conn->UID() +
" is neither felix or eth connection");
104 auto det_senders = flx_conn->get_felix_senders();
107 for (
const auto* felix_sender : det_senders) {
109 if ( helper->is_disabled(felix_sender) ) {
110 TLOG() <<
"Skipping disabled sender: " << felix_sender->UID();
114 auto ip = felix_sender -> get_control_host();
118 auto streams = felix_sender -> get_streams();
120 for (
const auto * det_s : streams ) {
122 if ( helper->is_disabled(det_s) ) {
123 TLOG() <<
"Skipping disabled DetStream: " << det_s->UID();
127 auto geo_id = det_s->get_geo_id();
128 auto id = fmt::format(
"{}.{}.{}", geo_id->get_detector_id(), geo_id->get_crate_id(), geo_id->get_slot_id());
129 if (!v3_map.contains(
id)) {
139 auto det_senders = net_conn->get_net_senders();
141 for (
const auto* nw_sender : det_senders ) {
142 if ( helper->is_disabled(nw_sender) ) {
143 TLOG() <<
"Skipping disabled sender: " << nw_sender->UID();
150 throw(BadConf(
ERS_HERE, fmt::format(
"DataSender {} is not a appmodel::HermesDataSender", nw_sender->UID())));
153 hermes_senders[hrms_sender->get_control_host()].push_back(hrms_sender);
155 auto streams = nw_sender -> get_streams();
156 for (
const auto * det_s : streams ) {
158 if ( helper->is_disabled(det_s) ) {
159 TLOG() <<
"Skipping disabled DetStream: " << det_s->UID();
163 auto geo_id = det_s->get_geo_id();
164 auto id = fmt::format(
"{}.{}.{}", geo_id->get_detector_id(), geo_id->get_crate_id(), geo_id->get_slot_id());
165 if (!v3_map.contains(
id)) {
167 interfaces[id] = net_conn->get_net_receiver()->get_uses();
168 ctrl_hosts[id] = hrms_sender->get_control_host();
182 for (
const auto & [
id, v3] : v3_map ) {
184 auto conf_it = conf_map.find(
id);
185 if ( conf_it == conf_map.end() ) {
188 auto conf = conf_it->second;
190 conffwk::ConfigObject module_obj = obj_fac.
create( (v3 ?
"DaphneV3ControllerModule" :
"DaphneV2ControllerModule"), fmt::format(
"controller-{}",
id) );
194 auto module = obj_fac.get_dal<confmodel::DaqModule>(module_obj);
195 modules.push_back(module);
200 std::string hermes_uid = fmt::format(
"daphne-hermes-ctrl-{}",
id);
207 std::vector< const conffwk::ConfigObject * > links_obj;
208 const auto & senders = hermes_senders[ctrl_hosts[id]];
209 for (
const auto* sndr : senders ){
210 links_obj.push_back(&sndr->config_object());
212 hermes_obj.
set_objs(
"links", links_obj);
228 if ( ch_p->get_channel_id() == ch ) {
240 if ( ch_p->get_channel_id() == ch ) {
252 auto end = (afe+1)*8;
253 for (
size_t i = begin; i < end; ++i) {
266 if ( afe_p->get_afe_id() == ch ) {
284 return reg4.to_ulong();
296 return reg51.to_ulong() ;
302 std::bitset<16> reg52;
315 return reg52.to_ulong();
void update_modules(const std::vector< const confmodel::DaqModule * > &modules)
const T * get_dal(std::string uid) const
conffwk::ConfigObject create(const std::string &class_name, const std::string &id) const
const std::vector< const dunedaq::confmodel::DetectorToDaqConnection * > & get_detector_connections() const
Get "detector_connections" relationship value. List of detector components controlled by this applica...
void generate_modules(std::shared_ptr< appmodel::ConfigurationHelper >) const override
virtual std::vector< const Resource * > contained_resources() const override
const dunedaq::appmodel::HermesModuleConf * get_hermes_module_conf() const
Get "hermes_module_conf" relationship value.
const dunedaq::appmodel::DaphneConf * get_configuration() const
Get "configuration" relationship value.
uint16_t get_reg4() const
bool get_MSB_first() const
Get "MSB_first" attribute value. Which Significant bit comes first, true=MSB, false=LSB.
bool get_low_resolution() const
Get "low_resolution" attribute value. true=12bit, false=14bit.
bool get_output_offset_binary() const
Get "output_offset_binary" attribute value. true=Offset Binary, false=2s complement.
const std::vector< const dunedaq::appmodel::DaphneV2AFE * > & get_active_afes() const
Get "active_afes" relationship value.
const DaphneV2AFE & get_afe(size_t id) const
const DaphneV2Channel & get_channel(size_t ch) const
bool is_channel_used(size_t ch) const
bool is_afe_used(size_t ch) const
const dunedaq::appmodel::DaphneV2Channel * get_default_channel() const
Get "default_channel" relationship value.
const std::vector< const dunedaq::appmodel::DaphneV2Channel * > & get_active_channels() const
Get "active_channels" relationship value.
const dunedaq::appmodel::DaphneV2AFE * get_default_afe() const
Get "default_afe" relationship value.
uint16_t get_reg52() const
bool get_integrator_disable() const
Get "integrator_disable" attribute value.
uint8_t get_clamp() const
Get "clamp" attribute value. 0=auto setting, 1=1.5 Vpp, 2=1.15 Vpp, 3=0.6 Vpp.
uint8_t get_gain() const
Get "gain" attribute value. 0=18 dB, 1=24 dB, 2=12 dB.
bool get_integrator_disable() const
Get "integrator_disable" attribute value.
uint8_t get_lpf_cut_frequency() const
Get "lpf_cut_frequency" attribute value. cut frequency, only 4 values acceptable. 0=15MHz,...
uint16_t get_reg51() const
bool get_gain() const
Get "gain" attribute value. rue=30 dB, false=24 dB.
uint32_t get_ipbus_timeout_ms() const
Get "ipbus_timeout_ms" attribute value.
void set_by_val(const std::string &name, T value)
Set attribute value.
void set_objs(const std::string &name, const std::vector< const ConfigObject * > &o, bool skip_non_null_check=false)
Set relationship multi-value.
void set_obj(const std::string &name, const ConfigObject *o, bool skip_non_null_check=false)
Set relationship single-value.
const ConfigObject & config_object() const
const std::string & UID() const noexcept
std::vector< const dunedaq::confmodel::Resource * > to_resources(const std::vector< T * > &vector_of_children)
#define TLOG_DEBUG(lvl,...)