Belle II Software development
KLMUnpackerModule.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/* KLM headers. */
12#include <klm/dataobjects/KLMDigit.h>
13#include <klm/dataobjects/KLMDigitEventInfo.h>
14#include <klm/dataobjects/KLMDigitRaw.h>
15#include <klm/dataobjects/KLMElementNumbers.h>
16#include <klm/dbobjects/KLMElectronicsMap.h>
17#include <klm/dbobjects/KLMScintillatorFEEParameters.h>
18#include <klm/time/KLMTime.h>
19
20/* Basf2 headers. */
21#include <framework/core/Module.h>
22#include <framework/database/DBObjPtr.h>
23#include <framework/datastore/StoreArray.h>
24#include <rawdata/dataobjects/RawKLM.h>
25
26/* C++ headers. */
27#include <string>
28
29namespace Belle2 {
34
38 class KLMUnpackerModule : public Module {
39
40 public:
41
46
50 ~KLMUnpackerModule() override;
51
55 void initialize() override;
56
60 void beginRun() override;
61
65 void event() override;
66
67 private:
68
82 void createDigit(
83 const KLM::RawData* raw, const KLMDigitRaw* klmDigitRaw,
84 KLMDigitEventInfo* klmDigitEventInfo, int subdetector, int section,
85 int sector, int layer, int plane, int strip, int lastStrip);
86
95 void unpackKLMDigit(const int* rawData, int copper, int hslb,
96 int daqSubdetector,
97 KLMDigitEventInfo* klmDigitEventInfo);
98
114 static void convertPCIe40ToCOPPER(int channel, unsigned int* copper, int* hslb);
115
116 /* Module parameters. */
117
120
123
126
129
132
135
136 /* EKLM parameters. */
137
143
149
150 /* BKLM parameters. */
151
153 bool m_keepEvenPackages = false;
154
155 /* Common database objects. */
156
159
162
165
168
171
174
177
180
181 /* Other common variables. */
182
185
188
189 };
190
192}
Class for accessing objects in the database.
Definition DBObjPtr.h:21
Class to store debugging information from the unpacker (event based).
Class to store the raw words from the unpacker, digit-by-digit.
Definition KLMDigitRaw.h:29
KLM time conversion.
Definition KLMTime.h:27
DBObjPtr< KLMScintillatorFEEParameters > m_FEEParameters
Scintillator FEE parameters.
unsigned int m_triggerCTimeOfPreviousEvent
Trigger ctime of the previous event.
StoreArray< KLMDigit > m_Digits
Digits.
static void convertPCIe40ToCOPPER(int channel, unsigned int *copper, int *hslb)
Map a PCIe40 channel to the old and corresponding (COPPER, HSLB) address.
void initialize() override
Initializer.
void unpackKLMDigit(const int *rawData, int copper, int hslb, int daqSubdetector, KLMDigitEventInfo *klmDigitEventInfo)
Unpack KLM digit.
void event() override
This method is called for each event.
int m_DAQChannelModule
Record DAQ channel for specific module.
const KLMElementNumbers * m_ElementNumbers
Element numbers.
void createDigit(const KLM::RawData *raw, const KLMDigitRaw *klmDigitRaw, KLMDigitEventInfo *klmDigitEventInfo, int subdetector, int section, int sector, int layer, int plane, int strip, int lastStrip)
Create KLM digit.
bool m_WriteWrongHits
Record wrong hits (for debugging).
bool m_IgnoreWrongHits
Do not issue B2ERROR on wrong hits, with certain firmware versions wrong strip numbers are expected.
StoreArray< KLMDigitEventInfo > m_DigitEventInfos
Event information.
StoreArray< KLMDigit > m_klmDigitsOutOfRange
Out-of-range digits.
bool m_IgnoreStrip0
Ignore hits with strip = 0.
void beginRun() override
Called when entering a new run.
~KLMUnpackerModule() override
Destructor.
DBObjPtr< KLMElectronicsMap > m_ElectronicsMap
Electronics map.
StoreArray< RawKLM > m_RawKLMs
Raw data.
bool m_DAQChannelBKLMScintillators
Record DAQ channel for BKLM scintillators.
std::string m_outputKLMDigitsName
Name of KLMDigit store array.
bool m_keepEvenPackages
Flag to keep the even packages.
bool m_WriteDigitRaws
Record raw data in dataobject format (for debugging).
bool m_DebugElectronicsMap
Debug electronics map (record DAQ channel instead of strip).
KLMTime * m_Time
Time conversion.
StoreArray< KLMDigitRaw > m_klmDigitRaws
Raw digits.
KLM raw data.
Definition RawData.h:50
Module()
Constructor.
Definition Module.cc:30
Accessor to arrays stored in the data store.
Definition StoreArray.h:113
Abstract base class for different kinds of events.