CMS 3D CMS Logo

Public Member Functions | Private Member Functions

npstat::EquidistantInLogSpace Class Reference

#include <EquidistantSequence.h>

Inheritance diagram for npstat::EquidistantInLogSpace:
vector

List of all members.

Public Member Functions

 EquidistantInLogSpace (double minScale, double maxScale, unsigned nScales)
virtual ~EquidistantInLogSpace ()

Private Member Functions

 EquidistantInLogSpace ()

Detailed Description

A sequence of points equidistant in log space. Note that std::vector destructor is not virtual, so do not destroy this class by base pointer or reference.

Definition at line 38 of file EquidistantSequence.h.


Constructor & Destructor Documentation

npstat::EquidistantInLogSpace::EquidistantInLogSpace ( double  minScale,
double  maxScale,
unsigned  nScales 
)

Definition at line 38 of file EquidistantSequence.cc.

References funct::exp(), i, funct::log(), and mathSSE::sqrt().

        : std::vector<double>()
    {
        if (nScales)
            if (!(minScale > 0.0 && maxScale > 0.0))
                throw npstat::NpstatInvalidArgument(
                    "In npstat::EquidistantInLogSpace constructor: "
                    "minimum and maximum scales must be positive");
        switch (nScales)
        {
        case 0:
        break;

        case 1:
        {
            this->reserve(nScales);
            const double sc = (minScale == maxScale ? minScale :
                               sqrt(minScale*maxScale));
            push_back(sc);
        }
        break;

        default:
        {
            this->reserve(nScales);
            const double logmax = log(maxScale);
            const double logmin = log(minScale);
            const double logstep = (logmax - logmin)/(nScales - 1);
            push_back(minScale);
            for (unsigned i=1; i<nScales - 1; ++i)
                push_back(exp(logmin + i*logstep));
            push_back(maxScale);
        }
        break;
        }
    }
virtual npstat::EquidistantInLogSpace::~EquidistantInLogSpace ( ) [inline, virtual]

Definition at line 43 of file EquidistantSequence.h.

{}
npstat::EquidistantInLogSpace::EquidistantInLogSpace ( ) [private]