diff --git a/lib/Statistics/XYSampleData.cpp b/lib/Statistics/XYSampleData.cpp index ae5edba..73e5e51 100644 --- a/lib/Statistics/XYSampleData.cpp +++ b/lib/Statistics/XYSampleData.cpp @@ -234,6 +234,12 @@ DVec XYSampleData::getYError(const Index j) return data_.getYError(j); } +void XYSampleData::setChi2PerDofBound(double upper_lim, double lower_lim) +{ + chi2PerDofu_ = upper_lim; + chi2PerDofl_ = lower_lim; +} + bool XYSampleData::checkFit() { return goodFit_; @@ -241,7 +247,7 @@ bool XYSampleData::checkFit() void XYSampleData::checkChi2PerDof(double Chi2PerDof) { - if(Chi2PerDof >= 2 or Chi2PerDof < 0 or isnan(Chi2PerDof)) + if(Chi2PerDof >= chi2PerDofu_ or Chi2PerDof < chi2PerDofl_ or isnan(Chi2PerDof)) { goodFit_ = false; } diff --git a/lib/Statistics/XYSampleData.hpp b/lib/Statistics/XYSampleData.hpp index a66c9dd..a18103a 100644 --- a/lib/Statistics/XYSampleData.hpp +++ b/lib/Statistics/XYSampleData.hpp @@ -91,6 +91,8 @@ public: const DMat & getXYVar(const Index i, const Index j); DVec getXError(const Index i); DVec getYError(const Index j); + // fit criteria + void setChi2PerDofBound(double upper_lim, double lower_lim); bool checkFit(); // check fit candidate based on chi2PerDof void checkChi2PerDof(double Chi2PerDof); // get total fit variance matrix and its pseudo-inverse @@ -136,6 +138,7 @@ private: bool initData_{true}, computeVarMat_{true}; bool initXMap_{true}; bool goodFit_{true}; // used to break minimisation if central sample chi2PerDof is bad + double chi2PerDofu_{1e10}, chi2PerDofl_{0}; }; /******************************************************************************