9 #include <beast/qcsmonitor/modules/QcsmonitorDigitizerModule.h>
10 #include <beast/qcsmonitor/dataobjects/QcsmonitorSimHit.h>
12 #include <mdst/dataobjects/MCParticle.h>
13 #include <framework/logging/Logger.h>
14 #include <framework/gearbox/GearDir.h>
22 using namespace qcsmonitor;
37 setDescription(
"Qcsmonitor digitizer module");
40 addParam(
"ScintCell", m_ScintCell,
"Number of scintillator cell", 2);
41 addParam(
"TimeStep", m_TimeStep,
"Time step", 0.8);
42 addParam(
"C_keV_to_MIP", m_C_keV_to_MIP,
"C_keV_to_MIP", 241.65);
43 addParam(
"C_MIP_to_PE", m_C_MIP_to_PE,
"C_MIP_to_PE", 15.0);
44 addParam(
"MinTime", m_MinTime,
"Min. time", 0.0);
45 addParam(
"MaxTime", m_MaxTime,
"Max. time", 750.0);
46 addParam(
"MIPthres", m_MIPthres,
"Energy threshold in keV", 0.5);
49 QcsmonitorDigitizerModule::~QcsmonitorDigitizerModule()
53 void QcsmonitorDigitizerModule::initialize()
55 B2INFO(
"QcsmonitorDigitizer: Initializing");
56 m_qcsmonitorHit.registerInDataStore();
63 void QcsmonitorDigitizerModule::beginRun()
67 void QcsmonitorDigitizerModule::event()
80 int number_of_timebins = (int)((m_MaxTime - m_MinTime) / m_TimeStep);
82 for (
int i = 0; i < 1000; i ++)
83 for (
int j = 0; j < 100; j ++)
84 hitsarrayinMIP[i][j] = 0;
86 for (
const auto& SimHit : SimHits) {
87 const int detNb = SimHit.getCellId();
88 const double Edep = SimHit.getEnergyDep() * 1e6;
89 const double tof = SimHit.getFlightTime();
90 int TimeBin = tof / m_TimeStep;
91 double MIP = Edep / m_C_keV_to_MIP;
93 if (m_MinTime < tof && tof < m_MaxTime && TimeBin < 1000 && detNb < 100)
94 hitsarrayinMIP[TimeBin][detNb] += MIP;
112 for (
int i = 0; i < number_of_timebins; i ++) {
113 for (
int j = 0; j < m_ScintCell; j ++) {
114 if (hitsarrayinMIP[i][j] > m_MIPthres) {
115 double MIP = hitsarrayinMIP[i][j];
116 double Edep = MIP * m_C_keV_to_MIP * 1e-6;
117 double PE = MIP * m_C_MIP_to_PE;
126 void QcsmonitorDigitizerModule::getXMLData()
128 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name=\"QCSMONITOR\"]/Content/");
130 m_ScintCell = content.getInt(
"ScintCell");
131 m_TimeStep = content.getDouble(
"TimeStep");
132 m_MinTime = content.getDouble(
"MinTime");
133 m_MaxTime = content.getDouble(
"MaxTime");
134 m_MIPthres = content.getDouble(
"MIPthres");
135 m_C_keV_to_MIP = content.getDouble(
"C_keV_to_MIP");
136 m_C_MIP_to_PE = content.getDouble(
"C_MIP_to_PE");
138 B2INFO(
"QcsmonitorDigitizer: Aquired qcsmonitor locations and gas parameters");
142 void QcsmonitorDigitizerModule::endRun()
146 void QcsmonitorDigitizerModule::terminate()
GearDir is the basic class used for accessing the parameter store.
ClassQcsmonitorHit - digitization simulated hit for the Qcsmonitor detector.
Accessor to arrays stored in the data store.
T * appendNew()
Construct a new T object at the end of the array.
int getEntries() const
Get the number of objects in the array.
Qcsmonitor tube digitizer.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.