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 ( )

Definition at line 6 of file HcalPolynomialFunctor.cc.

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 11 of file HcalPolynomialFunctor.cc.

16  : coeffs_(coeffs),
17  shift_(shift),
18  xmin_(xmin),
19  xmax_(xmax),
20  outOfRangeValue_(outOfRangeValue)
21 {
22 }
double xmin() const override
std::vector< double > coeffs_
static unsigned int const shift
double xmax() const override
HcalPolynomialFunctor::~HcalPolynomialFunctor ( )
inlineoverride

Definition at line 33 of file HcalPolynomialFunctor.h.

References operator()(), and x.

33 {}

Member Function Documentation

bool HcalPolynomialFunctor::isEqual ( const AbsHcalFunctor other) const
inlineoverrideprotectedvirtual
double HcalPolynomialFunctor::operator() ( double  x) const
overridevirtual

Implements AbsHcalFunctor.

Definition at line 24 of file HcalPolynomialFunctor.cc.

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

Referenced by ~HcalPolynomialFunctor().

25 {
26  double result = outOfRangeValue_;
27  if (x >= xmin_ && x <= xmax_)
28  {
29  result = 0.0;
30  if (!coeffs_.empty())
31  {
32  const double* a = &coeffs_[0];
33  const double y = x + shift_;
34  for (int deg = coeffs_.size()-1; deg >= 0; --deg)
35  {
36  result *= y;
37  result += a[deg];
38  }
39  }
40  }
41  return result;
42 }
std::vector< double > coeffs_
double a
Definition: hdecay.h:121
template<class Archive >
void HcalPolynomialFunctor::serialize ( Archive &  ar,
unsigned   
)
inlineprivate

Definition at line 61 of file HcalPolynomialFunctor.h.

References outOfRangeValue_.

62  {
63  boost::serialization::base_object<AbsHcalFunctor>(*this);
65  }
std::vector< double > coeffs_
double HcalPolynomialFunctor::xmax ( ) const
inlineoverridevirtual

Reimplemented from AbsHcalFunctor.

Definition at line 37 of file HcalPolynomialFunctor.h.

References xmin_.

Referenced by svgfig.XAxis::__repr__().

37 {return xmin_;}
double HcalPolynomialFunctor::xmin ( ) const
inlineoverridevirtual

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 58 of file HcalPolynomialFunctor.h.

Member Data Documentation

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

Definition at line 52 of file HcalPolynomialFunctor.h.

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

double HcalPolynomialFunctor::outOfRangeValue_
private

Definition at line 56 of file HcalPolynomialFunctor.h.

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

double HcalPolynomialFunctor::shift_
private

Definition at line 53 of file HcalPolynomialFunctor.h.

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

double HcalPolynomialFunctor::xmax_
private

Definition at line 55 of file HcalPolynomialFunctor.h.

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

double HcalPolynomialFunctor::xmin_
private

Definition at line 54 of file HcalPolynomialFunctor.h.

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