DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
detchannelmaps
src
TPCChannelMapSP.h
Go to the documentation of this file.
1
2
// Class: TPCChannelMapSP
3
// Module type: algorithm
4
// File: TPCChannelMapSP.h
5
// Author: Tom Junk, Jan 2025
6
//
7
// Meant to cover cases with HD and VD (BDE and TDE) which use the DUNE-DAQ v4.4.0 DAQEth header
8
// detdataformats/DAQEthHeader.hpp
10
11
#ifndef TPCChannelMapSP_H
12
#define TPCChannelMapSP_H
13
14
#include <stdexcept>
15
#include <string>
16
#include <unordered_map>
17
#include <vector>
18
19
namespace
dune
{
20
class
TPCChannelMapSP
;
21
}
22
23
class
dune::TPCChannelMapSP
{
24
25
public
:
26
typedef
struct
TPCChanInfo
{
27
unsigned
int
offlchan
;
// in gdml and channel sorting convention
28
unsigned
int
detid
;
// from detdatformats/DetID.hpp. Map key
29
unsigned
int
detelement
;
// CRP number for Vertical Drift or APA number for Horizontal Drift
30
unsigned
int
crate
;
// crate number Map key
31
unsigned
int
slot
;
// slot in crate (WIB for BDE and HD, card for TDE) Map key
32
unsigned
int
stream
;
// Hermes stream for BDE and HD, 0 for TDE Map key
33
unsigned
int
streamchan
;
// channel in the stream. Usually 0:63 Map key
34
unsigned
int
plane
;
// 0: U, 1: V, 2: X For info only
35
unsigned
int
chan_in_plane
;
// which channel this is in the plane For info only
36
unsigned
int
femb
;
// which FEMB For info only
37
unsigned
int
asic
;
// ASIC For info only
38
unsigned
int
asicchan
;
// ASIC channel For info only
39
bool
valid
;
// true if valid, false if not -- if map lookup fails, this is false
40
}
TPCChanInfo_t
;
41
42
TPCChannelMapSP
();
// constructor
43
44
// initialize: read map from file
45
46
void
ReadMapFromFile
(std::string& fullname);
47
48
// TPC channel map accessors
49
50
// Map instrumentation numbers (detid:crate:slot:stream:streamchan) to offline channel number.
51
52
TPCChanInfo_t
GetChanInfoFromElectronicsIDs
(
unsigned
int
detid
,
53
unsigned
int
crate,
54
unsigned
int
slot,
55
unsigned
int
stream,
56
unsigned
int
streamchan)
const
;
57
58
TPCChanInfo_t
GetChanInfoFromOfflChan
(
unsigned
int
offlchan)
const
;
59
60
unsigned
int
GetNChannels
() {
return
fNChans
; };
61
62
// crate to substitute in case the crate number is not understood.
63
64
void
SetSubstituteCrate
(
unsigned
int
sc) {
fSubstituteCrate
= sc; }
65
66
unsigned
int
GetSubstituteCrate
() {
return
fSubstituteCrate
; }
67
68
private
:
69
unsigned
int
fNChans
;
// summed over the detector
70
unsigned
int
fSubstituteCrate
;
// crate to substitute in case crate is not understood.
71
// this is meant for re-using a channel map for a coldbox for example
72
73
// map of detid, crate, slot, stream, streamchan to channel info struct
74
75
std::unordered_map<size_t, TPCChanInfo_t>
DetToChanInfo
;
// just one key, a hash of the five keys (see make_hash)
76
77
// map of chan info indexed by offline channel number
78
79
std::unordered_map<unsigned int, TPCChanInfo_t>
OfflToChanInfo
;
80
81
//-----------------------------------------------
82
83
void
check_offline_channel
(
unsigned
int
offlineChannel)
const
84
{
85
// do nothing as channels may not be densely spaced in offline channel number.
86
};
87
88
size_t
make_hash
(
unsigned
int
detid
,
//6 bits
89
unsigned
int
crate,
//10 bits
90
unsigned
int
slot,
//4 bits
91
unsigned
int
stream,
//8 bits
92
unsigned
int
streamch
//12 bits
93
)
const
;
94
};
95
96
#endif
detid
detid
Definition
TriggerActivity_serialization.hpp:47
dune::TPCChannelMapSP
Definition
TPCChannelMapSP.h:23
dune::TPCChannelMapSP::GetSubstituteCrate
unsigned int GetSubstituteCrate()
Definition
TPCChannelMapSP.h:66
dune::TPCChannelMapSP::GetNChannels
unsigned int GetNChannels()
Definition
TPCChannelMapSP.h:60
dune::TPCChannelMapSP::make_hash
size_t make_hash(unsigned int detid, unsigned int crate, unsigned int slot, unsigned int stream, unsigned int streamch) const
Definition
TPCChannelMapSP.cpp:111
dune::TPCChannelMapSP::GetChanInfoFromOfflChan
TPCChanInfo_t GetChanInfoFromOfflChan(unsigned int offlchan) const
Definition
TPCChannelMapSP.cpp:99
dune::TPCChannelMapSP::OfflToChanInfo
std::unordered_map< unsigned int, TPCChanInfo_t > OfflToChanInfo
Definition
TPCChannelMapSP.h:79
dune::TPCChannelMapSP::ReadMapFromFile
void ReadMapFromFile(std::string &fullname)
Definition
TPCChannelMapSP.cpp:22
dune::TPCChannelMapSP::fSubstituteCrate
unsigned int fSubstituteCrate
Definition
TPCChannelMapSP.h:70
dune::TPCChannelMapSP::DetToChanInfo
std::unordered_map< size_t, TPCChanInfo_t > DetToChanInfo
Definition
TPCChannelMapSP.h:75
dune::TPCChannelMapSP::TPCChanInfo_t
struct dune::TPCChannelMapSP::TPCChanInfo TPCChanInfo_t
dune::TPCChannelMapSP::fNChans
unsigned int fNChans
Definition
TPCChannelMapSP.h:69
dune::TPCChannelMapSP::check_offline_channel
void check_offline_channel(unsigned int offlineChannel) const
Definition
TPCChannelMapSP.h:83
dune::TPCChannelMapSP::TPCChannelMapSP
TPCChannelMapSP()
Definition
TPCChannelMapSP.cpp:17
dune::TPCChannelMapSP::GetChanInfoFromElectronicsIDs
TPCChanInfo_t GetChanInfoFromElectronicsIDs(unsigned int detid, unsigned int crate, unsigned int slot, unsigned int stream, unsigned int streamchan) const
Definition
TPCChannelMapSP.cpp:76
dune::TPCChannelMapSP::SetSubstituteCrate
void SetSubstituteCrate(unsigned int sc)
Definition
TPCChannelMapSP.h:64
dune
Definition
PD2HDChannelMapSP.h:19
dune::TPCChannelMapSP::TPCChanInfo
Definition
TPCChannelMapSP.h:26
dune::TPCChannelMapSP::TPCChanInfo::femb
unsigned int femb
Definition
TPCChannelMapSP.h:36
dune::TPCChannelMapSP::TPCChanInfo::asicchan
unsigned int asicchan
Definition
TPCChannelMapSP.h:38
dune::TPCChannelMapSP::TPCChanInfo::chan_in_plane
unsigned int chan_in_plane
Definition
TPCChannelMapSP.h:35
dune::TPCChannelMapSP::TPCChanInfo::stream
unsigned int stream
Definition
TPCChannelMapSP.h:32
dune::TPCChannelMapSP::TPCChanInfo::offlchan
unsigned int offlchan
Definition
TPCChannelMapSP.h:27
dune::TPCChannelMapSP::TPCChanInfo::valid
bool valid
Definition
TPCChannelMapSP.h:39
dune::TPCChannelMapSP::TPCChanInfo::asic
unsigned int asic
Definition
TPCChannelMapSP.h:37
dune::TPCChannelMapSP::TPCChanInfo::crate
unsigned int crate
Definition
TPCChannelMapSP.h:30
dune::TPCChannelMapSP::TPCChanInfo::slot
unsigned int slot
Definition
TPCChannelMapSP.h:31
dune::TPCChannelMapSP::TPCChanInfo::detid
unsigned int detid
Definition
TPCChannelMapSP.h:28
dune::TPCChannelMapSP::TPCChanInfo::detelement
unsigned int detelement
Definition
TPCChannelMapSP.h:29
dune::TPCChannelMapSP::TPCChanInfo::plane
unsigned int plane
Definition
TPCChannelMapSP.h:34
dune::TPCChannelMapSP::TPCChanInfo::streamchan
unsigned int streamchan
Definition
TPCChannelMapSP.h:33
Generated on
for DUNE-DAQ by
1.17.0