90#include "TRestDetectorHitmapAnalysisProcess.h"
139 TVector3 hitMean =
fHitsEvent->GetMeanPosition();
141 TVector3 transformedMean = hitMean;
147 if (tr.
type ==
"specular") transformedMean =
Specular(transformedMean, tr);
148 if (tr.
type ==
"rotation") transformedMean =
Rotation(transformedMean, tr);
149 if (tr.
type ==
"translation") transformedMean =
Translation(transformedMean, tr);
164 if (tr.
type !=
"specular")
return {0, 0, 0};
167 Double_t vByN = V.Dot(tr.
vector);
168 TVector3 reflectionVector = V - 2 * vByN * tr.
vector;
169 return tr.
position + reflectionVector;
177 if (tr.
type !=
"rotation")
return {0, 0, 0};
179 TVector3 position = pos - tr.
position;
191 if (tr.
type !=
"translation")
return {0, 0, 0};
193 TVector3 position = pos + tr.
vector;
202 if (t.name == name)
return t;
216 while (specularDef) {
218 trans.
type =
"specular";
221 if (name ==
"Not defined") {
222 RESTError <<
"The `name` field was not found in specular definition!" <<
RESTendl;
227 TVector3 position = Get3DVectorParameterWithUnits(
"position", specularDef);
228 if (position == TVector3(-1, -1, -1)) {
229 RESTError <<
"The `position` field was not found in specular definition!" <<
RESTendl;
234 TVector3 vect = Get3DVectorParameterWithUnits(
"vector", specularDef);
235 if (vect == TVector3(-1, -1, -1)) {
236 RESTError <<
"The `vector` field was not found in specular definition!" <<
RESTendl;
246 while (rotationDef) {
248 trans.
type =
"rotation";
251 if (name ==
"Not defined") {
252 RESTError <<
"The `name` field was not found in rotation definition!" <<
RESTendl;
257 TVector3 position = Get3DVectorParameterWithUnits(
"position", rotationDef);
258 if (position == TVector3(-1, -1, -1)) {
259 RESTError <<
"The `position` field was not found in rotation definition!" <<
RESTendl;
264 TVector3 vect = Get3DVectorParameterWithUnits(
"vector", rotationDef);
265 if (vect == TVector3(-1, -1, -1)) {
266 RESTError <<
"The `vector` field was not found in rotation definition!" <<
RESTendl;
271 Double_t angle = GetDblParameterWithUnits(
"angle", rotationDef);
272 if (angle == PARAMETER_NOT_FOUND_DBL) {
273 RESTError <<
"The `angle` field was not found in rotation definition!" <<
RESTendl;
282 auto translationDef =
GetElement(
"translation");
283 while (translationDef) {
285 trans.
type =
"translation";
288 if (name ==
"Not defined") {
289 RESTError <<
"The `name` field was not found in translation definition!" <<
RESTendl;
294 TVector3 vect = Get3DVectorParameterWithUnits(
"vector", translationDef);
295 if (vect == TVector3(-1, -1, -1)) {
296 RESTError <<
"The `vector` field was not found in translation definition!" <<
RESTendl;
313 RESTMetadata <<
" List of transformation definitions: " <<
RESTendl;
314 RESTMetadata <<
" ----------------------------------- " <<
RESTendl;
317 RESTMetadata <<
" No transformations found! " <<
RESTendl;
320 if (t.type ==
"specular") {
321 RESTMetadata <<
" - Specular transformation: " <<
RESTendl;
322 RESTMetadata <<
" + Plane position : (" << t.position.X() <<
", " << t.position.Y() <<
", "
323 << t.position.Z() <<
") mm" <<
RESTendl;
324 RESTMetadata <<
" + Plane normal : (" << t.vector.X() <<
", " << t.vector.Y() <<
", "
329 if (t.type ==
"rotation") {
330 RESTMetadata <<
" - Rotation transformation: " <<
RESTendl;
331 RESTMetadata <<
" + Rotation center : (" << t.position.X() <<
", " << t.position.Y() <<
", "
332 << t.position.Z() <<
") mm" <<
RESTendl;
333 RESTMetadata <<
" + Rotation axis : (" << t.vector.X() <<
", " << t.vector.Y() <<
", "
335 RESTMetadata <<
" + Rotation angle : " << t.angle *
units(
"degrees") <<
" degrees" <<
RESTendl;
339 if (t.type ==
"translation") {
340 RESTMetadata <<
" - Translation transformation: " <<
RESTendl;
341 RESTMetadata <<
" + Translation vector : (" << t.vector.X() <<
", " << t.vector.Y() <<
", "
342 << t.vector.Z() <<
") mm" <<
RESTendl;
347 RESTMetadata <<
" Order of transformations: " <<
RESTendl;
348 RESTMetadata <<
" ------------------------- " <<
RESTendl;
354 RESTMetadata << n <<
". " << t <<
RESTendl;
An analysis process to apply rotation/translation/specular to mean hit positions.
std::vector< HitTransformation > fTransDefinitions
A list of transformations that can be applied to the mean positions.
TVector3 Specular(const TVector3 &pos, const HitTransformation &tr)
It performs a specular transformation of the given pos in the argument and the transformation propert...
TRestDetectorHitmapAnalysisProcess()
Default constructor.
HitTransformation GetTransformation(const std::string &name)
It returns the transformation with a given name.
void Initialize() override
Function to initialize input/output event members and define the section name.
~TRestDetectorHitmapAnalysisProcess()
Default destructor.
TRestDetectorHitsEvent * fHitsEvent
A pointer to the specific TRestDetectorHitsEvent input.
TVector3 Translation(const TVector3 &pos, const HitTransformation &tr)
It performs a translation of the given pos in the argument and the transformation properties stored i...
std::vector< std::string > fTransformations
An ordered list with the names of transformations that will be applied.
TVector3 Rotation(const TVector3 &pos, const HitTransformation &tr)
It performs a rotation of the given pos in the argument and the transformation properties stored in t...
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
void PrintMetadata() override
Prints out the metadata member values.
void InitFromConfigFile() override
A custom initalization from a config file.
virtual void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
void BeginPrintProcess()
[name, cut range]
void SetObservableValue(const std::string &name, const T &value)
Set observable value for AnalysisTree.
A base class for any REST event.