10 #include <top/modules/TOPDoublePulseGenerator/TOPCalPulseGeneratorModule.h>
11 #include <top/geometry/TOPGeometryPar.h>
14 #include <framework/datastore/StoreArray.h>
17 #include <framework/logging/Logger.h>
47 setDescription(
"Realistic generator of calibration double pulses. "
48 "Needs TOPDigitizer to digitize");
49 setPropertyFlags(c_ParallelProcessingCertified);
52 addParam(
"moduleIDs", m_moduleIDs,
53 "list of slots for which to generate cal pulse, empty list means all slots.",
55 m_asicChannels.push_back(0);
56 addParam(
"asicChannels", m_asicChannels,
57 "ASIC calibration channels (0 - 7), empty list means all channels.",
60 addParam(
"amplitude", m_amplitude,
"amplitude of cal pulse [ADC counts]", 600.0);
61 addParam(
"delay", m_delay,
"delay of cal pulse [ns]", 10.5);
62 addParam(
"windowSize", m_windowSize,
"size of time window in which to generate cal pulses [ns]", 8.0);
66 void TOPCalPulseGeneratorModule::initialize()
70 m_calPulses.registerInDataStore();
74 const auto* geo = TOPGeometryPar::Instance()->getGeometry();
76 if (m_moduleIDs.empty()) {
77 for (
const auto& module : geo->getModules()) {
78 m_moduleIDs.push_back(module.getModuleID());
81 for (
auto moduleID : m_moduleIDs) {
82 if (!geo->isModuleIDValid(moduleID))
83 B2ERROR(
"Invalid module ID found in input list: " << moduleID);
87 if (m_asicChannels.empty()) {
88 for (
unsigned ch = 0; ch < 8; ch++) m_asicChannels.push_back(ch);
90 for (
unsigned ch : m_asicChannels) {
92 B2ERROR(
"Invalid ASIC channel found in input list: " << ch);
99 void TOPCalPulseGeneratorModule::event()
101 const auto& chMapper = TOPGeometryPar::Instance()->getChannelMapper();
103 double time = m_delay + gRandom->Uniform(m_windowSize);
104 for (
auto moduleID : m_moduleIDs) {
105 for (
unsigned asic = 0; asic < 64; asic++) {
108 auto pixelID = chMapper.getPixelID(channel);
109 m_calPulses.appendNew(moduleID, channel, pixelID, time, m_amplitude);
Generator of calibration pulses Output to TOPSimCalPulses.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.
record to be used to store ASIC info