52std::vector<const confmodel::Resource*>
63 std::vector<const confmodel::DaqModule*> modules;
67 std::map<std::string, const DaphneV2BoardConf*> conf_map;
68 auto confs = daphne_conf->get_boards();
69 for (
const auto & c : confs ) {
70 conf_map[c->get_key()] = c->get_conf();
74 std::map<std::string, bool> v3_map;
75 std::map<std::string, const confmodel::NetworkInterface*> interfaces;
76 std::map<std::string, std::string> ctrl_hosts;
79 std::map<std::string, std::vector<const appmodel::HermesDataSender*> > hermes_senders;
84 if (d2d_conn->is_disabled(*
session)) {
85 TLOG_DEBUG(7) <<
"Ignoring disabled DetectorToDaqConnection " << d2d_conn->UID();
89 TLOG_DEBUG(6) <<
"Processing DetectorToDaqConnection " << d2d_conn->UID();
93 if (d2d_conn->contained_resources().empty()) {
94 throw(BadConf(
ERS_HERE,
"DetectorToDaqConnection does not contain senders or receivers"));
100 if ( ! net_conn && ! flx_conn) {
101 throw BadConf(
ERS_HERE, d2d_conn->UID() +
" is neither felix or eth connection");
105 auto det_senders = flx_conn->get_felix_senders();
108 for (
const auto* felix_sender : det_senders) {
110 if ( felix_sender->is_disabled(*
session) ) {
111 TLOG() <<
"Skipping disabled sender: " << felix_sender->UID();
115 auto ip = felix_sender -> get_control_host();
119 auto streams = felix_sender -> get_streams();
121 for (
const auto * det_s : streams ) {
123 if ( det_s->is_disabled(*
session) ) {
124 TLOG() <<
"Skipping disabled DetStream: " << det_s->UID();
128 auto geo_id = det_s->get_geo_id();
129 auto id = fmt::format(
"{}.{}.{}", geo_id->get_detector_id(), geo_id->get_crate_id(), geo_id->get_slot_id());
130 if (!v3_map.contains(
id)) {
140 auto det_senders = net_conn->get_net_senders();
142 for (
const auto* nw_sender : det_senders ) {
143 if ( nw_sender->is_disabled(*
session) ) {
144 TLOG() <<
"Skipping disabled sender: " << nw_sender->UID();
151 throw(BadConf(
ERS_HERE, fmt::format(
"DataSender {} is not a appmodel::HermesDataSender", nw_sender->UID())));
154 hermes_senders[hrms_sender->get_control_host()].push_back(hrms_sender);
156 auto streams = nw_sender -> get_streams();
157 for (
const auto * det_s : streams ) {
159 if ( det_s->is_disabled(*
session) ) {
160 TLOG() <<
"Skipping disabled DetStream: " << det_s->UID();
164 auto geo_id = det_s->get_geo_id();
165 auto id = fmt::format(
"{}.{}.{}", geo_id->get_detector_id(), geo_id->get_crate_id(), geo_id->get_slot_id());
166 if (!v3_map.contains(
id)) {
168 interfaces[id] = net_conn->get_net_receiver()->get_uses();
169 ctrl_hosts[id] = hrms_sender->get_control_host();
183 for (
const auto & [
id, v3] : v3_map ) {
185 auto conf_it = conf_map.find(
id);
186 if ( conf_it == conf_map.end() ) {
189 auto conf = conf_it->second;
191 conffwk::ConfigObject module_obj = obj_fac.
create( (v3 ?
"DaphneV3ControllerModule" :
"DaphneV2ControllerModule"), fmt::format(
"controller-{}",
id) );
195 auto module = obj_fac.get_dal<confmodel::DaqModule>(module_obj);
196 modules.push_back(module);
201 std::string hermes_uid = fmt::format(
"daphne-hermes-ctrl-{}",
id);
208 std::vector< const conffwk::ConfigObject * > links_obj;
209 const auto & senders = hermes_senders[ctrl_hosts[id]];
210 for (
const auto* sndr : senders ){
211 links_obj.push_back(&sndr->config_object());
213 hermes_obj.
set_objs(
"links", links_obj);
229 if ( ch_p->get_channel_id() == ch ) {
241 if ( ch_p->get_channel_id() == ch ) {
253 auto end = (afe+1)*8;
254 for (
size_t i = begin; i < end; ++i) {
267 if ( afe_p->get_afe_id() == ch ) {
285 return reg4.to_ulong();
297 return reg51.to_ulong() ;
303 std::bitset<16> reg52;
316 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(const confmodel::Session *) 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,...)