Belle II Software development
RawData Class Reference

KLM raw data. More...

#include <RawData.h>

Public Member Functions

 RawData (int copper, int slot, const int *buffer, StoreArray< KLMDigitRaw > *klmDigitRaws, KLMDigitRaw **newDigitRaw, bool fillDigitRaws)
 Constructor (unpack KLM raw data).
 
 ~RawData ()
 Destructor.
 
uint16_t getType () const
 Get packet type.
 
uint16_t getLane () const
 Get lane.
 
uint16_t getAxis () const
 Get axis.
 
uint16_t getChannel () const
 Get channel.
 
uint16_t getCTime () const
 Get CTIME.
 
uint16_t getTriggerBits () const
 Get trigger bits.
 
uint16_t getTDC () const
 Get TDC.
 
uint16_t getCharge () const
 Get charge.
 
uint16_t getFE () const
 Get feature-extraction mode.
 
bool multipleStripHit () const
 Check whether this hit corresponds to multiple strips.
 
void getChannelGroups (std::vector< ChannelGroup > &channelGroups) const
 Get channel groups corresponding to this hit.
 

Static Public Member Functions

static uint16_t unpackType (uint16_t raw)
 Unpack packet type.
 
static uint16_t unpackLane (uint16_t raw)
 Unpack lane.
 
static uint16_t unpackAxis (uint16_t raw)
 Unpack axis.
 
static uint16_t unpackChannel (uint16_t raw)
 Unpack channel.
 
static uint16_t unpackCTime (uint16_t raw)
 Unpack CTIME.
 
static uint16_t unpackTriggerBits (uint16_t raw)
 Unpack trigger bits.
 
static uint16_t unpackTDC (uint16_t raw)
 Unpack TDC.
 
static uint16_t unpackCharge (uint16_t raw)
 Unpack charge.
 
static uint16_t unpackFE (uint16_t raw)
 Unpack feature-extraction bit.
 

Protected Attributes

uint16_t m_Type
 Packet type (3 bits).
 
uint16_t m_Lane
 Lane (5 bits).
 
uint16_t m_Axis
 Axis (1 bit).
 
uint16_t m_Channel
 Channel (7 bits).
 
uint16_t m_CTime
 CTIME (16 bits).
 
uint16_t m_TriggerBits
 Trigger bits (5 bits).
 
uint16_t m_TDC
 TDC (11 bits).
 
uint16_t m_Charge
 Charge (12 bits).
 
uint16_t m_FE
 Feature extraction mode (1 bit).
 

Detailed Description

KLM raw data.

Definition at line 50 of file RawData.h.

Constructor & Destructor Documentation

◆ RawData()

RawData ( int  copper,
int  slot,
const int *  buffer,
StoreArray< KLMDigitRaw > *  klmDigitRaws,
KLMDigitRaw **  newDigitRaw,
bool  fillDigitRaws 
)

Constructor (unpack KLM raw data).

Parameters
[in]copperCopper identifier.
[in]slotSlot number (1-based).
[in]bufferData buffer (to be unpacked).
[in,out]klmDigitRawsKLMDigitRaw array.
[out]newDigitRawNew KLMRawDigit.
[in]fillDigitRawsWhether to fill klmDigitRaws.

Definition at line 20 of file RawData.cc.

24{
25 uint16_t dataWords[4];
26 dataWords[0] = (buffer[0] >> 16) & 0xFFFF;
27 dataWords[1] = buffer[0] & 0xFFFF;
28 dataWords[2] = (buffer[1] >> 16) & 0xFFFF;
29 dataWords[3] = buffer[1] & 0xFFFF;
30 m_Type = unpackType(dataWords[0]);
31 m_Lane = unpackLane(dataWords[0]);
32 m_Axis = unpackAxis(dataWords[0]);
33 m_Channel = unpackChannel(dataWords[0]);
34 m_CTime = unpackCTime(dataWords[1]);
35 m_TriggerBits = unpackTriggerBits(dataWords[2]);
36 m_TDC = unpackTDC(dataWords[2]);
37 m_Charge = unpackCharge(dataWords[3]);
38 m_FE = unpackFE(dataWords[3]);
39 if (fillDigitRaws) {
40 *newDigitRaw = klmDigitRaws->appendNew(copper, slot,
41 dataWords[0], dataWords[1],
42 dataWords[2], dataWords[3]);
43 }
44}
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
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
static uint16_t unpackCharge(uint16_t raw)
Unpack charge.
Definition: RawData.h:225
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
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
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
static uint16_t unpackAxis(uint16_t raw)
Unpack axis.
Definition: RawData.h:181
uint16_t m_CTime
CTIME (16 bits).
Definition: RawData.h:253

◆ ~RawData()

~RawData ( )

Destructor.

Definition at line 46 of file RawData.cc.

47{
48}

Member Function Documentation

◆ getAxis()

uint16_t getAxis ( ) const
inline

Get axis.

Definition at line 92 of file RawData.h.

93 {
94 return m_Axis;
95 }

◆ getChannel()

uint16_t getChannel ( ) const
inline

Get channel.

Definition at line 100 of file RawData.h.

101 {
102 return m_Channel;
103 }

◆ getChannelGroups()

void getChannelGroups ( std::vector< ChannelGroup > &  channelGroups) const

Get channel groups corresponding to this hit.

Parameters
[out]channelGroupsChannel groups.

Definition at line 50 of file RawData.cc.

51{
52 ChannelGroup group;
53 if (multipleStripHit()) {
54 int asic = (m_Channel - 1) / c_NChannelsAsic;
55 int channelBase = c_NChannelsAsic * asic;
56 channelGroups.clear();
57 if (m_Type == 0x4) { // for old scintillator-readout firmware with bug
58 if ((m_TriggerBits & 0xF) != 0) {
59 group.firstChannel = channelBase + 1;
60 group.lastChannel = channelBase + c_NChannelsAsic;
61 channelGroups.push_back(group);
62 }
63 } else if ((m_Type == 0x5) && (m_FE != 0)) { // for new scintillator-readout firmware
64 group.firstChannel = m_Channel;
65 group.lastChannel = 0;
66 channelGroups.push_back(group);
67 } else if ((m_Type == 0x5) && (m_FE == 0)) { // for new scintillator-readout firmware
68 if ((m_TriggerBits & 0x1) != 0) {
69 group.firstChannel = channelBase + 1;
70 group.lastChannel = channelBase + 4;
71 channelGroups.push_back(group);
72 }
73 if ((m_TriggerBits & 0x2) != 0) {
74 group.firstChannel = channelBase + 5;
75 group.lastChannel = channelBase + 8;
76 channelGroups.push_back(group);
77 }
78 if ((m_TriggerBits & 0x4) != 0) {
79 group.firstChannel = channelBase + 9;
80 group.lastChannel = channelBase + 12;
81 channelGroups.push_back(group);
82 }
83 if ((m_TriggerBits & 0x8) != 0) {
84 group.firstChannel = channelBase + 13;
85 group.lastChannel = channelBase + c_NChannelsAsic;
86 channelGroups.push_back(group);
87 }
88 }
89 } else { // for RPC strip or isolated scintillator
90 group.firstChannel = m_Channel;
91 group.lastChannel = 0;
92 channelGroups.push_back(group);
93 }
94}
bool multipleStripHit() const
Check whether this hit corresponds to multiple strips.
Definition: RawData.h:148
Channel group.
Definition: RawData.h:31

◆ getCharge()

uint16_t getCharge ( ) const
inline

Get charge.

Definition at line 132 of file RawData.h.

133 {
134 return m_Charge;
135 }

◆ getCTime()

uint16_t getCTime ( ) const
inline

Get CTIME.

Definition at line 108 of file RawData.h.

109 {
110 return m_CTime;
111 }

◆ getFE()

uint16_t getFE ( ) const
inline

Get feature-extraction mode.

Definition at line 140 of file RawData.h.

141 {
142 return m_FE;
143 }

◆ getLane()

uint16_t getLane ( ) const
inline

Get lane.

Definition at line 84 of file RawData.h.

85 {
86 return m_Lane;
87 }

◆ getTDC()

uint16_t getTDC ( ) const
inline

Get TDC.

Definition at line 124 of file RawData.h.

125 {
126 return m_TDC;
127 }

◆ getTriggerBits()

uint16_t getTriggerBits ( ) const
inline

Get trigger bits.

Definition at line 116 of file RawData.h.

117 {
118 return m_TriggerBits;
119 }

◆ getType()

uint16_t getType ( ) const
inline

Get packet type.

Definition at line 76 of file RawData.h.

77 {
78 return m_Type;
79 }

◆ multipleStripHit()

bool multipleStripHit ( ) const
inline

Check whether this hit corresponds to multiple strips.

Definition at line 148 of file RawData.h.

149 {
150 return (m_TriggerBits & 0x10) != 0;
151 }

◆ unpackAxis()

static uint16_t unpackAxis ( uint16_t  raw)
inlinestatic

Unpack axis.

Parameters
[in]rawRaw-data word.

Definition at line 181 of file RawData.h.

182 {
183 return (raw >> 7) & 0x1;
184 };

◆ unpackChannel()

static uint16_t unpackChannel ( uint16_t  raw)
inlinestatic

Unpack channel.

Parameters
[in]rawRaw-data word.

Definition at line 190 of file RawData.h.

191 {
192 return raw & 0x7F;
193 }

◆ unpackCharge()

static uint16_t unpackCharge ( uint16_t  raw)
inlinestatic

Unpack charge.

Definition at line 225 of file RawData.h.

226 {
227 return raw & 0xFFF;
228 }

◆ unpackCTime()

static uint16_t unpackCTime ( uint16_t  raw)
inlinestatic

Unpack CTIME.

Parameters
[in]rawRaw-data word.

Definition at line 199 of file RawData.h.

200 {
201 return raw;
202 }

◆ unpackFE()

static uint16_t unpackFE ( uint16_t  raw)
inlinestatic

Unpack feature-extraction bit.

Definition at line 233 of file RawData.h.

234 {
235 return (raw >> 15) & 0x1;
236 }

◆ unpackLane()

static uint16_t unpackLane ( uint16_t  raw)
inlinestatic

Unpack lane.

Parameters
[in]rawRaw-data word.

Definition at line 172 of file RawData.h.

173 {
174 return (raw >> 8) & 0x1F;
175 }

◆ unpackTDC()

static uint16_t unpackTDC ( uint16_t  raw)
inlinestatic

Unpack TDC.

Parameters
[in]rawRaw-data word.

Definition at line 217 of file RawData.h.

218 {
219 return raw & 0x7FF;
220 }

◆ unpackTriggerBits()

static uint16_t unpackTriggerBits ( uint16_t  raw)
inlinestatic

Unpack trigger bits.

Parameters
[in]rawRaw-data word.

Definition at line 208 of file RawData.h.

209 {
210 return (raw >> 11) & 0x1F;
211 }

◆ unpackType()

static uint16_t unpackType ( uint16_t  raw)
inlinestatic

Unpack packet type.

Parameters
[in]rawRaw-data word.

Definition at line 163 of file RawData.h.

164 {
165 return (raw >> 13) & 0x7;
166 }

Member Data Documentation

◆ m_Axis

uint16_t m_Axis
protected

Axis (1 bit).

Definition at line 247 of file RawData.h.

◆ m_Channel

uint16_t m_Channel
protected

Channel (7 bits).

Definition at line 250 of file RawData.h.

◆ m_Charge

uint16_t m_Charge
protected

Charge (12 bits).

Definition at line 262 of file RawData.h.

◆ m_CTime

uint16_t m_CTime
protected

CTIME (16 bits).

Definition at line 253 of file RawData.h.

◆ m_FE

uint16_t m_FE
protected

Feature extraction mode (1 bit).

Definition at line 265 of file RawData.h.

◆ m_Lane

uint16_t m_Lane
protected

Lane (5 bits).

Definition at line 244 of file RawData.h.

◆ m_TDC

uint16_t m_TDC
protected

TDC (11 bits).

Definition at line 259 of file RawData.h.

◆ m_TriggerBits

uint16_t m_TriggerBits
protected

Trigger bits (5 bits).

Definition at line 256 of file RawData.h.

◆ m_Type

uint16_t m_Type
protected

Packet type (3 bits).

Definition at line 241 of file RawData.h.


The documentation for this class was generated from the following files: