@@ -77,7 +77,7 @@ namespace HFit {
7777 void StoreAndDrawFitFunction (FitObject * h1, TF1 * f1, const ROOT ::Fit::DataRange & range, bool , bool , const char *goption);
7878
7979 template <class FitObject >
80- double ComputeChi2 (const FitObject & h1, TF1 &f1, bool useRange, ROOT ::Fit::EChisquareType type );
80+ double ComputeChi2 (const FitObject & h1, TF1 &f1, bool useRange, ROOT ::Fit::EChisquareType type, bool useIntegral = false );
8181
8282
8383
@@ -1029,22 +1029,23 @@ TFitResultPtr ROOT::Fit::FitObject(THnBase * s1, TF1 *f1 , Foption_t & foption ,
10291029// function to compute the simple chi2 for graphs and histograms
10301030
10311031
1032- double ROOT::Fit::Chisquare (const TH1 & h1, TF1 & f1, bool useRange, ROOT ::Fit::EChisquareType type) {
1033- return HFit::ComputeChi2 (h1,f1,useRange, type);
1032+ double ROOT::Fit::Chisquare (const TH1 & h1, TF1 & f1, bool useRange, ROOT ::Fit::EChisquareType type, bool useIntegral ) {
1033+ return HFit::ComputeChi2 (h1,f1,useRange, type, useIntegral );
10341034}
10351035
10361036double ROOT::Fit::Chisquare (const TGraph & g, TF1 & f1, bool useRange) {
10371037 return HFit::ComputeChi2 (g,f1, useRange, ROOT ::Fit::EChisquareType::kNeyman );
10381038}
10391039
10401040template <class FitObject >
1041- double HFit::ComputeChi2 (const FitObject & obj, TF1 & f1, bool useRange, ROOT ::Fit::EChisquareType type ) {
1041+ double HFit::ComputeChi2 (const FitObject & obj, TF1 & f1, bool useRange, ROOT ::Fit::EChisquareType type, bool useIntegral ) {
10421042
10431043 // implement using the fitting classes
10441044 ROOT ::Fit::DataOptions opt;
10451045 opt.fUseEmpty = (type != ROOT ::Fit::EChisquareType::kNeyman ); // use empty bin when not using Neyman chisquare (observed error)
10461046 opt.fExpErrors = (type == ROOT ::Fit::EChisquareType::kPearson );
10471047 opt.fErrors1 = (type == ROOT ::Fit::EChisquareType::kPearson ); // not using observed errors in Pearson chi2
1048+ opt.fIntegral = useIntegral; // use bin integral instead of value at bin center
10481049
10491050 ROOT ::Fit::DataRange range;
10501051 // get range of function
0 commit comments