9 #include <beast/bgo/modules/BgoDigitizerModule.h>
10 #include <beast/bgo/dataobjects/BgoSimHit.h>
12 #include <framework/logging/Logger.h>
13 #include <framework/gearbox/GearDir.h>
14 #include <framework/core/RandomNumbers.h>
38 setDescription(
"Bgo digitizer module");
47 BgoDigitizerModule::~BgoDigitizerModule()
51 void BgoDigitizerModule::initialize()
53 B2INFO(
"BgoDigitizer: Initializing");
54 m_bgoHit.registerInDataStore();
61 void BgoDigitizerModule::beginRun()
65 void BgoDigitizerModule::event()
70 for (
int i = 0; i < nentries; i++) {
79 double erecdep = m_energyDeposit;
80 erecdep += gRandom->Gaus(0, GetEnergyResolutionGeV(m_energyDeposit, m_cellID));
82 BgoHits.
appendNew(
BgoHit(m_cellID, m_trackID, pdgCode, m_Time * m_energyDeposit / erecdep, m_energyDeposit, m_Mom,
83 m_Pos * (m_energyDeposit / erecdep), erecdep));
89 void BgoDigitizerModule::getXMLData()
91 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name=\"BGO\"]/Content/");
96 for (
double EnResConst : content.getArray(
"EnergyResolutionConst", {0})) {
97 m_EnergyResolutionConst[iEnResConst] = EnResConst;
101 for (
double EnResFac : content.getArray(
"EnergyResolutionFactor", {0})) {
102 m_EnergyResolutionFactor[iEnResFac] = EnResFac / 100.;
106 for (
double Threshold : content.getArray(
"Threshold", {0})) {
108 m_Threshold[iThres] = Threshold;
112 for (
double Range : content.getArray(
"Range", {0})) {
114 m_Range[iRange] =
Range;
118 B2INFO(
"BgoDigitizer: Aquired bgo locations and gas parameters");
119 B2INFO(
" from BGO.xml. There are " << nBGO <<
" BGOs implemented");
124 Double_t BgoDigitizerModule::GetEnergyResolutionGeV(Double_t pEnergy,
int CellId)
127 return (m_EnergyResolutionFactor[CellId] * TMath::Sqrt(pEnergy) + m_EnergyResolutionConst[CellId] * pEnergy);
132 void BgoDigitizerModule::endRun()
136 void BgoDigitizerModule::terminate()
ClassBgoHit - Geant4 ulated hit for the Bgo crystal in beast.
ClassBgoSimHit - Geant4 simulated hit for the Bgo crystal in beast.
int getPDGCode() const
Get Particle PDG (can be one of secondaries)
int getTrackId() const
Get Track ID.
int getCellId() const
Get Cell ID.
double getFlightTime() const
Get Flight time from IP.
double getEnergyDep() const
Get Deposit energy.
TVector3 getMomentum() const
Get Momentum.
TVector3 getPosition() const
Get Position.
GearDir is the basic class used for accessing the parameter store.
Represents a range of arithmetic types.
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.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.