16 #include "TRestDetectorFiducializationProcess.h"
22 TRestDetectorFiducializationProcess::TRestDetectorFiducializationProcess() { Initialize(); }
24 TRestDetectorFiducializationProcess::TRestDetectorFiducializationProcess(
const char* configFilename) {
26 if (LoadConfigFromFile(configFilename)) {
31 TRestDetectorFiducializationProcess::~TRestDetectorFiducializationProcess() {
delete fOutputHitsEvent; }
33 void TRestDetectorFiducializationProcess::LoadDefaultConfig() { SetTitle(
"Default config"); }
36 SetSectionName(this->ClassName());
37 SetLibraryVersion(LIBRARY_VERSION);
40 fInputHitsEvent =
nullptr;
45 void TRestDetectorFiducializationProcess::LoadConfig(
const string& configFilename,
const string& name) {
46 if (LoadConfigFromFile(configFilename, name)) LoadDefaultConfig();
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)
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...
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