9#include <beast/he3tube/modules/He3DigitizerModule.h>
10#include <beast/he3tube/dataobjects/He3tubeSimHit.h>
12#include <mdst/dataobjects/MCParticle.h>
13#include <framework/datastore/RelationArray.h>
14#include <framework/datastore/RelationIndex.h>
15#include <framework/logging/Logger.h>
16#include <framework/gearbox/GearDir.h>
17#include <framework/gearbox/Const.h>
21#include <boost/foreach.hpp>
31using namespace he3tube;
49 "Conversion factor for pulse heights", 0.303132019);
50 addParam(
"useMCParticles",
m_mcpExist,
"Use MCParticles to determine if neutrons are present",
true);
60 B2INFO(
"He3Digitizer: Initializing");
76 B2DEBUG(250,
"Beginning of event method");
83 std::fill_n(lowTime,
numOfTubes, 9999999999999);
89 B2DEBUG(250,
"Skipping event #" <<
Event <<
" since there are no sim hits");
103 for (
int i = 0; i < nMCParticles; ++i) {
109 BOOST_FOREACH(
const relMCSimHit_Element & relation, relMCSimHit.
getElementsFrom(mcp)) {
115 if (mom == NULL)
continue;
121 definiteNeutron[detNB] =
true;
122 ProcessHit(aHit, lowTime, edepDet, NbEle_tot);
131 for (
int i = 0; i < nentries; i++) {
148 B2DEBUG(80,
"He3Digitizer: " << edepDet[i] <<
"MeV deposited in tube #" << i <<
" with waveform peak of " << peak[i]);
159 delete[] definiteNeutron;
172 if (time < lowTime[detNB]) lowTime[detNB] =
176 B2WARNING(
"He3Digitizer: Detector number of He3tubeSimHit is greater than number implemented! Ignoring He3tubeSimHit.");
181 double ionEn = (edep - niel) * 1e3;
189 const int NbEle = (int)gRandom->Gaus(meanE1,
192 NbEle_tot[detNB] = NbEle_tot[detNB] + NbEle;
196 edepDet[detNB] = edepDet[detNB] + edep;
203 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name=\"HE3TUBE\"]/Content/");
206 BOOST_FOREACH(
const GearDir & activeParams, content.getNodes(
"Active")) {
207 B2DEBUG(250,
"Tubes located at x=" << activeParams.
getLength(
"x_he3tube"));
212 B2INFO(
"He3Digitizer: There are " <<
numOfTubes <<
" tubes implemented");
int getPDGCode() const
PDG code.
static const ParticleType neutron
neutron particle
static const ChargedStable proton
proton particle
GearDir is the basic class used for accessing the parameter store.
ClassHe3Hit - digitization simulated hit for the He3tube detector.
ClassHe3tubeSimHit - Geant4 simulated hit for the He3tube detector.
float getEnergyDep() const
Return the energy deposition in electrons.
float getdetNb() const
Return the He3tube number.
float getEnergyNiel() const
Return the non-ionization energy in electrons.
int gettkPDG() const
Return the PDG number of the track.
float getGlTime() const
Return the global time.
A Class to store the Monte Carlo particle information.
int getPDG() const
Return PDG code of particle.
void setDescription(const std::string &description)
Sets the description of the module.
Low-level class to create/modify relations between StoreArrays.
Provides access to fast ( O(log n) ) bi-directional lookups on a specified relation.
range_from getElementsFrom(const FROM *from) const
Return a range of all elements pointing from the given object.
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.
double getLength(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard length unit.
StoreArray< He3tubeHit > m_he3tubeHit
Array for He3tubeHit.
void ProcessHit(He3tubeSimHit *aHit, double *lowTime, double *edepDet, double *NbEle_tot)
Process the he3tube simhits.
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
virtual void endRun() override
End-of-run action.
virtual void getXMLData()
reads data from HE3TUBE.xml: tube location, drift data filename, sigma of impulse response function
bool m_mcpExist
Whether or not mcparticle array exists.
virtual void terminate() override
Termination action.
double m_ConversionFactor
Conversion to ADC counts, set in steering file.
virtual ~He3DigitizerModule()
Destructor.
int numOfTubes
number of detectors.
virtual void beginRun() override
Called when entering a new run.
double m_Workfct
ionization energy of He3
He3DigitizerModule()
Constructor: Sets the description, the properties and the parameters of the module.
double m_Fanofac
fano factor
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.
double sqrt(double a)
sqrt for double
MCParticle * getMother() const
Returns a pointer to the mother particle.
Abstract base class for different kinds of events.
Element type for the index.