11 #include "TRestTrackToDetectorHitsProcess.h"
17 TRestTrackToDetectorHitsProcess::TRestTrackToDetectorHitsProcess() { Initialize(); }
19 TRestTrackToDetectorHitsProcess::TRestTrackToDetectorHitsProcess(
const char* configFilename) {
22 if (LoadConfigFromFile(configFilename) == -1) LoadDefaultConfig();
25 TRestTrackToDetectorHitsProcess::~TRestTrackToDetectorHitsProcess() {
delete fOutputHitsEvent; }
27 void TRestTrackToDetectorHitsProcess::LoadDefaultConfig() {
28 SetName(
"trackToDetectorHitsProcess");
29 SetTitle(
"Default config");
35 SetSectionName(this->ClassName());
36 SetLibraryVersion(LIBRARY_VERSION);
38 fInputTrackEvent =
nullptr;
42 void TRestTrackToDetectorHitsProcess::LoadConfig(
const string& configFilename,
const string& name) {
43 if (LoadConfigFromFile(configFilename, name) == -1) LoadDefaultConfig();
52 fInputTrackEvent->PrintOnlyTracks();
54 for (
int n = 0; n < fInputTrackEvent->GetNumberOfTracks(); n++)
55 if (fInputTrackEvent->GetLevel(n) == fTrackLevel) {
56 TRestHits* hits = fInputTrackEvent->GetTrack(n)->GetHits();
58 for (
unsigned int h = 0; h < hits->GetNumberOfHits(); h++)
59 fOutputHitsEvent->
AddHit(hits->GetX(h), hits->GetY(h), hits->GetZ(h), hits->GetEnergy(h),
60 hits->GetTime(h), hits->GetType(h));
63 return fOutputHitsEvent;
A base class for any REST event.
It saves a 3-coordinate position and an energy for each punctual deposition.
void AddHit(const TVector3 &position, Double_t energy, Double_t time=0, REST_HitType type=XYZ)
Adds a new hit to the list of hits using a TVector3.
@ REST_Debug
+show the defined debug messages
void InitProcess() override
To be executed at the beginning of the run (outside event loop)
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
Process one event.
void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
void Initialize() override
Making default settings.
void EndProcess() override
To be executed at the end of the run (outside event loop)
Int_t StringToInteger(std::string in)
Gets an integer from a string.