DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
detchannelmaps
include
detchannelmaps
TPCChannelMap.hpp
Go to the documentation of this file.
1
#ifndef DETCHANNELMAPS_INCLUDE_DETCHANNELMAPS_TPCCHANNELMAP_HPP_
2
#define DETCHANNELMAPS_INCLUDE_DETCHANNELMAPS_TPCCHANNELMAP_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_TPCCHANNEL_MAP(klass) \
22
EXTERN_C_FUNC_DECLARE_START \
23
std::shared_ptr<dunedaq::detchannelmaps::TPCChannelMap> make() \
24
{ \
25
return std::shared_ptr<dunedaq::detchannelmaps::TPCChannelMap>(new klass()); \
26
} \
27
}
28
29
namespace
dunedaq
{
30
31
// Disable coverage collection LCOV_EXCL_START
35
ERS_DECLARE_ISSUE
(
detchannelmaps
,
36
ChannelMapCreationFailed,
37
"Failed to create TPCChannelMap of type "
<< plugin_name,
38
((std::string)plugin_name)
39
)
40
41
ERS_DECLARE_ISSUE
(
detchannelmaps
,
42
InvalidStreamID
,
43
"Invalid stream identifier "
<< stream,
44
((uint)stream)
45
)
46
47
ERS_DECLARE_ISSUE
(
detchannelmaps
,
48
InvalidDetectorID,
49
"Invalid detector identifier "
<< stream,
50
((uint)stream)
51
)
52
53
namespace
detchannelmaps
{
54
55
class
TPCChannelMap
56
{
57
public
:
58
struct
TPCChannelInfo
59
{
60
static
constexpr
uint16_t kUndefined = 0xffff;
61
62
uint16_t detector = kUndefined;
63
uint16_t crate = kUndefined;
64
uint16_t slot = kUndefined;
65
uint16_t stream = kUndefined;
66
uint16_t channel = kUndefined;
67
uint16_t element = kUndefined;
68
};
69
81
virtual
uint get_offline_channel_from_det_crate_slot_stream_chan(uint det,
82
uint crate,
83
uint slot,
84
uint stream,
85
uint channel) = 0;
86
87
virtual
uint get_plane_from_offline_channel(uint offchannel) = 0;
88
virtual
uint get_element_id_from_offline_channel(uint) = 0;
89
virtual
std::string get_element_name_from_offline_channel(uint) = 0;
90
virtual
std::optional<TPCChannelInfo> get_channel_info_from_offline_channel(uint offchannel) = 0;
94
virtual
~TPCChannelMap()
noexcept
=
default
;
95
96
protected
:
101
explicit
TPCChannelMap() {}
102
};
103
112
inline
std::shared_ptr<TPCChannelMap>
113
make_tpc_map(std::string
const
& plugin_name)
114
{
115
static
cet::BasicPluginFactory bpf(
"duneTPCChannelMap"
,
"make"
);
116
117
std::shared_ptr<TPCChannelMap> mod_ptr;
118
try
{
119
mod_ptr = bpf.makePlugin<std::shared_ptr<TPCChannelMap>>(plugin_name);
120
}
catch
(
const
cet::exception& cexpt) {
121
throw
ChannelMapCreationFailed(
ERS_HERE
, plugin_name, cexpt);
122
}
123
return
mod_ptr;
124
}
125
126
}
// namespace detchannelmaps
127
128
}
// namespace dunedaq
129
130
#endif
// DETCHANNELMAPS_INCLUDE_DETCHANNELMAPS_TPCCHANNELMAP_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::InvalidStreamID
InvalidStreamID
< Namespace
Definition
TPCChannelMap.hpp:42
Generated on
for DUNE-DAQ by
1.18.0