DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
detchannelmaps
include
detchannelmaps
PDSChannelMap.hpp
Go to the documentation of this file.
1
#ifndef DETCHANNELMAPS_INCLUDE_DETCHANNELMAPS_PDSCHANNELMAP_HPP_
2
#define DETCHANNELMAPS_INCLUDE_DETCHANNELMAPS_PDSCHANNELMAP_HPP_
3
4
#include "cetlib/BasicPluginFactory.h"
5
#include "cetlib/compiler_macros.h"
6
#include "
ers/Issue.hpp
"
7
#include "
logging/Logging.hpp
"
// NOTE: if ISSUES ARE DECLARED BEFORE include logging/Logging.hpp, TLOG_DEBUG<<issue wont work.
8
#include <optional>
9
10
#ifndef EXTERN_C_FUNC_DECLARE_START
11
// NOLINTNEXTLINE(build/define_used)
12
#define EXTERN_C_FUNC_DECLARE_START \
13
extern "C" \
14
{
15
#endif
20
// NOLINTNEXTLINE(build/define_used)
21
#define DEFINE_DUNE_DET_PDSCHANNEL_MAP(klass) \
22
EXTERN_C_FUNC_DECLARE_START \
23
std::shared_ptr<dunedaq::detchannelmaps::PDSChannelMap> make() \
24
{ \
25
return std::shared_ptr<dunedaq::detchannelmaps::PDSChannelMap>(new klass()); \
26
} \
27
}
28
29
namespace
dunedaq
{
30
31
// Disable coverage collection LCOV_EXCL_START
35
ERS_DECLARE_ISSUE
(
detchannelmaps
,
36
PDSChannelMapCreationFailed,
37
"Failed to create PDSChannelMap of type "
<< plugin_name,
38
((std::string)plugin_name)
39
)
40
ERS_DECLARE_ISSUE
(
detchannelmaps
,
41
PDSInvalidStream
,
42
"Invalid stream number "
<< stream,
43
((uint)stream)
44
)
45
46
namespace
detchannelmaps
{
47
48
class
PDSChannelMap
49
{
50
public
:
51
struct
PDSChannelInfo
52
{
53
static
constexpr
uint16_t kUndefined = 0xffff;
54
55
uint16_t detector = kUndefined;
56
uint16_t crate = kUndefined;
57
uint16_t slot = kUndefined;
58
uint16_t stream = kUndefined;
59
uint16_t channel = kUndefined;
60
uint16_t element = kUndefined;
61
};
62
74
virtual
uint get_offline_channel_from_det_crate_slot_stream_chan(uint det,
75
uint crate,
76
uint slot,
77
uint stream,
78
uint channel) = 0;
79
80
virtual
uint get_element_from_offline_channel(uint) = 0;
81
virtual
std::string get_element_name_from_offline_channel(uint) = 0;
82
virtual
std::optional<PDSChannelInfo> get_det_crate_slot_fiber_chan_from_offline_channel(uint offchannel) = 0;
86
virtual
~PDSChannelMap()
noexcept
=
default
;
87
88
protected
:
89
/*
90
* @brief PDSChannelMap Constructor
91
* @param name Name of the PDSChannelMap
92
*/
93
explicit
PDSChannelMap() {}
94
};
95
104
inline
std::shared_ptr<PDSChannelMap>
105
make_pds_map(std::string
const
& plugin_name)
106
{
107
static
cet::BasicPluginFactory bpf(
"dunePDSChannelMap"
,
"make"
);
108
109
std::shared_ptr<PDSChannelMap> mod_ptr;
110
try
{
111
mod_ptr = bpf.makePlugin<std::shared_ptr<PDSChannelMap>>(plugin_name);
112
}
catch
(
const
cet::exception& cexpt) {
113
throw
PDSChannelMapCreationFailed(
ERS_HERE
, plugin_name, cexpt);
114
}
115
return
mod_ptr;
116
}
117
118
}
// namespace detchannelmaps
119
120
}
// namespace dunedaq
121
122
#endif
// DETCHANNELMAPS_INCLUDE_DETCHANNELMAPS_PDSCHANNELMAP_HPP_
Issue.hpp
ERS_HERE
#define ERS_HERE
Definition
LocalContext.hpp:127
Logging.hpp
detchannelmaps
Definition
__init__.py:1
dunedaq
The DUNE-DAQ namespace.
Definition
cib_utilities.cpp:5
dunedaq::ERS_DECLARE_ISSUE
ERS_DECLARE_ISSUE(cibmodules, CIBCommunicationError, " CIB Hardware Communication Error: "<< descriptor,((std::string) descriptor)) ERS_DECLARE_ISSUE(cibmodules
dunedaq::PDSInvalidStream
PDSInvalidStream
< Namespace
Definition
PDSChannelMap.hpp:41
Generated on
for DUNE-DAQ by
1.18.0