14#include <boost/serialization/vector.hpp>
38 MaterialMap(
int nBins,
float xyMax,
float zRef,
float zMin,
float zMax);
58 void Add(const
MaterialMap& other,
float zTarg = defs::Undef<
float>);
61 int GetBin(
float x,
float y) const;
64 int GetNbins()
const {
return fNbins; }
85 if constexpr (std::is_same_v<I, fvec>) {
87 for (
size_t i = 0; i < utils::simd::Size<I>(); ++i) {
88 res[i] = GetThicknessX0(
x[i],
y[i]);
95 int i =
static_cast<int>((xNew + fXYmax) * fFactor);
96 int j =
static_cast<int>((yNew + fXYmax) * fFactor);
97 i = (i < fNbins && i >= 0) ? i : fNbins / 2;
98 j = (j < fNbins && j >= 0) ? j : fNbins / 2;
99 return fTable[i + j * fNbins];
109 if constexpr (std::is_same_v<I, fvec>) {
111 for (
size_t i = 0; i < utils::simd::Size<I>(); ++i) {
112 res[i] = GetBinThicknessX0<fscal>(iGlob);
117 return fTable[iGlob];
128 return GetBinThicknessX0<I>(iX + iY * fNbins);
134 return utils::IsUndefined(fNbins) || utils::IsUndefined(fXYmax * fFactor * fZref * fZmin * fZmax);
139 void Rebin(
int factor);
148 void SetRadThickBin(
int iBinX,
int iBinY,
float thickness) { fTable[iBinX + fNbins * iBinY] = thickness; }
156 std::string
ToString(
int indentLevel = 0,
int verbose = 1)
const;
164 void CheckConsistency()
const;
167 int fNbins = defs::Undef<int>;
168 float fXYmax = defs::Undef<float>;
169 float fFactor = defs::Undef<float>;
170 float fZref = defs::Undef<float>;
171 float fZmin = defs::Undef<float>;
172 float fZmax = defs::Undef<float>;
173 std::vector<float> fTable{};
176 friend class boost::serialization::access;
177 template<
class Archive>
std::string ToString(ECbmModuleId modId)
bool Add(const std::vector< litfloat > &a, const std::vector< litfloat > &b, std::vector< litfloat > &c)
Common constant definitions for the Kalman Filter library.
A map of station thickness in units of radiation length (X0) to the specific point in XY plane.
float GetXYmax() const
Gets radius of the material table [cm].
MaterialMap & operator=(const MaterialMap &other)=default
Copy assignment operator.
float GetZmin() const
Gets minimal Z of the collected material [cm].
~MaterialMap() noexcept=default
Destructor.
float GetZref() const
Gets reference Z of the material [cm].
float fZref
Reference Z of the collected material [cm].
void SetRadThickBin(int iBinX, int iBinY, float thickness)
Sets value of material thickness in units of X0 for a given cell of the material table.
MaterialMap(const MaterialMap &other)=default
Copy constructor.
MaterialMap()=default
Default constructor.
I GetBinThicknessX0(int iGlob) const
Gets material thickness in units of radiational length X0.
friend bool operator<(const MaterialMap &lhs, const MaterialMap &rhs)
Comparison operator (material map ordering by fZref)
I GetThicknessX0(const I &x, const I &y) const
Gets material thickness in units of radiational length X0.
void serialize(Archive &ar, const unsigned int)
float GetZmax() const
Gets maximal Z of the collected material [cm].
bool IsUndefined() const
Function to test the instance for NaN.
I GetBinThicknessX0(int iX, int iY) const
Gets material thickness in units of radiational length X0.