40 #include "TRestDetectorHitsEvent.h"
44 #include "TRestStringHelper.h"
45 #include "TRestTools.h"
49 using namespace TMath;
70 fXYHitGraph =
nullptr;
71 fXZHitGraph =
nullptr;
72 fYZHitGraph =
nullptr;
100 fHits->AddHit({x, y, z}, en, t, type);
110 fHits->AddHit(position, energy, time, type);
140 if (compareCondition == 0) {
142 std::sort(fHits->begin(), fHits->end(),
144 return hit1.z() < hit2.z();
147 std::sort(fHits->begin(), fHits->end(), compareCondition);
151 void 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));
158 fHits->SwapHits(hit1, hit2);
173 for (
unsigned int i = 0; i < this->GetNumberOfHits(); i++) {
174 if (GetType(i) == XZ) {
175 fXZHits->AddHit({this->GetX(i), this->GetY(i), this->GetZ(i)}, this->GetEnergy(i),
176 this->GetTime(i), XZ);
193 for (
unsigned int i = 0; i < this->GetNumberOfHits(); i++) {
194 if (GetType(i) == YZ) {
195 fYZHits->AddHit({this->GetX(i), this->GetY(i), this->GetZ(i)}, this->GetEnergy(i),
196 this->GetTime(i), YZ);
213 for (
unsigned int i = 0; i < this->GetNumberOfHits(); i++) {
214 if (GetType(i) == XYZ) {
216 fXYZHits->AddHit({this->GetX(i), this->GetY(i), this->GetZ(i)}, this->GetEnergy(i),
217 this->GetTime(i), XYZ);
233 if (fHits->GetNumberOfHitsInsideCylinder(x0, x1, radius) > 0) {
248 if ((
size_t)fHits->GetNumberOfHitsInsideCylinder(x0, x1, radius) == GetNumberOfHits())
return true;
262 return fHits->GetEnergyInCylinder(x0, x1, radius);
274 return fHits->GetNumberOfHitsInsideCylinder(x0, x1, radius);
286 return fHits->GetMeanPositionInCylinder(x0, x1, radius);
300 if (fHits->GetNumberOfHitsInsidePrism(x0, x1, sizeX, sizeY, theta) > 0)
return true;
316 if ((
size_t)fHits->GetNumberOfHitsInsidePrism(x0, x1, sizeX, sizeY, theta) == GetNumberOfHits())
334 return fHits->GetEnergyInPrism(x0, x1, sizeX, sizeY, theta);
348 Double_t sizeY, Double_t theta) {
349 return fHits->GetNumberOfHitsInsidePrism(x0, x1, sizeX, sizeY, theta);
363 Double_t sizeY, Double_t theta) {
364 return fHits->GetMeanPositionInPrism(x0, x1, sizeX, sizeY, 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++) {
389 if (fHits->isHitNInsideCylinder(n, x0, x1, radius)) {
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++) {
425 if (fHits->isHitNInsideCylinder(n, x0, x1, radius)) {
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++) {
459 if (fHits->isHitNInsideCylinder(n, x0, x1, radius)) {
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++) {
496 if (fHits->isHitNInsidePrism(n, x0, x1, sizeX, sizeY, theta)) {
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++) {
536 if (fHits->isHitNInsidePrism(n, x0, x1, sizeX, sizeY, theta)) {
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++) {
573 if (fHits->isHitNInsidePrism(n, x0, x1, sizeX, sizeY, theta)) {
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);
683 if (fXYHitGraph !=
nullptr) {
685 fXYHitGraph =
nullptr;
687 if (fXZHitGraph !=
nullptr) {
689 fXZHitGraph =
nullptr;
691 if (fYZHitGraph !=
nullptr) {
693 fYZHitGraph =
nullptr;
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]);
731 fXZHitGraph->SetMarkerColor(kBlue);
732 fXZHitGraph->SetMarkerSize(0.3);
733 fXZHitGraph->SetMarkerStyle(20);
735 fYZHitGraph =
new TGraph(nYZ, &yz[0][0], &yz[1][0]);
736 fYZHitGraph->SetMarkerColor(kRed);
737 fYZHitGraph->SetMarkerSize(0.3);
738 fYZHitGraph->SetMarkerStyle(20);
740 fXYHitGraph =
new TGraph(nXY, &xy[0][0], &xy[1][0]);
741 fXYHitGraph->SetMarkerColor(kBlack);
742 fXYHitGraph->SetMarkerSize(0.3);
743 fXYHitGraph->SetMarkerStyle(20);
747 sprintf(title,
"Event ID %d", this->GetID());
750 fPad->cd(1 + 3 * column);
751 fXZHitGraph->SetTitle(title);
752 fXZHitGraph->Draw(
"AP*");
754 fXZHitGraph->GetXaxis()->SetTitle(
"X-axis (mm)");
755 fXZHitGraph->GetYaxis()->SetTitle(
"Z-axis (mm)");
759 fPad->cd(2 + 3 * column);
760 fYZHitGraph->SetTitle(title);
761 fYZHitGraph->Draw(
"AP");
763 fYZHitGraph->GetXaxis()->SetTitle(
"Y-axis (mm)");
764 fYZHitGraph->GetYaxis()->SetTitle(
"Z-axis (mm)");
768 fPad->cd(3 + 3 * column);
769 fXYHitGraph->SetTitle(title);
770 fXYHitGraph->Draw(
"AP");
772 fXYHitGraph->GetXaxis()->SetTitle(
"X-axis (mm)");
773 fXYHitGraph->GetYaxis()->SetTitle(
"Y-axis (mm)");
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);
829 fXYHisto->SetStats(
false);
830 fXZHisto->SetStats(
false);
831 fYZHisto->SetStats(
false);
833 fXHisto->SetStats(
false);
834 fYHisto->SetStats(
false);
835 fZHisto->SetStats(
false);
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) {
848 fXZHisto->Fill(x, z, en);
852 if (type % YZ == 0) {
853 fYZHisto->Fill(y, z, en);
857 if (type % XY == 0) {
858 fXYHisto->Fill(x, y, en);
882 fPad->cd(1 + 3 * column);
883 fXZHisto->Draw(histOption);
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);
895 fYZHisto->Draw(histOption);
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);
907 fXYHisto->Draw(histOption);
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);
921 fXHisto->Draw(histOption);
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);
933 fYHisto->Draw(histOption);
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);
945 fZHisto->Draw(histOption);
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;
970 fHits->PrintHits(nHits);
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);
1026 fXYHisto->SetStats(
false);
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) {
1037 fXYHisto->Fill(x, y, en);
1043 style.SetPalette(1);
1046 fXYHisto->Draw(
"col");
1047 fXYHisto->Draw(
"cont3 same");
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);
1113 fXZHisto->SetStats(
false);
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) {
1124 fXZHisto->Fill(x, z, en);
1130 style.SetPalette(1);
1133 fXZHisto->Draw(
"col");
1134 fXZHisto->Draw(
"cont3 same");
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);
1200 fYZHisto->SetStats(
false);
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) {
1211 fYZHisto->Fill(y, z, en);
1217 style.SetPalette(1);
1220 fYZHisto->Draw(
"col");
1221 fYZHisto->Draw(
"cont3 same");
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.
TPad * DrawEvent(const TString &option="")
This method draws the hits event structure into a TPad.
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.
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...
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...
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.
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.
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.
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.
virtual void PrintEvent() const
virtual void Initialize()=0
It saves a 3-coordinate position and an energy for each punctual deposition.
virtual void RemoveHits()
It removes all hits inside the class.
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...