CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
funct::RootHistoPdf Class Reference

#include <HistoPdf.h>

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

Public Member Functions

 RootHistoPdf (const TH1 &histo, double fMin, double fMax)
 
- Public Member Functions inherited from funct::HistoPdf
void dump ()
 
template<typename Iterator >
 HistoPdf (double xMin, double xMax, const Iterator &begin, const Iterator &end)
 
 HistoPdf ()
 
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)
 

Detailed Description

Definition at line 71 of file HistoPdf.h.

Constructor & Destructor Documentation

funct::RootHistoPdf::RootHistoPdf ( const TH1 &  histo,
double  fMin,
double  fMax 
)
inlineexplicit

Definition at line 73 of file HistoPdf.h.

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

73  {
74  unsigned int nBins = histo.GetNbinsX();
75  std::vector<double> y;
76  y.reserve(nBins);
77  double xMin = histo.GetXaxis()->GetXmin();
78  double xMax = histo.GetXaxis()->GetXmax();
79  double deltaX =(xMax - xMin) / nBins;
80  for(unsigned int i = 0; i != nBins; ++i) {
81  double x = xMin + (i + .5) * deltaX;
82  if(x > fMin && x < fMax) {
83  y.push_back(histo.GetBinContent(i+1));
84  }
85  }
86  init(fMin, fMax, y.begin(), y.end());
87  }
int i
Definition: DBlmapReader.cc:9
void init(double xMin, double xMax, const Iterator &begin, const Iterator &end)
Definition: HistoPdf.h:22