11 #include <beast/qcsmonitor/modules/QcsmonitorDigitizerModule.h>
12 #include <beast/qcsmonitor/dataobjects/QcsmonitorSimHit.h>
14 #include <mdst/dataobjects/MCParticle.h>
15 #include <framework/logging/Logger.h>
16 #include <framework/gearbox/GearDir.h>
24 using namespace qcsmonitor;
39 setDescription(
"Qcsmonitor digitizer module");
42 addParam(
"ScintCell", m_ScintCell,
"Number of scintillator cell", 2);
43 addParam(
"TimeStep", m_TimeStep,
"Time step", 0.8);
44 addParam(
"C_keV_to_MIP", m_C_keV_to_MIP,
"C_keV_to_MIP", 241.65);
45 addParam(
"C_MIP_to_PE", m_C_MIP_to_PE,
"C_MIP_to_PE", 15.0);
46 addParam(
"MinTime", m_MinTime,
"Min. time", 0.0);
47 addParam(
"MaxTime", m_MaxTime,
"Max. time", 750.0);
48 addParam(
"MIPthres", m_MIPthres,
"Energy threshold in keV", 0.5);
51 QcsmonitorDigitizerModule::~QcsmonitorDigitizerModule()
55 void QcsmonitorDigitizerModule::initialize()
57 B2INFO(
"QcsmonitorDigitizer: Initializing");
58 m_qcsmonitorHit.registerInDataStore();
65 void QcsmonitorDigitizerModule::beginRun()
69 void QcsmonitorDigitizerModule::event()
84 int number_of_timebins = (int)((m_MaxTime - m_MinTime) / m_TimeStep);
86 for (
int i = 0; i < 1000; i ++)
87 for (
int j = 0; j < 100; j ++)
88 hitsarrayinMIP[i][j] = 0;
90 for (
const auto& SimHit : SimHits) {
91 const int detNb = SimHit.getCellId();
92 const double Edep = SimHit.getEnergyDep() * 1e6;
93 const double tof = SimHit.getFlightTime();
94 int TimeBin = tof / m_TimeStep;
95 double MIP = Edep / m_C_keV_to_MIP;
97 if (m_MinTime < tof && tof < m_MaxTime && TimeBin < 1000 && detNb < 100)
98 hitsarrayinMIP[TimeBin][detNb] += MIP;
116 for (
int i = 0; i < number_of_timebins; i ++) {
117 for (
int j = 0; j < m_ScintCell; j ++) {
118 if (hitsarrayinMIP[i][j] > m_MIPthres) {
119 double MIP = hitsarrayinMIP[i][j];
120 double Edep = MIP * m_C_keV_to_MIP * 1e-6;
121 double PE = MIP * m_C_MIP_to_PE;
130 void QcsmonitorDigitizerModule::getXMLData()
132 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name=\"QCSMONITOR\"]/Content/");
134 m_ScintCell = content.getInt(
"ScintCell");
135 m_TimeStep = content.getDouble(
"TimeStep");
136 m_MinTime = content.getDouble(
"MinTime");
137 m_MaxTime = content.getDouble(
"MaxTime");
138 m_MIPthres = content.getDouble(
"MIPthres");
139 m_C_keV_to_MIP = content.getDouble(
"C_keV_to_MIP");
140 m_C_MIP_to_PE = content.getDouble(
"C_MIP_to_PE");
142 B2INFO(
"QcsmonitorDigitizer: Aquired qcsmonitor locations and gas parameters");
146 void QcsmonitorDigitizerModule::endRun()
150 void QcsmonitorDigitizerModule::terminate()