Belle II Software  release-08-01-10
KLMDigitizerModule.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/KLMElementNumbers.h>
14 #include <klm/dataobjects/KLMSimHit.h>
15 #include <klm/dbobjects/KLMChannelStatus.h>
16 #include <klm/dbobjects/KLMElectronicsMap.h>
17 #include <klm/dbobjects/KLMScintillatorDigitizationParameters.h>
18 #include <klm/dbobjects/KLMScintillatorFEEParameters.h>
19 #include <klm/dbobjects/KLMScintillatorFirmware.h>
20 #include <klm/dbobjects/KLMStripEfficiency.h>
21 #include <klm/rawdata/RawData.h>
22 #include <klm/simulation/ScintillatorFirmware.h>
23 #include <klm/time/KLMTime.h>
24 
25 /* Basf2 headers. */
26 #include <framework/core/Module.h>
27 #include <framework/database/DBObjPtr.h>
28 #include <framework/datastore/StoreArray.h>
29 
30 namespace Belle2 {
42  class KLMDigitizerModule : public Module {
43 
44  public:
45 
50 
55 
59  void initialize() override;
60 
64  void beginRun() override;
65 
69  void event() override;
70 
74  void endRun() override;
75 
79  void terminate() override;
80 
81  private:
82 
87 
90 
93 
94  };
95 
100 
104  void digitizeRPC();
105 
109  void digitizeScintillator();
110 
114  void digitizeAsic();
115 
120  bool checkActive(KLMChannelNumber channel);
121 
127  bool efficiencyCorrection(float efficiency);
128 
131 
134 
137 
140 
143 
146 
149 
152 
154  std::string m_SimulationMode;
155 
158 
161 
164 
166  std::string m_Efficiency;
167 
170 
173 
176 
178  bool m_Debug;
179 
181  std::multimap<KLMPlaneNumber, const KLMSimHit*> m_MapPlaneSimHit;
182 
184  std::multimap<KLMChannelNumber, const KLMSimHit*> m_MapChannelSimHit;
185 
187  std::multimap<KLMElectronicsChannel, const KLMSimHit*> m_MapAsicSimHit;
188 
190  KLMDigit* m_AsicDigits[KLM::c_NChannelsAsic];
191 
193  std::multimap<KLMChannelNumber, const KLMSimHit*>::iterator
194  m_AsicDigitSimHitsLowerBound[KLM::c_NChannelsAsic];
195 
197  std::multimap<KLMChannelNumber, const KLMSimHit*>::iterator
198  m_AsicDigitSimHitsUpperBound[KLM::c_NChannelsAsic];
199 
202 
205 
208 
211 
212  };
213 
215 }
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
KLM digit (class representing a digitized hit in RPCs or scintillators).
Definition: KLMDigit.h:29
KLM digitization module.
std::multimap< KLMChannelNumber, const KLMSimHit * >::iterator m_AsicDigitSimHitsUpperBound[KLM::c_NChannelsAsic]
Simulation hits upper bound for ASIC digit.
std::multimap< KLMElectronicsChannel, const KLMSimHit * > m_MapAsicSimHit
Simulation hit map (by ASIC).
std::multimap< KLMPlaneNumber, const KLMSimHit * > m_MapPlaneSimHit
Simulation hit map (by plane).
std::multimap< KLMChannelNumber, const KLMSimHit * >::iterator m_AsicDigitSimHitsLowerBound[KLM::c_NChannelsAsic]
Simulation hits lower bound for ASIC digit.
KLMDigit * m_AsicDigits[KLM::c_NChannelsAsic]
Digits corresponding to ASIC channels.
EfficiencyMode m_EfficiencyMode
Efficiency determination mode (converted from the string parameter).
StoreArray< KLMDigit > m_Digits
KLM digits.
DBObjPtr< KLMChannelStatus > m_ChannelStatus
Channel status.
DBObjPtr< KLMScintillatorFEEParameters > m_FEEPar
Scintillator FEE parameters.
void initialize() override
Initializer.
bool m_CreateMultiStripDigitsByRun
Whether to create multi-strip digits for one particular run.
bool efficiencyCorrection(float efficiency)
Efficiency correction.
void event() override
This method is called for each event.
const KLMElementNumbers * m_ElementNumbers
Element numbers.
bool m_SaveFPGAFit
Save FPGA fit data (KLMScintillatorFirmwareFitResult).
bool checkActive(KLMChannelNumber channel)
Check if channel is active (status is not KLMChannelStatus::c_Dead).
void endRun() override
This method is called if the current run ends.
DBObjPtr< KLMScintillatorDigitizationParameters > m_DigPar
Scintillator digitization parameters.
std::multimap< KLMChannelNumber, const KLMSimHit * > m_MapChannelSimHit
Simulation hit map (by channel).
void terminate() override
This method is called at the end of the event processing.
EfficiencyMode
Efficiency determination mode.
bool m_Debug
Use debug mode in EKLM::ScintillatorSimulator or not.
StoreArray< KLMSimHit > m_SimHits
Simulation hits.
void digitizeRPC()
Digitization in RPCs.
int m_DigitizationInitialTime
Initial digitization time in CTIME periods.
void digitizeScintillator()
Digitization in scintillators.
void checkScintillatorFEEParameters()
Check scintillator FEE parameters for channel-specific simulation.
std::string m_Efficiency
Efficiency determination mode ("Strip" or "Plane").
void beginRun() override
Called when entering a new run.
DBObjPtr< KLMScintillatorFirmware > m_ScintillatorFirmware
Scintillator FEE firmware version.
DBObjPtr< KLMElectronicsMap > m_ElectronicsMap
Electronics map.
void digitizeAsic()
Digitization in ASIC.
StoreArray< KLMScintillatorFirmwareFitResult > m_FPGAFits
FPGA fits.
bool m_ChannelSpecificSimulation
Whether the simulation is channel-specific.
KLMTime * m_Time
Time conversion.
bool m_CreateMultiStripDigits
Whether to create multi-strip digits.
DBObjPtr< KLMStripEfficiency > m_StripEfficiency
Strip efficiency.
KLM::ScintillatorFirmware * m_Fitter
FPGA fitter.
std::string m_SimulationMode
Simulation mode.
KLM element numbers.
KLM time conversion.
Definition: KLMTime.h:27
Base class for Modules.
Definition: Module.h:72
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
uint16_t KLMChannelNumber
Channel number.
Abstract base class for different kinds of events.