2 #ifndef TRestSoft_TRestDetectorHitsEvent
3 #define TRestSoft_TRestDetectorHitsEvent
10 #include <TRestEvent.h>
11 #include <TRestHits.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);
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); }
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 {
117 inline Double_t GetSkewZ()
const {
return fHits->
GetSkewZ(); }
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.
A base class for any REST event.
It saves a 3-coordinate position and an energy for each punctual deposition.
Double_t GetEnergyX() const
It calculates the total energy of hits with a valid X coordinate.
Double_t GetMaximumHitEnergy() const
It returns the maximum hit energy.
Double_t GetMeanPositionZ() const
It calculates the mean Z position weighting with the energy of the hits with a valid Z coordinate.
Double_t GetMeanPositionX() const
It calculates the mean X position weighting with the energy of the hits with a valid X coordinate.
Double_t GetSkewXY() const
It returns the 2-dimensional skewness on the XY-plane which is a measure of the hits distribution asy...
TVector3 GetMeanPosition() const
It calculates the mean position weighting with the energy of the hits. Each coordinate is calculated ...
Double_t GetMeanPositionY() const
It calculates the mean Y position weighting with the energy of the hits with a valid Y coordinate.
Double_t GetMeanHitEnergy() const
It returns the mean hits energy.
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 GetSigmaX() const
It calculates the hits standard deviation in the X-coordinate.
Double_t GetEnergyY() const
It calculates the total energy of hits with a valid Y coordinate.
Double_t GetGaussSigmaZ(Double_t error=150.0, Int_t nHitsMin=100000)
It computes the gaussian sigma in the Z-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,...
Int_t GetClosestHit(const TVector3 &position) const
It returns the closest hit to a given position.
Double_t GetSigmaZ2() const
It returns the hits distribution variance on the Z-axis.
Double_t GetSkewZ() const
It returns the hits distribution skewness, or asymmetry on the Z-axis.
Double_t GetSigmaY() const
It calculates the hits standard deviation in the Y-coordinate.
Double_t GetDistance2(int n, int m) const
It returns the euclidian distance between hits n and m.
TVector3 GetPosition(int n) const
It returns the position of hit number n.
Double_t GetSigmaXY2() const
It calculates the 2-dimensional hits variance.
Double_t GetMinimumHitEnergy() const
It returns the minimum hit energy.
Int_t GetNumberOfHitsY() const
It returns the number of hits with a valid Y coordinate.
Int_t GetNumberOfHitsX() const
It returns the number of hits with a valid X coordinate.