From e579ec5f52518b70b825836d0af26be4181f168d Mon Sep 17 00:00:00 2001 From: Felix Weiglhofer <weiglhofer@fias.uni-frankfurt.de> Date: Tue, 24 Jan 2023 10:55:44 +0000 Subject: [PATCH] StsPhysics: Add getter for landau table. --- core/detectors/sts/CbmStsPhysics.cxx | 24 ++++++++++++++++++++++++ core/detectors/sts/CbmStsPhysics.h | 8 ++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/core/detectors/sts/CbmStsPhysics.cxx b/core/detectors/sts/CbmStsPhysics.cxx index 40775a76bc..237a28cecf 100644 --- a/core/detectors/sts/CbmStsPhysics.cxx +++ b/core/detectors/sts/CbmStsPhysics.cxx @@ -188,6 +188,30 @@ Double_t CbmStsPhysics::LandauWidth(Double_t mostProbableCharge) } // ------------------------------------------------------------------------- +std::pair<std::vector<double>, double> CbmStsPhysics::GetLandauWidthTable() const +{ + std::vector<double> landauTableFlat; + + auto landauEntry = fLandauWidth.begin(); + + landauTableFlat.push_back(landauEntry->second); + + auto prevLandauEntry = landauEntry; + landauEntry++; + + double stepSize = landauEntry->first - prevLandauEntry->first; + + for (; landauEntry != fLandauWidth.end(); landauEntry++) { + LOG_IF(fatal, stepSize != landauEntry->first - prevLandauEntry->first) + << "StsLandau table doesn't have fixed step size."; + + landauTableFlat.push_back(landauEntry->second); + prevLandauEntry = landauEntry; + } + + return std::make_pair(std::move(landauTableFlat), stepSize); +} + // ----- Particle charge for PDG PID ---------------------------------- Double_t CbmStsPhysics::ParticleCharge(Int_t pid) diff --git a/core/detectors/sts/CbmStsPhysics.h b/core/detectors/sts/CbmStsPhysics.h index 5e5068b5a9..25ee848991 100644 --- a/core/detectors/sts/CbmStsPhysics.h +++ b/core/detectors/sts/CbmStsPhysics.h @@ -15,6 +15,8 @@ #include <RtypesCore.h> // for Double_t, Int_t, Bool_t #include <map> // for map +#include <utility> +#include <vector> /** @class CbmStsPhysics ** @brief Auxiliary class for physics processes in Silicon @@ -88,8 +90,10 @@ public: **/ Double_t LandauWidth(Double_t mostProbableCharge); - std::map<Double_t, Double_t> GetLandauWidthTable() const { return fLandauWidth; } - + /** @brief Raw values of landau width interpolation table + ** @return interpolation table values and step size of table + **/ + std::pair<std::vector<double>, double> GetLandauWidthTable() const; /** @brief Energy for electron-hole pair creation in silicon ** @return Pair creation energy [GeV] -- GitLab