Belle II Software  release-08-01-10
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 
18 namespace Belle2 {
24  class ARICHRawDigit : public TObject {
25 
26  public:
27  struct FEBDigit {
28  unsigned char type;
29  unsigned char ver;
30  unsigned char boardid;
31  unsigned char febno; // should be 8
32  unsigned int length;
33  unsigned int trgno;
34  unsigned int febtrgno;
35  struct ChannelDigit {
36  unsigned char chno;
37  unsigned char val;
38  };
39  mutable std::vector<ChannelDigit> channels;
40  const ChannelDigit& operator[](unsigned char i) const
41  {
42  return channels[i];
43  }
44  ChannelDigit& operator[](unsigned char i)
45  {
46  return channels[i];
47  }
48  unsigned int size() const { return channels.size(); }
49  void push_back(unsigned char ich, unsigned char val)
50  {
51  ChannelDigit channel = {ich, val};
52  channels.push_back(channel);
53  }
54  std::vector<ChannelDigit>& operator()() { return channels; }
55  const std::vector<ChannelDigit>& operator()() const { return channels; }
56  };
57 
58  public:
59 
62  {
63  set(0, 0, 0, 0, 0, 0);
64  m_copperid = 0;
65  m_hslb = 0;
66  m_pcieid = 0;
67  m_pciechid = 0;
68  }
69 
70  ARICHRawDigit(int type, int ver, int boardid, int febno, unsigned int length, unsigned int trgno = 0)
71  {
72  set(type, ver, boardid, febno, length, trgno);
73  m_copperid = 0;
74  m_hslb = 0;
75  m_pcieid = 0;
76  m_pciechid = 0;
77  }
78 
81  {
83  }
84 
85  void set(int type, int ver, int boardid, int febno, unsigned int length, unsigned int trgno = 0);
86 
87  public:
88  int getCopperId() { return m_copperid; }
89  int getHslbId() { return m_hslb; }
90  int getPcieId() { return m_pcieid; }
91  int getPcieChId() { return m_pciechid; }
92  int getType() const { return m_type; }
93  int getVersion() const { return m_ver; }
94  int getBoardId() const { return m_boardid; }
95  int getFEBNo() const { return m_febno; }
96  unsigned int getLength() const { return m_length; }
97  unsigned int getTrgNo() const { return m_trgno; }
98  int getNFEBs() const { return m_febs.size(); }
99  void addFEB(FEBDigit& feb, int type, int ver, int boardid, int febno,
100  unsigned int length, unsigned int trgno, unsigned int febtrgno)
101  {
102  feb.type = type;
103  feb.ver = ver;
104  feb.boardid = boardid;
105  feb.febno = febno;
106  feb.length = length;
107  feb.trgno = trgno;
108  feb.febtrgno = febtrgno;
109  m_febs.push_back(feb);
110  }
111  void setCopperId(int id) { m_copperid = id; }
112  void setHslbId(int id) { m_hslb = id; }
113  void setPcieId(int id) { m_pcieid = id; }
114  void setPcieChId(int id) { m_pciechid = id; }
115  const std::vector<FEBDigit>& getFEBs() const { return m_febs; }
116  std::vector<FEBDigit>& getFEBs() { return m_febs; }
117 
118  private:
119  int m_copperid;
120  int m_hslb;
121  int m_pcieid;
122  int m_pciechid;
123  int m_type;
124  int m_ver;
125  int m_boardid;
126  int m_febno; // should be 8
127  unsigned int m_length;
128  unsigned int m_trgno;
129  std::vector<FEBDigit> m_febs;
130 
133  };
134 
136 } // end namespace Belle2
137 
138 #endif
ClassDef(ARICHRawDigit, 2)
the class title
~ARICHRawDigit()
Destructor.
Definition: ARICHRawDigit.h:80
ARICHRawDigit()
Default constructor for ROOT IO.
Definition: ARICHRawDigit.h:61
Abstract base class for different kinds of events.