67 #include "TRestDetectorHitsSpecularProcess.h"
73 TRestDetectorHitsSpecularProcess::TRestDetectorHitsSpecularProcess() { Initialize(); }
87 TRestDetectorHitsSpecularProcess::TRestDetectorHitsSpecularProcess(
const char* configFilename) {
89 LoadConfigFromFile(configFilename);
92 TRestDetectorHitsSpecularProcess::~TRestDetectorHitsSpecularProcess() {}
95 SetSectionName(this->ClassName());
96 SetLibraryVersion(LIBRARY_VERSION);
98 fInputEvent =
nullptr;
106 for (
unsigned int hit = 0; hit < fInputEvent->GetNumberOfHits(); hit++) {
107 TVector3 position(fInputEvent->GetX(hit), fInputEvent->GetY(hit), fInputEvent->GetZ(hit));
108 const auto type = fInputEvent->GetType(hit);
109 const auto energy = fInputEvent->GetEnergy(hit);
110 const auto time = fInputEvent->GetTime(hit);
113 fOutputEvent->AddHit(position, energy, time, type);
117 const TVector3 relativePosition = position - fPosition;
118 const TVector3 reflectionVector = relativePosition - 2 * relativePosition.Dot(fNormal) * fNormal;
120 position = fPosition + reflectionVector;
122 fOutputEvent->AddHit(position, energy, time, type);
130 fNormal = Get3DVectorParameterWithUnits(
"normal", {0, 0, 1});
131 fNormal = fNormal.Unit();
132 fPosition = Get3DVectorParameterWithUnits(
"position", {0, 0, 1});
138 RESTMetadata <<
" - Plane normal : ( " << fNormal.X() <<
", " << fNormal.Y() <<
", " << fNormal.Z()
139 <<
") mm" << RESTendl;
140 RESTMetadata <<
" - Plane position : ( " << fPosition.X() <<
", " << fPosition.Y() <<
", "
141 << fPosition.Z() <<
")" << RESTendl;
A process to create specular hit images using a plane definition.
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 PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
void Initialize() override
Making default settings.
virtual void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
A base class for any REST event.
void SetEventInfo(TRestEvent *eve)