CMS 3D CMS Logo

HistogramGenerator.cc
Go to the documentation of this file.
2 
3 //#include "TAxis.h"
4 
5 double HistogramGenerator::ersatzt(double x) {
6  int ibin = theXaxis->FindBin(x);
7  // std::cout << x << " Bin " << ibin << std::endl;
8  double x1 = myHisto->GetBinLowEdge(ibin);
9  double x2 = x1 + myHisto->GetBinWidth(ibin);
10  double y1 = myHisto->GetBinContent(ibin);
11  double y2;
12  if (ibin < nbins)
13  y2 = myHisto->GetBinContent(ibin + 1);
14  else
15  y2 = y1;
16  // std::cout << " X1 " << x1 <<" X2 " << x2 << " Y1 " <<y1 << " Y2 " << y2 << std::endl;
17  return y2 + (y1 - y2) * (x2 - x) / (x2 - x1);
18 }
TH1 * myHisto
Pointer to the histogram.
TAxis * theXaxis
the axis
float x
double ersatzt(double x)
Gamma Function.