CMS 3D CMS Logo

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 74 of file HistoPdf.h.

Constructor & Destructor Documentation

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

Definition at line 76 of file HistoPdf.h.

References mps_fire::i, funct::HistoPdf::init(), x(), anotherprimaryvertexanalyzer_cfi::xMax, and anotherprimaryvertexanalyzer_cfi::xMin.

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