Belle II Software development
ARICHRawDigit.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#ifndef ARICHRAWDIGIT_H
10#define ARICHRAWDIGIT_H
11
12// ROOT
13#include <TObject.h>
14
15// std
16#include <vector>
17
18namespace Belle2 {
27 class ARICHRawDigit : public TObject {
28
29 public:
33 struct FEBDigit {
34 unsigned char type;
35 unsigned char ver;
36 unsigned char boardid;
37 unsigned char febno;
38 unsigned int length;
39 unsigned int trgno;
40 unsigned int febtrgno;
45 struct ChannelDigit {
46 unsigned char chno;
47 unsigned char val;
48 };
49
50 mutable std::vector<ChannelDigit> channels;
55 const ChannelDigit& operator[](unsigned char i) const
56 {
57 return channels[i];
58 }
59
63 ChannelDigit& operator[](unsigned char i)
64 {
65 return channels[i];
66 }
67
71 unsigned int size() const { return channels.size(); }
72
76 void push_back(unsigned char ich, unsigned char val)
77 {
78 ChannelDigit channel = {ich, val};
79 channels.push_back(channel);
80 }
81
85 std::vector<ChannelDigit>& operator()() { return channels; }
86
90 const std::vector<ChannelDigit>& operator()() const { return channels; }
91 };
92
93 public:
94
97 {
98 set(0, 0, 0, 0, 0, 0);
99 m_copperid = 0;
100 m_hslb = 0;
101 m_pcieid = 0;
102 m_pciechid = 0;
103 }
104
106 ARICHRawDigit(int type, int ver, int boardid, int febno, unsigned int length, unsigned int trgno = 0)
107 {
108 set(type, ver, boardid, febno, length, trgno);
109 m_copperid = 0;
110 m_hslb = 0;
111 m_pcieid = 0;
112 m_pciechid = 0;
113 }
114
117 {
119 }
120
124 void set(int type, int ver, int boardid, int febno, unsigned int length, unsigned int trgno = 0);
125
126 public:
130 int getCopperId() { return m_copperid; }
131
135 int getHslbId() { return m_hslb; }
136
140 int getPcieId() { return m_pcieid; }
141
145 int getPcieChId() { return m_pciechid; }
146
150 int getType() const { return m_type; }
151
155 int getVersion() const { return m_ver; }
156
160 int getBoardId() const { return m_boardid; }
161
165 int getFEBNo() const { return m_febno; }
166
170 unsigned int getLength() const { return m_length; }
171
175 unsigned int getTrgNo() const { return m_trgno; }
176
180 int getNFEBs() const { return m_febs.size(); }
181
185 void addFEB(FEBDigit& feb, int type, int ver, int boardid, int febno,
186 unsigned int length, unsigned int trgno, unsigned int febtrgno)
187 {
188 feb.type = type;
189 feb.ver = ver;
190 feb.boardid = boardid;
191 feb.febno = febno;
192 feb.length = length;
193 feb.trgno = trgno;
194 feb.febtrgno = febtrgno;
195 m_febs.push_back(feb);
196 }
197
201 void setCopperId(int id) { m_copperid = id; }
202
206 void setHslbId(int id) { m_hslb = id; }
207
211 void setPcieId(int id) { m_pcieid = id; }
212
216 void setPcieChId(int id) { m_pciechid = id; }
217
221 const std::vector<FEBDigit>& getFEBs() const { return m_febs; }
222
226 std::vector<FEBDigit>& getFEBs() { return m_febs; }
227
228 private:
230 int m_hslb;
233 int m_type;
234 int m_ver;
237 unsigned int m_length;
238 unsigned int m_trgno;
239 std::vector<FEBDigit> m_febs;
243 };
244
246} // end namespace Belle2
247
248#endif
Class of ARICH raw digits.
Definition: ARICHRawDigit.h:27
int m_hslb
High-speed link board.
unsigned int getLength() const
Get length.
int getCopperId()
Get COPPER ID.
int getNFEBs() const
Get number of FEBs.
std::vector< FEBDigit > m_febs
vector of front-end board digits
void setCopperId(int id)
Set COPPER ID.
ClassDef(ARICHRawDigit, 2)
the class title
int m_copperid
COPPER ID.
unsigned int m_trgno
trigger number
int getBoardId() const
Get board ID.
void setPcieChId(int id)
Set PCIe channel ID.
unsigned int getTrgNo() const
Get trigger number.
int getFEBNo() const
Get FEB number.
int m_pciechid
PCIe channel ID.
unsigned int m_length
length
int getPcieChId()
Get PCIe channel ID.
void setHslbId(int id)
Set HSLB ID.
const std::vector< FEBDigit > & getFEBs() const
Get const vector of FEB digits.
int getVersion() const
Get version.
int getPcieId()
Get PCIe ID.
~ARICHRawDigit()
Destructor.
int getType() const
Get type.
void addFEB(FEBDigit &feb, int type, int ver, int boardid, int febno, unsigned int length, unsigned int trgno, unsigned int febtrgno)
Add properties of FEB.
void setPcieId(int id)
Set PCIe ID.
std::vector< FEBDigit > & getFEBs()
Get vector of FEB digits.
void set(int type, int ver, int boardid, int febno, unsigned int length, unsigned int trgno=0)
Set properties.
int m_febno
FEB number which should be 8.
ARICHRawDigit()
Default constructor for ROOT IO.
Definition: ARICHRawDigit.h:96
ARICHRawDigit(int type, int ver, int boardid, int febno, unsigned int length, unsigned int trgno=0)
Constructor.
int getHslbId()
Get HSLB ID.
Abstract base class for different kinds of events.
Struct for ChannelDigit within FEBDigit struct.
Definition: ARICHRawDigit.h:45
Struct for front-end board.
Definition: ARICHRawDigit.h:33
void push_back(unsigned char ich, unsigned char val)
Add channel.
Definition: ARICHRawDigit.h:76
const std::vector< ChannelDigit > & operator()() const
Get vector of ChannelDigits (const version)
Definition: ARICHRawDigit.h:90
unsigned int trgno
trigger number
Definition: ARICHRawDigit.h:39
const ChannelDigit & operator[](unsigned char i) const
Access given ChannelDigit (const version)
Definition: ARICHRawDigit.h:55
unsigned int size() const
Get number of channels.
Definition: ARICHRawDigit.h:71
unsigned char febno
FEB number which should be 8.
Definition: ARICHRawDigit.h:37
unsigned char ver
version
Definition: ARICHRawDigit.h:35
ChannelDigit & operator[](unsigned char i)
Access given ChannelDigit.
Definition: ARICHRawDigit.h:63
unsigned char boardid
board ID
Definition: ARICHRawDigit.h:36
std::vector< ChannelDigit > & operator()()
Get vector of ChannelDigits.
Definition: ARICHRawDigit.h:85
std::vector< ChannelDigit > channels
vector of ChannelDigits
Definition: ARICHRawDigit.h:50
unsigned int febtrgno
front-end board trigger number
Definition: ARICHRawDigit.h:40