Belle II Software development
CDCPackerModule.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#include <framework/core/Module.h>
12#include <framework/datastore/StoreArray.h>
13#include <cdc/dataobjects/CDCHit.h>
14#include <cdc/dataobjects/CDCRawHit.h>
15#include <cdc/dbobjects/CDCChannelMap.h>
16
17#include <framework/database/DBArray.h>
18
19#include <rawdata/dataobjects/RawCDC.h>
20
21namespace Belle2 {
27 namespace CDC {
28
33 class CDCPackerModule : public Module {
34
35 public:
40
44 virtual ~CDCPackerModule();
45
49 void initialize() override;
50
55 void beginRun() override;
56
62 void event() override;
63
67 void endRun() override;
68
72 void terminate() override;
73
77 void setCDCPacketHeader(const int* buf)
78 {
79
80 if ((buf[0] & 0xff000000) == 0x22000000) { // raw data mode.
81 m_dataType = 1;
82 } else if ((buf[0] & 0xff000000) == 0x20000000) { // suppressed data mode.
83 m_dataType = 2;
84 } else {
85 B2ERROR("Undefined data type");
86 }
87
88 m_version = ((buf[0] & 0xff0000) >> 16); // Always zero.
89 m_boardId = (buf[0] & 0xffff);
90 m_triggerTime = ((buf[1] & 0xffff0000) >> 16);
91 m_dataLength = (buf[1] & 0xffff);
92 m_triggerNumber = buf[2];
93
94 }
95
101 int getFEEID(int copper_id, int slot_id);
102
108 {
109 return m_dataType;
110 }
111
117 {
118 return m_triggerTime;
119 }
120
126 {
127 return m_dataLength;
128 }
129
135 {
136 return m_triggerNumber;
137 }
138
139
144 {
145 return m_boardId;
146 }
147
151 void loadMap();
152
156 const WireID getWireID(int iBoard, int iCh);
157
158 private:
159
162 // int m_overflow; /**< TDC overflow. */
163
164
165 private:
166
171
176
181
186
191
196
198 // * Number of good blocks.
199 // */
200 // int m_nGoodBlocks;
201
202 // /**
203 // * Number of error blocks.
204 // */
205 // int m_nErrorBlocks;
206
211
217
221 std::string m_rawCDCName;
222
226 std::string m_cdcRawHitName;
227
231 std::string m_cdcHitName;
232
236 std::string m_xmlMapFileName;
237
241 std::vector<unsigned short> m_buffer;
242
247 WireID m_map[300][48];
248
255 int m_fee_board[9][8][384];
256
263 int m_fee_ch[9][8][384];
264
270
275
280
285
290
291 };//end class declaration
292
293
294 } //end CDC namespace;
296} // end namespace Belle2
297
CDCPackerModule: The CDC Raw Hits Decoder.
StoreArray< RawCDC > m_rawCDCs
Raw CDC array.
int m_fee_ch[9][8][384]
Assignment map of FE board channel to the cell.
bool m_enableDatabase
Enable/Disable to read the channel map from the database.
int m_boardId
Frontend board ID.
std::vector< unsigned short > m_buffer
Short ward buffer of CDC event block.
virtual ~CDCPackerModule()
Destructor of the module.
std::string m_rawCDCName
Name of the RawCDC dataobject (supressed mode).
void initialize() override
Initializes the Module.
DBArray< CDCChannelMap > m_channelMapFromDB
Channel map retrieved from DB.
int getTriggerNumber()
Getter for trigger number.
void event() override
Event action (main routine).
int getFEEID(int copper_id, int slot_id)
Getter for Front End Electronics ID.
int m_fee_board[9][8][384]
Assignment map of FE board ID to the cell.
StoreArray< CDCRawHit > m_CDCRawHits
CDC raw hits.
void endRun() override
End run action.
const WireID getWireID(int iBoard, int iCh)
Getter of Wire ID.
void terminate() override
Termination action.
int m_fadcThreshold
FADC threshold.
int getTriggerTime()
Getter for trigger time in nsec.
std::string m_xmlMapFileName
Name of the assignment map of FE board channel to the cell.
int m_dataType
Data type of CDC data block.
WireID m_map[300][48]
Assignment map of FE board channel to the cell.
CDCPackerModule()
Constructor of the module.
int getDataType()
Getter for CDC data mode.
std::string m_cdcRawHitName
Name of the CDCRawHit dataobject (supressed mode).
void beginRun() override
Begin run action.
int getDataLength()
Getter for data length in byte.
int m_dataLength
Data length of the CDC data block (in bytes).
void loadMap()
Load FE channel to cell ID map.
int m_triggerNumber
Trigger number.
int m_version
Format version.
bool m_enablePrintOut
Enable/Disable to print out the data to the terminal.
void setCDCPacketHeader(const int *buf)
Set CDC Packet header.
int getBoardId()
Getter for FE board ID.
std::string m_cdcHitName
Tree name of the CDCHit object.
StoreArray< CDCHit > m_CDCHits
CDC hits.
Class for accessing arrays of objects in the database.
Definition: DBArray.h:26
Base class for Modules.
Definition: Module.h:72
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Class to identify a wire inside the CDC.
Definition: WireID.h:34
Abstract base class for different kinds of events.