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.

25 : a_(1.0), b_(0.0), period_(2.0 * M_PI) {}

◆ CircularMapper1d() [2/3]

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

Definition at line 27 of file CircularMapper1d.h.

28  : a_(ca), b_(cb), period_(std::abs(cperiod)) {
29  check();
30  }

References check().

◆ CircularMapper1d() [3/3]

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

Definition at line 32 of file CircularMapper1d.h.

33  : a_(mapper.a()), b_(mapper.b()), period_(std::abs(cperiod)) {
34  check();
35  }

References check().

Member Function Documentation

◆ a()

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

Definition at line 45 of file CircularMapper1d.h.

45 { return a_; }

References a_.

◆ b()

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

Definition at line 46 of file CircularMapper1d.h.

46 { return b_; }

References b_.

◆ check()

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

Definition at line 51 of file CircularMapper1d.h.

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

References period_.

Referenced by CircularMapper1d().

◆ linearMapper()

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

Definition at line 48 of file CircularMapper1d.h.

48 { return LinearMapper1d(a_, b_); }

References a_, and b_.

◆ operator()()

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

Definition at line 37 of file CircularMapper1d.h.

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  }

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

◆ period()

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

Definition at line 47 of file CircularMapper1d.h.

47 { return period_; }

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

npstat::CircularMapper1d::check
void check()
Definition: CircularMapper1d.h:51
npstat::CircularMapper1d::period_
double period_
Definition: CircularMapper1d.h:60
DDAxes::x
npstat::NpstatInvalidArgument
Definition: NpstatException.h:38
value
Definition: value.py:1
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
npstat::CircularMapper1d::a_
double a_
Definition: CircularMapper1d.h:58
relativeConstraints.value
value
Definition: relativeConstraints.py:53
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
npstat::CircularMapper1d::b_
double b_
Definition: CircularMapper1d.h:59