CMS 3D CMS Logo

Public Member Functions

funct::RootHistoPdf Class Reference

#include <HistoPdf.h>

Inheritance diagram for funct::RootHistoPdf:
funct::HistoPdf

List of all members.

Public Member Functions

 RootHistoPdf (const TH1 &histo, double fMin, double fMax)

Detailed Description

Definition at line 71 of file HistoPdf.h.


Constructor & Destructor Documentation

funct::RootHistoPdf::RootHistoPdf ( const TH1 &  histo,
double  fMin,
double  fMax 
) [inline, explicit]

Definition at line 73 of file HistoPdf.h.

References i, funct::HistoPdf::init(), x, and detailsBasic3DVector::y.

                                                                       {
      unsigned int nBins = histo.GetNbinsX();
      std::vector<double> y;      
      y.reserve(nBins);
      double xMin = histo.GetXaxis()->GetXmin();
      double xMax = histo.GetXaxis()->GetXmax();
      double deltaX =(xMax - xMin) / nBins;
      for(unsigned int i = 0; i != nBins; ++i) {
        double x = xMin + (i + .5) * deltaX;
        if(x > fMin && x < fMax) {
          y.push_back(histo.GetBinContent(i+1));
        }
      }
      init(fMin, fMax, y.begin(), y.end());
    }