diff --git a/core/detectors/sts/CbmStsPhysics.cxx b/core/detectors/sts/CbmStsPhysics.cxx index 40775a76bcc2289c7df84115e14bedbb5cfb6dd0..237a28cecf181b681c8410a5eab907f0d1ea0bfa 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 5e5068b5a9ff2d14ec661cbe8384118d79ac0940..25ee84899157b7eff5eda2f9d449bc00a93b6f63 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]