DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
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
19namespace dune {
21}
22
24
25public:
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
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
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
63private:
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
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
void ReadMapFromFile(std::string &fullname)
std::unordered_map< unsigned int, std::unordered_map< unsigned int, std::unordered_map< unsigned int, std::unordered_map< unsigned int, HDChanInfo_t > > > > DetToChanInfo
std::unordered_map< unsigned int, HDChanInfo_t > OfflToChanInfo
HDChanInfo_t GetChanInfoFromOfflChan(unsigned int offlchan) const
struct dune::PD2HDChannelMapSP::HDChanInfo HDChanInfo_t
void check_offline_channel(unsigned int offlineChannel) const
HDChanInfo_t GetChanInfoFromWIBElements(unsigned int crate, unsigned int slot, unsigned int link, unsigned int wibframechan) const
const unsigned int fNChans