Belle II Software  release-08-01-10
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 /* Basf2 headers. */
12 #include <framework/datastore/StoreArray.h>
13 
14 namespace Belle2 {
20  /* KLM forward declarations. */
21  class KLMDigitRaw;
22 
23  namespace KLM {
24 
26  const int c_NChannelsAsic = 15;
27 
31  struct ChannelGroup {
32 
34  int firstChannel = 0;
35 
37  int lastChannel = 0;
38 
40  int firstStrip = 0;
41 
43  int lastStrip = 0;
44 
45  };
46 
50  class RawData {
51 
52  public:
53 
63  RawData(
64  int copper, int slot, const int* buffer,
65  StoreArray<KLMDigitRaw>* klmDigitRaws, KLMDigitRaw** newDigitRaw,
66  bool fillDigitRaws);
67 
71  ~RawData();
72 
76  uint16_t getType() const
77  {
78  return m_Type;
79  }
80 
84  uint16_t getLane() const
85  {
86  return m_Lane;
87  }
88 
92  uint16_t getAxis() const
93  {
94  return m_Axis;
95  }
96 
100  uint16_t getChannel() const
101  {
102  return m_Channel;
103  }
104 
108  uint16_t getCTime() const
109  {
110  return m_CTime;
111  }
112 
116  uint16_t getTriggerBits() const
117  {
118  return m_TriggerBits;
119  }
120 
124  uint16_t getTDC() const
125  {
126  return m_TDC;
127  }
128 
132  uint16_t getCharge() const
133  {
134  return m_Charge;
135  }
136 
140  uint16_t getFE() const
141  {
142  return m_FE;
143  }
144 
148  bool multipleStripHit() const
149  {
150  return (m_TriggerBits & 0x10) != 0;
151  }
152 
157  void getChannelGroups(std::vector<ChannelGroup>& channelGroups) const;
158 
163  static uint16_t unpackType(uint16_t raw)
164  {
165  return (raw >> 13) & 0x7;
166  }
167 
172  static uint16_t unpackLane(uint16_t raw)
173  {
174  return (raw >> 8) & 0x1F;
175  }
176 
181  static uint16_t unpackAxis(uint16_t raw)
182  {
183  return (raw >> 7) & 0x1;
184  };
185 
190  static uint16_t unpackChannel(uint16_t raw)
191  {
192  return raw & 0x7F;
193  }
194 
199  static uint16_t unpackCTime(uint16_t raw)
200  {
201  return raw;
202  }
203 
208  static uint16_t unpackTriggerBits(uint16_t raw)
209  {
210  return (raw >> 11) & 0x1F;
211  }
212 
217  static uint16_t unpackTDC(uint16_t raw)
218  {
219  return raw & 0x7FF;
220  }
221 
225  static uint16_t unpackCharge(uint16_t raw)
226  {
227  return raw & 0xFFF;
228  }
229 
233  static uint16_t unpackFE(uint16_t raw)
234  {
235  return (raw >> 15) & 0x1;
236  }
237 
238  protected:
239 
241  uint16_t m_Type;
242 
244  uint16_t m_Lane;
245 
247  uint16_t m_Axis;
248 
250  uint16_t m_Channel;
251 
253  uint16_t m_CTime;
254 
256  uint16_t m_TriggerBits;
257 
259  uint16_t m_TDC;
260 
262  uint16_t m_Charge;
263 
265  uint16_t m_FE;
266 
267  };
268 
269  }
270 
272 }
Class to store the raw words from the unpacker, digit-by-digit.
Definition: KLMDigitRaw.h:29
KLM raw data.
Definition: RawData.h:50
uint16_t m_Charge
Charge (12 bits).
Definition: RawData.h:262
static uint16_t unpackFE(uint16_t raw)
Unpack feature-extraction bit.
Definition: RawData.h:233
uint16_t m_TDC
TDC (11 bits).
Definition: RawData.h:259
uint16_t getType() const
Get packet type.
Definition: RawData.h:76
static uint16_t unpackTDC(uint16_t raw)
Unpack TDC.
Definition: RawData.h:217
static uint16_t unpackType(uint16_t raw)
Unpack packet type.
Definition: RawData.h:163
static uint16_t unpackChannel(uint16_t raw)
Unpack channel.
Definition: RawData.h:190
uint16_t getCTime() const
Get CTIME.
Definition: RawData.h:108
static uint16_t unpackCharge(uint16_t raw)
Unpack charge.
Definition: RawData.h:225
uint16_t getTDC() const
Get TDC.
Definition: RawData.h:124
uint16_t m_Axis
Axis (1 bit).
Definition: RawData.h:247
uint16_t m_Channel
Channel (7 bits).
Definition: RawData.h:250
uint16_t m_TriggerBits
Trigger bits (5 bits).
Definition: RawData.h:256
uint16_t getChannel() const
Get channel.
Definition: RawData.h:100
static uint16_t unpackCTime(uint16_t raw)
Unpack CTIME.
Definition: RawData.h:199
uint16_t m_Type
Packet type (3 bits).
Definition: RawData.h:241
uint16_t m_FE
Feature extraction mode (1 bit).
Definition: RawData.h:265
static uint16_t unpackLane(uint16_t raw)
Unpack lane.
Definition: RawData.h:172
uint16_t getLane() const
Get lane.
Definition: RawData.h:84
static uint16_t unpackTriggerBits(uint16_t raw)
Unpack trigger bits.
Definition: RawData.h:208
uint16_t m_Lane
Lane (5 bits).
Definition: RawData.h:244
bool multipleStripHit() const
Check whether this hit corresponds to multiple strips.
Definition: RawData.h:148
uint16_t getCharge() const
Get charge.
Definition: RawData.h:132
RawData(int copper, int slot, const int *buffer, StoreArray< KLMDigitRaw > *klmDigitRaws, KLMDigitRaw **newDigitRaw, bool fillDigitRaws)
Constructor (unpack KLM raw data).
Definition: RawData.cc:20
uint16_t getFE() const
Get feature-extraction mode.
Definition: RawData.h:140
static uint16_t unpackAxis(uint16_t raw)
Unpack axis.
Definition: RawData.h:181
void getChannelGroups(std::vector< ChannelGroup > &channelGroups) const
Get channel groups corresponding to this hit.
Definition: RawData.cc:50
~RawData()
Destructor.
Definition: RawData.cc:46
uint16_t m_CTime
CTIME (16 bits).
Definition: RawData.h:253
uint16_t getTriggerBits() const
Get trigger bits.
Definition: RawData.h:116
uint16_t getAxis() const
Get axis.
Definition: RawData.h:92
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:31
int firstChannel
First channel in the group.
Definition: RawData.h:34
int firstStrip
Strip number corresponding to the first channel.
Definition: RawData.h:40
int lastStrip
Strip number corresponding to the last channel.
Definition: RawData.h:43
int lastChannel
Last channel in the group (0 for single-strip hits).
Definition: RawData.h:37