Belle II Software  release-08-01-10
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 
21 namespace Belle2 {
27  namespace CDC {
28 
36  class CDCPackerModule : public Module {
37 
38  public:
43 
47  virtual ~CDCPackerModule();
48 
52  void initialize() override;
53 
58  void beginRun() override;
59 
65  void event() override;
66 
70  void endRun() override;
71 
75  void terminate() override;
76 
80  void setCDCPacketHeader(const int* buf)
81  {
82 
83  if ((buf[0] & 0xff000000) == 0x22000000) { // raw data mode.
84  m_dataType = 1;
85  } else if ((buf[0] & 0xff000000) == 0x20000000) { // suppressed data mode.
86  m_dataType = 2;
87  } else {
88  B2ERROR("Undefined data type");
89  }
90 
91  m_version = ((buf[0] & 0xff0000) >> 16); // Always zero.
92  m_boardId = (buf[0] & 0xffff);
93  m_triggerTime = ((buf[1] & 0xffff0000) >> 16);
94  m_dataLength = (buf[1] & 0xffff);
95  m_triggerNumber = buf[2];
96 
97  }
98 
104  int getFEEID(int copper_id, int slot_id);
105 
111  {
112  return m_dataType;
113  }
114 
120  {
121  return m_triggerTime;
122  }
123 
129  {
130  return m_dataLength;
131  }
132 
138  {
139  return m_triggerNumber;
140  }
141 
142 
147  {
148  return m_boardId;
149  }
150 
154  void loadMap();
155 
159  const WireID getWireID(int iBoard, int iCh);
160 
161  private:
162 
163  int m_event;
165  // int m_overflow; /**< TDC overflow. */
166 
167 
168  private:
169 
174 
179 
184 
189 
194 
199 
201  // * Number of good blocks.
202  // */
203  // int m_nGoodBlocks;
204 
205  // /**
206  // * Number of error blocks.
207  // */
208  // int m_nErrorBlocks;
209 
214 
220 
224  std::string m_rawCDCName;
225 
229  std::string m_cdcRawHitName;
230 
234  std::string m_cdcHitName;
235 
239  std::string m_xmlMapFileName;
240 
244  std::vector<unsigned short> m_buffer;
245 
250  WireID m_map[300][48];
251 
258  int m_fee_board[9][8][384];
259 
266  int m_fee_ch[9][8][384];
267 
273 
278 
283 
288 
293 
294  };//end class declaration
295 
296 
297  } //end CDC namespace;
299 } // end namespace Belle2
300 
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.