Belle II Software  release-06-01-15
RawData.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 #pragma once
10 
11 /* Belle 2 headers. */
12 #include <framework/datastore/StoreArray.h>
13 
14 namespace Belle2 {
20  /* KLM forward declarations. */
21  class KLMDigitRaw;
22 
23  namespace KLM {
24 
28  struct ChannelGroup {
29 
31  int firstChannel = 0;
32 
34  int lastChannel = 0;
35 
37  int firstStrip = 0;
38 
40  int lastStrip = 0;
41 
42  };
43 
47  class RawData {
48 
49  public:
50 
60  RawData(
61  int copper, int slot, const int* buffer,
62  StoreArray<KLMDigitRaw>* klmDigitRaws, KLMDigitRaw** newDigitRaw,
63  bool fillDigitRaws);
64 
68  ~RawData();
69 
73  uint16_t getLane() const
74  {
75  return m_Lane;
76  }
77 
81  uint16_t getAxis() const
82  {
83  return m_Axis;
84  }
85 
89  uint16_t getChannel() const
90  {
91  return m_Channel;
92  }
93 
97  uint16_t getCTime() const
98  {
99  return m_CTime;
100  }
101 
105  uint16_t getTriggerBits() const
106  {
107  return m_TriggerBits;
108  }
109 
113  uint16_t getTDC() const
114  {
115  return m_TDC;
116  }
117 
121  uint16_t getCharge() const
122  {
123  return m_Charge;
124  }
125 
129  bool multipleStripHit() const
130  {
131  return (m_TriggerBits & 0x10) != 0;
132  }
133 
138  void getChannelGroups(std::vector<ChannelGroup>& channelGroups) const;
139 
144  static uint16_t unpackLane(uint16_t raw)
145  {
146  return (raw >> 8) & 0x1F;
147  }
148 
153  static uint16_t unpackAxis(uint16_t raw)
154  {
155  return (raw >> 7) & 0x1;
156  };
157 
162  static uint16_t unpackChannel(uint16_t raw)
163  {
164  return raw & 0x7F;
165  }
166 
171  static uint16_t unpackCTime(uint16_t raw)
172  {
173  return raw;
174  }
175 
180  static uint16_t unpackTriggerBits(uint16_t raw)
181  {
182  return (raw >> 11) & 0x1F;
183  }
184 
189  static uint16_t unpackTDC(uint16_t raw)
190  {
191  return raw & 0x7FF;
192  }
193 
197  static uint16_t unpackCharge(uint16_t raw)
198  {
199  return raw & 0xFFF;
200  }
201 
202  protected:
203 
205  uint16_t m_Lane;
206 
208  uint16_t m_Axis;
209 
211  uint16_t m_Channel;
212 
214  uint16_t m_CTime;
215 
217  uint16_t m_TriggerBits;
218 
220  uint16_t m_TDC;
221 
223  uint16_t m_Charge;
224 
225  };
226 
227  }
228 
230 }
Class to store the raw words from the unpacker, digit-by-digit.
Definition: KLMDigitRaw.h:29
KLM raw data.
Definition: RawData.h:47
uint16_t m_Charge
Charge (12 bits).
Definition: RawData.h:223
uint16_t m_TDC
TDC (11 bits).
Definition: RawData.h:220
static uint16_t unpackTDC(uint16_t raw)
Unpack TDC.
Definition: RawData.h:189
static uint16_t unpackChannel(uint16_t raw)
Unpack channel.
Definition: RawData.h:162
uint16_t getCTime() const
Get CTIME.
Definition: RawData.h:97
static uint16_t unpackCharge(uint16_t raw)
Unpack charge.
Definition: RawData.h:197
uint16_t getTDC() const
Get TDC.
Definition: RawData.h:113
uint16_t m_Axis
Axis (1 bit).
Definition: RawData.h:208
uint16_t m_Channel
Channel (7 bits).
Definition: RawData.h:211
uint16_t m_TriggerBits
Trigger bits (5 bits).
Definition: RawData.h:217
uint16_t getChannel() const
Get channel.
Definition: RawData.h:89
static uint16_t unpackCTime(uint16_t raw)
Unpack CTIME.
Definition: RawData.h:171
static uint16_t unpackLane(uint16_t raw)
Unpack lane.
Definition: RawData.h:144
uint16_t getLane() const
Get lane.
Definition: RawData.h:73
static uint16_t unpackTriggerBits(uint16_t raw)
Unpack trigger bits.
Definition: RawData.h:180
uint16_t m_Lane
Lane (5 bits).
Definition: RawData.h:205
bool multipleStripHit() const
Check whether this hit corresponds to multiple strips.
Definition: RawData.h:129
uint16_t getCharge() const
Get charge.
Definition: RawData.h:121
RawData(int copper, int slot, const int *buffer, StoreArray< KLMDigitRaw > *klmDigitRaws, KLMDigitRaw **newDigitRaw, bool fillDigitRaws)
Constructor (unpack KLM raw data).
Definition: RawData.cc:20
static uint16_t unpackAxis(uint16_t raw)
Unpack axis.
Definition: RawData.h:153
void getChannelGroups(std::vector< ChannelGroup > &channelGroups) const
Get channel groups corresponding to this hit.
Definition: RawData.cc:48
~RawData()
Destructor.
Definition: RawData.cc:44
uint16_t m_CTime
CTIME (16 bits).
Definition: RawData.h:214
uint16_t getTriggerBits() const
Get trigger bits.
Definition: RawData.h:105
uint16_t getAxis() const
Get axis.
Definition: RawData.h:81
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Abstract base class for different kinds of events.
Channel group.
Definition: RawData.h:28
int firstChannel
First channel in the group.
Definition: RawData.h:31
int firstStrip
Strip number corresponding to the first channel.
Definition: RawData.h:37
int lastStrip
Strip number corresponding to the last channel.
Definition: RawData.h:40
int lastChannel
Last channel in the group (0 for single-strip hits).
Definition: RawData.h:34