Belle II Software  release-06-00-14
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  }
67 
68  ARICHRawDigit(int type, int ver, int boardid, int febno, unsigned int length, unsigned int trgno = 0)
69  {
70  set(type, ver, boardid, febno, length, trgno);
71  m_copperid = 0;
72  m_hslb = 0;
73  }
74 
77  {
79  }
80 
81  void set(int type, int ver, int boardid, int febno, unsigned int length, unsigned int trgno = 0);
82 
83  public:
84  int getCopperId() { return m_copperid; }
85  int getHslbId() { return m_hslb; }
86  int getType() const { return m_type; }
87  int getVersion() const { return m_ver; }
88  int getBoardId() const { return m_boardid; }
89  int getFEBNo() const { return m_febno; }
90  unsigned int getLength() const { return m_length; }
91  unsigned int getTrgNo() const { return m_trgno; }
92  int getNFEBs() const { return m_febs.size(); }
93  void addFEB(FEBDigit& feb, int type, int ver, int boardid, int febno,
94  unsigned int length, unsigned int trgno, unsigned int febtrgno)
95  {
96  feb.type = type;
97  feb.ver = ver;
98  feb.boardid = boardid;
99  feb.febno = febno;
100  feb.length = length;
101  feb.trgno = trgno;
102  feb.febtrgno = febtrgno;
103  m_febs.push_back(feb);
104  }
105  void setCopperId(int id) { m_copperid = id; }
106  void setHslbId(int id) { m_hslb = id; }
107  const std::vector<FEBDigit>& getFEBs() const { return m_febs; }
108  std::vector<FEBDigit>& getFEBs() { return m_febs; }
109 
110  private:
111  int m_copperid;
112  int m_hslb;
113  int m_type;
114  int m_ver;
115  int m_boardid;
116  int m_febno; // should be 8
117  unsigned int m_length;
118  unsigned int m_trgno;
119  std::vector<FEBDigit> m_febs;
120 
123  };
124 
126 } // end namespace Belle2
127 
128 #endif
ClassDef(ARICHRawDigit, 1)
the class title
~ARICHRawDigit()
Destructor.
Definition: ARICHRawDigit.h:76
ARICHRawDigit()
Default constructor for ROOT IO.
Definition: ARICHRawDigit.h:61
Abstract base class for different kinds of events.