#include <PhysicsTools/Utilities/interface/HistoChiSquare.h>
Public Member Functions | |
size_t | degreesOfFreedom () const |
const T & | function () const |
T & | function () |
HistoChiSquare (T &t, TH1 *histo, double rangeMin, double rangeMax) | |
HistoChiSquare () | |
double | operator() () const |
void | setHistos (TH1 *histo) |
Private Attributes | |
std::vector< double > | cont_ |
double | deltaX_ |
std::vector< double > | err_ |
size_t | nBins_ |
double | rangeMax_ |
double | rangeMin_ |
T * | t_ |
double | xMax_ |
double | xMin_ |
Definition at line 8 of file HistoChiSquare.h.
fit::HistoChiSquare< T >::HistoChiSquare | ( | ) | [inline] |
fit::HistoChiSquare< T >::HistoChiSquare | ( | T & | t, | |
TH1 * | histo, | |||
double | rangeMin, | |||
double | rangeMax | |||
) | [inline] |
Definition at line 11 of file HistoChiSquare.h.
00011 : 00012 t_(&t), rangeMin_(rangeMin), rangeMax_(rangeMax) { 00013 nBins_ = histo->GetNbinsX(); 00014 xMin_ = histo->GetXaxis()->GetXmin(); 00015 xMax_ = histo->GetXaxis()->GetXmax(); 00016 deltaX_ =(xMax_ - xMin_) / nBins_; 00017 for(size_t i = 0; i < nBins_; ++i) { 00018 cont_.push_back( histo->GetBinContent(i+1) ); 00019 err_.push_back( histo->GetBinError(i+1) ); 00020 } 00021 }
size_t fit::HistoChiSquare< T >::degreesOfFreedom | ( | ) | const [inline] |
Definition at line 39 of file HistoChiSquare.h.
Referenced by fit::MultiHistoChiSquare< T1, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg >::degreesOfFreedom(), fit::MultiHistoChiSquare< T1, T2, T3, T4, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg >::degreesOfFreedom(), fit::MultiHistoChiSquare< T1, T2, T3, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg >::degreesOfFreedom(), fit::MultiHistoChiSquare< T1, T2, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg >::degreesOfFreedom(), fit::MultiHistoChiSquare< T1, T2, T3, T4, T5, helper::MultiHistoChiSquareNoArg >::degreesOfFreedom(), and fit::MultiHistoChiSquare< T1, T2, T3, T4, T5, T6 >::degreesOfFreedom().
00039 { 00040 size_t fullBins = 0; 00041 for(size_t i = 0; i < nBins_; ++i) { 00042 double x = xMin_ + ( i +.5 ) * deltaX_; 00043 if((x > rangeMin_)&&(x < rangeMax_)&&(err_[i] > 0)) 00044 fullBins++; 00045 } 00046 return fullBins; 00047 }
const T& fit::HistoChiSquare< T >::function | ( | ) | const [inline] |
T& fit::HistoChiSquare< T >::function | ( | ) | [inline] |
Definition at line 48 of file HistoChiSquare.h.
Referenced by fit::MultiHistoChiSquare< T1, T2, T3, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg >::function1(), fit::MultiHistoChiSquare< T1, T2, T3, T4, T5, T6 >::function1(), fit::MultiHistoChiSquare< T1, T2, T3, T4, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg >::function1(), fit::MultiHistoChiSquare< T1, T2, T3, T4, T5, helper::MultiHistoChiSquareNoArg >::function1(), fit::MultiHistoChiSquare< T1, T2, T3, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg >::function2(), fit::MultiHistoChiSquare< T1, T2, T3, T4, T5, T6 >::function2(), fit::MultiHistoChiSquare< T1, T2, T3, T4, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg >::function2(), fit::MultiHistoChiSquare< T1, T2, T3, T4, T5, helper::MultiHistoChiSquareNoArg >::function2(), fit::MultiHistoChiSquare< T1, T2, T3, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg >::function3(), fit::MultiHistoChiSquare< T1, T2, T3, T4, T5, T6 >::function3(), fit::MultiHistoChiSquare< T1, T2, T3, T4, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg >::function3(), fit::MultiHistoChiSquare< T1, T2, T3, T4, T5, helper::MultiHistoChiSquareNoArg >::function3(), fit::MultiHistoChiSquare< T1, T2, T3, T4, T5, T6 >::function4(), fit::MultiHistoChiSquare< T1, T2, T3, T4, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg >::function4(), fit::MultiHistoChiSquare< T1, T2, T3, T4, T5, helper::MultiHistoChiSquareNoArg >::function4(), fit::MultiHistoChiSquare< T1, T2, T3, T4, T5, T6 >::function5(), fit::MultiHistoChiSquare< T1, T2, T3, T4, T5, helper::MultiHistoChiSquareNoArg >::function5(), and fit::MultiHistoChiSquare< T1, T2, T3, T4, T5, T6 >::function6().
00048 { return * t_; }
double fit::HistoChiSquare< T >::operator() | ( | void | ) | const [inline] |
Definition at line 22 of file HistoChiSquare.h.
00022 { 00023 double chi2 = 0; 00024 for(size_t i = 0; i < nBins_; ++i) { 00025 double x = xMin_ + ( i +.5 ) * deltaX_; 00026 if((x > rangeMin_)&&(x < rangeMax_)&&(err_[i] > 0)) { 00027 double r = ( cont_[i] - (*t_)(x) )/err_[i]; 00028 chi2 += (r * r); 00029 } 00030 } 00031 return chi2; 00032 }
void fit::HistoChiSquare< T >::setHistos | ( | TH1 * | histo | ) | [inline] |
Definition at line 33 of file HistoChiSquare.h.
Referenced by fit::MultiHistoChiSquare< T1, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg >::setHistos(), fit::MultiHistoChiSquare< T1, T2, T3, T4, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg >::setHistos(), fit::MultiHistoChiSquare< T1, T2, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg >::setHistos(), fit::MultiHistoChiSquare< T1, T2, T3, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg, helper::MultiHistoChiSquareNoArg >::setHistos(), fit::MultiHistoChiSquare< T1, T2, T3, T4, T5, helper::MultiHistoChiSquareNoArg >::setHistos(), and fit::MultiHistoChiSquare< T1, T2, T3, T4, T5, T6 >::setHistos().
00033 { 00034 nBins_ = histo->GetNbinsX(); 00035 xMin_ = histo->GetXaxis()->GetXmin(); 00036 xMax_ = histo->GetXaxis()->GetXmax(); 00037 deltaX_ =(xMax_ - xMin_) / nBins_; 00038 }
std::vector<double> fit::HistoChiSquare< T >::cont_ [private] |
Definition at line 55 of file HistoChiSquare.h.
Referenced by fit::HistoChiSquare< T6 >::HistoChiSquare(), and fit::HistoChiSquare< T6 >::operator()().
double fit::HistoChiSquare< T >::deltaX_ [private] |
Definition at line 54 of file HistoChiSquare.h.
Referenced by fit::HistoChiSquare< T6 >::degreesOfFreedom(), fit::HistoChiSquare< T6 >::HistoChiSquare(), fit::HistoChiSquare< T6 >::operator()(), and fit::HistoChiSquare< T6 >::setHistos().
std::vector<double> fit::HistoChiSquare< T >::err_ [private] |
Definition at line 56 of file HistoChiSquare.h.
Referenced by fit::HistoChiSquare< T6 >::HistoChiSquare(), and fit::HistoChiSquare< T6 >::operator()().
size_t fit::HistoChiSquare< T >::nBins_ [private] |
Definition at line 53 of file HistoChiSquare.h.
Referenced by fit::HistoChiSquare< T6 >::degreesOfFreedom(), fit::HistoChiSquare< T6 >::HistoChiSquare(), fit::HistoChiSquare< T6 >::operator()(), and fit::HistoChiSquare< T6 >::setHistos().
double fit::HistoChiSquare< T >::rangeMax_ [private] |
Definition at line 52 of file HistoChiSquare.h.
double fit::HistoChiSquare< T >::rangeMin_ [private] |
Definition at line 52 of file HistoChiSquare.h.
Referenced by fit::HistoChiSquare< T6 >::degreesOfFreedom(), and fit::HistoChiSquare< T6 >::operator()().
T* fit::HistoChiSquare< T >::t_ [private] |
Definition at line 51 of file HistoChiSquare.h.
Referenced by fit::HistoChiSquare< T6 >::function().
double fit::HistoChiSquare< T >::xMax_ [private] |
Definition at line 54 of file HistoChiSquare.h.
Referenced by fit::HistoChiSquare< T6 >::HistoChiSquare(), and fit::HistoChiSquare< T6 >::setHistos().
double fit::HistoChiSquare< T >::xMin_ [private] |
Definition at line 54 of file HistoChiSquare.h.
Referenced by fit::HistoChiSquare< T6 >::degreesOfFreedom(), fit::HistoChiSquare< T6 >::HistoChiSquare(), fit::HistoChiSquare< T6 >::operator()(), and fit::HistoChiSquare< T6 >::setHistos().