Belle II Software  release-05-02-19
RawData.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2012 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Kirill Chilikin *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 /* Belle 2 headers. */
14 #include <framework/datastore/StoreArray.h>
15 
16 namespace Belle2 {
22  /* KLM forward declarations. */
23  class KLMDigitRaw;
24 
25  namespace KLM {
26 
30  struct ChannelGroup {
31 
33  int firstChannel = 0;
34 
36  int lastChannel = 0;
37 
39  int firstStrip = 0;
40 
42  int lastStrip = 0;
43 
44  };
45 
49  class RawData {
50 
51  public:
52 
62  RawData(
63  int copper, int slot, const int* buffer,
64  StoreArray<KLMDigitRaw>* klmDigitRaws, KLMDigitRaw** newDigitRaw,
65  bool fillDigitRaws);
66 
70  ~RawData();
71 
75  uint16_t getLane() const
76  {
77  return m_Lane;
78  }
79 
83  uint16_t getAxis() const
84  {
85  return m_Axis;
86  }
87 
91  uint16_t getChannel() const
92  {
93  return m_Channel;
94  }
95 
99  uint16_t getCTime() const
100  {
101  return m_CTime;
102  }
103 
107  uint16_t getTriggerBits() const
108  {
109  return m_TriggerBits;
110  }
111 
115  uint16_t getTDC() const
116  {
117  return m_TDC;
118  }
119 
123  uint16_t getCharge() const
124  {
125  return m_Charge;
126  }
127 
131  bool multipleStripHit() const
132  {
133  return (m_TriggerBits & 0x10) != 0;
134  }
135 
140  void getChannelGroups(std::vector<ChannelGroup>& channelGroups) const;
141 
146  static uint16_t unpackLane(uint16_t raw)
147  {
148  return (raw >> 8) & 0x1F;
149  }
150 
155  static uint16_t unpackAxis(uint16_t raw)
156  {
157  return (raw >> 7) & 0x1;
158  };
159 
164  static uint16_t unpackChannel(uint16_t raw)
165  {
166  return raw & 0x7F;
167  }
168 
173  static uint16_t unpackCTime(uint16_t raw)
174  {
175  return raw;
176  }
177 
182  static uint16_t unpackTriggerBits(uint16_t raw)
183  {
184  return (raw >> 11) & 0x1F;
185  }
186 
191  static uint16_t unpackTDC(uint16_t raw)
192  {
193  return raw & 0x7FF;
194  }
195 
199  static uint16_t unpackCharge(uint16_t raw)
200  {
201  return raw & 0xFFF;
202  }
203 
204  protected:
205 
207  uint16_t m_Lane;
208 
210  uint16_t m_Axis;
211 
213  uint16_t m_Channel;
214 
216  uint16_t m_CTime;
217 
219  uint16_t m_TriggerBits;
220 
222  uint16_t m_TDC;
223 
225  uint16_t m_Charge;
226 
227  };
228 
229  }
230 
232 }
Belle2::KLM::RawData::getCharge
uint16_t getCharge() const
Get charge.
Definition: RawData.h:131
Belle2::KLM::RawData::getChannel
uint16_t getChannel() const
Get channel.
Definition: RawData.h:99
Belle2::KLM::RawData::unpackTriggerBits
static uint16_t unpackTriggerBits(uint16_t raw)
Unpack trigger bits.
Definition: RawData.h:190
Belle2::KLM::RawData::getTriggerBits
uint16_t getTriggerBits() const
Get trigger bits.
Definition: RawData.h:115
Belle2::KLM::ChannelGroup::firstChannel
int firstChannel
First channel in the group.
Definition: RawData.h:41
Belle2::KLM::RawData::m_CTime
uint16_t m_CTime
CTIME (16 bits).
Definition: RawData.h:224
Belle2::KLM::RawData::m_Axis
uint16_t m_Axis
Axis (1 bit).
Definition: RawData.h:218
Belle2::KLM::RawData::getCTime
uint16_t getCTime() const
Get CTIME.
Definition: RawData.h:107
Belle2::KLM::RawData::getTDC
uint16_t getTDC() const
Get TDC.
Definition: RawData.h:123
Belle2::KLM::RawData::unpackLane
static uint16_t unpackLane(uint16_t raw)
Unpack lane.
Definition: RawData.h:154
Belle2::KLM::RawData::~RawData
~RawData()
Destructor.
Definition: RawData.cc:46
Belle2::KLM::RawData::m_Lane
uint16_t m_Lane
Lane (5 bits).
Definition: RawData.h:215
Belle2::KLM::ChannelGroup::lastStrip
int lastStrip
Strip number corresponding to the last channel.
Definition: RawData.h:50
Belle2::KLM::RawData::unpackTDC
static uint16_t unpackTDC(uint16_t raw)
Unpack TDC.
Definition: RawData.h:199
Belle2::KLM::ChannelGroup::lastChannel
int lastChannel
Last channel in the group (0 for single-strip hits).
Definition: RawData.h:44
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::KLM::RawData::m_Charge
uint16_t m_Charge
Charge (12 bits).
Definition: RawData.h:233
Belle2::KLM::RawData::RawData
RawData(int copper, int slot, const int *buffer, StoreArray< KLMDigitRaw > *klmDigitRaws, KLMDigitRaw **newDigitRaw, bool fillDigitRaws)
Constructor (unpack KLM raw data).
Definition: RawData.cc:22
Belle2::KLM::RawData::unpackChannel
static uint16_t unpackChannel(uint16_t raw)
Unpack channel.
Definition: RawData.h:172
Belle2::KLM::RawData::m_Channel
uint16_t m_Channel
Channel (7 bits).
Definition: RawData.h:221
Belle2::KLMDigitRaw
Class to store the raw words from the unpacker, digit-by-digit.
Definition: KLMDigitRaw.h:39
Belle2::KLM::RawData::m_TriggerBits
uint16_t m_TriggerBits
Trigger bits (5 bits).
Definition: RawData.h:227
Belle2::KLM::RawData::unpackCTime
static uint16_t unpackCTime(uint16_t raw)
Unpack CTIME.
Definition: RawData.h:181
Belle2::KLM::ChannelGroup::firstStrip
int firstStrip
Strip number corresponding to the first channel.
Definition: RawData.h:47
Belle2::KLM::RawData::multipleStripHit
bool multipleStripHit() const
Check whether this hit corresponds to multiple strips.
Definition: RawData.h:139
Belle2::KLM::RawData::getAxis
uint16_t getAxis() const
Get axis.
Definition: RawData.h:91
Belle2::KLM::RawData::unpackCharge
static uint16_t unpackCharge(uint16_t raw)
Unpack charge.
Definition: RawData.h:207
Belle2::KLM::RawData::m_TDC
uint16_t m_TDC
TDC (11 bits).
Definition: RawData.h:230
Belle2::KLM::RawData::getChannelGroups
void getChannelGroups(std::vector< ChannelGroup > &channelGroups) const
Get channel groups corresponding to this hit.
Definition: RawData.cc:50
Belle2::KLM::RawData::unpackAxis
static uint16_t unpackAxis(uint16_t raw)
Unpack axis.
Definition: RawData.h:163
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::KLM::RawData
KLM raw data.
Definition: RawData.h:57
Belle2::KLM::RawData::getLane
uint16_t getLane() const
Get lane.
Definition: RawData.h:83