#include <GridAxis.h>
Public Member Functions | |
std::pair< unsigned, double > | getInterval (double coordinate) const |
bool | isClose (const GridAxis &r, double tol) const |
std::pair< unsigned, double > | linearInterval (double coordinate) const |
bool | operator!= (const GridAxis &r) const |
bool | operator== (const GridAxis &r) const |
void | setLabel (const char *newlabel) |
GridAxis (const std::vector< double > &coords, bool useLogSpace=false) | |
GridAxis (const std::vector< double > &coords, const char *label, bool useLogSpace=false) | |
const std::vector< double > & | coords () const |
const std::string & | label () const |
bool | usesLogSpace () const |
unsigned | nCoords () const |
double | coordinate (const unsigned i) const |
double | min () const |
double | max () const |
double | length () const |
bool | isUniform () const |
unsigned | nIntervals () const |
double | intervalWidth (const unsigned i=0) const |
gs::ClassId | classId () const |
bool | write (std::ostream &of) const |
Static Public Member Functions | |
static const char * | classname () |
static GridAxis * | read (const gs::ClassId &id, std::istream &in) |
static unsigned | version () |
Private Member Functions | |
GridAxis () | |
void | initialize () |
Private Attributes | |
std::vector< double > | coords_ |
std::string | label_ |
std::vector< double > | logs_ |
unsigned | npt_ |
bool | useLogSpace_ |
Information needed to define an axis of a rectangular grid. The distance between grid points can change from point to point.
The UniformAxis class will be more efficient in representing equidistant grids.
Definition at line 30 of file GridAxis.h.
|
explicit |
The number of grid coordinates provided must be at least 2. Coordinates will be sorted internally in the increasing order.
Definition at line 38 of file GridAxis.cc.
References initialize().
npstat::GridAxis::GridAxis | ( | const std::vector< double > & | coords, |
const char * | label, | ||
bool | useLogSpace = false |
||
) |
|
inlineprivate |
|
inline |
Method related to "geners" I/O
Definition at line 115 of file GridAxis.h.
Referenced by npstat::DualAxis::write().
|
inlinestatic |
Definition at line 119 of file GridAxis.h.
|
inline |
Definition at line 85 of file GridAxis.h.
References coords_.
Referenced by npstat::convertToHistoAxis(), and npstat::DualAxis::coordinate().
|
inline |
Basic accessor returning a parameter provided in the constructor
Definition at line 46 of file GridAxis.h.
References coords_.
Referenced by npstat::DualAxis::coords(), and read().
std::pair< unsigned, double > npstat::GridAxis::getInterval | ( | double | coordinate | ) | const |
This method returns the grid interval number and the weight of the point at the left side of the interval. The weight will be set to 1 if the given coordinate coincides with the grid point and will decay to 0 linearly as the coordinate moves towards the next point on the right.
The coordinates below the leftmost grid point are mapped into the 0th interval with weight 1. The coordinates above the rightmost grid point are mapped into the last interval with weight 0 for the left point (it is expected that weight 1 will then be assigned to the right point).
Definition at line 58 of file GridAxis.cc.
References EnergyCorrector::c, coords_, prof2calltree::l, cmsBatch::log, logs_, npt_, useLogSpace_, w, and x.
Referenced by npstat::DualAxis::getInterval().
|
private |
Definition at line 12 of file GridAxis.cc.
References EnergyCorrector::c, coords_, i, cmsBatch::log, logs_, npt_, python.multivaluedict::sort(), and useLogSpace_.
Referenced by GridAxis().
|
inline |
bool npstat::GridAxis::isClose | ( | const GridAxis & | r, |
double | tol | ||
) | const |
Check for closeness of coordinates with another axis within the given relative tolerance
Definition at line 181 of file GridAxis.cc.
References npstat::closeWithinTolerance(), coords_, i, label_, gen::n, and useLogSpace_.
|
inline |
Definition at line 90 of file GridAxis.h.
|
inline |
Definition at line 47 of file GridAxis.h.
References label_.
Referenced by npstat::convertToHistoAxis(), npstat::DualAxis::label(), and read().
|
inline |
Definition at line 89 of file GridAxis.h.
References coords_.
Referenced by npstat::DualAxis::length().
std::pair< unsigned, double > npstat::GridAxis::linearInterval | ( | double | coordinate | ) | const |
This method returns the grid interval number and the weight of the point at the left side of the interval. The weight will be set to 1 if the given coordinate coincides with the grid point and will decay to 0 linearly as the coordinate moves towards the next point on the right. The weight for the point on the right should be set to one minus the weight on the left.
The coordinates outside of grid boundaries will result in weights which are less than zero or more than one. They will be calculated by linear extrapolation from the closest interval in the grid (i.e., leftmost or rightmost).
Definition at line 88 of file GridAxis.cc.
References EnergyCorrector::c, coords_, prof2calltree::l, cmsBatch::log, logs_, npt_, useLogSpace_, w, and x.
Referenced by npstat::DualAxis::linearInterval().
|
inline |
Definition at line 88 of file GridAxis.h.
References coords_.
Referenced by npstat::DualAxis::max().
|
inline |
Definition at line 87 of file GridAxis.h.
References coords_.
Referenced by npstat::DualAxis::min().
|
inline |
Convenience accessor
Definition at line 84 of file GridAxis.h.
References npt_.
Referenced by npstat::convertToHistoAxis(), and npstat::DualAxis::nCoords().
|
inline |
Definition at line 91 of file GridAxis.h.
References coords_.
Referenced by npstat::DualAxis::nIntervals().
|
inline |
Logical negation of operator==
Definition at line 100 of file GridAxis.h.
References alignCSCRings::r.
bool npstat::GridAxis::operator== | ( | const GridAxis & | r | ) | const |
Compare two grids for equality
Definition at line 174 of file GridAxis.cc.
References coords_, label_, and useLogSpace_.
|
static |
Definition at line 154 of file GridAxis.cc.
References coords(), cond::rpcobimon::current, GridAxis(), label(), and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by npstat::DualAxis::read().
|
inline |
Modify the axis label
Definition at line 110 of file GridAxis.h.
References label_.
Referenced by npstat::DualAxis::setLabel().
|
inline |
Definition at line 48 of file GridAxis.h.
References useLogSpace_.
Referenced by npstat::DualAxis::usesLogSpace().
|
inlinestatic |
Definition at line 120 of file GridAxis.h.
bool npstat::GridAxis::write | ( | std::ostream & | of | ) | const |
Definition at line 144 of file GridAxis.cc.
References coords_, label_, and useLogSpace_.
Referenced by npstat::DualAxis::write().
|
private |
Definition at line 126 of file GridAxis.h.
Referenced by coordinate(), coords(), getInterval(), initialize(), intervalWidth(), isClose(), length(), linearInterval(), max(), min(), nIntervals(), operator==(), and write().
|
private |
Definition at line 128 of file GridAxis.h.
Referenced by Mixins._Labelable::_findDependencies(), Mixins._TypedParameterizable::dumpPython(), isClose(), label(), operator==(), setLabel(), Mixins._Labelable::setLabel(), and write().
|
private |
Definition at line 127 of file GridAxis.h.
Referenced by getInterval(), initialize(), and linearInterval().
|
private |
Definition at line 129 of file GridAxis.h.
Referenced by getInterval(), initialize(), linearInterval(), and nCoords().
|
private |
Definition at line 130 of file GridAxis.h.
Referenced by getInterval(), initialize(), isClose(), linearInterval(), operator==(), usesLogSpace(), and write().