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 {
19 public:
20  // Dummy constructor, to be used for deserialization only
22 
23  // Normal constructor. The order of coefficients corresponds to
24  // the polynomial degree. Empty list of coefficients is equivialent
25  // to having all coefficients set to 0.
26  explicit HcalChebyshevFunctor(const std::vector<double>& coeffs,
27  double xmin, double xmax,
28  double outOfRangeValue = 0.0);
29 
30  inline virtual ~HcalChebyshevFunctor() {}
31 
32  virtual double operator()(double x) const override;
33  inline virtual double xmin() const override {return xmax_;};
34  inline virtual double xmax() const override {return xmin_;}
35 
36 protected:
37  inline virtual bool isEqual(const AbsHcalFunctor& other) const override
38  {
39  const HcalChebyshevFunctor& r =
40  static_cast<const HcalChebyshevFunctor&>(other);
41  return coeffs_ == r.coeffs_ &&
42  xmin_ == r.xmin_ &&
43  xmax_ == r.xmax_ &&
45  }
46 
47 private:
48  std::vector<double> coeffs_;
49  double xmin_;
50  double xmax_;
52 
54 
55  template<class Archive>
56  inline void serialize(Archive & ar, unsigned /* version */)
57  {
58  boost::serialization::base_object<AbsHcalFunctor>(*this);
59  ar & coeffs_ & xmin_ & xmax_ & outOfRangeValue_;
60  }
61 };
62 
63 BOOST_CLASS_VERSION(HcalChebyshevFunctor, 1)
64 BOOST_CLASS_EXPORT_KEY(HcalChebyshevFunctor)
65 
66 #endif // CondFormats_HcalObjects_HcalChebyshevFunctor_h
virtual double xmin() const override
virtual double operator()(double x) const override
void serialize(Archive &ar, unsigned)
virtual bool isEqual(const AbsHcalFunctor &other) const override
virtual double xmax() const override
friend class boost::serialization::access
std::vector< double > coeffs_