DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
detchannelmaps
src
PD2HDChannelMapSP.h
Go to the documentation of this file.
1
2
// Class: PD2HDChannelMapSP
3
// Module type: algorithm
4
// File: PD2HDChannelMapSP.h
5
// Author: Tom Junk, June 2022
6
//
7
// Implementation of hardware-offline channel mapping reading from a file.
8
// art-independent class
9
// ProtoDUNE-2 Horizontal Drift APA wire to offline channel map
11
12
#ifndef PD2HDChannelMapSP_H
13
#define PD2HDChannelMapSP_H
14
15
#include <unordered_map>
16
#include <vector>
17
#include <stdexcept>
18
19
namespace
dune
{
20
class
PD2HDChannelMapSP
;
21
}
22
23
class
dune::PD2HDChannelMapSP
{
24
25
public
:
26
27
typedef
struct
HDChanInfo
{
28
unsigned
int
offlchan
;
// in gdml and channel sorting convention
29
unsigned
int
crate
;
// crate number
30
std::string
APAName
;
// Descriptive APA name
31
unsigned
int
wib
;
// 1, 2, 3, 4 or 5 (slot number +1?)
32
unsigned
int
link
;
// link identifier: 0 or 1
33
unsigned
int
femb_on_link
;
// which of two FEMBs in the WIB frame this FEMB is: 0 or 1
34
unsigned
int
cebchan
;
// cold electronics channel on FEMB: 0 to 127
35
unsigned
int
plane
;
// 0: U, 1: V, 2: X
36
unsigned
int
chan_in_plane
;
// which channel this is in the plane in the FEMB: 0:39 for U and V, 0:47 for X
37
unsigned
int
femb
;
// which FEMB on an APA -- 1 to 20
38
unsigned
int
asic
;
// ASIC: 1 to 8
39
unsigned
int
asicchan
;
// ASIC channel: 0 to 15
40
unsigned
int
wibframechan
;
// channel index in WIB frame (used with get_adc in detdataformats/WIB2Frame.hh). 0:255
41
bool
valid
;
// true if valid, false if not
42
}
HDChanInfo_t
;
43
44
PD2HDChannelMapSP
();
// constructor
45
46
// initialize: read map from file
47
48
void
ReadMapFromFile
(std::string &fullname);
49
50
// TPC channel map accessors
51
52
// Map instrumentation numbers (crate:slot:link:FEMB:plane) to offline channel number. FEMB is 0 or 1 and indexes the FEMB in the WIB frame.
53
// plane = 0 for U, 1 for V and 2 for X
54
55
HDChanInfo_t
GetChanInfoFromWIBElements
(
56
unsigned
int
crate,
57
unsigned
int
slot,
58
unsigned
int
link,
59
unsigned
int
wibframechan)
const
;
60
61
HDChanInfo_t
GetChanInfoFromOfflChan
(
unsigned
int
offlchan)
const
;
62
63
private
:
64
65
const
unsigned
int
fNChans
= 2560*4;
66
67
// map of crate, slot, link, femb_on_link, plane, chan to channel info struct
68
69
std::unordered_map<
unsigned
int,
// crate
70
std::unordered_map<
unsigned
int,
// wib
71
std::unordered_map<
unsigned
int,
// link
72
std::unordered_map<
unsigned
int,
// wibframechan
73
HDChanInfo_t
> > > >
DetToChanInfo
;
74
75
// map of chan info indexed by offline channel number
76
77
std::unordered_map<unsigned int, HDChanInfo_t>
OfflToChanInfo
;
78
79
//-----------------------------------------------
80
81
void
check_offline_channel
(
unsigned
int
offlineChannel)
const
82
{
83
if
(offlineChannel >=
fNChans
)
84
{
85
throw
std::range_error(
"PD2HDChannelMapSP offline Channel out of range"
);
86
}
87
};
88
89
};
90
91
92
#endif
dune::PD2HDChannelMapSP
Definition
PD2HDChannelMapSP.h:23
dune::PD2HDChannelMapSP::ReadMapFromFile
void ReadMapFromFile(std::string &fullname)
Definition
PD2HDChannelMapSP.cpp:22
dune::PD2HDChannelMapSP::HDChanInfo_t
struct dune::PD2HDChannelMapSP::HDChanInfo HDChanInfo_t
dune::PD2HDChannelMapSP::DetToChanInfo
std::unordered_map< unsigned int, std::unordered_map< unsigned int, std::unordered_map< unsigned int, std::unordered_map< unsigned int, HDChanInfo_t > > > > DetToChanInfo
Definition
PD2HDChannelMapSP.h:73
dune::PD2HDChannelMapSP::OfflToChanInfo
std::unordered_map< unsigned int, HDChanInfo_t > OfflToChanInfo
Definition
PD2HDChannelMapSP.h:77
dune::PD2HDChannelMapSP::PD2HDChannelMapSP
PD2HDChannelMapSP()
Definition
PD2HDChannelMapSP.cpp:18
dune::PD2HDChannelMapSP::GetChanInfoFromOfflChan
HDChanInfo_t GetChanInfoFromOfflChan(unsigned int offlchan) const
Definition
PD2HDChannelMapSP.cpp:100
dune::PD2HDChannelMapSP::check_offline_channel
void check_offline_channel(unsigned int offlineChannel) const
Definition
PD2HDChannelMapSP.h:81
dune::PD2HDChannelMapSP::GetChanInfoFromWIBElements
HDChanInfo_t GetChanInfoFromWIBElements(unsigned int crate, unsigned int slot, unsigned int link, unsigned int wibframechan) const
Definition
PD2HDChannelMapSP.cpp:60
dune::PD2HDChannelMapSP::fNChans
const unsigned int fNChans
Definition
PD2HDChannelMapSP.h:65
dune
Definition
PD2HDChannelMapSP.h:19
wib
Definition
wib.pb.cc:23
dune::PD2HDChannelMapSP::HDChanInfo
Definition
PD2HDChannelMapSP.h:27
dune::PD2HDChannelMapSP::HDChanInfo::asicchan
unsigned int asicchan
Definition
PD2HDChannelMapSP.h:39
dune::PD2HDChannelMapSP::HDChanInfo::offlchan
unsigned int offlchan
Definition
PD2HDChannelMapSP.h:28
dune::PD2HDChannelMapSP::HDChanInfo::APAName
std::string APAName
Definition
PD2HDChannelMapSP.h:30
dune::PD2HDChannelMapSP::HDChanInfo::asic
unsigned int asic
Definition
PD2HDChannelMapSP.h:38
dune::PD2HDChannelMapSP::HDChanInfo::link
unsigned int link
Definition
PD2HDChannelMapSP.h:32
dune::PD2HDChannelMapSP::HDChanInfo::femb
unsigned int femb
Definition
PD2HDChannelMapSP.h:37
dune::PD2HDChannelMapSP::HDChanInfo::valid
bool valid
Definition
PD2HDChannelMapSP.h:41
dune::PD2HDChannelMapSP::HDChanInfo::plane
unsigned int plane
Definition
PD2HDChannelMapSP.h:35
dune::PD2HDChannelMapSP::HDChanInfo::crate
unsigned int crate
Definition
PD2HDChannelMapSP.h:29
dune::PD2HDChannelMapSP::HDChanInfo::chan_in_plane
unsigned int chan_in_plane
Definition
PD2HDChannelMapSP.h:36
dune::PD2HDChannelMapSP::HDChanInfo::wibframechan
unsigned int wibframechan
Definition
PD2HDChannelMapSP.h:40
dune::PD2HDChannelMapSP::HDChanInfo::femb_on_link
unsigned int femb_on_link
Definition
PD2HDChannelMapSP.h:33
dune::PD2HDChannelMapSP::HDChanInfo::cebchan
unsigned int cebchan
Definition
PD2HDChannelMapSP.h:34
Generated on
for DUNE-DAQ by
1.17.0