Belle II Software  release-05-01-25
ARICHRawDigit.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Tomoyuki Konno
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #ifndef ARICHRAWDIGIT_H
12 #define ARICHRAWDIGIT_H
13 
14 // ROOT
15 #include <TObject.h>
16 
17 // std
18 #include <vector>
19 
20 namespace Belle2 {
26  class ARICHRawDigit : public TObject {
27 
28  public:
29  struct FEBDigit {
30  unsigned char type;
31  unsigned char ver;
32  unsigned char boardid;
33  unsigned char febno; // should be 8
34  unsigned int length;
35  unsigned int trgno;
36  unsigned int febtrgno;
37  struct ChannelDigit {
38  unsigned char chno;
39  unsigned char val;
40  };
41  mutable std::vector<ChannelDigit> channels;
42  const ChannelDigit& operator[](unsigned char i) const
43  {
44  return channels[i];
45  }
46  ChannelDigit& operator[](unsigned char i)
47  {
48  return channels[i];
49  }
50  unsigned int size() const { return channels.size(); }
51  void push_back(unsigned char ich, unsigned char val)
52  {
53  ChannelDigit channel = {ich, val};
54  channels.push_back(channel);
55  }
56  std::vector<ChannelDigit>& operator()() { return channels; }
57  const std::vector<ChannelDigit>& operator()() const { return channels; }
58  };
59 
60  public:
61 
64  {
65  set(0, 0, 0, 0, 0, 0);
66  m_copperid = 0;
67  m_hslb = 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  }
76 
79  {
81  }
82 
83  void set(int type, int ver, int boardid, int febno, unsigned int length, unsigned int trgno = 0);
84 
85  public:
86  int getCopperId() { return m_copperid; }
87  int getHslbId() { return m_hslb; }
88  int getType() const { return m_type; }
89  int getVersion() const { return m_ver; }
90  int getBoardId() const { return m_boardid; }
91  int getFEBNo() const { return m_febno; }
92  unsigned int getLength() const { return m_length; }
93  unsigned int getTrgNo() const { return m_trgno; }
94  int getNFEBs() const { return m_febs.size(); }
95  void addFEB(FEBDigit& feb, int type, int ver, int boardid, int febno,
96  unsigned int length, unsigned int trgno, unsigned int febtrgno)
97  {
98  feb.type = type;
99  feb.ver = ver;
100  feb.boardid = boardid;
101  feb.febno = febno;
102  feb.length = length;
103  feb.trgno = trgno;
104  feb.febtrgno = febtrgno;
105  m_febs.push_back(feb);
106  }
107  void setCopperId(int id) { m_copperid = id; }
108  void setHslbId(int id) { m_hslb = id; }
109  const std::vector<FEBDigit>& getFEBs() const { return m_febs; }
110  std::vector<FEBDigit>& getFEBs() { return m_febs; }
111 
112  private:
113  int m_copperid;
114  int m_hslb;
115  int m_type;
116  int m_ver;
117  int m_boardid;
118  int m_febno; // should be 8
119  unsigned int m_length;
120  unsigned int m_trgno;
121  std::vector<FEBDigit> m_febs;
122 
123  ClassDef(ARICHRawDigit, 1);
125  };
126 
128 } // end namespace Belle2
129 
130 #endif
Belle2::ARICHRawDigit::~ARICHRawDigit
~ARICHRawDigit()
Destructor.
Definition: ARICHRawDigit.h:86
Belle2::ARICHRawDigit::ARICHRawDigit
ARICHRawDigit()
Default constructor for ROOT IO.
Definition: ARICHRawDigit.h:71
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ARICHRawDigit::FEBDigit::ChannelDigit
Definition: ARICHRawDigit.h:45
Belle2::ARICHRawDigit::ClassDef
ClassDef(ARICHRawDigit, 1)
the class title