ProtoduneChannelHelper.h
Go to the documentation of this file.
1 // ProtoduneChannelHelper.h
2 //
3 // David Adams
4 // October 2020
5 //
6 // Tool to intepret PDSP channel numbers.
7 
8 #ifndef ProtoduneChannelHelper_H
9 #define ProtoduneChannelHelper_H
10 
11 #include <string>
12 
14 
15 public:
16 
17  using Index = unsigned int;
18  using Name = std::string;
19 
20  static Index badIndex() { return -1; }
21 
22  // Helpers to extract info from a channel index.
23  // Set isOff true if the index is offline.
24  static Index tpcSet(Index chan, bool isOff); // 0-5
25  static Index apa(Index chan, bool isOff); // 1-6 (PDSP-1 convention)
26  static Index femb(Index chan, bool isOff); // 1-20
27  static Index asic(Index chan, bool isOff); // 1-8
28  static Index asicChannel(Index chan, bool isOff); // 0-15
29 
30  // Convert offline to online channel index.
31  static Index onlineChannel(Index chanOff, Index dbg =0);
32 
33  // Ctor specifying whether channel indices are online or offline.
34  ProtoduneChannelHelper(bool isOff);
35 
36  bool isOffline() const { return m_isOff; }
37 
38  // Return channel component indices.
39  Index tpcSet(Index chan) const { return tpcSet(chan, isOffline()); }
40  Index apa(Index chan) const { return apa(chan, isOffline()); }
41  Index femb(Index chan) const { return femb(chan, isOffline()); }
42  Index asic(Index chan) const { return asic(chan, isOffline()); }
43  Index asicChannel(Index chan) const { return asicChannel(chan, isOffline()); }
44 
45  // Return the ASIC location: AFF-CXX
46  // A = APA, FF=FEMB, C=ascic (1-8), XX=asic channel (0-15)
47  Name asicChannelName(Index icha) const;
48 
49 private:
50 
51  bool m_isOff;
52 
53 };
54 
55 #endif
static Index onlineChannel(Index chanOff, Index dbg=0)
bool dbg
Name asicChannelName(Index icha) const
std::string string
Definition: nybbler.cc:12
Index tpcSet(Index chan) const
static Index femb(Index chan, bool isOff)
static Index asicChannel(Index chan, bool isOff)
static Index apa(Index chan, bool isOff)
Index asicChannel(Index chan) const
Index asic(Index chan) const
static Index asic(Index chan, bool isOff)
Index apa(Index chan) const
static Index tpcSet(Index chan, bool isOff)
Index femb(Index chan) const