#include <HistoPdf.h>
Public Member Functions | |
void | dump () |
HistoPdf () | |
template<typename Iterator > | |
HistoPdf (double xMin, double xMax, const Iterator &begin, const Iterator &end) | |
template<typename Iterator > | |
void | init (double xMin, double xMax, const Iterator &begin, const Iterator &end) |
double | operator() (double x) const |
void | rebin (unsigned int r) |
Private Attributes | |
double | binSize_ |
double | delta_ |
double | xMax_ |
double | xMin_ |
std::vector< double > | y_ |
Definition at line 7 of file HistoPdf.h.
funct::HistoPdf::HistoPdf | ( | double | xMin, |
double | xMax, | ||
const Iterator & | begin, | ||
const Iterator & | end | ||
) | [inline] |
Definition at line 10 of file HistoPdf.h.
References end, i, alignCSCRings::s, and y_.
funct::HistoPdf::HistoPdf | ( | ) | [inline] |
Definition at line 20 of file HistoPdf.h.
{ }
void funct::HistoPdf::dump | ( | void | ) | [inline] |
Definition at line 54 of file HistoPdf.h.
References binSize_, gather_cfg::cout, delta_, i, operator()(), alignCSCRings::s, x, xMax_, xMin_, detailsBasic3DVector::y, and y_.
{ std::cout << ">>> range: [" << xMin_ << ", " << xMax_ << "], bin size: " << delta_ << "/" << y_.size() << " = " << binSize_ << std::endl; double s = 0; for(unsigned int i = 0; i != y_.size(); ++i) { double x = xMin_ + (0.5 + i)*binSize_; double y = operator()(x); std::cout << ">>> pdf(" << x << ") = " << y << std::endl; s+= y*binSize_; } std::cout << ">>>: PDF normalization is " << s << std::endl; }
void funct::HistoPdf::init | ( | double | xMin, |
double | xMax, | ||
const Iterator & | begin, | ||
const Iterator & | end | ||
) | [inline] |
Definition at line 22 of file HistoPdf.h.
References begin, binSize_, delta_, end, i, n, alignCSCRings::s, xMax_, xMin_, and y_.
Referenced by funct::RootHistoPdf::RootHistoPdf().
double funct::HistoPdf::operator() | ( | double | x | ) | const [inline] |
void funct::HistoPdf::rebin | ( | unsigned int | r | ) | [inline] |
Definition at line 42 of file HistoPdf.h.
References binSize_, edm::errors::Configuration, i, j, gen::k, n, alignCSCRings::r, detailsBasic3DVector::y, and y_.
{ if(y_.size() % r != 0) throw edm::Exception(edm::errors::Configuration) << "HistoPdf: can't rebin histogram of " << y_.size() << " entries by " << r << "\n"; unsigned int n = y_.size() / r; std::vector<double> y(n, 0); for(unsigned int i = 0, j = 0; i < n; ++i) for(unsigned int k = 0; k < r; ++k) y[i] += y_[j++]; y_ = y; binSize_ *= r; }
double funct::HistoPdf::binSize_ [private] |
Definition at line 67 of file HistoPdf.h.
Referenced by dump(), init(), operator()(), and rebin().
double funct::HistoPdf::delta_ [private] |
Definition at line 67 of file HistoPdf.h.
Referenced by dump(), init(), and operator()().
double funct::HistoPdf::xMax_ [private] |
Definition at line 67 of file HistoPdf.h.
Referenced by dump(), init(), and operator()().
double funct::HistoPdf::xMin_ [private] |
Definition at line 67 of file HistoPdf.h.
Referenced by dump(), init(), and operator()().
std::vector<double> funct::HistoPdf::y_ [private] |
Definition at line 68 of file HistoPdf.h.
Referenced by dump(), HistoPdf(), init(), operator()(), and rebin().