1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-11-14 17:55:37 +00:00

Changed fit criteria from chi2PerDof to pValue.

This commit is contained in:
AndrewYongZhenNing 2021-09-22 12:35:41 +01:00
parent f0739047c3
commit 9c5ade4989
2 changed files with 9 additions and 10 deletions

View File

@ -20,7 +20,6 @@
#include <LatAnalyze/Statistics/XYSampleData.hpp> #include <LatAnalyze/Statistics/XYSampleData.hpp>
#include <LatAnalyze/includes.hpp> #include <LatAnalyze/includes.hpp>
#include <LatAnalyze/Core/Math.hpp> #include <LatAnalyze/Core/Math.hpp>
// #include <LatAnalyze/Core/Exceptions.hpp>
using namespace std; using namespace std;
using namespace Latan; using namespace Latan;
@ -235,17 +234,17 @@ DVec XYSampleData::getYError(const Index j)
return data_.getYError(j); return data_.getYError(j);
} }
void XYSampleData::setChi2PerDofBound(double uLim, double lLim) void XYSampleData::setPValueBound(double uLim, double lLim)
{ {
chi2PerDofu_ = uLim; pValMax = uLim;
chi2PerDofl_ = lLim; pValMin = lLim;
} }
void XYSampleData::checkChi2PerDof(double Chi2PerDof) void XYSampleData::checkPValue(double pValue)
{ {
if(Chi2PerDof >= chi2PerDofu_ or Chi2PerDof < chi2PerDofl_ or isnan(Chi2PerDof)) if(pValue >= pValMax or pValue <= pValMin or isnan(pValue))
{ {
string msg = "central chi2perDof = " + to_string(Chi2PerDof) + " not within user-set bound of " + to_string(chi2PerDofl_) + " < chi2PerDof < " + to_string(chi2PerDofu_) ; string msg = "central pValue = " + to_string(pValue) + " not within user-set bound of " + to_string(pValMin) + " < pValue < " + to_string(pValMax) ;
LATAN_ERROR(Runtime, msg); LATAN_ERROR(Runtime, msg);
} }
} }

View File

@ -92,8 +92,8 @@ public:
DVec getXError(const Index i); DVec getXError(const Index i);
DVec getYError(const Index j); DVec getYError(const Index j);
// fit criteria // fit criteria
void setChi2PerDofBound(double uLim, double lLim); void setPValueBound(double uLim, double lLim);
void checkChi2PerDof(double Chi2PerDof); void checkPValue(double Chi2PerDof);
// get total fit variance matrix and its pseudo-inverse // get total fit variance matrix and its pseudo-inverse
const DMat & getFitVarMat(void); const DMat & getFitVarMat(void);
const DMat & getFitVarMatPInv(void); const DMat & getFitVarMatPInv(void);
@ -136,7 +136,7 @@ private:
Index nSample_, dataSample_{central}; Index nSample_, dataSample_{central};
bool initData_{true}, computeVarMat_{true}; bool initData_{true}, computeVarMat_{true};
bool initXMap_{true}; bool initXMap_{true};
double chi2PerDofu_{1e10}, chi2PerDofl_{0}; double pValMax{1}, pValMin{0};
}; };
/****************************************************************************** /******************************************************************************