File indexing completed on 2024-04-06 12:19:19
0001 #ifndef NPSTAT_COORDINATESELECTOR_HH_
0002 #define NPSTAT_COORDINATESELECTOR_HH_
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <climits>
0016 #include "JetMETCorrections/InterpolationTables/interface/NpstatException.h"
0017
0018 #include "JetMETCorrections/InterpolationTables/interface/AbsMultivariateFunctor.h"
0019
0020 namespace npstat {
0021
0022
0023
0024
0025 class CoordinateSelector : public AbsMultivariateFunctor {
0026 public:
0027 inline explicit CoordinateSelector(const unsigned i) : index_(i) {}
0028
0029 CoordinateSelector() = delete;
0030
0031 inline ~CoordinateSelector() override {}
0032
0033 inline double operator()(const double* point, const unsigned dim) const override {
0034 if (dim <= index_)
0035 throw npstat::NpstatInvalidArgument(
0036 "In npstat::CoordinateSelector::operator(): "
0037 "input array dimensionality is too small");
0038 return point[index_];
0039 }
0040 inline unsigned minDim() const override { return index_ + 1U; }
0041 inline unsigned maxDim() const override { return UINT_MAX; }
0042
0043 private:
0044 unsigned index_;
0045 };
0046 }
0047
0048 #endif