CMS 3D CMS Logo

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::HcalPolynomialFunctor ( )
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 xmin() const override
std::vector< double > coeffs_
static unsigned int const shift
double xmax() const override
HcalPolynomialFunctor::~HcalPolynomialFunctor ( )
inlineoverride

Definition at line 32 of file HcalPolynomialFunctor.h.

References operator()(), and x.

32 {}

Member Function Documentation

bool HcalPolynomialFunctor::isEqual ( const AbsHcalFunctor other) const
inlineoverrideprotectedvirtual
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_, xmax_, xmin_, and y.

Referenced by ~HcalPolynomialFunctor().

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
template<class Archive >
void HcalPolynomialFunctor::serialize ( Archive &  ar,
unsigned   
)
inlineprivate

Definition at line 55 of file HcalPolynomialFunctor.h.

References outOfRangeValue_.

55  {
56  boost::serialization::base_object<AbsHcalFunctor>(*this);
58  }
std::vector< double > coeffs_
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_; }
double HcalPolynomialFunctor::xmin ( ) const
inlineoverridevirtual

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 52 of file HcalPolynomialFunctor.h.

Member Data Documentation

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

Definition at line 46 of file HcalPolynomialFunctor.h.

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

double HcalPolynomialFunctor::outOfRangeValue_
private

Definition at line 50 of file HcalPolynomialFunctor.h.

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

double HcalPolynomialFunctor::shift_
private

Definition at line 47 of file HcalPolynomialFunctor.h.

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

double HcalPolynomialFunctor::xmax_
private

Definition at line 49 of file HcalPolynomialFunctor.h.

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

double HcalPolynomialFunctor::xmin_
private

Definition at line 48 of file HcalPolynomialFunctor.h.

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