CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
npstat::CircularMapper1d Class Reference

#include <CircularMapper1d.h>

Public Member Functions

double a () const
 
double b () const
 
 CircularMapper1d ()
 
 CircularMapper1d (const double ca, const double cb, const double cperiod)
 
 CircularMapper1d (const LinearMapper1d &mapper, const double cperiod)
 
LinearMapper1d linearMapper () const
 
double operator() (const double &x) const
 
double period () const
 

Private Member Functions

void check ()
 

Private Attributes

double a_
 
double b_
 
double period_
 

Detailed Description

1-d linear transformation functor followed by the shift of the result into the interval [-T/2, T/2], where T is the period

Definition at line 23 of file CircularMapper1d.h.

Constructor & Destructor Documentation

◆ CircularMapper1d() [1/3]

npstat::CircularMapper1d::CircularMapper1d ( )
inline

Definition at line 25 of file CircularMapper1d.h.

◆ CircularMapper1d() [2/3]

npstat::CircularMapper1d::CircularMapper1d ( const double  ca,
const double  cb,
const double  cperiod 
)
inline

Definition at line 27 of file CircularMapper1d.h.

References check().

28  : a_(ca), b_(cb), period_(std::abs(cperiod)) {
29  check();
30  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ CircularMapper1d() [3/3]

npstat::CircularMapper1d::CircularMapper1d ( const LinearMapper1d mapper,
const double  cperiod 
)
inline

Definition at line 32 of file CircularMapper1d.h.

References check().

33  : a_(mapper.a()), b_(mapper.b()), period_(std::abs(cperiod)) {
34  check();
35  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Function Documentation

◆ a()

double npstat::CircularMapper1d::a ( ) const
inline

Definition at line 45 of file CircularMapper1d.h.

References a_.

45 { return a_; }

◆ b()

double npstat::CircularMapper1d::b ( ) const
inline

Definition at line 46 of file CircularMapper1d.h.

References b_.

46 { return b_; }

◆ check()

void npstat::CircularMapper1d::check ( void  )
inlineprivate

Definition at line 51 of file CircularMapper1d.h.

References period_.

Referenced by CircularMapper1d().

51  {
52  if (!period_)
54  "In npstat::CircularMapper1d constructor: "
55  "invalid period argument (can not be 0)");
56  }

◆ linearMapper()

LinearMapper1d npstat::CircularMapper1d::linearMapper ( ) const
inline

Definition at line 48 of file CircularMapper1d.h.

References a_, and b_.

48 { return LinearMapper1d(a_, b_); }

◆ operator()()

double npstat::CircularMapper1d::operator() ( const double &  x) const
inline

Definition at line 37 of file CircularMapper1d.h.

References a_, b_, period_, relativeConstraints::value, and x.

37  {
38  double value = a_ * x + b_;
39  value -= period_ * floor(value / period_);
40  if (value > period_ / 2.0)
41  value -= period_;
42  return value;
43  }
Definition: value.py:1
float x

◆ period()

double npstat::CircularMapper1d::period ( ) const
inline

Definition at line 47 of file CircularMapper1d.h.

References period_.

47 { return period_; }

Member Data Documentation

◆ a_

double npstat::CircularMapper1d::a_
private

Definition at line 58 of file CircularMapper1d.h.

Referenced by a(), linearMapper(), and operator()().

◆ b_

double npstat::CircularMapper1d::b_
private

Definition at line 59 of file CircularMapper1d.h.

Referenced by b(), linearMapper(), and operator()().

◆ period_

double npstat::CircularMapper1d::period_
private

Definition at line 60 of file CircularMapper1d.h.

Referenced by check(), operator()(), and period().