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 {
38 class KLMUnpackerModule : public Module {
39
40 public:
41
46
51
55 void initialize() override;
56
60 void beginRun() override;
61
65 void event() override;
66
70 void endRun() override;
71
75 void terminate() override;
76
77 private:
78
92 void createDigit(
93 const KLM::RawData* raw, const KLMDigitRaw* klmDigitRaw,
94 KLMDigitEventInfo* klmDigitEventInfo, int subdetector, int section,
95 int sector, int layer, int plane, int strip, int lastStrip);
96
105 void unpackKLMDigit(const int* rawData, int copper, int hslb,
106 int daqSubdetector,
107 KLMDigitEventInfo* klmDigitEventInfo);
108
124 void convertPCIe40ToCOPPER(int channel, unsigned int* copper, int* hslb) const;
125
126 /* Module parameters. */
127
130
133
136
139
142
145
146 /* EKLM parameters. */
147
153
159
160 /* BKLM parameters. */
161
163 bool m_keepEvenPackages = false;
164
165 /* Common database objects. */
166
169
172
175
178
181
184
187
190
191 /* Other common variables. */
192
195
198
199 };
200
202}
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 element numbers.
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.
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.
void endRun() override
This method is called if the current run ends.
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.
void terminate() override
This method is called at the end of the event processing.
StoreArray< KLMDigitEventInfo > m_DigitEventInfos
Event information.
void convertPCIe40ToCOPPER(int channel, unsigned int *copper, int *hslb) const
Map a PCIe40 channel to the old and corresponding (COPPER, HSLB) address.
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.
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
Base class for Modules.
Definition: Module.h:72
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Abstract base class for different kinds of events.