1 #ifndef PhysicsTools_Utilities_HistoChiSquare_h 2 #define PhysicsTools_Utilities_HistoChiSquare_h 15 nBins_ = histo->GetNbinsX();
16 xMin_ = histo->GetXaxis()->GetXmin();
17 xMax_ = histo->GetXaxis()->GetXmax();
20 cont_.push_back( histo->GetBinContent(
i+1) );
21 err_.push_back( histo->GetBinError(
i+1) );
28 if((x >
rangeMin_)&&(x < rangeMax_)&&(err_[i] > 0)) {
36 nBins_ = histo->GetNbinsX();
37 xMin_ = histo->GetXaxis()->GetXmin();
38 xMax_ = histo->GetXaxis()->GetXmax();
45 if((x >
rangeMin_)&&(x < rangeMax_)&&(err_[i] > 0))
50 T &
function() {
return *
t_; }
51 const T &
function()
const {
return *
t_; }
65 std::cout <<
"chi-squared/n.d.o.f. = " << amin <<
"/" << ndof <<
" = " << amin/ndof
66 <<
"; prob: " << TMath::Prob(amin, ndof)
HistoChiSquare(T &t, TH1 *histo, double rangeMin, double rangeMax)
void setHistos(TH1 *histo)
size_t numberOfBins() const
T x() const
Cartesian x coordinate.
std::vector< double > cont_
std::vector< double > err_
double operator()() const
static void print(double amin, unsigned int numberOfFreeParameters, const HistoChiSquare< T > &f)