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.

5 : xmin_(-1.0), xmax_(1.0), outOfRangeValue_(0.0) {}

◆ 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.

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

References Exception, xmax_, and xmin_.

◆ ~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.

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  }

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

◆ operator()()

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

Implements AbsHcalFunctor.

Definition at line 16 of file HcalChebyshevFunctor.cc.

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 }

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

◆ serialize()

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

Definition at line 51 of file HcalChebyshevFunctor.h.

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

References coeffs_, outOfRangeValue_, xmax_, and xmin_.

◆ xmax()

double HcalChebyshevFunctor::xmax ( ) const
inlineoverridevirtual

Reimplemented from AbsHcalFunctor.

Definition at line 34 of file HcalChebyshevFunctor.h.

34 { return xmin_; }

References xmin_.

Referenced by svgfig.XAxis::__repr__().

◆ xmin()

double HcalChebyshevFunctor::xmin ( ) const
inlineoverridevirtual

Reimplemented from AbsHcalFunctor.

Definition at line 33 of file HcalChebyshevFunctor.h.

33 { return xmax_; };

References xmax_.

Referenced by svgfig.XAxis::__repr__(), svgfig.Axes::__repr__(), svgfig.HGrid::__repr__(), svgfig.Grid::__repr__(), and svgfig.Axes::SVG().

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

DDAxes::y
HcalChebyshevFunctor::outOfRangeValue_
double outOfRangeValue_
Definition: HcalChebyshevFunctor.h:46
DDAxes::x
HcalChebyshevFunctor::coeffs_
std::vector< double > coeffs_
Definition: HcalChebyshevFunctor.h:43
trackingPlots.other
other
Definition: trackingPlots.py:1465
dqmdumpme.k
k
Definition: dqmdumpme.py:60
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
a
double a
Definition: hdecay.h:119
HcalChebyshevFunctor::xmax
double xmax() const override
Definition: HcalChebyshevFunctor.h:34
alignCSCRings.r
r
Definition: alignCSCRings.py:93
HcalChebyshevFunctor
Definition: HcalChebyshevFunctor.h:17
Exception
Definition: hltDiff.cc:246
HcalChebyshevFunctor::xmax_
double xmax_
Definition: HcalChebyshevFunctor.h:45
HcalChebyshevFunctor::xmin
double xmin() const override
Definition: HcalChebyshevFunctor.h:33
HcalChebyshevFunctor::xmin_
double xmin_
Definition: HcalChebyshevFunctor.h:44