From bcd4e90ee5e9bb0227b52fc6ed4a147f887943be Mon Sep 17 00:00:00 2001 From: eduard322 <1HArleey1@gmail.com> Date: Thu, 5 Feb 2026 18:35:14 +0100 Subject: [PATCH 1/4] add: fix coordinate info in MTC without geofile --- SND/MTC/MTCDetHit.cxx | 20 ++++++++++++++++++-- SND/MTC/MTCDetHit.h | 8 +++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/SND/MTC/MTCDetHit.cxx b/SND/MTC/MTCDetHit.cxx index 617e9163bc..8a8f8cd9b5 100644 --- a/SND/MTC/MTCDetHit.cxx +++ b/SND/MTC/MTCDetHit.cxx @@ -5,7 +5,8 @@ #include "MTCDetHit.h" #include - +#include +#include #include "FairRunSim.h" #include "MTCDetPoint.h" #include "MTCDetector.h" @@ -45,29 +46,44 @@ MTCDetHit::MTCDetHit(int SiPMChan, const std::vector& points, Float_t total_light_yield = 0.0f; Float_t earliest_to_A = std::numeric_limits::max(); Float_t earliest_to_B = std::numeric_limits::max(); + const size_t n = points.size(); Float_t signal_sum = 0.0f; bool hit_flag = false; // Separate handling for scintillating mat (plane_type == 2) if (plane_type == 2) { + std::vector x_temp, y_temp, z_temp; + x_temp.reserve(n); + y_temp.reserve(n); + z_temp.reserve(n); for (auto* pt : points) { signal_sum += pt->GetEnergyLoss(); // Track earliest arrival time Float_t arrival = pt->GetTime(); earliest_to_B = std::min(earliest_to_B, arrival); + x_temp.push_back(pt->GetX()); + y_temp.push_back(pt->GetY()); + z_temp.push_back(pt->GetZ()); } flag = true; time = gRandom->Gaus(earliest_to_B, time_res); + // for scintillating tiles set simulated coordinates so far as the realistic geometry is not yet done. + Xch = TMath::Mean(x_temp.begin(), x_temp.end()); + Ych = TMath::Mean(y_temp.begin(), y_temp.end()); + Zch = TMath::Mean(z_temp.begin(), z_temp.end()); signals = signal_sum; return; } // Fiber hit processing - const size_t n = points.size(); total_light_yield = 0.0f; TVector3 sipmA, sipmB; MTCDet->GetSiPMPosition(SiPMChan, sipmA, sipmB); + // Define only X and Z coordinates for Sci-Fi. + Xch = sipmB.X(); + Ych = 0.0; + Zch = sipmB.Z(); for (size_t i = 0; i < n; ++i) { auto* pt = points[i]; diff --git a/SND/MTC/MTCDetHit.h b/SND/MTC/MTCDetHit.h index 5ade135148..a4bdef924d 100644 --- a/SND/MTC/MTCDetHit.h +++ b/SND/MTC/MTCDetHit.h @@ -57,17 +57,19 @@ class MTCDetHit : public ShipHit { } Int_t GetSiPM() const { return (static_cast(fDetectorID / 1000) % 10); } Int_t GetSiPMChan() const { return (fDetectorID % 1000); } + TVector3 GetChannelCoordinates() const { return TVector3(Xch, Ych, Zch); } Float_t GetEnergy() const; void setInvalid() { flag = false; } bool isValid() const { return flag; } /* - SND@LHC comment: from Guido (22.9.2021): A threshold of 3.5pe should - be used, which corresponds to 0.031MeV. 1 SiPM channel has 104 pixels, - pixel can only see 0 or >0 photons. + SND@LHC comment: from Guido (22.9.2021): A threshold of 3.5pe should + be used, which corresponds to 0.031MeV. 1 SiPM channel has 104 pixels, + pixel can only see 0 or >0 photons. */ private: Float_t signals = 0; Float_t time; + Float_t Xch, Ych, Zch; Float_t light_attenuation(Float_t distance); Float_t sipm_saturation(Float_t ly); Float_t n_pixels_to_qdc(Float_t npix); From 7e7e6adddb19096e6f46fff9c194ff3c19ce9aae Mon Sep 17 00:00:00 2001 From: eduard322 <1HArleey1@gmail.com> Date: Thu, 5 Feb 2026 18:37:02 +0100 Subject: [PATCH 2/4] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ba3842349..1bc5be3321 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -173,6 +173,7 @@ it in future. * Use STL vectors for SBT digitisation * Use maximum splitting (99) for vector branches instead of no splitting (-1) * Make TTree branch split level configurable in BaseDetector, set splitLevel=1 for MTC +* Storing channel coordinates in the digi containers. No need to read geofile #### Geometry Configuration System From ce7b47f0478e1d37d8290258ff1d4b58512cc214 Mon Sep 17 00:00:00 2001 From: eduard322 <1HArleey1@gmail.com> Date: Fri, 6 Feb 2026 13:05:13 +0100 Subject: [PATCH 3/4] fix #1 --- CHANGELOG.md | 2 +- SND/MTC/MTCDetHit.cxx | 18 +++++++----------- SND/MTC/MTCDetHit.h | 4 ++-- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bc5be3321..5d6e6806ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -173,7 +173,7 @@ it in future. * Use STL vectors for SBT digitisation * Use maximum splitting (99) for vector branches instead of no splitting (-1) * Make TTree branch split level configurable in BaseDetector, set splitLevel=1 for MTC -* Storing channel coordinates in the digi containers. No need to read geofile +* Store channel coordinates in the digi containers to avoid reading geofile #### Geometry Configuration System diff --git a/SND/MTC/MTCDetHit.cxx b/SND/MTC/MTCDetHit.cxx index 8a8f8cd9b5..e78380429b 100644 --- a/SND/MTC/MTCDetHit.cxx +++ b/SND/MTC/MTCDetHit.cxx @@ -52,25 +52,22 @@ MTCDetHit::MTCDetHit(int SiPMChan, const std::vector& points, // Separate handling for scintillating mat (plane_type == 2) if (plane_type == 2) { - std::vector x_temp, y_temp, z_temp; - x_temp.reserve(n); - y_temp.reserve(n); - z_temp.reserve(n); + Float_t x_temp = 0.0, y_temp = 0.0, z_temp = 0.0; for (auto* pt : points) { signal_sum += pt->GetEnergyLoss(); // Track earliest arrival time Float_t arrival = pt->GetTime(); earliest_to_B = std::min(earliest_to_B, arrival); - x_temp.push_back(pt->GetX()); - y_temp.push_back(pt->GetY()); - z_temp.push_back(pt->GetZ()); + x_temp += pt->GetX(); + y_temp += pt->GetY(); + z_temp += pt->GetZ(); } flag = true; time = gRandom->Gaus(earliest_to_B, time_res); // for scintillating tiles set simulated coordinates so far as the realistic geometry is not yet done. - Xch = TMath::Mean(x_temp.begin(), x_temp.end()); - Ych = TMath::Mean(y_temp.begin(), y_temp.end()); - Zch = TMath::Mean(z_temp.begin(), z_temp.end()); + Xch = x_temp / n; + Ych = y_temp / n; + Zch = z_temp / n; signals = signal_sum; return; } @@ -82,7 +79,6 @@ MTCDetHit::MTCDetHit(int SiPMChan, const std::vector& points, MTCDet->GetSiPMPosition(SiPMChan, sipmA, sipmB); // Define only X and Z coordinates for Sci-Fi. Xch = sipmB.X(); - Ych = 0.0; Zch = sipmB.Z(); for (size_t i = 0; i < n; ++i) { diff --git a/SND/MTC/MTCDetHit.h b/SND/MTC/MTCDetHit.h index a4bdef924d..d3c1998953 100644 --- a/SND/MTC/MTCDetHit.h +++ b/SND/MTC/MTCDetHit.h @@ -69,13 +69,13 @@ class MTCDetHit : public ShipHit { private: Float_t signals = 0; Float_t time; - Float_t Xch, Ych, Zch; + Float_t Xch = 0.0, Ych = 0.0, Zch = 0.0; Float_t light_attenuation(Float_t distance); Float_t sipm_saturation(Float_t ly); Float_t n_pixels_to_qdc(Float_t npix); Float_t flag; ///< flag - ClassDef(MTCDetHit, 4); + ClassDef(MTCDetHit, 5); }; #endif // SND_MTC_MTCDETHIT_H_ From 8b3c191111357afafb74ca3c3f196aace309ab80 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 6 Feb 2026 12:06:40 +0000 Subject: [PATCH 4/4] style: pre-commit fixes --- SND/MTC/MTCDetHit.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/SND/MTC/MTCDetHit.cxx b/SND/MTC/MTCDetHit.cxx index e78380429b..7714e778ed 100644 --- a/SND/MTC/MTCDetHit.cxx +++ b/SND/MTC/MTCDetHit.cxx @@ -4,9 +4,11 @@ #include "MTCDetHit.h" +#include #include + #include -#include + #include "FairRunSim.h" #include "MTCDetPoint.h" #include "MTCDetector.h" @@ -64,7 +66,8 @@ MTCDetHit::MTCDetHit(int SiPMChan, const std::vector& points, } flag = true; time = gRandom->Gaus(earliest_to_B, time_res); - // for scintillating tiles set simulated coordinates so far as the realistic geometry is not yet done. + // for scintillating tiles set simulated coordinates so far as the realistic + // geometry is not yet done. Xch = x_temp / n; Ych = y_temp / n; Zch = z_temp / n;