Belle II Software development
ARICHUnpackerModule.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#pragma once
9
10// mapper
11#include <arich/dbobjects/ARICHMergerMapping.h>
12#include <framework/database/DBObjPtr.h>
13
14#include <framework/core/Module.h>
15#include <arich/modules/arichUnpacker/ARICHRawDataHeader.h>
16#include <string>
17
18namespace Belle2 {
27 class ARICHUnpackerModule : public Module {
28
29 public:
30
35
39 virtual ~ARICHUnpackerModule();
40
45 virtual void initialize() override;
46
50 virtual void event() override;
51
52 private:
53
59 void printBits(const int* buffer, int bufferSize);
60
64 void readHeader(const int* buffer, unsigned& ibyte, ARICHRawHeader& head);
65
69 void readFEHeader(const int* buffer, unsigned& ibyte, ARICHRawHeader& head);
70
71
72
73 uint8_t m_bitMask;
74 int m_debug;
79 std::string m_outputDigitsName;
82 std::string m_inputRawDataName;
86 protected:
87 unsigned int calbyte(const int* buf);
88 unsigned int cal2byte(const int* buf);
89 unsigned int calword(const int* buf);
90 unsigned int m_ibyte = 0;
91 };
92
96 inline unsigned int ARICHUnpackerModule::calbyte(const int* buf)
97 {
98 int shift = (3 - m_ibyte % 4) * 8;
99 unsigned int val = 0xff & (buf[m_ibyte / 4] >> shift);
100 m_ibyte++;
101 return val;
102 }
103
107 inline unsigned int ARICHUnpackerModule::cal2byte(const int* buf)
108 {
109 return (calbyte(buf) << 8) | calbyte(buf);
110 }
111
115 inline unsigned int ARICHUnpackerModule::calword(const int* buf)
116 {
117 return (calbyte(buf) << 24) | (calbyte(buf) << 16)
118 | (calbyte(buf) << 8) | calbyte(buf);
119 }
120
122} // Belle2 namespace
Raw data unpacker for ARICH.
DBObjPtr< ARICHMergerMapping > m_mergerMap
mapping of modules to mergers
std::string m_outputarichinfoName
name of ARICHInfo store object
int m_rawmode
Activate Raw Unpacker.
std::string m_outputRawDigitsName
name of ARICHRawDigit store array
uint8_t m_bitMask
bitmask for hit detection (8bits/hit)
std::string m_outputDigitsName
name of ARICHDigit store array
int m_disable_unpacker
Disable regular Unpacker.
std::string m_inputRawDataName
name of RawARICH store array
unsigned int m_ibyte
bye index of raw unpacker
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
Base class for Modules.
Definition: Module.h:72
unsigned int calbyte(const int *buf)
calculate number of bytes in raw Unpacker
virtual void initialize() override
Initialize the Module.
unsigned int calword(const int *buf)
calculate number of words in raw Unpacker
virtual void event() override
Event processor.
void printBits(const int *buffer, int bufferSize)
Unpack raw data given in production format.
unsigned int cal2byte(const int *buf)
calculate number of lines (2 bytes) in raw Unpacker
void readHeader(const int *buffer, unsigned &ibyte, ARICHRawHeader &head)
Read Merger header.
void readFEHeader(const int *buffer, unsigned &ibyte, ARICHRawHeader &head)
Read FE header.
virtual ~ARICHUnpackerModule()
Destructor.
Abstract base class for different kinds of events.
ARICH raw-data header.