40#include "TRestDetectorHitsEvent.h"
44#include "TRestStringHelper.h"
45#include "TRestTools.h"
140 if (compareCondition == 0) {
144 return hit1.z() < hit2.z();
147 std::sort(
fHits->begin(),
fHits->end(), compareCondition);
151void TRestDetectorHitsEvent::Shuffle(
int NLoop) {
152 Int_t nHits =
fHits->GetNumberOfHits();
154 for (
int n = 0; n < NLoop; n++) {
155 Int_t hit1 = (Int_t)(nHits * gRandom->Uniform(0, 1));
156 Int_t hit2 = (Int_t)(nHits * gRandom->Uniform(0, 1));
173 for (
unsigned int i = 0; i < this->GetNumberOfHits(); i++) {
174 if (GetType(i) == XZ) {
176 this->GetTime(i), XZ);
193 for (
unsigned int i = 0; i < this->GetNumberOfHits(); i++) {
194 if (GetType(i) == YZ) {
196 this->GetTime(i), YZ);
213 for (
unsigned int i = 0; i < this->GetNumberOfHits(); i++) {
214 if (GetType(i) == XYZ) {
217 this->GetTime(i), XYZ);
348 Double_t sizeY, Double_t theta) {
363 Double_t sizeY, Double_t theta) {
379 Double_t rad2 = radius * radius;
380 Double_t hitDistance = rad2;
384 TVector3 axis = x1 - x0;
385 Double_t cylLength = axis.Mag();
388 for (
unsigned int n = 0; n < GetNumberOfHits(); n++) {
390 l = axis.Dot(this->GetPosition(n) - x0) / cylLength;
392 d2 = rad2 - (this->GetPosition(n) - x0).Mag2() + l * l;
394 if (d2 < hitDistance) hitDistance = d2;
400 if (nhits == 0)
return -1;
402 return TMath::Sqrt(hitDistance);
417 TVector3 axis = x1 - x0;
418 Double_t cylLength = axis.Mag();
420 Double_t hitDistance = cylLength;
421 Double_t d = cylLength;
424 for (
unsigned int n = 0; n < GetNumberOfHits(); n++) {
426 d = cylLength - axis.Dot(this->GetPosition(n) - x0) / cylLength;
428 if (d < hitDistance) hitDistance = d;
434 if (nhits == 0)
return -1;
451 TVector3 axis = x1 - x0;
452 Double_t cylLength = axis.Mag();
454 Double_t hitDistance = cylLength;
455 Double_t d = cylLength;
458 for (
unsigned int n = 0; n < GetNumberOfHits(); n++) {
460 d = axis.Dot(this->GetPosition(n) - x0) / cylLength;
462 if (d < hitDistance) hitDistance = d;
468 if (nhits == 0)
return -1;
486 Double_t sizeX, Double_t sizeY,
488 Double_t dX = sizeX / 2;
489 Double_t dY = sizeY / 2;
491 Double_t hitDistance = max(dX, dY);
495 for (
unsigned int n = 0; n < GetNumberOfHits(); n++) {
497 dX = sizeX / 2 - TMath::Abs((this->GetPosition(n) - x0).X());
498 dY = sizeY / 2 - TMath::Abs((this->GetPosition(n) - x0).Y());
502 if (d < hitDistance) hitDistance = d;
508 if (nhits == 0)
return -1;
526 Double_t sizeX, Double_t sizeY,
528 TVector3 axis = x1 - x0;
529 Double_t prismLength = axis.Mag();
531 Double_t hitDistance = prismLength;
535 for (
unsigned int n = 0; n < GetNumberOfHits(); n++) {
537 d = prismLength - axis.Dot(this->GetPosition(n) - x0) / prismLength;
539 if (d < hitDistance) hitDistance = d;
545 if (nhits == 0)
return -1;
563 const TVector3& x1, Double_t sizeX,
564 Double_t sizeY, Double_t theta) {
565 TVector3 axis = x1 - x0;
566 Double_t prismLength = axis.Mag();
568 Double_t hitDistance = prismLength;
572 for (
unsigned int n = 0; n < GetNumberOfHits(); n++) {
574 d = axis.Dot(this->GetPosition(n) - x0) / prismLength;
576 if (d < hitDistance) hitDistance = d;
582 if (nhits == 0)
return -1;
614 for (
unsigned int n = 0; n < optList.size(); n++) {
615 if (optList[n] ==
"print") this->
PrintEvent();
618 optList.erase(std::remove(optList.begin(), optList.end(),
"print"), optList.end());
622 if (optList.size() == 0) optList.push_back(
"hist(Cont1,col)[3]");
624 if (fPad !=
nullptr) {
629 fPad =
new TPad(this->GetName(),
" ", 0, 0, 1, 1);
630 fPad->Divide(3, 2 * optList.size());
634 for (
unsigned int n = 0; n < optList.size(); n++) {
635 string optionStr = (string)optList[n];
636 TString drawEventOption = optList[n];
639 size_t startPos = optionStr.find(
"(");
640 if (startPos != string::npos) drawEventOption = optList[n](0, startPos);
643 string histOption =
"";
644 size_t endPos = optionStr.find(
")");
645 if (endPos != string::npos) {
646 TString histOptionTmp = optList[n](startPos + 1, endPos - startPos - 1);
648 histOption = (string)histOptionTmp;
650 while ((pos = histOption.find(
",", pos)) != string::npos) {
651 histOption.replace(pos, 1,
":");
657 string pitchOption =
"";
659 startPos = optionStr.find(
"[");
660 endPos = optionStr.find(
"]");
662 if (endPos != string::npos) {
663 TString pitchOption = optList[n](startPos + 1, endPos - startPos - 1);
664 pitch = stod((
string)pitchOption);
667 if (drawEventOption ==
"graph") this->
DrawGraphs(column);
669 if (drawEventOption ==
"hist") this->
DrawHistograms(column, histOption, pitch);
696 vector<vector<Double_t>> xz(2, vector<Double_t>(this->GetNumberOfHits()));
697 vector<vector<Double_t>> yz(2, vector<Double_t>(this->GetNumberOfHits()));
698 vector<vector<Double_t>> xy(2, vector<Double_t>(this->GetNumberOfHits()));
705 for (
unsigned int nhit = 0; nhit < this->GetNumberOfHits(); nhit++) {
706 Double_t x =
fHits->GetX(nhit);
707 Double_t y =
fHits->GetY(nhit);
708 Double_t z =
fHits->GetZ(nhit);
709 int type =
fHits->GetType(nhit);
711 if (type % XZ == 0) {
717 if (type % YZ == 0) {
723 if (type % XY == 0) {
730 fXZHitGraph =
new TGraph(nXZ, &xz[0][0], &xz[1][0]);
735 fYZHitGraph =
new TGraph(nYZ, &yz[0][0], &yz[1][0]);
740 fXYHitGraph =
new TGraph(nXY, &xy[0][0], &xy[1][0]);
747 sprintf(title,
"Event ID %d", this->GetID());
750 fPad->cd(1 + 3 * column);
759 fPad->cd(2 + 3 * column);
768 fPad->cd(3 + 3 * column);
794 std::vector<double> fX, fY, fZ;
795 for (
unsigned int i = 0; i < GetNumberOfHits(); i++) {
796 if (GetType(i) % X == 0) fX.emplace_back(
GetX(i));
797 if (GetType(i) % Y == 0) fY.emplace_back(
GetY(i));
798 if (GetType(i) % Z == 0) fZ.emplace_back(
GetZ(i));
801 double maxX, minX, maxY, minY, maxZ, minZ;
802 int nBinsX, nBinsY, nBinsZ;
808 nBinsX = std::round((maxX - minX) / pitch);
809 nBinsY = std::round((maxY - minY) / pitch);
810 nBinsZ = std::round((maxZ - minZ) / pitch);
821 fXYHisto =
new TH2F(
"XY",
"", nBinsX, minX, maxX, nBinsY, minY, maxY);
822 fXZHisto =
new TH2F(
"XZ",
"", nBinsX, minX, maxX, nBinsZ, minZ, maxZ);
823 fYZHisto =
new TH2F(
"YZ",
"", nBinsY, minY, maxY, nBinsZ, minZ, maxZ);
825 fXHisto =
new TH1F(
"X",
"", nBinsX, minX, maxX);
826 fYHisto =
new TH1F(
"Y",
"", nBinsY, minY, maxY);
827 fZHisto =
new TH1F(
"Z",
"", nBinsZ, minZ, maxZ);
837 Int_t nYZ = 0, nXZ = 0, nXY = 0;
838 Int_t nX = 0, nY = 0, nZ = 0;
840 for (
unsigned int nhit = 0; nhit < this->GetNumberOfHits(); nhit++) {
841 Double_t x =
fHits->GetX(nhit);
842 Double_t y =
fHits->GetY(nhit);
843 Double_t z =
fHits->GetZ(nhit);
844 Double_t en =
fHits->GetEnergy(nhit);
845 int type =
fHits->GetType(nhit);
847 if (type % XZ == 0) {
852 if (type % YZ == 0) {
857 if (type % XY == 0) {
882 fPad->cd(1 + 3 * column);
884 fXZHisto->GetXaxis()->SetTitle(
"X-axis (mm)");
885 fXZHisto->GetYaxis()->SetTitle(
"Z-axis (mm)");
886 fXZHisto->GetYaxis()->SetTitleSize(1.4 *
fXZHisto->GetYaxis()->GetTitleSize());
887 fXZHisto->GetXaxis()->SetTitleSize(1.4 *
fXZHisto->GetXaxis()->GetTitleSize());
888 fXZHisto->GetYaxis()->SetLabelSize(1.25 *
fXZHisto->GetYaxis()->GetLabelSize());
889 fXZHisto->GetXaxis()->SetLabelSize(1.25 *
fXZHisto->GetXaxis()->GetLabelSize());
890 fXZHisto->GetYaxis()->SetTitleOffset(1);
894 fPad->cd(2 + 3 * column);
896 fYZHisto->GetXaxis()->SetTitle(
"Y-axis (mm)");
897 fYZHisto->GetYaxis()->SetTitle(
"Z-axis (mm)");
898 fYZHisto->GetYaxis()->SetTitleSize(1.4 *
fYZHisto->GetYaxis()->GetTitleSize());
899 fYZHisto->GetXaxis()->SetTitleSize(1.4 *
fYZHisto->GetXaxis()->GetTitleSize());
900 fYZHisto->GetYaxis()->SetLabelSize(1.25 *
fYZHisto->GetYaxis()->GetLabelSize());
901 fYZHisto->GetXaxis()->SetLabelSize(1.25 *
fYZHisto->GetXaxis()->GetLabelSize());
902 fYZHisto->GetYaxis()->SetTitleOffset(1);
906 fPad->cd(3 + 3 * column);
908 fXYHisto->GetXaxis()->SetTitle(
"X-axis (mm)");
909 fXYHisto->GetYaxis()->SetTitle(
"Y-axis (mm)");
910 fXYHisto->GetYaxis()->SetTitleSize(1.4 *
fXYHisto->GetYaxis()->GetTitleSize());
911 fXYHisto->GetXaxis()->SetTitleSize(1.4 *
fXYHisto->GetXaxis()->GetTitleSize());
912 fXYHisto->GetYaxis()->SetLabelSize(1.25 *
fXYHisto->GetYaxis()->GetLabelSize());
913 fXYHisto->GetXaxis()->SetLabelSize(1.25 *
fXYHisto->GetXaxis()->GetLabelSize());
914 fXYHisto->GetYaxis()->SetTitleOffset(1);
920 fPad->cd(1 + 3 * column);
922 fXHisto->GetXaxis()->SetTitle(
"X-axis (mm)");
923 fXHisto->GetYaxis()->SetTitle(
"Number of events");
924 fXHisto->GetYaxis()->SetTitleSize(1.4 *
fXHisto->GetYaxis()->GetTitleSize());
925 fXHisto->GetXaxis()->SetTitleSize(1.4 *
fXHisto->GetXaxis()->GetTitleSize());
926 fXHisto->GetYaxis()->SetLabelSize(1.25 *
fXHisto->GetYaxis()->GetLabelSize());
927 fXHisto->GetXaxis()->SetLabelSize(1.25 *
fXHisto->GetXaxis()->GetLabelSize());
928 fXHisto->GetYaxis()->SetTitleOffset(1);
932 fPad->cd(2 + 3 * column);
934 fYHisto->GetXaxis()->SetTitle(
"Y-axis (mm)");
935 fYHisto->GetYaxis()->SetTitle(
"Number of events");
936 fYHisto->GetYaxis()->SetTitleSize(1.4 *
fYHisto->GetYaxis()->GetTitleSize());
937 fYHisto->GetXaxis()->SetTitleSize(1.4 *
fYHisto->GetXaxis()->GetTitleSize());
938 fYHisto->GetYaxis()->SetLabelSize(1.25 *
fYHisto->GetYaxis()->GetLabelSize());
939 fYHisto->GetXaxis()->SetLabelSize(1.25 *
fYHisto->GetXaxis()->GetLabelSize());
940 fYHisto->GetYaxis()->SetTitleOffset(1);
944 fPad->cd(3 + 3 * column);
946 fZHisto->GetXaxis()->SetTitle(
"Z-axis (mm)");
947 fZHisto->GetYaxis()->SetTitle(
"Number of events");
948 fZHisto->GetYaxis()->SetTitleSize(1.4 *
fYHisto->GetYaxis()->GetTitleSize());
949 fZHisto->GetXaxis()->SetTitleSize(1.4 *
fYHisto->GetXaxis()->GetTitleSize());
950 fZHisto->GetYaxis()->SetLabelSize(1.25 *
fYHisto->GetYaxis()->GetLabelSize());
951 fZHisto->GetXaxis()->SetLabelSize(1.25 *
fYHisto->GetXaxis()->GetLabelSize());
952 fZHisto->GetYaxis()->SetTitleOffset(1);
961 cout <<
"Total energy : " << GetTotalEnergy() << endl;
962 cout <<
"Mean position : ( " << GetMeanPositionX() <<
" , " << GetMeanPositionY() <<
" , "
963 << GetMeanPositionZ() <<
" ) " << endl;
964 cout <<
"Number of hits : " <<
fHits->GetNumberOfHits() << endl;
966 cout <<
"+++++++++++++++++++++++" << endl;
967 cout <<
"Printing only the first " << nHits <<
" hits" << endl;
985 double maxX, minX, maxY, minY;
988 if (ranges.size() == 6) {
997 std::vector<double> x, y, en;
999 for (
unsigned int i = 0; i < GetNumberOfHits(); i++) {
1000 if (GetType(i) % X == 0) x.emplace_back(
GetX(i));
1001 if (GetType(i) % Y == 0) y.emplace_back(
GetY(i));
1004 if (x.empty() && y.empty()) {
1005 std::cout <<
"TRestDetectorHitsEvent::GetXYHistogram. Empty histogram!" << std::endl;
1019 nBinsX = std::round((maxX - minX) / pitch);
1020 nBinsY = std::round((maxY - minY) / pitch);
1025 fXYHisto =
new TH2F(
"XY",
"", nBinsX, minX, maxX, nBinsY, minY, maxY);
1030 for (
unsigned int nhit = 0; nhit < this->GetNumberOfHits(); nhit++) {
1031 Double_t x =
fHits->GetX(nhit);
1032 Double_t y =
fHits->GetY(nhit);
1033 Double_t en =
fHits->GetEnergy(nhit);
1034 int type =
fHits->GetType(nhit);
1036 if (type % XY == 0 || type % XYZ == 0) {
1043 style.SetPalette(1);
1048 fXYHisto->GetXaxis()->SetTitle(
"X-axis (mm)");
1049 fXYHisto->GetYaxis()->SetTitle(
"Y-axis (mm)");
1050 fXYHisto->GetYaxis()->SetTitleSize(1.4 *
fXYHisto->GetYaxis()->GetTitleSize());
1051 fXYHisto->GetXaxis()->SetTitleSize(1.4 *
fXYHisto->GetXaxis()->GetTitleSize());
1052 fXYHisto->GetYaxis()->SetLabelSize(1.25 *
fXYHisto->GetYaxis()->GetLabelSize());
1053 fXYHisto->GetXaxis()->SetLabelSize(1.25 *
fXYHisto->GetXaxis()->GetLabelSize());
1054 fXYHisto->GetYaxis()->SetTitleOffset(1);
1072 double maxX, minX, maxZ, minZ;
1075 if (ranges.size() == 6) {
1084 std::vector<double> x, z;
1086 for (
unsigned int i = 0; i < GetNumberOfHits(); i++) {
1087 if (GetType(i) % X == 0) x.emplace_back(
GetX(i));
1088 if (GetType(i) % Z == 0) z.emplace_back(
GetZ(i));
1091 if (x.empty() || z.empty()) {
1092 std::cout <<
"TRestDetectorHitsEvent::GetXZHistogram. Empty histogram!" << std::endl;
1106 nBinsX = std::round((maxX - minX) / pitch);
1107 nBinsZ = std::round((maxZ - minZ) / pitch);
1112 fXZHisto =
new TH2F(
"XZ",
"", nBinsX, minX, maxX, nBinsZ, minZ, maxZ);
1117 for (
unsigned int nhit = 0; nhit < this->GetNumberOfHits(); nhit++) {
1118 Double_t x =
fHits->GetX(nhit);
1119 Double_t z =
fHits->GetZ(nhit);
1120 Double_t en =
fHits->GetEnergy(nhit);
1121 int type =
fHits->GetType(nhit);
1123 if (type % XZ == 0 || type % XYZ == 0) {
1130 style.SetPalette(1);
1135 fXZHisto->GetXaxis()->SetTitle(
"X-axis (mm)");
1136 fXZHisto->GetYaxis()->SetTitle(
"Z-axis (mm)");
1137 fXZHisto->GetYaxis()->SetTitleSize(1.4 *
fXZHisto->GetYaxis()->GetTitleSize());
1138 fXZHisto->GetXaxis()->SetTitleSize(1.4 *
fXYHisto->GetXaxis()->GetTitleSize());
1139 fXZHisto->GetYaxis()->SetLabelSize(1.25 *
fXYHisto->GetYaxis()->GetLabelSize());
1140 fXZHisto->GetXaxis()->SetLabelSize(1.25 *
fXYHisto->GetXaxis()->GetLabelSize());
1141 fXZHisto->GetYaxis()->SetTitleOffset(1);
1159 double maxY, minY, maxZ, minZ;
1162 if (ranges.size() == 6) {
1171 std::vector<double> y, z, en;
1173 for (
unsigned int i = 0; i < GetNumberOfHits(); i++) {
1174 if (GetType(i) % Y == 0) y.emplace_back(
GetY(i));
1175 if (GetType(i) % Z == 0) z.emplace_back(
GetZ(i));
1178 if (y.empty() || z.empty()) {
1179 std::cout <<
"TRestDetectorHitsEvent::GetYZHistogram. Empty histogram!" << std::endl;
1193 nBinsY = std::round((maxY - minZ) / pitch);
1194 nBinsZ = std::round((maxZ - minZ) / pitch);
1199 fYZHisto =
new TH2F(
"YZ",
"", nBinsY, minY, maxY, nBinsZ, minZ, maxZ);
1204 for (
unsigned int nhit = 0; nhit < this->GetNumberOfHits(); nhit++) {
1205 Double_t y =
fHits->GetY(nhit);
1206 Double_t z =
fHits->GetZ(nhit);
1207 Double_t en =
fHits->GetEnergy(nhit);
1208 int type =
fHits->GetType(nhit);
1210 if (type % YZ == 0 || type % XYZ == 0) {
1217 style.SetPalette(1);
1222 fYZHisto->GetXaxis()->SetTitle(
"Y-axis (mm)");
1223 fYZHisto->GetYaxis()->SetTitle(
"Z-axis (mm)");
1224 fYZHisto->GetYaxis()->SetTitleSize(1.4 *
fYZHisto->GetYaxis()->GetTitleSize());
1225 fYZHisto->GetXaxis()->SetTitleSize(1.4 *
fYZHisto->GetXaxis()->GetTitleSize());
1226 fYZHisto->GetYaxis()->SetLabelSize(1.25 *
fYZHisto->GetYaxis()->GetLabelSize());
1227 fYZHisto->GetXaxis()->SetLabelSize(1.25 *
fYZHisto->GetXaxis()->GetLabelSize());
1228 fYZHisto->GetYaxis()->SetTitleOffset(1);
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.
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.
virtual void PrintEvent() const
virtual void Initialize()=0
It saves a 3-coordinate position and an energy for each punctual deposition.
Int_t GetNumberOfHitsInsidePrism(const TVector3 &x0, const TVector3 &x1, Double_t sizeX, Double_t sizeY, Double_t theta) const
It determines the total number of hits contained inside a prisma delimited between x0 and y0 vertex,...
virtual void RemoveHits()
It removes all hits inside the class.
TVector3 GetMeanPositionInCylinder(const TVector3 &x0, const TVector3 &x1, Double_t radius) const
It determines the mean position using the hits contained inside a cylinder with a given radius and de...
static void GetBoundaries(std::vector< double > &val, double &max, double &min, int &nBins, double offset=10)
TODO This method is not using any TRestHits member. This probably means that it should be placed some...
Double_t GetEnergyInCylinder(const TVector3 &x0, const TVector3 &x1, Double_t radius) const
It determines the total energy contained inside a cylinder with a given radius and delimited between ...
Bool_t isHitNInsidePrism(Int_t n, const TVector3 &x0, const TVector3 &x1, Double_t sizeX, Double_t sizeY, Double_t theta) const
It determines if hit n is contained inside a prisma delimited between x0 and y0 vertex,...
Double_t GetEnergyInPrism(const TVector3 &x0, const TVector3 &x1, Double_t sizeX, Double_t sizeY, Double_t theta) const
It determines the total hit energy contained inside a prisma delimited between x0 and y0 vertex,...
void AddHit(const TVector3 &position, Double_t energy, Double_t time=0, REST_HitType type=XYZ)
Adds a new hit to the list of hits using a TVector3.
Int_t GetNumberOfHitsInsideCylinder(const TVector3 &x0, const TVector3 &x1, Double_t radius) const
It determines the total number of hits contained inside a cylinder with a given radius and delimited ...
Bool_t isHitNInsideCylinder(Int_t n, const TVector3 &x0, const TVector3 &x1, Double_t radius) const
It determines if hit n is contained inside a cylinder with a given radius and delimited between x0 an...
TVector3 GetMeanPositionInPrism(const TVector3 &x0, const TVector3 &x1, Double_t sizeX, Double_t sizeY, Double_t theta) const
It determines the mean position of hits contained inside a prisma delimited between x0 and x1 vertex,...
virtual void SwapHits(Int_t i, Int_t j)
It exchanges hits n and m affecting to the ordering of the hits inside the list of hits.
virtual void PrintHits(Int_t nHits=-1) const
It prints on screen the first nHits from the list.