10#include <klm/modules/KLMScintillatorSimulator/KLMScintillatorSimulatorModule.h>
13#include <klm/eklm/geometry/GeometryData.h>
14#include <klm/simulation/ScintillatorSimulator.h>
17#include <framework/gearbox/Unit.h>
26static const char MemErr[] =
"Memory allocation error.";
35 setDescription(
"Standalone generation and studies of ADC output.");
38 std::string(
"KLMScintillatorSimulator.root"));
40 std::string(
"Strips"));
48 const char* name,
double l,
double d,
int npe)
59 h =
new TH1F(name,
"",
m_SciSimPar->getNDigitizations(), 0, t);
60 }
catch (std::bad_alloc& ba) {
63 for (j = 0; j <
m_SciSimPar->getNDigitizations(); j++) {
67 fe.generatePhotoelectrons(l, d, npe, 0,
false);
68 fe.generatePhotoelectrons(l, d, npe, 0,
true);
69 fe.fillSiPMOutput(
m_hDir,
true,
false);
70 fe.fillSiPMOutput(
m_hRef,
false,
true);
72 for (j = 0; j <
m_SciSimPar->getNDigitizations(); j++)
74 for (j = 1; j <=
m_SciSimPar->getNDigitizations(); j++)
75 h->SetBinContent(j, (
m_hDir[j - 1] +
m_hRef[j - 1]) / s);
89 B2FATAL(
"EKLM digitization parameters are not available.");
94 }
catch (std::bad_alloc& ba) {
103 if (
m_mode.compare(
"Strips") == 0) {
106 snprintf(str, 32,
"h%d_near", i);
108 snprintf(str, 32,
"h%d_far", i);
111 }
else if (
m_mode.compare(
"Shape") == 0) {
115 B2FATAL(
"Unknown operation mode.");
int getNStrips() const
Get number of strips.
static const GeometryData & Instance(enum DataSource dataSource=c_Database, const GearDir *gearDir=nullptr)
Instantiation.
double getStripLength(int strip) const
Get strip length.
Class to store KLM scintillator simulation parameters in the database.
~KLMScintillatorSimulatorModule()
Destructor.
void generateHistogram(const char *name, double l, double d, int npe)
Generate output histogram.
void initialize() override
Initializer.
float * m_hRef
Reflected histogram.
void event() override
This method is called for each event.
TFile * m_fout
Output file.
void endRun() override
This method is called if the current run ends.
void terminate() override
This method is called at the end of the event processing.
KLMScintillatorDigitizationParameters * m_SciSimPar
Scintillator simulation parameters.
float * m_hDir
Direct histogram.
void beginRun() override
Called when entering a new run.
std::string m_out
Name of output file.
DBObjPtr< KLMScintillatorDigitizationParameters > m_SciSimParDatabase
Scintillator simulation parameters.
std::string m_mode
Operation mode.
KLMScintillatorSimulatorModule()
Constructor.
double getTDCPeriod() const
Get TDC period.
void updateConstants()
Update constants from database objects.
static KLMTime & Instance()
Instantiation.
Digitize EKLMSim2Hits to get EKLM StripHits.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
static const double mm
[millimeters]
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.