16#include "TRestDetectorFiducializationProcess.h"
22TRestDetectorFiducializationProcess::TRestDetectorFiducializationProcess() {
Initialize(); }
24TRestDetectorFiducializationProcess::TRestDetectorFiducializationProcess(
const char* configFilename) {
31TRestDetectorFiducializationProcess::~TRestDetectorFiducializationProcess() {
delete fOutputHitsEvent; }
33void TRestDetectorFiducializationProcess::LoadDefaultConfig() { SetTitle(
"Default config"); }
40 fInputHitsEvent =
nullptr;
45void TRestDetectorFiducializationProcess::LoadConfig(
const string& configFilename,
const string& name) {
50 fReadout = GetMetadata<TRestDetectorReadout>();
51 if (fReadout ==
nullptr) {
52 cout <<
"REST ERROR: Readout has not been initialized" << endl;
60 Int_t nHits = fInputHitsEvent->GetNumberOfHits();
61 if (nHits <= 0)
return nullptr;
63 TRestHits* hits = fInputHitsEvent->GetHits();
64 for (
int n = 0; n < nHits; n++) {
65 Double_t eDep = hits->GetEnergy(n);
67 const Double_t x = hits->GetX(n);
68 const Double_t y = hits->GetY(n);
69 const Double_t z = hits->GetZ(n);
71 const Double_t t = hits->GetTime(n);
72 auto type = hits->GetType(n);
74 for (
int p = 0; p < fReadout->GetNumberOfReadoutPlanes(); p++) {
78 fOutputHitsEvent->
AddHit(x, y, z, eDep, t, type);
83 if (fOutputHitsEvent->GetNumberOfHits() == 0) {
88 cout <<
"TRestDetectorFiducializationProcess. Hits added : " << fOutputHitsEvent->GetNumberOfHits()
90 cout <<
"TRestDetectorFiducializationProcess. Hits total energy : "
91 << fOutputHitsEvent->GetTotalEnergy() << endl;
94 return fOutputHitsEvent;
void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
void Initialize() override
Making default settings.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
Process one event.
void EndProcess() override
To be executed at the end of the run (outside event loop)
void InitProcess() override
To be executed at the beginning of the run (outside event loop)
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.
Int_t GetModuleIDFromPosition(const TVector3 &position) const
This method returns the module id where pos is found. The z-coordinate must be found in between the c...
TRestDetectorReadoutPlane * GetReadoutPlane(int p)
Returns a pointer to the readout plane by index.
A base class for any REST event.
It saves a 3-coordinate position and an energy for each punctual deposition.
@ REST_Debug
+show the defined debug messages