22#include "TRestDetectorAvalancheProcess.h"
30TRestDetectorAvalancheProcess::TRestDetectorAvalancheProcess() {
Initialize(); }
32TRestDetectorAvalancheProcess::TRestDetectorAvalancheProcess(
const char* configFilename) {
43TRestDetectorAvalancheProcess::~TRestDetectorAvalancheProcess() {
45 delete fHitsOutputEvent;
48void TRestDetectorAvalancheProcess::LoadDefaultConfig() {
49 SetTitle(
"Default config");
66 fHitsInputEvent =
nullptr;
70void TRestDetectorAvalancheProcess::LoadConfig(
string configFilename) {
86 if (fGas ==
nullptr) cout <<
"REST ERROR: Gas has not been initialized" << endl;
92 Double_t fW = fGas->GetWvalue();
93 Double_t gain, totelectrons = 0;
95 Double_t eDep = fHitsInputEvent->GetTotalEnergy() * fW / 1000.0;
98 cout <<
"Initial electrons " << fHitsInputEvent->GetTotalEnergy() <<
" ; eDep " << eDep
99 <<
" keV; resolution " << eRes * 2.35 * 100 <<
" fwhm" << endl;
101 TRandom3* rnd =
new TRandom3(0);
103 for (
unsigned int hit = 0; hit < fHitsInputEvent->GetNumberOfHits(); hit++) {
109 totelectrons += gain;
111 fHitsOutputEvent->
AddHit(fHitsInputEvent->
GetX(hit), fHitsInputEvent->
GetY(hit),
112 fHitsInputEvent->
GetZ(hit), fHitsInputEvent->GetEnergy(hit) * gain);
117 if (fHitsOutputEvent->GetNumberOfHits() == 0)
return nullptr;
119 cout <<
"Initial: " << fHitsInputEvent->GetNumberOfHits() <<
"e-s, and amplified: " << totelectrons
120 <<
" e-s : " << endl;
121 return fHitsOutputEvent;
134 fEnergyRef = GetDblParameterWithUnits(
"energyReference");
void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
void InitProcess() override
To be executed at the beginning of the run (outside event loop)
void EndProcess() override
To be executed at the end of the run (outside event loop)
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
Process one event.
Double_t fEnergyRef
reference energy for the FWHM
Double_t fResolutionAtEref
FWHM at Energy of reference.
void Initialize() override
Making default settings.
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
Double_t fDetectorGain
Detector's gain.
void PrintMetadata() override
Prints the metadata information from the gas.
Double_t GetX(int n) const
Returns the X-coordinate of hit entry n in mm.
Double_t GetY(int n) const
Returns the Y-coordinate of hit entry n in mm.
Double_t GetZ(int n) const
Returns the Z-coordinate of hit entry n in mm.
void AddHit(Double_t x, Double_t y, Double_t z, Double_t en, Double_t t=0, REST_HitType type=XYZ)
Adds a new hit to this event.
A base class for any REST event.
Double_t StringToDouble(std::string in)
Gets a double from a string.