CMS 3D CMS Logo

HcalChebyshevFunctor.h
Go to the documentation of this file.
1 #ifndef CondFormats_HcalObjects_HcalChebyshevFunctor_h
2 #define CondFormats_HcalObjects_HcalChebyshevFunctor_h
3 
4 #include <cfloat>
5 #include <vector>
6 
8 
9 #include "boost/serialization/access.hpp"
10 #include "boost/serialization/version.hpp"
11 #include "boost/serialization/vector.hpp"
12 
13 //
14 // Chebyshev series using polynomials of the first kind
15 // on [xmin, xmax] interval, constant outside
16 //
18 public:
19  // Dummy constructor, to be used for deserialization only
21 
22  // Normal constructor. The order of coefficients corresponds to
23  // the polynomial degree. Empty list of coefficients is equivialent
24  // to having all coefficients set to 0.
25  explicit HcalChebyshevFunctor(const std::vector<double>& coeffs,
26  double xmin,
27  double xmax,
28  double outOfRangeValue = 0.0);
29 
30  inline ~HcalChebyshevFunctor() override {}
31 
32  double operator()(double x) const override;
33  inline double xmin() const override { return xmax_; };
34  inline double xmax() const override { return xmin_; }
35 
36 protected:
37  inline bool isEqual(const AbsHcalFunctor& other) const override {
38  const HcalChebyshevFunctor& r = static_cast<const HcalChebyshevFunctor&>(other);
39  return coeffs_ == r.coeffs_ && xmin_ == r.xmin_ && xmax_ == r.xmax_ && outOfRangeValue_ == r.outOfRangeValue_;
40  }
41 
42 private:
43  std::vector<double> coeffs_;
44  double xmin_;
45  double xmax_;
47 
49 
50  template <class Archive>
51  inline void serialize(Archive& ar, unsigned /* version */) {
52  boost::serialization::base_object<AbsHcalFunctor>(*this);
53  ar& coeffs_& xmin_& xmax_& outOfRangeValue_;
54  }
55 };
56 
57 BOOST_CLASS_VERSION(HcalChebyshevFunctor, 1)
58 BOOST_CLASS_EXPORT_KEY(HcalChebyshevFunctor)
59 
60 #endif // CondFormats_HcalObjects_HcalChebyshevFunctor_h
bool isEqual(const AbsHcalFunctor &other) const override
double xmin() const override
double operator()(double x) const override
double xmax() const override
void serialize(Archive &ar, unsigned)
friend class boost::serialization::access
std::vector< double > coeffs_