CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HcalPolynomialFunctor.h
Go to the documentation of this file.
1 #ifndef CondFormats_HcalObjects_HcalPolynomialFunctor_h
2 #define CondFormats_HcalObjects_HcalPolynomialFunctor_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 // Polynomial on the interval [xmin, xmax], constant outside
15 //
17 public:
18  // Dummy constructor, to be used for deserialization only
20 
21  // Normal constructor. The order of coefficients
22  // corresponds to the monomial degree. The coefficients
23  // are for the monomial in the variable y = (x + shift).
24  // Empty list of coefficients is equivialent to having
25  // all coefficients set to 0.
26  explicit HcalPolynomialFunctor(const std::vector<double>& coeffs,
27  double shift = 0.0,
28  double xmin = -DBL_MAX,
29  double xmax = DBL_MAX,
30  double outOfRangeValue = 0.0);
31 
32  inline ~HcalPolynomialFunctor() override {}
33 
34  double operator()(double x) const override;
35  inline double xmin() const override { return xmax_; };
36  inline double xmax() const override { return xmin_; }
37 
38 protected:
39  inline bool isEqual(const AbsHcalFunctor& other) const override {
40  const HcalPolynomialFunctor& r = static_cast<const HcalPolynomialFunctor&>(other);
41  return coeffs_ == r.coeffs_ && shift_ == r.shift_ && xmin_ == r.xmin_ && xmax_ == r.xmax_ &&
43  }
44 
45 private:
46  std::vector<double> coeffs_;
47  double shift_;
48  double xmin_;
49  double xmax_;
51 
53 
54  template <class Archive>
55  inline void serialize(Archive& ar, unsigned /* version */) {
56  boost::serialization::base_object<AbsHcalFunctor>(*this);
58  }
59 };
60 
61 BOOST_CLASS_VERSION(HcalPolynomialFunctor, 1)
62 BOOST_CLASS_EXPORT_KEY(HcalPolynomialFunctor)
63 
64 #endif // CondFormats_HcalObjects_HcalPolynomialFunctor_h
void serialize(Archive &ar, unsigned)
double operator()(double x) const override
bool isEqual(const AbsHcalFunctor &other) const override
double xmax() const override
std::vector< double > coeffs_
friend class boost::serialization::access
static unsigned int const shift
double xmin() const override