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

#include <PD2HDChannelMapSPPluginBase.hpp>

Inheritance diagram for dunedaq::detchannelmaps::PD2HDChannelMapSPPluginBase:
[legend]
Collaboration diagram for dunedaq::detchannelmaps::PD2HDChannelMapSPPluginBase:
[legend]

Public Member Functions

 PD2HDChannelMapSPPluginBase (uint det_id, const std::string &channel_map_path)
 Construct a new PD2HDChannelMapSPPluginBase object.
 PD2HDChannelMapSPPluginBase (const PD2HDChannelMapSPPluginBase &)=delete
 PD2HDChannelMapSPPluginBase is not copy-constructible.
PD2HDChannelMapSPPluginBase & operator= (const PD2HDChannelMapSPPluginBase &)=delete
 PD2HDChannelMapSPPluginBase is not copy-assignable.
 PD2HDChannelMapSPPluginBase (PD2HDChannelMapSPPluginBase &&)=delete
 PD2HDChannelMapSPPluginBase is not move-constructible.
PD2HDChannelMapSPPluginBase & operator= (PD2HDChannelMapSPPluginBase &&)=delete
 PD2HDChannelMapSPPluginBase is not move-assignable.
uint get_offline_channel_from_det_crate_slot_stream_chan (uint det, uint crate, uint slot, uint stream, uint channel) final
 Get the offline channel from detector crate slot stream chan object.
uint get_plane_from_offline_channel (uint offchannel) final
 Get the plane from offline channel object.
uint get_element_id_from_offline_channel (uint offchannel) final
 Get the element id from offline channel object.
std::string get_element_name_from_offline_channel (uint offchannel) final
 Get the tpc element name from offline channel object.
std::optional< TPCChannelMap::TPCChannelInfo > get_channel_info_from_offline_channel (uint offchannel) final

Protected Attributes

std::function< uint(std::string)> m_elem_name_id_converter

Private Attributes

const uint m_det_id
std::unique_ptr< dune::PD2HDChannelMapSP > m_channel_map

Detailed Description

Definition at line 10 of file PD2HDChannelMapSPPluginBase.hpp.

Constructor & Destructor Documentation

◆ PD2HDChannelMapSPPluginBase() [1/3]

dunedaq::detchannelmaps::PD2HDChannelMapSPPluginBase::PD2HDChannelMapSPPluginBase ( uint det_id,
const std::string & channel_map_path )
inlineexplicit

Construct a new PD2HDChannelMapSPPluginBase object.

Parameters
det_id
channel_map_path

Definition at line 26 of file PD2HDChannelMapSPPluginBase.hpp.

27 : m_det_id(det_id)
28 {
29
30 const char* detchannelmaps_share_cstr = getenv("DETCHANNELMAPS_SHARE");
31 if (!detchannelmaps_share_cstr) {
32 throw std::runtime_error("Environment variable DETCHANNELMAPS_SHARE is not set");
33 }
34 std::string detchannelmaps_share(detchannelmaps_share_cstr);
35 std::string channel_map_file = detchannelmaps_share + "/config/" + channel_map_path;
36 m_channel_map.reset(new dune::PD2HDChannelMapSP());
37 m_channel_map->ReadMapFromFile(channel_map_file);
38 }

◆ PD2HDChannelMapSPPluginBase() [2/3]

dunedaq::detchannelmaps::PD2HDChannelMapSPPluginBase::PD2HDChannelMapSPPluginBase ( const PD2HDChannelMapSPPluginBase & )
delete

PD2HDChannelMapSPPluginBase is not copy-constructible.

◆ PD2HDChannelMapSPPluginBase() [3/3]

dunedaq::detchannelmaps::PD2HDChannelMapSPPluginBase::PD2HDChannelMapSPPluginBase ( PD2HDChannelMapSPPluginBase && )
delete

PD2HDChannelMapSPPluginBase is not move-constructible.

Member Function Documentation

◆ get_channel_info_from_offline_channel()

std::optional< TPCChannelMap::TPCChannelInfo > dunedaq::detchannelmaps::PD2HDChannelMapSPPluginBase::get_channel_info_from_offline_channel ( uint offchannel)
inlinefinal

Definition at line 144 of file PD2HDChannelMapSPPluginBase.hpp.

145 {
146 auto ci = m_channel_map->GetChanInfoFromOfflChan(offchannel);
147
148 if (!ci.valid) {
149 return std::nullopt;
150 }
151 constexpr uint n_chan_per_stream = 64;
152 uint16_t slot_id = ci.wib - 1;
153 uint16_t stream_id = ci.link * n_chan_per_stream + ci.wibframechan / n_chan_per_stream;
154 uint16_t chan_id = ci.wibframechan % n_chan_per_stream;
155
156 return TPCChannelMap::TPCChannelInfo{ m_det_id, ci.crate, slot_id,
157 stream_id, chan_id, m_elem_name_id_converter(ci.APAName) };
158 }

◆ get_element_id_from_offline_channel()

uint dunedaq::detchannelmaps::PD2HDChannelMapSPPluginBase::get_element_id_from_offline_channel ( uint offchannel)
inlinefinal

Get the element id from offline channel object.

Parameters
offchannel
Returns
uint

Definition at line 113 of file PD2HDChannelMapSPPluginBase.hpp.

114 {
115 auto chan_info = m_channel_map->GetChanInfoFromOfflChan(offchannel);
116
117 if (!chan_info.valid) {
118 return -1;
119 }
120
121 return m_elem_name_id_converter(chan_info.APAName);
122
123 // There is only one element
124 return 0;
125 }

◆ get_element_name_from_offline_channel()

std::string dunedaq::detchannelmaps::PD2HDChannelMapSPPluginBase::get_element_name_from_offline_channel ( uint offchannel)
inlinefinal

Get the tpc element name from offline channel object.

Parameters
offchannel
Returns
std::string

Definition at line 133 of file PD2HDChannelMapSPPluginBase.hpp.

134 {
135 auto chan_info = m_channel_map->GetChanInfoFromOfflChan(offchannel);
136
137 if (!chan_info.valid) {
138 return "";
139 }
140
141 return chan_info.APAName;
142 }

◆ get_offline_channel_from_det_crate_slot_stream_chan()

uint dunedaq::detchannelmaps::PD2HDChannelMapSPPluginBase::get_offline_channel_from_det_crate_slot_stream_chan ( uint det,
uint crate,
uint slot,
uint stream,
uint channel )
inlinefinal

Get the offline channel from detector crate slot stream chan object.

Parameters
det
crate
slot
stream
channel
Returns
offline channel identifier

Definition at line 60 of file PD2HDChannelMapSPPluginBase.hpp.

65 {
66
67 // Must be a BDE channel
68 if (det != m_det_id)
69 return -1;
70
71 // if stream number looks wrong (not 0,1,2,3 or 64,65,66,67)
72 if ((stream & 0xbc))
73 return -1;
74
75 constexpr uint n_chan_per_stream = 64;
76
77 uint link = (stream >> 6) & 1;
78 uint stream_in_link = (stream & 0x3);
79 uint wibframechan = n_chan_per_stream * stream_in_link + channel;
80
81 auto chan_info = m_channel_map->GetChanInfoFromWIBElements(crate, slot, link, wibframechan);
82
83 if (!chan_info.valid) {
84 return -1;
85 }
86
87 return chan_info.offlchan;
88 }

◆ get_plane_from_offline_channel()

uint dunedaq::detchannelmaps::PD2HDChannelMapSPPluginBase::get_plane_from_offline_channel ( uint offchannel)
inlinefinal

Get the plane from offline channel object.

Parameters
offchannel
Returns
plane id (0, 1 or 2)

Definition at line 96 of file PD2HDChannelMapSPPluginBase.hpp.

97 {
98 auto chan_info = m_channel_map->GetChanInfoFromOfflChan(offchannel);
99
100 if (!chan_info.valid) {
101 return -1;
102 }
103
104 return chan_info.plane;
105 };

◆ operator=() [1/2]

PD2HDChannelMapSPPluginBase & dunedaq::detchannelmaps::PD2HDChannelMapSPPluginBase::operator= ( const PD2HDChannelMapSPPluginBase & )
delete

PD2HDChannelMapSPPluginBase is not copy-assignable.

◆ operator=() [2/2]

PD2HDChannelMapSPPluginBase & dunedaq::detchannelmaps::PD2HDChannelMapSPPluginBase::operator= ( PD2HDChannelMapSPPluginBase && )
delete

PD2HDChannelMapSPPluginBase is not move-assignable.

Member Data Documentation

◆ m_channel_map

std::unique_ptr<dune::PD2HDChannelMapSP> dunedaq::detchannelmaps::PD2HDChannelMapSPPluginBase::m_channel_map
private

Definition at line 14 of file PD2HDChannelMapSPPluginBase.hpp.

◆ m_det_id

const uint dunedaq::detchannelmaps::PD2HDChannelMapSPPluginBase::m_det_id
private

Definition at line 13 of file PD2HDChannelMapSPPluginBase.hpp.

◆ m_elem_name_id_converter

std::function<uint(std::string)> dunedaq::detchannelmaps::PD2HDChannelMapSPPluginBase::m_elem_name_id_converter
protected

Definition at line 17 of file PD2HDChannelMapSPPluginBase.hpp.


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