12#include <boost/serialization/array.hpp>
13#include <boost/serialization/string.hpp>
44 void SetRange(
float xMin,
float xMax,
int xNbins,
float yMin,
float yMax,
int yNbins)
60 for (
auto& bin :
fBins) {
67 void Update(
float x,
float y,
float dx,
float dy,
float ms)
70 bin.dx = std::max(bin.dx, std::fabs(dx));
71 bin.dy = std::max(bin.dy, std::fabs(dy));
72 bin.ms = std::max(bin.ms, std::fabs(ms));
80 binX = std::clamp(binX, 0,
fXnBins - 1);
81 binY = std::clamp(binY, 0,
fYnBins - 1);
89 return {
x - b.dx,
x + b.dx,
y - b.dy,
y + b.dy};
95 return {{
x - b.dx,
x + b.dx,
y - b.dy,
y + b.dy}, b.ms};
110 template<
class Archive>
130 template<
class Archive>
int fYnBins
Number of bins in Y.
SearchWindow GetSearchWindow(float x, float y) const
void SetRange(float xMin, float xMax, int xNbins, float yMin, float yMax, int yNbins)
Constructor.
int fXnBins
Number of bins in X.
int GetBin(float x, float y) const
Get bin index.
std::vector< BinData > fBins
Bin data.
std::string ToString() const
String representation of the contents.
SearchWindowMap()=default
Default constructor.
void serialize(Archive &ar, const unsigned int)
int fNbins
Total number of bins.
void Update(float x, float y, float dx, float dy, float ms)
Update the map.
~SearchWindowMap()=default
Destructor.
void Clear()
Clear the map.
friend class boost::serialization::access
Serialization function.
std::tuple< SearchWindow, float > GetSearchWindowAndMs(float x, float y) const
TODO: SZh 8.11.2022: add selection of parameterisation.
friend class boost::serialization::access
Serialization function.
void serialize(Archive &ar, const unsigned int)
std::string ToString() const
String representation of the contents.