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