CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

npstat::CircularMapper1d Class Reference

#include <CircularMapper1d.h>

List of all members.

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

npstat::CircularMapper1d::CircularMapper1d ( ) [inline]

Definition at line 26 of file CircularMapper1d.h.

: a_(1.0), b_(0.0), period_(2.0*M_PI) {}
npstat::CircularMapper1d::CircularMapper1d ( const double  ca,
const double  cb,
const double  cperiod 
) [inline]

Definition at line 28 of file CircularMapper1d.h.

References check().

            : a_(ca), b_(cb), period_(std::abs(cperiod)) {check();}
npstat::CircularMapper1d::CircularMapper1d ( const LinearMapper1d mapper,
const double  cperiod 
) [inline]

Definition at line 32 of file CircularMapper1d.h.

References check().

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

Member Function Documentation

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

Definition at line 46 of file CircularMapper1d.h.

References a_.

{return a_;}
double npstat::CircularMapper1d::b ( ) const [inline]

Definition at line 47 of file CircularMapper1d.h.

References b_.

{return b_;}
void npstat::CircularMapper1d::check ( void  ) [inline, private]

Definition at line 53 of file CircularMapper1d.h.

References period_.

Referenced by CircularMapper1d().

        {
            if (!period_) throw npstat::NpstatInvalidArgument(
                "In npstat::CircularMapper1d constructor: "
                "invalid period argument (can not be 0)");
        }
LinearMapper1d npstat::CircularMapper1d::linearMapper ( ) const [inline]

Definition at line 49 of file CircularMapper1d.h.

References a_, and b_.

            {return LinearMapper1d(a_, b_);}
double npstat::CircularMapper1d::operator() ( const double &  x) const [inline]

Definition at line 37 of file CircularMapper1d.h.

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

        {
            double value = a_*x + b_;
            value -= period_*floor(value/period_);
            if (value > period_/2.0)
                value -= period_;
            return value;
        }
double npstat::CircularMapper1d::period ( ) const [inline]

Definition at line 48 of file CircularMapper1d.h.

References period_.

{return period_;}

Member Data Documentation

double npstat::CircularMapper1d::a_ [private]

Definition at line 60 of file CircularMapper1d.h.

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

double npstat::CircularMapper1d::b_ [private]

Definition at line 61 of file CircularMapper1d.h.

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

Definition at line 62 of file CircularMapper1d.h.

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