CMS 3D CMS Logo

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_ &&
42  outOfRangeValue_ == r.outOfRangeValue_;
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
HcalPolynomialFunctor::xmax
double xmax() const override
Definition: HcalPolynomialFunctor.h:36
HcalPolynomialFunctor::isEqual
bool isEqual(const AbsHcalFunctor &other) const override
Definition: HcalPolynomialFunctor.h:39
AbsHcalFunctor
Definition: AbsHcalFunctor.h:19
HcalPolynomialFunctor::operator()
double operator()(double x) const override
Definition: HcalPolynomialFunctor.cc:15
HcalPolynomialFunctor::coeffs_
std::vector< double > coeffs_
Definition: HcalPolynomialFunctor.h:46
HcalPolynomialFunctor::access
friend class boost::serialization::access
Definition: HcalPolynomialFunctor.h:52
DDAxes::x
HcalPolynomialFunctor
Definition: HcalPolynomialFunctor.h:16
trackingPlots.other
other
Definition: trackingPlots.py:1465
HcalPolynomialFunctor::xmax_
double xmax_
Definition: HcalPolynomialFunctor.h:49
AbsHcalFunctor.h
HcalPolynomialFunctor::serialize
void serialize(Archive &ar, unsigned)
Definition: HcalPolynomialFunctor.h:55
alignCSCRings.r
r
Definition: alignCSCRings.py:93
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
HcalPolynomialFunctor::HcalPolynomialFunctor
HcalPolynomialFunctor()
Definition: HcalPolynomialFunctor.cc:6
HcalPolynomialFunctor::xmin
double xmin() const override
Definition: HcalPolynomialFunctor.h:35
HcalPolynomialFunctor::shift_
double shift_
Definition: HcalPolynomialFunctor.h:47
HcalPolynomialFunctor::~HcalPolynomialFunctor
~HcalPolynomialFunctor() override
Definition: HcalPolynomialFunctor.h:32
HcalPolynomialFunctor::outOfRangeValue_
double outOfRangeValue_
Definition: HcalPolynomialFunctor.h:50
HcalPolynomialFunctor::xmin_
double xmin_
Definition: HcalPolynomialFunctor.h:48