Belle II Software development
KLMDigitizerModule.cc
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/* Own header. */
10#include <klm/modules/KLMDigitizer/KLMDigitizerModule.h>
11
12/* KLM headers. */
13#include <klm/dataobjects/KLMChannelIndex.h>
14#include <klm/dataobjects/KLMScintillatorFirmwareFitResult.h>
15#include <klm/simulation/ScintillatorSimulator.h>
16
17/* Basf2 headers. */
18#include <framework/dataobjects/BackgroundMetaData.h>
19#include <mdst/dataobjects/MCParticle.h>
20
21/* ROOT headers. */
22#include <TRandom.h>
23
24using namespace Belle2;
25
26REG_MODULE(KLMDigitizer);
27
29 Module(),
30 m_Time(&(KLMTime::Instance())),
31 m_ElementNumbers(&(KLMElementNumbers::Instance())),
32 m_ChannelSpecificSimulation(false),
33 m_EfficiencyMode(c_Plane),
34 m_Fitter(nullptr)
35{
36 setDescription("KLM digitization module: create KLMDigits from KLMSimHits.");
38 addParam("SimulationMode", m_SimulationMode,
39 "Simulation mode (\"Generic\" or \"ChannelSpecific\").",
40 std::string("Generic"));
41 /*
42 * Initial digitization time is negative to work with cosmic events (the part
43 * of the track directed to the interaction pointhas a negative time).
44 */
45 addParam("DigitizationInitialTime", m_DigitizationInitialTime,
46 "Initial digitization time in CTIME periods.", -5);
47 addParam("SaveFPGAFit", m_SaveFPGAFit, "Save FPGA fit data and set a relation with KLMDigits.", false);
48 addParam("Efficiency", m_Efficiency,
49 "Efficiency determination mode (\"Strip\" or \"Plane\").",
50 std::string("Plane"));
51 addParam("CreateMultiStripDigits", m_CreateMultiStripDigits,
52 "Whether to create multi-strip digits in Run 1 data (not used for Run 2+).", true);
53 addParam("Debug", m_Debug,
54 "Debug mode (generates additional output files with histograms).",
55 false);
56}
57
59{
60}
61
63{
64 m_SimHits.isRequired();
65 m_Digits.registerInDataStore();
66 m_Digits.registerRelationTo(m_SimHits);
67 if (m_SaveFPGAFit) {
68 m_FPGAFits.registerInDataStore();
69 m_Digits.registerRelationTo(m_FPGAFits);
70 }
71 if (m_SimulationMode == "Generic") {
72 /* Nothing to do. */
73 } else if (m_SimulationMode == "ChannelSpecific") {
75 } else {
76 B2FATAL("Unknown simulation mode: " << m_SimulationMode);
77 }
78 if (m_Efficiency == "Strip")
80 else if (m_Efficiency == "Plane")
82 else
83 B2FATAL("Unknown efficiency mode: " << m_EfficiencyMode);
84}
85
87{
88 KLMChannelIndex klmChannels;
89 for (KLMChannelIndex& klmChannel : klmChannels) {
90 KLMChannelNumber channel = m_ElementNumbers->channelNumber(klmChannel.getSubdetector(), klmChannel.getSection(),
91 klmChannel.getSector(), klmChannel.getLayer(),
92 klmChannel.getPlane(), klmChannel.getStrip());
93 const KLMScintillatorFEEData* FEEData = m_FEEPar->getFEEData(channel);
94 if (FEEData == nullptr)
95 B2FATAL("Incomplete scintillator FEE data.");
96 if (FEEData->getPhotoelectronAmplitude() <= 0) {
97 B2ERROR("Non-positive photoelectron amplitude. The requested "
98 "channel-specific simulation is impossible. "
99 "KLMDigitizer is switched to the generic mode."
100 << LogVar("Section", klmChannel.getSection())
101 << LogVar("Layer", klmChannel.getLayer())
102 << LogVar("Sector", klmChannel.getSector())
103 << LogVar("Plane", klmChannel.getPlane())
104 << LogVar("Strip", klmChannel.getStrip()));
106 return;
107 }
108 }
109}
110
112{
113 if (!m_DigPar.isValid())
114 B2FATAL("KLM scintillator digitization parameters are not available.");
115 if (!m_FEEPar.isValid())
116 B2FATAL("KLM scintillator FEE parameters are not available.");
117 if (!m_ChannelStatus.isValid())
118 B2FATAL("KLM channel status data are not available.");
119 if (!m_StripEfficiency.isValid())
120 B2FATAL("KLM strip efficiency data are not available.");
121 if (!m_ScintillatorFirmware.isValid())
122 B2FATAL("KLM scintillator firmware version is not available.");
126 m_Fitter = new KLM::ScintillatorFirmware(m_DigPar->getNDigitizations());
128 m_CreateMultiStripDigitsByRun = false; // do not make multi-strip KLMDigits for Run 2+ events
129 if ((fwVersion == KLMScintillatorFirmware::FirmwareVersion::c_Invalid) || // this should never happen!
130 (fwVersion == KLMScintillatorFirmware::FirmwareVersion::c_Phase2) || // for very early data (deprecated)
131 (fwVersion == KLMScintillatorFirmware::FirmwareVersion::c_Run1)) { // for data up to and including 2022b
133 }
134 B2INFO("KLM multi-strip digits are " << (m_CreateMultiStripDigitsByRun ? "" : "NOT") << " simulated");
135}
136
137/*
138 * Digitization. Light propagation into the fiber, SiPM and electronics effects
139 * are simulated in KLM::ScintillatorSimulator class.
140 */
141
143{
145 m_ChannelStatus->getChannelStatus(channel);
146 if (status == KLMChannelStatus::c_Unknown)
147 B2FATAL("Incomplete KLM channel status data.");
148 return (status != KLMChannelStatus::c_Dead);
149}
150
152{
153 if (std::isnan(efficiency))
154 B2FATAL("Incomplete KLM efficiency data.");
155 double selection = gRandom->Rndm();
156 return (selection < efficiency);
157}
158
160{
161 std::multimap<KLMChannelNumber, const KLMSimHit*>::iterator
162 it, it2, lowerBound, upperBound;
163 it = m_MapChannelSimHit.begin();
164 while (it != m_MapChannelSimHit.end()) {
165 lowerBound = it;
166 upperBound = m_MapChannelSimHit.upper_bound(it->first);
167 it = upperBound;
168 if (not lowerBound->second->inRPC())
169 B2FATAL("KLMDigitizer::digitizeRPC is trying to process a scintillator hit.");
170 if (m_EfficiencyMode == c_Strip) {
171 float efficiency = m_StripEfficiency->getEfficiency(lowerBound->first);
172 if (!efficiencyCorrection(efficiency))
173 continue;
174 }
176 m_ElementNumbers->localChannelNumberBKLM(lowerBound->first));
177 /* Select hit that has the smallest time. */
178 it2 = lowerBound;
179 const KLMSimHit* hit = lowerBound->second;
180 double time = hit->getTime();
181 ++it2;
182 while (it2 != upperBound) {
183 if (it2->second->getTime() < time) {
184 time = it2->second->getTime();
185 hit = it2->second;
186 }
187 ++it2;
188 }
189 KLMDigit* digit = m_Digits.appendNew(hit, strip);
190 it2 = lowerBound;
191 while (it2 != upperBound) {
192 digit->addRelationTo(it2->second);
193 ++it2;
194 }
195 }
196}
197
199{
200 uint16_t tdc;
202 &(*m_DigPar), m_Fitter,
204 const KLMScintillatorFEEData* FEEData;
205 std::multimap<KLMChannelNumber, const KLMSimHit*>::iterator
206 it, lowerBound, upperBound;
207 for (int i = 0; i < KLM::c_NChannelsAsic; ++i)
208 m_AsicDigits[i] = nullptr;
209 it = m_MapChannelSimHit.begin();
210 while (it != m_MapChannelSimHit.end()) {
211 lowerBound = it;
212 upperBound = m_MapChannelSimHit.upper_bound(it->first);
213 it = upperBound;
214 if (lowerBound->second->inRPC())
215 B2FATAL("KLMDigitizer::digitizeScintillator is trying to process a RPC hit.");
216 const KLMSimHit* simHit = lowerBound->second;
217 if (m_EfficiencyMode == c_Strip) {
218 float efficiency = m_StripEfficiency->getEfficiency(lowerBound->first);
219 if (!efficiencyCorrection(efficiency))
220 continue;
221 }
223 FEEData = m_FEEPar->getFEEData(lowerBound->first);
224 if (FEEData == nullptr)
225 B2FATAL("Incomplete KLM scintillator FEE data.");
226 simulator.setFEEData(FEEData);
227 }
228 simulator.simulate(lowerBound, upperBound);
229 if (simulator.getNGeneratedPhotoelectrons() == 0)
230 continue;
231 const KLMElectronicsChannel* electronicsChannel =
232 m_ElectronicsMap->getElectronicsChannel(lowerBound->first);
233 int channel = (electronicsChannel->getChannel() - 1) %
234 KLM::c_NChannelsAsic;
235 KLMDigit* digit = new KLMDigit(simHit);
236 m_AsicDigits[channel] = digit;
237 m_AsicDigitSimHitsLowerBound[channel] = lowerBound;
238 m_AsicDigitSimHitsUpperBound[channel] = upperBound;
239 digit->setMCTime(simulator.getMCTime());
240 digit->setSiPMMCTime(simulator.getSiPMMCTime());
242 simulator.getNGeneratedPhotoelectrons());
243 if (simulator.getFitStatus() ==
244 KLM::c_ScintillatorFirmwareSuccessfulFit) {
245 tdc = simulator.getFPGAFit()->getStartTime();
246 digit->setCharge(simulator.getFPGAFit()->getMinimalAmplitude());
247 } else {
248 tdc = 0;
249 digit->setCharge(m_DigPar->getADCRange() - 1);
250 }
251 digit->setTDC(tdc);
252 digit->setTime(m_Time->getTimeSimulation(tdc, true));
253 digit->setFitStatus(simulator.getFitStatus());
254 digit->setNPhotoelectrons(simulator.getNPhotoelectrons());
255 digit->setEnergyDeposit(simulator.getEnergy());
256 if (m_SaveFPGAFit && (simulator.getFitStatus() ==
257 KLM::c_ScintillatorFirmwareSuccessfulFit)) {
259 m_FPGAFits.appendNew(*simulator.getFPGAFit());
260 digit->addRelationTo(fit);
261 }
262 }
263}
264
266{
267 std::multimap<KLMElectronicsChannel, const KLMSimHit*>::iterator
268 it, it2, upperBound;
269 std::multimap<KLMChannelNumber, const KLMSimHit*>::iterator it3;
270 it = m_MapAsicSimHit.begin();
271 while (it != m_MapAsicSimHit.end()) {
272 upperBound = m_MapAsicSimHit.upper_bound(it->first);
273 m_MapChannelSimHit.clear();
274 for (it2 = it; it2 != upperBound; ++it2) {
275 const KLMSimHit* hit = it2->second;
276 KLMChannelNumber channel =
278 hit->getSubdetector(), hit->getSection(), hit->getSector(),
279 hit->getLayer(), hit->getPlane(), hit->getStrip());
280 m_MapChannelSimHit.insert(
281 std::pair<KLMChannelNumber, const KLMSimHit*>(channel, hit));
282 }
285 int nDigits = 0;
286 for (int i = 0; i < KLM::c_NChannelsAsic; ++i) {
287 if (m_AsicDigits[i] != nullptr)
288 nDigits += 1;
289 }
290 bool multiStripMode = (nDigits >= 2);
291 int i = 0;
292 while (i < KLM::c_NChannelsAsic) {
293 KLMDigit* digit = m_AsicDigits[i];
294 if (digit == nullptr) {
295 ++i;
296 continue;
297 }
298 // Firmware bug (used OR of struck channel numbers in range 1..15) defeated the
299 // expected by-4 grouping so we assume the worst case: all 15 channels are struck.
300 // This will be reduced for BKLM scintillators if there are missing detectorChannels.
301 int minGroupChannel = 1;
302 int maxGroupChannel = KLM::c_NChannelsAsic;
303 KLMDigit* arrayDigit = m_Digits.appendNew(*digit);
304 KLMElectronicsChannel electronicsChannel(it->first);
305 int asic = electronicsChannel.getChannel();
306 bool connectedChannelFound = false;
307 int minStrip, maxStrip;
308 for (int j = minGroupChannel; j <= maxGroupChannel; ++j) {
309 electronicsChannel.setChannel(KLM::c_NChannelsAsic * asic + j);
310 const KLMChannelNumber* detectorChannel =
311 m_ElectronicsMap->getDetectorChannel(&electronicsChannel);
312 if (detectorChannel != nullptr) {
313 int subdetector, section, sector, layer, plane, strip;
315 *detectorChannel, &subdetector, &section, &sector, &layer,
316 &plane, &strip);
317 if (!connectedChannelFound) {
318 connectedChannelFound = true;
319 minStrip = strip;
320 maxStrip = strip;
321 } else {
322 if (strip < minStrip)
323 minStrip = strip;
324 if (strip > maxStrip)
325 maxStrip = strip;
326 }
327 }
328 }
329 /* This should never happen. */
330 if (!connectedChannelFound)
331 B2FATAL("Cannot find connected electronics channels.");
332 if (multiStripMode) {
333 arrayDigit->setStrip(minStrip);
334 arrayDigit->setLastStrip(maxStrip);
335 }
336 for (int j = i; j < maxGroupChannel; ++j) {
337 if (m_AsicDigits[j] == nullptr)
338 continue;
339 for (it3 = m_AsicDigitSimHitsLowerBound[j];
340 it3 != m_AsicDigitSimHitsUpperBound[j]; ++it3) {
341 arrayDigit->addRelationTo(it3->second);
342 }
343 }
344 i = maxGroupChannel;
345 }
346 for (i = 0; i < KLM::c_NChannelsAsic; ++i) {
347 if (m_AsicDigits[i] != nullptr)
348 delete m_AsicDigits[i];
349 }
350 } else {
351 for (int i = 0; i < KLM::c_NChannelsAsic; ++i) {
352 KLMDigit* digit = m_AsicDigits[i];
353 if (digit == nullptr)
354 continue;
355 KLMDigit* arrayDigit = m_Digits.appendNew(*digit);
356 for (it3 = m_AsicDigitSimHitsLowerBound[i];
357 it3 != m_AsicDigitSimHitsUpperBound[i]; ++it3) {
358 arrayDigit->addRelationTo(it3->second);
359 }
360 delete digit;
361 }
362 }
363 it = upperBound;
364 }
365}
366
368{
369 int i;
370 KLMChannelNumber channel;
371 m_MapChannelSimHit.clear();
372 m_MapAsicSimHit.clear();
373 if (m_EfficiencyMode == c_Plane) {
374 m_MapPlaneSimHit.clear();
375 for (i = 0; i < m_SimHits.getEntries(); i++) {
376 const KLMSimHit* hit = m_SimHits[i];
377 /* For RPCs. */
378 if (hit->getStrip() <= 0)
379 continue;
380 const MCParticle* particle = hit->getRelatedFrom<MCParticle>();
381 /*
382 * We do not simulate the plane efficiency for KLMSimHits
383 * from beam background because there are no MCParticles associated
384 * to them.
385 */
386 if (particle != nullptr) {
387 KLMPlaneNumber plane =
389 hit->getSubdetector(), hit->getSection(), hit->getSector(),
390 hit->getLayer(), hit->getPlane());
391 m_MapPlaneSimHit.insert(
392 std::pair<KLMPlaneNumber, const KLMSimHit*>(plane, hit));
393 } else {
394 B2ASSERT("The KLMSimHit is not related to any MCParticle and "
395 "it is also not a beam background hit.",
396 hit->getBackgroundTag() != BackgroundMetaData::bg_none);
397 channel =
399 hit->getSubdetector(), hit->getSection(), hit->getSector(),
400 hit->getLayer(), hit->getPlane(), hit->getStrip());
401 if (checkActive(channel)) {
402 bool rpc = hit->inRPC();
403 if (rpc) {
404 m_MapChannelSimHit.insert(std::pair<KLMChannelNumber, const KLMSimHit*>(channel, hit));
405 } else {
406 const KLMElectronicsChannel* electronicsChannel =
407 m_ElectronicsMap->getElectronicsChannel(channel);
408 if (electronicsChannel == nullptr)
409 B2FATAL("Incomplete electronics map.");
410 KLMElectronicsChannel asic = electronicsChannel->getAsic();
411 m_MapAsicSimHit.insert(std::pair<KLMElectronicsChannel, const KLMSimHit*>(asic, hit));
412 }
413 }
414 }
415 }
416 std::multimap<KLMPlaneNumber, const KLMSimHit*>::iterator it, it2;
417 std::multimap<const MCParticle*, const KLMSimHit*> particleHitMap;
418 std::multimap<const MCParticle*, const KLMSimHit*>::iterator
419 itParticle, it2Particle;
420 it = m_MapPlaneSimHit.begin();
421 while (it != m_MapPlaneSimHit.end()) {
422 particleHitMap.clear();
423 it2 = it;
424 while (true) {
425 const KLMSimHit* hit = it2->second;
426 const MCParticle* particle = hit->getRelatedFrom<MCParticle>();
427 particleHitMap.insert(
428 std::pair<const MCParticle*, const KLMSimHit*>(particle, hit));
429 ++it2;
430 if (it2 == m_MapPlaneSimHit.end())
431 break;
432 if (it2->first != it->first)
433 break;
434 }
435 itParticle = particleHitMap.begin();
436 while (itParticle != particleHitMap.end()) {
437 it2Particle = itParticle;
438 const KLMSimHit* hit = it2Particle->second;
439 channel =
441 hit->getSubdetector(), hit->getSection(), hit->getSector(),
442 hit->getLayer(), hit->getPlane(), hit->getStrip());
443 float efficiency = m_StripEfficiency->getEfficiency(channel);
444 bool hitSelected = efficiencyCorrection(efficiency);
445 while (true) {
446 hit = it2Particle->second;
447 bool rpc = hit->inRPC();
448 if (hitSelected) {
449 for (int s = hit->getStrip(); s <= hit->getLastStrip(); ++s) {
450 channel =
452 hit->getSubdetector(), hit->getSection(), hit->getSector(),
453 hit->getLayer(), hit->getPlane(), s);
454 if (!checkActive(channel))
455 continue;
456 if (rpc) {
457 m_MapChannelSimHit.insert(
458 std::pair<KLMChannelNumber, const KLMSimHit*>(channel, hit));
459 } else {
460 const KLMElectronicsChannel* electronicsChannel =
461 m_ElectronicsMap->getElectronicsChannel(channel);
462 if (electronicsChannel == nullptr)
463 B2FATAL("Incomplete electronics map.");
464 KLMElectronicsChannel asic = electronicsChannel->getAsic();
465 m_MapAsicSimHit.insert(
466 std::pair<KLMElectronicsChannel, const KLMSimHit*>(
467 asic, hit));
468 }
469 }
470 }
471 ++it2Particle;
472 if (it2Particle == particleHitMap.end())
473 break;
474 if (it2Particle->first != itParticle->first)
475 break;
476 }
477 itParticle = it2Particle;
478 }
479 it = it2;
480 }
481 } else {
482 for (i = 0; i < m_SimHits.getEntries(); i++) {
483 const KLMSimHit* hit = m_SimHits[i];
484 if (hit->inRPC()) {
485 if (hit->getStrip() <= 0)
486 continue;
487 for (int s = hit->getStrip(); s <= hit->getLastStrip(); ++s) {
489 hit->getSection(), hit->getSector(), hit->getLayer(),
490 hit->getPlane(), s);
491 if (checkActive(channel)) {
492 m_MapChannelSimHit.insert(
493 std::pair<KLMChannelNumber, const KLMSimHit*>(channel, hit));
494 }
495 }
496 } else {
498 hit->getSubdetector(), hit->getSection(), hit->getSector(),
499 hit->getLayer(), hit->getPlane(), hit->getStrip());
500 if (checkActive(channel)) {
501 const KLMElectronicsChannel* electronicsChannel =
502 m_ElectronicsMap->getElectronicsChannel(channel);
503 if (electronicsChannel == nullptr)
504 B2FATAL("Incomplete electronics map.");
505 KLMElectronicsChannel asic = electronicsChannel->getAsic();
506 m_MapAsicSimHit.insert(
507 std::pair<KLMElectronicsChannel, const KLMSimHit*>(asic, hit));
508 }
509 }
510 }
511 }
512 digitizeRPC();
513 digitizeAsic();
514}
515
517{
518 delete m_Fitter;
519}
520
522{
523}
static int getStripByModule(int module)
Get strip number by module identifier.
KLM channel index.
ChannelStatus
Channel status.
@ c_Dead
Dead channel (no signal).
@ c_Unknown
Unknown status (no data).
KLM digit (class representing a digitized hit in RPCs or scintillators).
Definition: KLMDigit.h:29
void setMCTime(float time)
Set MC time.
Definition: KLMDigit.h:384
void setNGeneratedPhotoelectrons(int nPhotoelectrons)
Set generated number of photoelectrons.
Definition: KLMDigit.h:339
void setLastStrip(int lastStrip)
Set last strip number (for multi-strip digits).
Definition: KLMDigit.h:189
void setSiPMMCTime(float time)
Set SiPM MC time.
Definition: KLMDigit.h:402
void setEnergyDeposit(float eDep)
Set energy deposit.
Definition: KLMDigit.h:303
void setNPhotoelectrons(float nPhotoelectrons)
Set number of photoelectrons.
Definition: KLMDigit.h:321
void setStrip(int strip)
Set strip number.
Definition: KLMDigit.h:171
void setTime(float time)
Set hit time.
Definition: KLMDigit.h:285
void setTDC(uint16_t tdc)
Set TDC.
Definition: KLMDigit.h:267
void setFitStatus(int s)
Set fit status.
Definition: KLMDigit.h:366
void setCharge(uint16_t charge)
Set charge.
Definition: KLMDigit.h:231
std::multimap< KLMElectronicsChannel, const KLMSimHit * > m_MapAsicSimHit
Simulation hit map (by ASIC).
std::multimap< KLMPlaneNumber, const KLMSimHit * > m_MapPlaneSimHit
Simulation hit map (by plane).
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.
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.
std::multimap< KLMChannelNumber, constKLMSimHit * >::iterator m_AsicDigitSimHitsUpperBound[KLM::c_NChannelsAsic]
Simulation hits upper bound for ASIC digit.
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.
std::multimap< KLMChannelNumber, constKLMSimHit * >::iterator m_AsicDigitSimHitsLowerBound[KLM::c_NChannelsAsic]
Simulation hits lower bound for ASIC digit.
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.
BKLM electronics channel.
int getChannel() const
Get channel.
KLMElectronicsChannel getAsic() const
Get ASIC.
void setChannel(int channel)
Set channel.
KLM element numbers.
KLMChannelNumber channelNumberBKLM(int section, int sector, int layer, int plane, int strip) const
Get channel number for BKLM.
KLMChannelNumber channelNumber(int subdetector, int section, int sector, int layer, int plane, int strip) const
Get channel number.
KLMPlaneNumber planeNumber(int subdetector, int section, int sector, int layer, int plane) const
Get plane number.
void channelNumberToElementNumbers(KLMChannelNumber channel, int *subdetector, int *section, int *sector, int *layer, int *plane, int *strip) const
Get element numbers by channel number.
int localChannelNumberBKLM(KLMChannelNumber channel) const
Get local BKLM channel number.
float getPhotoelectronAmplitude() const
Get photoelectron amplitude.
int getMinimalAmplitude() const
Get minimal amplitude (ADC output).
int getStartTime() const
Get signal start time (in TDC counts).
FirmwareVersion
Enumerator for the scintillator firmware version.
@ c_Invalid
Flag for marking an invalid version.
@ c_Run1
Flag for Run 1 (from 2019a to 2022b)
@ c_Phase2
Flag for Phase 2 version.
KLM simulation hit.
Definition: KLMSimHit.h:31
KLM time conversion.
Definition: KLMTime.h:27
double getCTimePeriod() const
Get CTIME period.
Definition: KLMTime.h:53
double getTimeSimulation(int tdc, bool scintillator) const
Get time for simulation.
Definition: KLMTime.cc:66
void updateConstants()
Update constants from database objects.
Definition: KLMTime.cc:20
Digitize EKLMSim2Hits to get EKLM StripHits.
float getSiPMMCTime() const
Get SiPM MC time.
void setFEEData(const KLMScintillatorFEEData *FEEData)
Set FEE data.
enum ScintillatorFirmwareFitStatus getFitStatus() const
Get fit status.
double getEnergy()
Get total energy deposited in the strip (sum over ssimulation hits).
double getNPhotoelectrons()
Get number of photoelectrons (fit result).
KLMScintillatorFirmwareFitResult * getFPGAFit()
Get fit data.
int getNGeneratedPhotoelectrons()
Get generated number of photoelectrons.
void simulate(const std::multimap< KLMChannelNumber, const KLMSimHit * >::iterator &firstHit, const std::multimap< KLMChannelNumber, const KLMSimHit * >::iterator &end)
Simulate a strip.
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
void addRelationTo(const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
Add a relation from this object to another object (with caching).
Class to store variables with their name which were sent to the logging service.
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
uint16_t KLMChannelNumber
Channel number.
uint16_t KLMPlaneNumber
Plane number.
Abstract base class for different kinds of events.