12 #ifndef RecoJets_FFTJetAlgorithms_LinInterpolatedTable1D_h 13 #define RecoJets_FFTJetAlgorithms_LinInterpolatedTable1D_h 20 #include "fftjet/SimpleFunctors.hh" 29 template <
typename RealN>
42 template <
typename RealN>
54 double operator()(
const double& x)
const override;
66 inline const double*
data()
const {
return &
data_[0]; }
89 const double x0,
const double x1,
const double y0,
const double y1,
const double x) {
90 return y0 + (
y1 - y0) * ((
x - x0) / (x1 - x0));
107 template <
typename RealN>
122 monotonicityKnown_(
false) {
124 throw cms::Exception(
"FFTJetBadConfig") <<
"No data configured" << std::endl;
126 throw cms::Exception(
"FFTJetBadConfig") <<
"Not enough data points" << std::endl;
129 template <
typename RealN>
136 binwidth_((xmax_ - xmin_) / (
npoints - 1
U)),
141 monotonicityKnown_(
false) {
142 const unsigned len =
v.size();
144 throw cms::Exception(
"FFTJetBadConfig") <<
"Not enough data for interpolation" << std::endl;
147 throw cms::Exception(
"FFTJetBadConfig") <<
"Not enough interpolation table entries" << std::endl;
149 const std::pair<RealN, RealN>* vdata = &
v[0];
150 for (
unsigned i = 1;
i < len; ++
i)
152 throw cms::Exception(
"FFTJetBadConfig") <<
"Input data is not sorted properly" << std::endl;
177 unsigned ibelow = 0, iabove = 1;
180 while (static_cast<double>(
v[iabove].
first) <=
x) {
185 data_[
i +
shift] = (
v[ibelow].second +
v[iabove].second) / 2.0;
192 #endif // RecoJets_FFTJetAlgorithms_LinInterpolatedTable1D_h std::vector< double > data_
bool operator==(const LinInterpolatedTable1D &r) const
bool rightExtrapolationLinear() const
U second(std::pair< T, U > const &p)
bool leftExtrapolationLinear() const
static double interpolateSimple(const double x0, const double x1, const double y0, const double y1, const double x)
const double * data() const
bool rightExtrapolationLinear_
bool isMonotonous() const
std::unique_ptr< LinInterpolatedTable1D > inverse(unsigned npoints, bool leftExtrapolationLinear, bool rightExtrapolationLinear) const
double operator()(const double &x) const override
char data[epos_bytes_allocation]
~LinInterpolatedTable1D() override
static unsigned int const shift
LinInterpolatedTable1D(const RealN *data, unsigned npoints, double x_min, double x_max, bool leftExtrapolationLinear, bool rightExtrapolationLinear)
bool operator!=(const LinInterpolatedTable1D &r) const
bool leftExtrapolationLinear_