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
11
#ifndef EXTERN_C_FUNC_DECLARE_START
12
// NOLINTNEXTLINE(build/define_used)
13
#define EXTERN_C_FUNC_DECLARE_START \
14
extern "C" \
15
{
16
#endif
21
// NOLINTNEXTLINE(build/define_used)
22
#define DEFINE_DUNE_DET_TPCCHANNEL_MAP(klass) \
23
EXTERN_C_FUNC_DECLARE_START \
24
std::shared_ptr<dunedaq::detchannelmaps::TPCChannelMap> make() \
25
{ \
26
return std::shared_ptr<dunedaq::detchannelmaps::TPCChannelMap>(new klass()); \
27
} \
28
}
29
30
31
namespace
dunedaq
{
32
33
// Disable coverage collection LCOV_EXCL_START
37
ERS_DECLARE_ISSUE
(
detchannelmaps
,
38
ChannelMapCreationFailed,
39
"Failed to create TPCChannelMap of type "
<< plugin_name,
40
((std::string)plugin_name)
41
)
42
43
ERS_DECLARE_ISSUE
(
detchannelmaps
,
44
InvalidStreamID
,
45
"Invalid stream identifier "
<< stream,
46
((uint)stream)
47
)
48
49
ERS_DECLARE_ISSUE
(
detchannelmaps
,
50
InvalidDetectorID,
51
"Invalid detector identifier "
<< stream,
52
((uint)stream)
53
)
54
55
56
namespace
detchannelmaps
{
57
58
class
TPCChannelMap
59
{
60
public
:
61
62
struct
TPCChannelInfo
63
{
64
static
constexpr
uint16_t kUndefined=0xffff;
65
66
uint16_t detector = kUndefined;
67
uint16_t crate = kUndefined;
68
uint16_t slot = kUndefined;
69
uint16_t stream = kUndefined;
70
uint16_t channel = kUndefined;
71
uint16_t element = kUndefined;
72
};
73
85
virtual
uint get_offline_channel_from_det_crate_slot_stream_chan(uint det, uint crate, uint slot, uint stream, 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:141
Logging.hpp
ERS_DECLARE_ISSUE
#define ERS_DECLARE_ISSUE( namespace_name, class_name, message_, attributes)
Definition
macro.hpp:65
detchannelmaps
Definition
__init__.py:1
dunedaq
Including Qt Headers.
Definition
module.cpp:16
dunedaq::InvalidStreamID
InvalidStreamID
< Namespace
Definition
TPCChannelMap.hpp:44
Generated on
for DUNE-DAQ by
1.17.0