Belle II Software development
ARICHRawUnpackerModule.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#include <framework/core/HistoModule.h>
11#include <TH1F.h>
12
13namespace Belle2 {
23
24 public:
25
30
35
39 virtual void defineHisto() override;
40
45 virtual void initialize() override;
46
50 virtual void event() override;
51
52 protected:
53
59 unsigned int calbyte(const int* buf);
60
66 unsigned int calword(const int* buf);
67
68 protected:
69
71 bool m_debug;
72
74 unsigned int m_ibyte = 0;
75
77 TH1* h_rate_a_all = NULL;
78
80 TH1* h_rate_b_all = NULL;
81
83 TH1* h_rate_c_all = NULL;
84
86 TH1* h_rate_d_all = NULL;
87
88 };
89
90 inline unsigned int ARICHRawUnpackerModule::calbyte(const int* buf)
91 {
92 int shift = (3 - m_ibyte % 4) * 8;
93 unsigned int val = 0xff & (buf[m_ibyte / 4] >> shift);
94 m_ibyte++;
95 return val;
96 }
97
98 inline unsigned int ARICHRawUnpackerModule::calword(const int* buf)
99 {
100 return (calbyte(buf) << 24) | (calbyte(buf) << 16)
101 | (calbyte(buf) << 8) | calbyte(buf);
102 }
103
104
106} // Belle2 namespace
Fill ARICHHit collection from ARICHDigits.
TH1 * h_rate_d_all
Rate histogram (unused).
TH1 * h_rate_b_all
Rate histogram (unused).
unsigned int m_ibyte
Current byte number.
TH1 * h_rate_a_all
Rate histogram (unused).
TH1 * h_rate_c_all
Rate histogram (unused).
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Definition: HistoModule.h:29
unsigned int calbyte(const int *buf)
Read byte with number m_ibyte from the buffer and increase the number by 1.
virtual void initialize() override
Initialize the Module.
unsigned int calword(const int *buf)
Read word (4 bytes) from the buffer and increase the byte number m_ibyte by 4.
virtual void event() override
Event processor.
virtual ~ARICHRawUnpackerModule()
Destructor.
virtual void defineHisto() override
Definition of the histograms.
Abstract base class for different kinds of events.