Belle II Software release-09-00-00
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 {
30 class ARICHUnpackerModule : public Module {
31
32 public:
33
38
42 virtual ~ARICHUnpackerModule();
43
48 virtual void initialize() override;
49
53 virtual void event() override;
54
55 private:
56
62 void printBits(const int* buffer, int bufferSize);
63
67 void readHeader(const int* buffer, unsigned& ibyte, ARICHRawHeader& head);
68
72 void readFEHeader(const int* buffer, unsigned& ibyte, ARICHRawHeader& head);
73
74
75
76 uint8_t m_bitMask;
77 int m_debug;
82 std::string m_outputDigitsName;
85 std::string m_inputRawDataName;
89 protected:
90 unsigned int calbyte(const int* buf);
91 unsigned int cal2byte(const int* buf);
92 unsigned int calword(const int* buf);
93 unsigned int m_ibyte = 0;
94 };
95
99 inline unsigned int ARICHUnpackerModule::calbyte(const int* buf)
100 {
101 int shift = (3 - m_ibyte % 4) * 8;
102 unsigned int val = 0xff & (buf[m_ibyte / 4] >> shift);
103 m_ibyte++;
104 return val;
105 }
106
110 inline unsigned int ARICHUnpackerModule::cal2byte(const int* buf)
111 {
112 return (calbyte(buf) << 8) | calbyte(buf);
113 }
114
118 inline unsigned int ARICHUnpackerModule::calword(const int* buf)
119 {
120 return (calbyte(buf) << 24) | (calbyte(buf) << 16)
121 | (calbyte(buf) << 8) | calbyte(buf);
122 }
123
125} // 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.