2#ifndef TRestSoft_TRestDetectorHitsEvent
3#define TRestSoft_TRestDetectorHitsEvent
10#include <TRestEvent.h>
57 void AddHit(Double_t x, Double_t y, Double_t z, Double_t en, Double_t t = 0, REST_HitType type = XYZ);
58 void AddHit(
const TVector3& position, Double_t energy, Double_t time, REST_HitType type = XYZ);
60 void Sort(
bool(compareCondition)(
const TRestHits::iterator& hit1,
61 const TRestHits::iterator& hit2) =
nullptr);
62 void Shuffle(
int NLoop);
64 inline size_t GetNumberOfHits()
const {
return fHits->GetNumberOfHits(); }
69 inline Double_t
GetX(
int n)
const {
return fHits->GetX(n); }
72 inline Double_t
GetY(
int n)
const {
return fHits->GetY(n); }
75 inline Double_t
GetZ(
int n)
const {
return fHits->GetZ(n); }
77 inline REST_HitType GetType(
int n)
const {
return fHits->GetType(n); }
93 inline TVector3 GetMeanPosition()
const {
return fHits->GetMeanPosition(); }
95 inline Int_t GetNumberOfHitsX()
const {
return fHits->GetNumberOfHitsX(); }
96 inline Int_t GetNumberOfHitsY()
const {
return fHits->GetNumberOfHitsY(); }
98 inline Double_t GetMeanPositionX()
const {
return fHits->GetMeanPositionX(); }
99 inline Double_t GetMeanPositionY()
const {
return fHits->GetMeanPositionY(); }
100 inline Double_t GetMeanPositionZ()
const {
return fHits->GetMeanPositionZ(); }
101 inline Double_t GetSigmaXY2()
const {
return fHits->GetSigmaXY2(); }
102 inline Double_t GetSigmaX()
const {
return fHits->GetSigmaX(); }
103 inline Double_t GetSigmaY()
const {
return fHits->GetSigmaY(); }
105 inline Double_t GetGaussSigmaX(Double_t error, Int_t nHitsMin) {
108 inline Double_t GetGaussSigmaY(Double_t error, Int_t nHitsMin) {
111 inline Double_t GetGaussSigmaZ(Double_t error, Int_t nHitsMin)
const {
112 return fHits->GetGaussSigmaZ(error, nHitsMin);
115 inline Double_t GetSigmaZ2()
const {
return fHits->GetSigmaZ2(); }
116 inline Double_t GetSkewXY()
const {
return fHits->GetSkewXY(); }
117 inline Double_t GetSkewZ()
const {
return fHits->GetSkewZ(); }
119 inline Double_t GetMaximumHitEnergy()
const {
return fHits->GetMaximumHitEnergy(); }
120 inline Double_t GetMinimumHitEnergy()
const {
return fHits->GetMinimumHitEnergy(); }
121 inline Double_t GetMeanHitEnergy()
const {
return fHits->GetMeanHitEnergy(); }
123 inline Double_t GetEnergyX()
const {
return fHits->GetEnergyX(); }
124 inline Double_t GetEnergyY()
const {
return fHits->GetEnergyY(); }
125 inline Double_t GetTotalEnergy()
const {
return fHits->GetTotalEnergy(); }
126 inline Double_t GetEnergy()
const {
return fHits->GetTotalEnergy(); }
128 inline Double_t GetEnergy(
int n)
const {
return fHits->GetEnergy(n); }
129 inline Double_t GetTime(
int n)
const {
return GetHits()->GetTime(n); }
131 inline Int_t GetClosestHit(
const TVector3& position)
const {
return fHits->GetClosestHit(position); }
141 Bool_t
anyHitInsidePrism(TVector3 x0, TVector3 x1, Double_t sizeX, Double_t sizeY, Double_t theta);
142 Bool_t
allHitsInsidePrism(TVector3 x0, TVector3 x1, Double_t sX, Double_t sY, Double_t theta);
144 Double_t
GetEnergyInPrism(TVector3 x0, TVector3 x1, Double_t sizeX, Double_t sizeY, Double_t theta);
147 TVector3
GetMeanPositionInPrism(TVector3 x0, TVector3 x1, Double_t sizeX, Double_t sizeY, Double_t theta);
160 Double_t sizeY, Double_t theta);
162 TPad*
DrawEvent(
const TString& option =
"");
164 TH2F*
GetXYHistogram(std::vector<float> ranges, Double_t pitch = 3, Double_t border = 5);
165 TH2F*
GetXZHistogram(std::vector<float> ranges, Double_t pitch = 3, Double_t border = 5);
166 TH2F*
GetYZHistogram(std::vector<float> ranges, Double_t pitch = 3, Double_t border = 5);
168 void DrawHistograms(Int_t& column,
const TString& histOption =
"",
double pitch = 0);
TH2F * GetXZHistogram(std::vector< float > ranges, Double_t pitch=3, Double_t border=5)
This method draws the hits found on XY as a TH2F and it returns the generated histogram.
TRestHits * GetXYZHits()
This method collects all hits which are compatible with a XYZ hit.
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.
TRestHits * GetXZHits()
This method collects all hits which are compatible with a XZ-projected hit.
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...
void DrawGraphs(Int_t &column)
This method draw the hits events as a graph.
TH1F * fZHisto
An auxiliary TH1F histogram to visualize hits on Z-projection.
TPad * DrawEvent(const TString &option="")
This method draws the hits event structure into a TPad.
Double_t GetX(int n) const
Returns the X-coordinate of hit entry n in mm.
TH2F * fXYHisto
An auxiliary TH2F histogram to visualize hits on XY-projection.
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.
TH2F * GetXYHistogram(std::vector< float > ranges, Double_t pitch=3, Double_t border=5)
This method draws the hits found on XY as a TH2F and it returns the generated histogram.
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.
TH2F * fYZHisto
An auxiliary TH2F histogram to visualize hits on YZ-projection.
Bool_t allHitsInsidePrism(TVector3 x0, TVector3 x1, Double_t sX, Double_t sY, Double_t theta)
This method returns true if all hits are found inside the prism volume given by argument.
void DrawHistograms(Int_t &column, const TString &histOption="", double pitch=0)
This method draw the hits events as an histogram.
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...
TGraph * fYZHitGraph
An auxiliary TGraph pointer to visualize hits on YZ-projection.
Double_t GetY(int n) const
Returns the Y-coordinate of hit entry n in mm.
Double_t GetZ(int n) const
Returns the Z-coordinate of hit entry n in mm.
TRestHits * fHits
The hits structure that is is saved to disk.
TRestHits * fXZHits
An auxiliary TRestHits structure to register hits on XZ projection.
TH2F * fXZHisto
An auxiliary TH2F histogram to visualize hits on XZ-projection.
TRestDetectorHitsEvent()
TRestDetectorHitsEvent default constructor.
Double_t GetDistance2(int n, int m) const
Returns the squared distance between hits n and m.
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...
TH1F * fYHisto
An auxiliary TH1F histogram to visualize hits on Y-projection.
TRestHits * fXYZHits
An auxiliary TRestHits structure to register hits on XYZ projection.
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.
Bool_t allHitsInsideCylinder(TVector3 x0, TVector3 x1, Double_t radius)
This method returns true if all hits are contained inside the cylinder 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.
TRestHits * GetYZHits()
This method collects all hits which are compatible with a YZ-projected hit.
TGraph * fXZHitGraph
An auxiliary TGraph pointer to visualize hits on XZ-projection.
TH2F * GetYZHistogram(std::vector< float > ranges, Double_t pitch=3, Double_t border=5)
This method draws the hits found on YZ as a TH2F and it returns the generated histogram.
TH1F * fXHisto
An auxiliary TH1F histogram to visualize hits on X-projection.
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.
virtual void Initialize()
Removes all hits from this event, and clears all auxiliar variables.
TGraph * fXYHitGraph
An auxiliary TGraph pointer to visualize hits on XY-projection.
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...
~TRestDetectorHitsEvent()
TRestDetectorHitsEvent default destructor.
TRestHits * fYZHits
An auxiliary TRestHits structure to register hits on YZ projection.
It saves a 3-coordinate position and an energy for each punctual deposition.
Double_t GetGaussSigmaX(Double_t error=150.0, Int_t nHitsMin=100000)
It computes the gaussian sigma in the X-coordinate. It adds a hit to the right and a hit to the left,...
Double_t GetGaussSigmaY(Double_t error=150.0, Int_t nHitsMin=100000)
It computes the gaussian sigma in the Y-coordinate. It adds a hit to the right and a hit to the left,...
TVector3 GetPosition(int n) const
It returns the position of hit number n.