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)
 
virtual double operator() (double x) const override
 
virtual double xmax () const override
 
virtual double xmin () const override
 
virtual ~HcalChebyshevFunctor ()
 
- Public Member Functions inherited from AbsHcalFunctor
bool operator!= (const AbsHcalFunctor &r) const
 
bool operator== (const AbsHcalFunctor &r) const
 
virtual ~AbsHcalFunctor ()
 

Protected Member Functions

virtual 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::HcalChebyshevFunctor ( )

Definition at line 5 of file HcalChebyshevFunctor.cc.

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

Definition at line 10 of file HcalChebyshevFunctor.cc.

References Exception, xmax_, and xmin_.

14  : coeffs_(coeffs),
15  xmin_(xmin),
16  xmax_(xmax),
17  outOfRangeValue_(outOfRangeValue)
18 {
19  if (xmin_ >= xmax_) throw cms::Exception(
20  "In HcalChebyshevFunctor constructor: invalid interval specification");
21 }
virtual double xmin() const override
virtual double xmax() const override
std::vector< double > coeffs_
virtual HcalChebyshevFunctor::~HcalChebyshevFunctor ( )
inlinevirtual

Definition at line 30 of file HcalChebyshevFunctor.h.

References operator()(), and x.

30 {}

Member Function Documentation

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

Implements AbsHcalFunctor.

Definition at line 23 of file HcalChebyshevFunctor.cc.

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

Referenced by ~HcalChebyshevFunctor().

24 {
25  if (!(y >= xmin_ && y <= xmax_))
26  return outOfRangeValue_;
27 
28  if (coeffs_.empty())
29  return 0.0;
30 
31  const double x = 2.0*(y - xmin_)/(xmax_ - xmin_) - 1.0;
32  const double* a = &coeffs_[0];
33  const double twox = 2.0*x;
34 
35  // Clenshaw recursion
36  double rp2 = 0.0, rp1 = 0.0, r = 0.0;
37  for (unsigned k = coeffs_.size()-1; k > 0U; --k)
38  {
39  r = twox*rp1 - rp2 + a[k];
40  rp2 = rp1;
41  rp1 = r;
42  }
43  return x*rp1 - rp2 + a[0];
44 }
int k[5][pyjets_maxn]
double a
Definition: hdecay.h:121
std::vector< double > coeffs_
template<class Archive >
void HcalChebyshevFunctor::serialize ( Archive &  ar,
unsigned   
)
inlineprivate

Definition at line 56 of file HcalChebyshevFunctor.h.

References outOfRangeValue_.

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

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 53 of file HcalChebyshevFunctor.h.

Member Data Documentation

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

Definition at line 48 of file HcalChebyshevFunctor.h.

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

double HcalChebyshevFunctor::outOfRangeValue_
private

Definition at line 51 of file HcalChebyshevFunctor.h.

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

double HcalChebyshevFunctor::xmax_
private

Definition at line 50 of file HcalChebyshevFunctor.h.

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

double HcalChebyshevFunctor::xmin_
private

Definition at line 49 of file HcalChebyshevFunctor.h.

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