CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends
HcalPolynomialFunctor Class Reference

#include <HcalPolynomialFunctor.h>

Inheritance diagram for HcalPolynomialFunctor:
AbsHcalFunctor

Public Member Functions

 HcalPolynomialFunctor ()
 
 HcalPolynomialFunctor (const std::vector< double > &coeffs, double shift=0.0, double xmin=-DBL_MAX, double xmax=DBL_MAX, double outOfRangeValue=0.0)
 
double operator() (double x) const override
 
double xmax () const override
 
double xmin () const override
 
 ~HcalPolynomialFunctor () override
 
- Public Member Functions inherited from AbsHcalFunctor
bool operator!= (const AbsHcalFunctor &r) const
 
bool operator== (const AbsHcalFunctor &r) const
 
virtual ~AbsHcalFunctor ()
 

Protected Member Functions

bool isEqual (const AbsHcalFunctor &other) const override
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, unsigned)
 

Private Attributes

std::vector< double > coeffs_
 
double outOfRangeValue_
 
double shift_
 
double xmax_
 
double xmin_
 

Friends

class boost::serialization::access
 

Additional Inherited Members

- Static Protected Member Functions inherited from AbsHcalFunctor
template<class Iter >
static bool isStrictlyDecreasing (Iter begin, Iter const end)
 
template<class Iter >
static bool isStrictlyIncreasing (Iter begin, Iter const end)
 

Detailed Description

Definition at line 16 of file HcalPolynomialFunctor.h.

Constructor & Destructor Documentation

◆ HcalPolynomialFunctor() [1/2]

HcalPolynomialFunctor::HcalPolynomialFunctor ( )

◆ HcalPolynomialFunctor() [2/2]

HcalPolynomialFunctor::HcalPolynomialFunctor ( const std::vector< double > &  coeffs,
double  shift = 0.0,
double  xmin = -DBL_MAX,
double  xmax = DBL_MAX,
double  outOfRangeValue = 0.0 
)
explicit

Definition at line 8 of file HcalPolynomialFunctor.cc.

13  : coeffs_(coeffs), shift_(shift), xmin_(xmin), xmax_(xmax), outOfRangeValue_(outOfRangeValue) {}
double xmax() const override
std::vector< double > coeffs_
static unsigned int const shift
double xmin() const override

◆ ~HcalPolynomialFunctor()

HcalPolynomialFunctor::~HcalPolynomialFunctor ( )
inlineoverride

Definition at line 32 of file HcalPolynomialFunctor.h.

32 {}

Member Function Documentation

◆ isEqual()

bool HcalPolynomialFunctor::isEqual ( const AbsHcalFunctor other) const
inlineoverrideprotectedvirtual

Implements AbsHcalFunctor.

Definition at line 39 of file HcalPolynomialFunctor.h.

References coeffs_, trackingPlots::other, outOfRangeValue_, alignCSCRings::r, shift_, xmax_, and xmin_.

39  {
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  }
std::vector< double > coeffs_

◆ operator()()

double HcalPolynomialFunctor::operator() ( double  x) const
overridevirtual

Implements AbsHcalFunctor.

Definition at line 15 of file HcalPolynomialFunctor.cc.

References a, coeffs_, outOfRangeValue_, mps_fire::result, shift_, x, xmax_, xmin_, and y.

15  {
16  double result = outOfRangeValue_;
17  if (x >= xmin_ && x <= xmax_) {
18  result = 0.0;
19  if (!coeffs_.empty()) {
20  const double* a = &coeffs_[0];
21  const double y = x + shift_;
22  for (int deg = coeffs_.size() - 1; deg >= 0; --deg) {
23  result *= y;
24  result += a[deg];
25  }
26  }
27  }
28  return result;
29 }
std::vector< double > coeffs_
double a
Definition: hdecay.h:119

◆ serialize()

template<class Archive >
void HcalPolynomialFunctor::serialize ( Archive &  ar,
unsigned   
)
inlineprivate

Definition at line 55 of file HcalPolynomialFunctor.h.

References coeffs_, outOfRangeValue_, shift_, xmax_, and xmin_.

55  {
56  boost::serialization::base_object<AbsHcalFunctor>(*this);
58  }
std::vector< double > coeffs_

◆ xmax()

double HcalPolynomialFunctor::xmax ( ) const
inlineoverridevirtual

Reimplemented from AbsHcalFunctor.

Definition at line 36 of file HcalPolynomialFunctor.h.

References xmin_.

Referenced by svgfig.XAxis::__repr__().

36 { return xmin_; }

◆ xmin()

double HcalPolynomialFunctor::xmin ( ) const
inlineoverridevirtual

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 52 of file HcalPolynomialFunctor.h.

Member Data Documentation

◆ coeffs_

std::vector<double> HcalPolynomialFunctor::coeffs_
private

Definition at line 46 of file HcalPolynomialFunctor.h.

Referenced by isEqual(), operator()(), and serialize().

◆ outOfRangeValue_

double HcalPolynomialFunctor::outOfRangeValue_
private

Definition at line 50 of file HcalPolynomialFunctor.h.

Referenced by isEqual(), operator()(), and serialize().

◆ shift_

double HcalPolynomialFunctor::shift_
private

Definition at line 47 of file HcalPolynomialFunctor.h.

Referenced by isEqual(), operator()(), and serialize().

◆ xmax_

double HcalPolynomialFunctor::xmax_
private

Definition at line 49 of file HcalPolynomialFunctor.h.

Referenced by isEqual(), operator()(), serialize(), and xmin().

◆ xmin_

double HcalPolynomialFunctor::xmin_
private

Definition at line 48 of file HcalPolynomialFunctor.h.

Referenced by isEqual(), operator()(), serialize(), and xmax().