40#include "TRestDetectorHitsEvent.h"
44#include "TRestStringHelper.h"
45#include "TRestTools.h"
141 if (compareCondition == 0) {
145 return hit1.z() < hit2.z();
148 std::sort(
fHits->begin(),
fHits->end(), compareCondition);
151 std::cout <<
"TRestDetectorHitsEvent::Sort is not implemented on MacOs!!" << std::endl;
152 std::cout <<
"This method implementation should be reviewed for proper operation in Mac" << std::endl;
156void TRestDetectorHitsEvent::Shuffle(
int NLoop) {
157 Int_t nHits =
fHits->GetNumberOfHits();
159 for (
int n = 0; n < NLoop; n++) {
160 Int_t hit1 = (Int_t)(nHits * gRandom->Uniform(0, 1));
161 Int_t hit2 = (Int_t)(nHits * gRandom->Uniform(0, 1));
178 for (
unsigned int i = 0; i < this->GetNumberOfHits(); i++) {
179 if (GetType(i) == XZ) {
181 this->GetTime(i), XZ);
198 for (
unsigned int i = 0; i < this->GetNumberOfHits(); i++) {
199 if (GetType(i) == YZ) {
201 this->GetTime(i), YZ);
218 for (
unsigned int i = 0; i < this->GetNumberOfHits(); i++) {
219 if (GetType(i) == XYZ) {
222 this->GetTime(i), XYZ);
353 Double_t sizeY, Double_t theta) {
368 Double_t sizeY, Double_t theta) {
384 Double_t rad2 = radius * radius;
385 Double_t hitDistance = rad2;
389 TVector3 axis = x1 - x0;
390 Double_t cylLength = axis.Mag();
393 for (
unsigned int n = 0; n < GetNumberOfHits(); n++) {
395 l = axis.Dot(this->GetPosition(n) - x0) / cylLength;
397 d2 = rad2 - (this->GetPosition(n) - x0).Mag2() + l * l;
399 if (d2 < hitDistance) hitDistance = d2;
405 if (nhits == 0)
return -1;
407 return TMath::Sqrt(hitDistance);
422 TVector3 axis = x1 - x0;
423 Double_t cylLength = axis.Mag();
425 Double_t hitDistance = cylLength;
426 Double_t d = cylLength;
429 for (
unsigned int n = 0; n < GetNumberOfHits(); n++) {
431 d = cylLength - axis.Dot(this->GetPosition(n) - x0) / cylLength;
433 if (d < hitDistance) hitDistance = d;
439 if (nhits == 0)
return -1;
456 TVector3 axis = x1 - x0;
457 Double_t cylLength = axis.Mag();
459 Double_t hitDistance = cylLength;
460 Double_t d = cylLength;
463 for (
unsigned int n = 0; n < GetNumberOfHits(); n++) {
465 d = axis.Dot(this->GetPosition(n) - x0) / cylLength;
467 if (d < hitDistance) hitDistance = d;
473 if (nhits == 0)
return -1;
491 Double_t sizeX, Double_t sizeY,
493 Double_t dX = sizeX / 2;
494 Double_t dY = sizeY / 2;
496 Double_t hitDistance = max(dX, dY);
500 for (
unsigned int n = 0; n < GetNumberOfHits(); n++) {
502 dX = sizeX / 2 - TMath::Abs((this->GetPosition(n) - x0).X());
503 dY = sizeY / 2 - TMath::Abs((this->GetPosition(n) - x0).Y());
507 if (d < hitDistance) hitDistance = d;
513 if (nhits == 0)
return -1;
531 Double_t sizeX, Double_t sizeY,
533 TVector3 axis = x1 - x0;
534 Double_t prismLength = axis.Mag();
536 Double_t hitDistance = prismLength;
540 for (
unsigned int n = 0; n < GetNumberOfHits(); n++) {
542 d = prismLength - axis.Dot(this->GetPosition(n) - x0) / prismLength;
544 if (d < hitDistance) hitDistance = d;
550 if (nhits == 0)
return -1;
568 const TVector3& x1, Double_t sizeX,
569 Double_t sizeY, Double_t theta) {
570 TVector3 axis = x1 - x0;
571 Double_t prismLength = axis.Mag();
573 Double_t hitDistance = prismLength;
577 for (
unsigned int n = 0; n < GetNumberOfHits(); n++) {
579 d = axis.Dot(this->GetPosition(n) - x0) / prismLength;
581 if (d < hitDistance) hitDistance = d;
587 if (nhits == 0)
return -1;
619 for (
unsigned int n = 0; n < optList.size(); n++) {
620 if (optList[n] ==
"print") this->
PrintEvent();
623 optList.erase(std::remove(optList.begin(), optList.end(),
"print"), optList.end());
627 if (optList.size() == 0) optList.push_back(
"hist(Cont1,col)[3]");
629 if (fPad !=
nullptr) {
634 fPad =
new TPad(this->GetName(),
" ", 0, 0, 1, 1);
635 fPad->Divide(3, 2 * optList.size());
639 for (
unsigned int n = 0; n < optList.size(); n++) {
640 string optionStr = (string)optList[n];
641 TString drawEventOption = optList[n];
644 size_t startPos = optionStr.find(
"(");
645 if (startPos != string::npos) drawEventOption = optList[n](0, startPos);
648 string histOption =
"";
649 size_t endPos = optionStr.find(
")");
650 if (endPos != string::npos) {
651 TString histOptionTmp = optList[n](startPos + 1, endPos - startPos - 1);
653 histOption = (string)histOptionTmp;
655 while ((pos = histOption.find(
",", pos)) != string::npos) {
656 histOption.replace(pos, 1,
":");
662 string pitchOption =
"";
664 startPos = optionStr.find(
"[");
665 endPos = optionStr.find(
"]");
667 if (endPos != string::npos) {
668 TString pitchOption = optList[n](startPos + 1, endPos - startPos - 1);
669 pitch = stod((
string)pitchOption);
672 if (drawEventOption ==
"graph") this->
DrawGraphs(column);
674 if (drawEventOption ==
"hist") this->
DrawHistograms(column, histOption, pitch);
701 vector<vector<Double_t>> xz(2, vector<Double_t>(this->GetNumberOfHits()));
702 vector<vector<Double_t>> yz(2, vector<Double_t>(this->GetNumberOfHits()));
703 vector<vector<Double_t>> xy(2, vector<Double_t>(this->GetNumberOfHits()));
710 for (
unsigned int nhit = 0; nhit < this->GetNumberOfHits(); nhit++) {
711 Double_t x =
fHits->GetX(nhit);
712 Double_t y =
fHits->GetY(nhit);
713 Double_t z =
fHits->GetZ(nhit);
714 int type =
fHits->GetType(nhit);
716 if (type % XZ == 0) {
722 if (type % YZ == 0) {
728 if (type % XY == 0) {
735 fXZHitGraph =
new TGraph(nXZ, &xz[0][0], &xz[1][0]);
740 fYZHitGraph =
new TGraph(nYZ, &yz[0][0], &yz[1][0]);
745 fXYHitGraph =
new TGraph(nXY, &xy[0][0], &xy[1][0]);
752 sprintf(title,
"Event ID %d", this->GetID());
755 fPad->cd(1 + 3 * column);
764 fPad->cd(2 + 3 * column);
773 fPad->cd(3 + 3 * column);
799 std::vector<double> fX, fY, fZ;
800 for (
unsigned int i = 0; i < GetNumberOfHits(); i++) {
801 if (GetType(i) % X == 0) fX.emplace_back(
GetX(i));
802 if (GetType(i) % Y == 0) fY.emplace_back(
GetY(i));
803 if (GetType(i) % Z == 0) fZ.emplace_back(
GetZ(i));
806 double maxX, minX, maxY, minY, maxZ, minZ;
807 int nBinsX, nBinsY, nBinsZ;
813 nBinsX = std::round((maxX - minX) / pitch);
814 nBinsY = std::round((maxY - minY) / pitch);
815 nBinsZ = std::round((maxZ - minZ) / pitch);
826 fXYHisto =
new TH2F(
"XY",
"", nBinsX, minX, maxX, nBinsY, minY, maxY);
827 fXZHisto =
new TH2F(
"XZ",
"", nBinsX, minX, maxX, nBinsZ, minZ, maxZ);
828 fYZHisto =
new TH2F(
"YZ",
"", nBinsY, minY, maxY, nBinsZ, minZ, maxZ);
830 fXHisto =
new TH1F(
"X",
"", nBinsX, minX, maxX);
831 fYHisto =
new TH1F(
"Y",
"", nBinsY, minY, maxY);
832 fZHisto =
new TH1F(
"Z",
"", nBinsZ, minZ, maxZ);
842 Int_t nYZ = 0, nXZ = 0, nXY = 0;
843 Int_t nX = 0, nY = 0, nZ = 0;
845 for (
unsigned int nhit = 0; nhit < this->GetNumberOfHits(); nhit++) {
846 Double_t x =
fHits->GetX(nhit);
847 Double_t y =
fHits->GetY(nhit);
848 Double_t z =
fHits->GetZ(nhit);
849 Double_t en =
fHits->GetEnergy(nhit);
850 int type =
fHits->GetType(nhit);
852 if (type % XZ == 0) {
857 if (type % YZ == 0) {
862 if (type % XY == 0) {
887 fPad->cd(1 + 3 * column);
889 fXZHisto->GetXaxis()->SetTitle(
"X-axis (mm)");
890 fXZHisto->GetYaxis()->SetTitle(
"Z-axis (mm)");
891 fXZHisto->GetYaxis()->SetTitleSize(1.4 *
fXZHisto->GetYaxis()->GetTitleSize());
892 fXZHisto->GetXaxis()->SetTitleSize(1.4 *
fXZHisto->GetXaxis()->GetTitleSize());
893 fXZHisto->GetYaxis()->SetLabelSize(1.25 *
fXZHisto->GetYaxis()->GetLabelSize());
894 fXZHisto->GetXaxis()->SetLabelSize(1.25 *
fXZHisto->GetXaxis()->GetLabelSize());
895 fXZHisto->GetYaxis()->SetTitleOffset(1);
899 fPad->cd(2 + 3 * column);
901 fYZHisto->GetXaxis()->SetTitle(
"Y-axis (mm)");
902 fYZHisto->GetYaxis()->SetTitle(
"Z-axis (mm)");
903 fYZHisto->GetYaxis()->SetTitleSize(1.4 *
fYZHisto->GetYaxis()->GetTitleSize());
904 fYZHisto->GetXaxis()->SetTitleSize(1.4 *
fYZHisto->GetXaxis()->GetTitleSize());
905 fYZHisto->GetYaxis()->SetLabelSize(1.25 *
fYZHisto->GetYaxis()->GetLabelSize());
906 fYZHisto->GetXaxis()->SetLabelSize(1.25 *
fYZHisto->GetXaxis()->GetLabelSize());
907 fYZHisto->GetYaxis()->SetTitleOffset(1);
911 fPad->cd(3 + 3 * column);
913 fXYHisto->GetXaxis()->SetTitle(
"X-axis (mm)");
914 fXYHisto->GetYaxis()->SetTitle(
"Y-axis (mm)");
915 fXYHisto->GetYaxis()->SetTitleSize(1.4 *
fXYHisto->GetYaxis()->GetTitleSize());
916 fXYHisto->GetXaxis()->SetTitleSize(1.4 *
fXYHisto->GetXaxis()->GetTitleSize());
917 fXYHisto->GetYaxis()->SetLabelSize(1.25 *
fXYHisto->GetYaxis()->GetLabelSize());
918 fXYHisto->GetXaxis()->SetLabelSize(1.25 *
fXYHisto->GetXaxis()->GetLabelSize());
919 fXYHisto->GetYaxis()->SetTitleOffset(1);
925 fPad->cd(1 + 3 * column);
927 fXHisto->GetXaxis()->SetTitle(
"X-axis (mm)");
928 fXHisto->GetYaxis()->SetTitle(
"Number of events");
929 fXHisto->GetYaxis()->SetTitleSize(1.4 *
fXHisto->GetYaxis()->GetTitleSize());
930 fXHisto->GetXaxis()->SetTitleSize(1.4 *
fXHisto->GetXaxis()->GetTitleSize());
931 fXHisto->GetYaxis()->SetLabelSize(1.25 *
fXHisto->GetYaxis()->GetLabelSize());
932 fXHisto->GetXaxis()->SetLabelSize(1.25 *
fXHisto->GetXaxis()->GetLabelSize());
933 fXHisto->GetYaxis()->SetTitleOffset(1);
937 fPad->cd(2 + 3 * column);
939 fYHisto->GetXaxis()->SetTitle(
"Y-axis (mm)");
940 fYHisto->GetYaxis()->SetTitle(
"Number of events");
941 fYHisto->GetYaxis()->SetTitleSize(1.4 *
fYHisto->GetYaxis()->GetTitleSize());
942 fYHisto->GetXaxis()->SetTitleSize(1.4 *
fYHisto->GetXaxis()->GetTitleSize());
943 fYHisto->GetYaxis()->SetLabelSize(1.25 *
fYHisto->GetYaxis()->GetLabelSize());
944 fYHisto->GetXaxis()->SetLabelSize(1.25 *
fYHisto->GetXaxis()->GetLabelSize());
945 fYHisto->GetYaxis()->SetTitleOffset(1);
949 fPad->cd(3 + 3 * column);
951 fZHisto->GetXaxis()->SetTitle(
"Z-axis (mm)");
952 fZHisto->GetYaxis()->SetTitle(
"Number of events");
953 fZHisto->GetYaxis()->SetTitleSize(1.4 *
fYHisto->GetYaxis()->GetTitleSize());
954 fZHisto->GetXaxis()->SetTitleSize(1.4 *
fYHisto->GetXaxis()->GetTitleSize());
955 fZHisto->GetYaxis()->SetLabelSize(1.25 *
fYHisto->GetYaxis()->GetLabelSize());
956 fZHisto->GetXaxis()->SetLabelSize(1.25 *
fYHisto->GetXaxis()->GetLabelSize());
957 fZHisto->GetYaxis()->SetTitleOffset(1);
966 cout <<
"Total energy : " << GetTotalEnergy() << endl;
967 cout <<
"Mean position : ( " << GetMeanPositionX() <<
" , " << GetMeanPositionY() <<
" , "
968 << GetMeanPositionZ() <<
" ) " << endl;
969 cout <<
"Number of hits : " <<
fHits->GetNumberOfHits() << endl;
971 cout <<
"+++++++++++++++++++++++" << endl;
972 cout <<
"Printing only the first " << nHits <<
" hits" << endl;
990 double maxX, minX, maxY, minY;
993 if (ranges.size() == 6) {
1002 std::vector<double> x, y, en;
1004 for (
unsigned int i = 0; i < GetNumberOfHits(); i++) {
1005 if (GetType(i) % X == 0) x.emplace_back(
GetX(i));
1006 if (GetType(i) % Y == 0) y.emplace_back(
GetY(i));
1009 if (x.empty() && y.empty()) {
1010 std::cout <<
"TRestDetectorHitsEvent::GetXYHistogram. Empty histogram!" << std::endl;
1024 nBinsX = std::round((maxX - minX) / pitch);
1025 nBinsY = std::round((maxY - minY) / pitch);
1030 fXYHisto =
new TH2F(
"XY",
"", nBinsX, minX, maxX, nBinsY, minY, maxY);
1035 for (
unsigned int nhit = 0; nhit < this->GetNumberOfHits(); nhit++) {
1036 Double_t x =
fHits->GetX(nhit);
1037 Double_t y =
fHits->GetY(nhit);
1038 Double_t en =
fHits->GetEnergy(nhit);
1039 int type =
fHits->GetType(nhit);
1041 if (type % XY == 0 || type % XYZ == 0) {
1048 style.SetPalette(1);
1053 fXYHisto->GetXaxis()->SetTitle(
"X-axis (mm)");
1054 fXYHisto->GetYaxis()->SetTitle(
"Y-axis (mm)");
1055 fXYHisto->GetYaxis()->SetTitleSize(1.4 *
fXYHisto->GetYaxis()->GetTitleSize());
1056 fXYHisto->GetXaxis()->SetTitleSize(1.4 *
fXYHisto->GetXaxis()->GetTitleSize());
1057 fXYHisto->GetYaxis()->SetLabelSize(1.25 *
fXYHisto->GetYaxis()->GetLabelSize());
1058 fXYHisto->GetXaxis()->SetLabelSize(1.25 *
fXYHisto->GetXaxis()->GetLabelSize());
1059 fXYHisto->GetYaxis()->SetTitleOffset(1);
1077 double maxX, minX, maxZ, minZ;
1080 if (ranges.size() == 6) {
1089 std::vector<double> x, z;
1091 for (
unsigned int i = 0; i < GetNumberOfHits(); i++) {
1092 if (GetType(i) % X == 0) x.emplace_back(
GetX(i));
1093 if (GetType(i) % Z == 0) z.emplace_back(
GetZ(i));
1096 if (x.empty() || z.empty()) {
1097 std::cout <<
"TRestDetectorHitsEvent::GetXZHistogram. Empty histogram!" << std::endl;
1111 nBinsX = std::round((maxX - minX) / pitch);
1112 nBinsZ = std::round((maxZ - minZ) / pitch);
1117 fXZHisto =
new TH2F(
"XZ",
"", nBinsX, minX, maxX, nBinsZ, minZ, maxZ);
1122 for (
unsigned int nhit = 0; nhit < this->GetNumberOfHits(); nhit++) {
1123 Double_t x =
fHits->GetX(nhit);
1124 Double_t z =
fHits->GetZ(nhit);
1125 Double_t en =
fHits->GetEnergy(nhit);
1126 int type =
fHits->GetType(nhit);
1128 if (type % XZ == 0 || type % XYZ == 0) {
1135 style.SetPalette(1);
1140 fXZHisto->GetXaxis()->SetTitle(
"X-axis (mm)");
1141 fXZHisto->GetYaxis()->SetTitle(
"Z-axis (mm)");
1142 fXZHisto->GetYaxis()->SetTitleSize(1.4 *
fXZHisto->GetYaxis()->GetTitleSize());
1143 fXZHisto->GetXaxis()->SetTitleSize(1.4 *
fXYHisto->GetXaxis()->GetTitleSize());
1144 fXZHisto->GetYaxis()->SetLabelSize(1.25 *
fXYHisto->GetYaxis()->GetLabelSize());
1145 fXZHisto->GetXaxis()->SetLabelSize(1.25 *
fXYHisto->GetXaxis()->GetLabelSize());
1146 fXZHisto->GetYaxis()->SetTitleOffset(1);
1164 double maxY, minY, maxZ, minZ;
1167 if (ranges.size() == 6) {
1176 std::vector<double> y, z, en;
1178 for (
unsigned int i = 0; i < GetNumberOfHits(); i++) {
1179 if (GetType(i) % Y == 0) y.emplace_back(
GetY(i));
1180 if (GetType(i) % Z == 0) z.emplace_back(
GetZ(i));
1183 if (y.empty() || z.empty()) {
1184 std::cout <<
"TRestDetectorHitsEvent::GetYZHistogram. Empty histogram!" << std::endl;
1198 nBinsY = std::round((maxY - minZ) / pitch);
1199 nBinsZ = std::round((maxZ - minZ) / pitch);
1204 fYZHisto =
new TH2F(
"YZ",
"", nBinsY, minY, maxY, nBinsZ, minZ, maxZ);
1209 for (
unsigned int nhit = 0; nhit < this->GetNumberOfHits(); nhit++) {
1210 Double_t y =
fHits->GetY(nhit);
1211 Double_t z =
fHits->GetZ(nhit);
1212 Double_t en =
fHits->GetEnergy(nhit);
1213 int type =
fHits->GetType(nhit);
1215 if (type % YZ == 0 || type % XYZ == 0) {
1222 style.SetPalette(1);
1227 fYZHisto->GetXaxis()->SetTitle(
"Y-axis (mm)");
1228 fYZHisto->GetYaxis()->SetTitle(
"Z-axis (mm)");
1229 fYZHisto->GetYaxis()->SetTitleSize(1.4 *
fYZHisto->GetYaxis()->GetTitleSize());
1230 fYZHisto->GetXaxis()->SetTitleSize(1.4 *
fYZHisto->GetXaxis()->GetTitleSize());
1231 fYZHisto->GetYaxis()->SetLabelSize(1.25 *
fYZHisto->GetYaxis()->GetLabelSize());
1232 fYZHisto->GetXaxis()->SetLabelSize(1.25 *
fYZHisto->GetXaxis()->GetLabelSize());
1233 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.