File indexing completed on 2024-09-07 04:35:38
0001 #ifndef CondFormats_HcalObjects_HcalInterpolatedTableFunctor_h
0002 #define CondFormats_HcalObjects_HcalInterpolatedTableFunctor_h
0003
0004 #include "CondFormats/HcalObjects/interface/HcalPiecewiseLinearFunctor.h"
0005
0006
0007
0008
0009
0010 class HcalInterpolatedTableFunctor : public AbsHcalFunctor {
0011 public:
0012
0013 HcalInterpolatedTableFunctor();
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 HcalInterpolatedTableFunctor(const std::vector<double>& values,
0027 double xmin,
0028 double xmax,
0029 bool leftExtrapolationLinear,
0030 bool rightExtrapolationLinear);
0031
0032 inline ~HcalInterpolatedTableFunctor() override {}
0033
0034 double operator()(double x) const override;
0035 inline double xmin() const override { return xmin_; }
0036 inline double xmax() const override { return xmax_; }
0037
0038
0039 bool isStrictlyMonotonous() const;
0040
0041
0042
0043 HcalPiecewiseLinearFunctor inverse() const;
0044
0045 protected:
0046 inline bool isEqual(const AbsHcalFunctor& other) const override {
0047 const HcalInterpolatedTableFunctor& r = static_cast<const HcalInterpolatedTableFunctor&>(other);
0048 return values_ == r.values_ && xmin_ == r.xmin_ && xmax_ == r.xmax_ &&
0049 leftExtrapolationLinear_ == r.leftExtrapolationLinear_ &&
0050 rightExtrapolationLinear_ == r.rightExtrapolationLinear_;
0051 }
0052
0053 private:
0054 std::vector<double> values_;
0055 double xmin_;
0056 double xmax_;
0057 bool leftExtrapolationLinear_;
0058 bool rightExtrapolationLinear_;
0059
0060 friend class boost::serialization::access;
0061
0062 template <class Archive>
0063 inline void serialize(Archive& ar, unsigned ) {
0064 boost::serialization::base_object<AbsHcalFunctor>(*this);
0065 ar & values_ & xmin_ & xmax_ & leftExtrapolationLinear_ & rightExtrapolationLinear_;
0066 }
0067 };
0068
0069 BOOST_CLASS_VERSION(HcalInterpolatedTableFunctor, 1)
0070 BOOST_CLASS_EXPORT_KEY(HcalInterpolatedTableFunctor)
0071
0072 #endif