CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends
HcalChebyshevFunctor Class Reference

#include <HcalChebyshevFunctor.h>

Inheritance diagram for HcalChebyshevFunctor:
AbsHcalFunctor

Public Member Functions

 HcalChebyshevFunctor ()
 
 HcalChebyshevFunctor (const std::vector< double > &coeffs, double xmin, double xmax, double outOfRangeValue=0.0)
 
double operator() (double x) const override
 
double xmax () const override
 
double xmin () const override
 
 ~HcalChebyshevFunctor () 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 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 17 of file HcalChebyshevFunctor.h.

Constructor & Destructor Documentation

◆ HcalChebyshevFunctor() [1/2]

HcalChebyshevFunctor::HcalChebyshevFunctor ( )

Definition at line 5 of file HcalChebyshevFunctor.cc.

◆ HcalChebyshevFunctor() [2/2]

HcalChebyshevFunctor::HcalChebyshevFunctor ( const std::vector< double > &  coeffs,
double  xmin,
double  xmax,
double  outOfRangeValue = 0.0 
)
explicit

Definition at line 7 of file HcalChebyshevFunctor.cc.

References Exception, xmax_, and xmin_.

11  : coeffs_(coeffs), xmin_(xmin), xmax_(xmax), outOfRangeValue_(outOfRangeValue) {
12  if (xmin_ >= xmax_)
13  throw cms::Exception("In HcalChebyshevFunctor constructor: invalid interval specification");
14 }
double xmin() const override
double xmax() const override
std::vector< double > coeffs_

◆ ~HcalChebyshevFunctor()

HcalChebyshevFunctor::~HcalChebyshevFunctor ( )
inlineoverride

Definition at line 30 of file HcalChebyshevFunctor.h.

30 {}

Member Function Documentation

◆ isEqual()

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

Implements AbsHcalFunctor.

Definition at line 37 of file HcalChebyshevFunctor.h.

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

37  {
38  const HcalChebyshevFunctor& r = static_cast<const HcalChebyshevFunctor&>(other);
39  return coeffs_ == r.coeffs_ && xmin_ == r.xmin_ && xmax_ == r.xmax_ && outOfRangeValue_ == r.outOfRangeValue_;
40  }
std::vector< double > coeffs_

◆ operator()()

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

Implements AbsHcalFunctor.

Definition at line 16 of file HcalChebyshevFunctor.cc.

References a, coeffs_, dqmdumpme::k, outOfRangeValue_, alignCSCRings::r, mitigatedMETSequence_cff::U, x, xmax_, xmin_, and y.

16  {
17  if (!(y >= xmin_ && y <= xmax_))
18  return outOfRangeValue_;
19 
20  if (coeffs_.empty())
21  return 0.0;
22 
23  const double x = 2.0 * (y - xmin_) / (xmax_ - xmin_) - 1.0;
24  const double* a = &coeffs_[0];
25  const double twox = 2.0 * x;
26 
27  // Clenshaw recursion
28  double rp2 = 0.0, rp1 = 0.0, r = 0.0;
29  for (unsigned k = coeffs_.size() - 1; k > 0U; --k) {
30  r = twox * rp1 - rp2 + a[k];
31  rp2 = rp1;
32  rp1 = r;
33  }
34  return x * rp1 - rp2 + a[0];
35 }
double a
Definition: hdecay.h:121
std::vector< double > coeffs_

◆ serialize()

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

Definition at line 51 of file HcalChebyshevFunctor.h.

References coeffs_, outOfRangeValue_, xmax_, and xmin_.

51  {
52  boost::serialization::base_object<AbsHcalFunctor>(*this);
54  }
std::vector< double > coeffs_

◆ xmax()

double HcalChebyshevFunctor::xmax ( ) const
inlineoverridevirtual

Reimplemented from AbsHcalFunctor.

Definition at line 34 of file HcalChebyshevFunctor.h.

References xmin_.

Referenced by svgfig.XAxis::__repr__().

34 { return xmin_; }

◆ xmin()

double HcalChebyshevFunctor::xmin ( ) const
inlineoverridevirtual

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 48 of file HcalChebyshevFunctor.h.

Member Data Documentation

◆ coeffs_

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

Definition at line 43 of file HcalChebyshevFunctor.h.

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

◆ outOfRangeValue_

double HcalChebyshevFunctor::outOfRangeValue_
private

Definition at line 46 of file HcalChebyshevFunctor.h.

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

◆ xmax_

double HcalChebyshevFunctor::xmax_
private

Definition at line 45 of file HcalChebyshevFunctor.h.

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

◆ xmin_

double HcalChebyshevFunctor::xmin_
private

Definition at line 44 of file HcalChebyshevFunctor.h.

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