123#include "TRestDetectorHitsAnalysisProcess.h"
129TRestDetectorHitsAnalysisProcess::TRestDetectorHitsAnalysisProcess() {
Initialize(); }
131TRestDetectorHitsAnalysisProcess::TRestDetectorHitsAnalysisProcess(
const char* configFilename) {
138TRestDetectorHitsAnalysisProcess::~TRestDetectorHitsAnalysisProcess() {
delete fOutputHitsEvent; }
140void TRestDetectorHitsAnalysisProcess::LoadDefaultConfig() { SetTitle(
"Default config"); }
146 fInputHitsEvent =
nullptr;
149 fPrismFiducial =
false;
150 fCylinderFiducial =
false;
153void TRestDetectorHitsAnalysisProcess::LoadConfig(
const string& configFilename,
const string& name) {
164 TRestHits* hits = fInputHitsEvent->GetHits();
165 for (
unsigned int n = 0; n < hits->GetNumberOfHits(); n++) {
166 Double_t eDep = hits->GetEnergy(n);
168 Double_t x = hits->GetX(n);
169 Double_t y = hits->GetY(n);
170 Double_t z = hits->GetZ(n);
172 auto time = hits->GetTime(n);
173 auto type = hits->GetType(n);
179 fOutputHitsEvent->
AddHit({x, y, z}, eDep, time, type);
182 Double_t energy = fOutputHitsEvent->GetTotalEnergy();
183 TVector3 meanPosition = fOutputHitsEvent->GetMeanPosition();
184 Double_t sigmaX = fOutputHitsEvent->GetSigmaX();
185 Double_t sigmaY = fOutputHitsEvent->GetSigmaY();
186 Double_t sigmaXY2 = fOutputHitsEvent->GetSigmaXY2();
187 Double_t sigmaZ2 = fOutputHitsEvent->GetSigmaZ2();
188 Double_t skewXY = fOutputHitsEvent->GetSkewXY();
189 Double_t skewZ = fOutputHitsEvent->GetSkewZ();
190 Double_t energyX = fOutputHitsEvent->GetEnergyX();
191 Double_t energyY = fOutputHitsEvent->GetEnergyY();
192 Double_t maxEnergy = fOutputHitsEvent->GetMaximumHitEnergy();
193 Double_t minEnergy = fOutputHitsEvent->GetMinimumHitEnergy();
194 Double_t meanEnergy = fOutputHitsEvent->GetMeanHitEnergy();
195 Int_t nHits = fOutputHitsEvent->GetNumberOfHits();
196 Int_t nHitsX = fOutputHitsEvent->GetNumberOfHitsX();
197 Int_t nHitsY = fOutputHitsEvent->GetNumberOfHitsY();
207 if ((nHits == nHitsX) || (nHits == nHitsY))
213 if (fCylinderFiducial) {
214 TVector3 meanPositionInCylinder =
217 Int_t isInsideCylinder = 0;
239 if (fPrismFiducial) {
240 TVector3 meanPositionInPrism =
243 Int_t isInsidePrism = 0;
244 if (fOutputHitsEvent->
anyHitInsidePrism(fFid_x0, fFid_x1, fFid_sX, fFid_sY, fFid_theta))
250 Double_t enPrismVol =
251 fOutputHitsEvent->
GetEnergyInPrism(fFid_x0, fFid_x1, fFid_sX, fFid_sY, fFid_theta);
270 if (fCylinderFiducial) {
272 Double_t dToCylWall =
276 Double_t dToCylBottom =
284 if (fPrismFiducial) {
287 fFid_x0, fFid_x1, fFid_sX, fFid_sY, fFid_theta);
289 fFid_x0, fFid_x1, fFid_sX, fFid_sY, fFid_theta);
291 fFid_x0, fFid_x1, fFid_sX, fFid_sY, fFid_theta);
332 if (fOutputHitsEvent->GetNumberOfHits() == 0) {
336 for (
unsigned int n = 0; n < hits->GetNumberOfHits(); n++) {
337 Double_t eDep = hits->GetEnergy(n);
339 Double_t x = hits->GetX(n);
340 Double_t y = hits->GetY(n);
341 Double_t z = hits->GetZ(n);
343 auto time = hits->GetTime(n);
344 auto type = hits->GetType(n);
350 fOutputHitsEvent->
AddHit({x, y, z}, eDep, time, type);
353 return fOutputHitsEvent;
366 fFid_x0 = Get3DVectorParameterWithUnits(
"fiducial_x0", TVector3(0, 0, 0));
367 fFid_x1 = Get3DVectorParameterWithUnits(
"fiducial_x1", TVector3(0, 0, 0));
369 fFid_R = GetDblParameterWithUnits(
"fiducial_R", 1);
370 fFid_sX = GetDblParameterWithUnits(
"fiducial_sX", 1);
371 fFid_sY = GetDblParameterWithUnits(
"fiducial_sY", 1);
373 fFid_theta = GetDblParameterWithUnits(
"fiducial_theta", 0.0);
375 if (
GetParameter(
"cylinderFiducialization",
"false") ==
"true") {
376 fCylinderFiducial =
true;
379 if (
GetParameter(
"prismFiducialization",
"false") ==
"true") {
380 fPrismFiducial =
true;
An analysis REST process to extract valuable information from Hits type of data.
void Initialize() override
Making default settings.
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 InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
Process one event.
virtual void PrintEvent() const
TVector3 GetMeanPositionInCylinder(TVector3 x0, TVector3 x1, Double_t radius)
This method returns the mean position of the hits found inside the cylinder volume given by argument.
Double_t GetClosestHitInsideDistanceToCylinderTop(TVector3 x0, TVector3 x1, Double_t radius)
This method returns the distance to the cylinder top face from the closest hit contained inside the c...
Double_t GetClosestHitInsideDistanceToPrismBottom(const TVector3 &x0, const TVector3 &x1, Double_t sizeX, Double_t sizeY, Double_t theta)
This method returns the distance to the prism bottom face from the closest hit contained inside the p...
Int_t GetNumberOfHitsInsideCylinder(TVector3 x0, TVector3 x1, Double_t radius)
This method returns the total number hits found inside the cylinder volume given by argument.
Bool_t anyHitInsideCylinder(TVector3 x0, TVector3 x1, Double_t radius)
This method returns true if at least 1 hit is found inside the cylinder volume given by argument.
Double_t GetEnergyInPrism(TVector3 x0, TVector3 x1, Double_t sizeX, Double_t sizeY, Double_t theta)
This method returns the total integrated energy of all hits found inside the prism volume given by ar...
Double_t GetClosestHitInsideDistanceToCylinderWall(TVector3 x0, TVector3 x1, Double_t radius)
This method returns the distance to the cylinder wall from the closest hit contained inside the cylin...
Int_t GetNumberOfHitsInsidePrism(TVector3 x0, TVector3 x1, Double_t sizeX, Double_t sizeY, Double_t theta)
This method returns the total number of hits found inside the prism volume given by argument.
Double_t GetClosestHitInsideDistanceToCylinderBottom(TVector3 x0, TVector3 x1, Double_t radius)
This method returns the distance to the cylinder bottom face from the closest hit contained inside th...
TVector3 GetMeanPositionInPrism(TVector3 x0, TVector3 x1, Double_t sizeX, Double_t sizeY, Double_t theta)
This method returns the mean position of all hits found inside the prism volume given by argument.
Double_t GetEnergyInCylinder(TVector3 x0, TVector3 x1, Double_t radius)
This method returns the total integrated energy of all hits found inside the cylinder volume given by...
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.
Double_t GetClosestHitInsideDistanceToPrismTop(TVector3 x0, TVector3 x1, Double_t sizeX, Double_t sizeY, Double_t theta)
This method returns the distance to the prism top face from the closest hit contained inside the pris...
Bool_t anyHitInsidePrism(TVector3 x0, TVector3 x1, Double_t sizeX, Double_t sizeY, Double_t theta)
This method returns true if at least 1 hit is found inside the prism volume given by argument.
Double_t GetClosestHitInsideDistanceToPrismWall(TVector3 x0, TVector3 x1, Double_t sizeX, Double_t sizeY, Double_t theta)
This method returns the distance to the prism wall from the closest hit contained inside the prism vo...
void SetObservableValue(const std::string &name, const T &value)
Set observable value for AnalysisTree.
A base class for any REST event.
It saves a 3-coordinate position and an energy for each punctual deposition.
@ REST_Extreme
show everything
Int_t GetChar(std::string hint="Press a KEY to continue ...")
Helps to pause the program, printing a message before pausing.