70 return std::sqrt((P2.x - P1.x) * (P2.x - P1.x) +
71 (P2.y - P1.y) * (P2.y - P1.y) +
72 (P2.z - P1.z) * (P2.z - P1.z));
78 const TH2F * h2D_TRDMap_YZ,
79 const TH2F * h2D_TRDMap_XY,
85 static TH2D * histogramXZ =
nullptr;
86 static TH2D * histogramYZ =
nullptr;
89 if (!histogramXZ || !histogramYZ)
93 std::cerr<<
"\n\n[INFO] Static histogramXZ and histogramYZ were created in AMSTrdMCTrack::IsClusterInsideTRD().\n";
97 for (
int x_bin = 1; x_bin <= 18; ++x_bin) {
98 for (
int z_bin = 1; z_bin <= 20; ++z_bin) {
99 histogramXZ->SetBinContent(x_bin, z_bin, 0);
100 if (4 < z_bin && z_bin <= 16)
101 histogramXZ->SetBinContent(x_bin, z_bin, 1);
102 if ((x_bin == 1 || x_bin == 18) && z_bin <= 12)
103 histogramXZ->SetBinContent(x_bin, z_bin, 0);
108 for (
int y_bin = 1; y_bin <= 18; ++y_bin) {
109 for (
int z_bin = 1; z_bin <= 20; ++z_bin) {
110 histogramYZ->SetBinContent(y_bin, z_bin, 0);
111 if (z_bin <= 4 || z_bin > 16)
112 histogramYZ->SetBinContent(y_bin, z_bin, 1);
113 if ((y_bin <= 2 || y_bin >= 17) && z_bin <= 4)
114 histogramYZ->SetBinContent(y_bin, z_bin, 0);
120 int bin_XZ = histogramXZ->FindBin(x, z);
121 if (histogramXZ->GetBinContent(bin_XZ) <= 0)
127 int bin_YZ = histogramYZ->FindBin(y, z);
128 if (histogramYZ->GetBinContent(bin_YZ) <= 0)
137 if (!h2D_TRDMap_XZ || !h2D_TRDMap_YZ || !h2D_TRDMap_XY)
139 std::cerr <<
"\n\n[ERROR]: Unable to open XZ, YZ and XY histograms.\n\n";
140 throw std::runtime_error(
"\n\nh2D_TRDMap histograms not found\n\n");
144 int bin_XY =
const_cast<TH2F*
>(h2D_TRDMap_XY)->FindBin(x, y);
145 if (h2D_TRDMap_XY->GetBinContent(bin_XY) <= 0)
151 bin_XZ =
const_cast<TH2F*
>(h2D_TRDMap_XZ)->FindBin(x, z);
152 if (h2D_TRDMap_XZ->GetBinContent(bin_XZ) <= 0)
158 bin_YZ =
const_cast<TH2F*
>(h2D_TRDMap_YZ)->FindBin(y, z);
159 if (h2D_TRDMap_YZ->GetBinContent(bin_YZ) <= 0)
172 for (
const auto& track : vTracks)
174 printf(
"\ntrkID: %5d, g3PID: %5d", track.trkID, track.g3PID);
176 for (
const auto& cluster : track.clusters)
177 printf(
"\n (x, y, z, Edep): %8.3f, %8.3f, %8.3f, %8.4f | Estimated (Layer, Ladder): %5d, %5d.", cluster.x, cluster.y, cluster.z, cluster.Edep, cluster.Layer, cluster.Ladder);
185 std::vector<double> allValues;
187 for (
const Track& track : allTracks)
189 for (
const Cluster& cluster : track.clusters)
194 allValues.push_back(cluster.
x);
197 allValues.push_back(cluster.
y);
200 allValues.push_back(cluster.
z);
213 std::vector<double> values;
218 values.push_back(cluster.
x);
221 values.push_back(cluster.
y);
224 values.push_back(cluster.
z);
238 TGraph2D *graph =
new TGraph2D();
239 for (
const auto &cluster : track.
clusters)
240 graph->SetPoint(graph->GetN(), cluster.x, cluster.y, cluster.z);
242 graph->SetMarkerColor(kRed);
243 graph->SetMarkerStyle(20);
254 TH3D* hist =
new TH3D(
"clustersHist",
"Clusters;X;Y;Z", 100,
TRD_XYMIN,
TRD_XYMAX, 100,
TRD_XYMIN,
TRD_XYMAX,
nZBins,
TRD_ZMIN,
TRD_ZMAX);
258 hist->Fill(cluster.
x, cluster.
y, cluster.
z);
const int TRD_ZMAX
for plotting TH2Ds
Definition: TRDConstants.h:4
const int TRD_XYMAX
Definition: TRDConstants.h:8
const int TRD_ZMIN
cm
Definition: TRDConstants.h:5
const int nZBins
cm
Definition: TRDConstants.h:6
const int TRD_XYMIN
cm
Definition: TRDConstants.h:9
Definition: AMSTrdMCTrack.h:15
TGraph2D * SetTrackClustersToGraph(const AMSTrdMCTrack::Track &track)
Definition: AMSTrdMCTrack.h:234
Coordinate
Definition: AMSTrdMCTrack.h:18
@ Z
Definition: AMSTrdMCTrack.h:21
@ X
Definition: AMSTrdMCTrack.h:19
@ Y
Definition: AMSTrdMCTrack.h:20
double GetDistance(const T &P1, const T &P2)
Definition: AMSTrdMCTrack.h:67
std::vector< double > GetTrkPosValues(const Track &track, Coordinate coord)
Definition: AMSTrdMCTrack.h:211
void printTRDTrackInfo(const std::vector< TRDTrack > &vTracks)
Definition: AMSTrdMCTrack.h:170
TH3D * SetTrackClustersInTH3D(const AMSTrdMCTrack::Track &track)
Definition: AMSTrdMCTrack.h:249
bool IsClusterInsideTRD(const TH2F *h2D_TRDMap_XZ, const TH2F *h2D_TRDMap_YZ, const TH2F *h2D_TRDMap_XY, double x, double y, double z)
Definition: AMSTrdMCTrack.h:77
std::vector< double > GetAllPosValues(const std::vector< Track > &allTracks, Coordinate coord)
Definition: AMSTrdMCTrack.h:183
const double SIM_TRD_ZMIN
Definition: EventGenTRDConsts.h:28
const double SIM_TRD_YMAX
Definition: EventGenTRDConsts.h:27
const double SIM_TRD_YMIN
Definition: EventGenTRDConsts.h:26
const double SIM_TRD_XMAX
Definition: EventGenTRDConsts.h:25
const double SIM_TRD_ZMAX
Definition: EventGenTRDConsts.h:29
const double SIM_TRD_XMIN
Angle of track from the vertical Z-axis in radians. | (1.0 rad ~ 57 degrees) (1.3 rad ~ 75 degrees)
Definition: EventGenTRDConsts.h:24
Definition: AMSTrdMCTrack.h:27
double y
Definition: AMSTrdMCTrack.h:29
double z
Definition: AMSTrdMCTrack.h:30
double x
Definition: AMSTrdMCTrack.h:28
Definition: AMSTrdMCTrack.h:36
int Tube
Definition: AMSTrdMCTrack.h:42
int Ladder
Definition: AMSTrdMCTrack.h:41
double z
Definition: AMSTrdMCTrack.h:39
int Layer
Definition: AMSTrdMCTrack.h:40
double y
Definition: AMSTrdMCTrack.h:38
double x
Definition: AMSTrdMCTrack.h:37
double Edep
Definition: AMSTrdMCTrack.h:43
Definition: AMSTrdMCTrack.h:58
std::vector< TRDHitCluster > clusters
Definition: AMSTrdMCTrack.h:61
int g3PID
Definition: AMSTrdMCTrack.h:60
int trkID
Definition: AMSTrdMCTrack.h:59
Definition: AMSTrdMCTrack.h:49
int trkID
Definition: AMSTrdMCTrack.h:50
std::vector< Cluster > clusters
Definition: AMSTrdMCTrack.h:52
int g3PID
Definition: AMSTrdMCTrack.h:51