9 #include <beast/csi/modules/CsiDigitizer_v2Module.h>
10 #include <beast/csi/dataobjects/CsiSimHit.h>
12 #include <framework/logging/Logger.h>
13 #include <framework/gearbox/GearDir.h>
14 #include <framework/core/RandomNumbers.h>
38 setDescription(
"Csi digitizer_v2 module");
45 CsiDigitizer_v2Module::~CsiDigitizer_v2Module()
49 void CsiDigitizer_v2Module::initialize()
51 B2INFO(
"CsiDigitizer_v2: Initializing");
52 m_csiHit_v2.registerInDataStore();
59 void CsiDigitizer_v2Module::beginRun()
63 void CsiDigitizer_v2Module::event()
68 for (
int i = 0; i < nentries; i++) {
71 int m_box = (int)m_cellID / 6;
72 int m_cry = m_cellID - m_box * 3;
79 double erecdep = m_energyDeposit;
80 erecdep += gRandom->Gaus(0, GetEnergyResolutionGeV(m_energyDeposit, m_cry));
82 CsiHits_v2.
appendNew(
CsiHit_v2(m_cellID, m_trackID, pdgCode, m_Time * m_energyDeposit / erecdep, m_energyDeposit, m_Mom,
83 m_Pos * (m_energyDeposit / erecdep), erecdep));
89 void CsiDigitizer_v2Module::getXMLData()
91 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name=\"CSI\"]/Content/");
93 int iEnergyResolutionConst = 0;
94 for (
double EnergyResolutionConst : content.getArray(
"EnergyResolutionConst", {0})) {
95 m_EnergyResolutionConst[iEnergyResolutionConst] = EnergyResolutionConst;
96 iEnergyResolutionConst++;
98 int iEnergyResolutionFactor = 0;
99 for (
double EnergyResolutionFactor : content.getArray(
"EnergyResolutionFactor", {0})) {
100 m_EnergyResolutionFactor[iEnergyResolutionFactor] = EnergyResolutionFactor;
101 iEnergyResolutionFactor++;
104 for (
double Threshold : content.getArray(
"Threshold", {0})) {
106 m_Threshold[iThres] = Threshold;
110 for (
double Range : content.getArray(
"Range", {0})) {
112 m_Range[iRange] =
Range;
116 B2INFO(
"CsiDigitizer_V2: Aquired csi locations and gas parameters");
117 B2INFO(
" from CSI.xml. There are " << nCSI <<
" CSIs implemented");
122 Double_t CsiDigitizer_v2Module::GetEnergyResolutionGeV(Double_t pEnergy,
int pcry)
125 return (m_EnergyResolutionFactor[pcry] * TMath::Sqrt(pEnergy) + m_EnergyResolutionConst[pcry] * pEnergy);
130 void CsiDigitizer_v2Module::endRun()
134 void CsiDigitizer_v2Module::terminate()
ClassCsiHit_v2 - Geant4 simulated hits in CsI crystals in BEAST.
ClassCsiSimHit - Geant4 simulated hits in CsI crystals 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.