Belle II Software  release-08-01-10
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 
29 namespace Belle2 {
41  class KLMUnpackerModule : public Module {
42 
43  public:
44 
49 
54 
58  void initialize() override;
59 
63  void beginRun() override;
64 
68  void event() override;
69 
73  void endRun() override;
74 
78  void terminate() override;
79 
80  private:
81 
95  void createDigit(
96  const KLM::RawData* raw, const KLMDigitRaw* klmDigitRaw,
97  KLMDigitEventInfo* klmDigitEventInfo, int subdetector, int section,
98  int sector, int layer, int plane, int strip, int lastStrip);
99 
108  void unpackKLMDigit(const int* rawData, int copper, int hslb,
109  int daqSubdetector,
110  KLMDigitEventInfo* klmDigitEventInfo);
111 
127  void convertPCIe40ToCOPPER(int channel, unsigned int* copper, int* hslb) const;
128 
129  /* Module parameters. */
130 
133 
136 
139 
142 
145 
148 
149  /* EKLM parameters. */
150 
156 
162 
163  /* BKLM parameters. */
164 
166  bool m_keepEvenPackages = false;
167 
168  /* Common database objects. */
169 
172 
175 
178 
181 
184 
187 
190 
193 
194  /* Other common variables. */
195 
198 
201 
202  };
203 
205 }
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
Class to store debugging informations 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.