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

XY*Data: dog is now a double

This commit is contained in:
Antonin Portelli 2014-09-18 17:15:56 +01:00
parent 05f5223d31
commit c0bfb12bd7
4 changed files with 22 additions and 11 deletions

View File

@ -38,13 +38,19 @@ const DSample & SampleFitResult::getChi2(const PlaceHolder ph __unused) const
double SampleFitResult::getChi2PerDof(const Index s) const
{
return chi2_[s]/static_cast<double>(nDof_);
return chi2_[s]/getNDof();
}
DSample SampleFitResult::getChi2PerDof(const PlaceHolder ph __unused) const
{
return chi2_/static_cast<double>(nDof_);
return chi2_/getNDof();
}
double SampleFitResult::getNDof(void) const
{
return static_cast<double>(nDof_);
}
const DoubleFunction & SampleFitResult::getModel(const Index s,
const Index j) const
{
@ -210,6 +216,7 @@ SampleFitResult XYSampleData::fit(Minimizer &minimizer, const DVec &init,
FitResult sampleResult;
SampleFitResult result;
bool initChi2;
DVec initBuf = init;
result.resize(nSample);
result.chi2_.resize(nSample);
@ -232,7 +239,11 @@ SampleFitResult XYSampleData::fit(Minimizer &minimizer, const DVec &init,
initChi2 = (s == central);
// fit
sampleResult = data_.fit(minimizer, init, modelVector);
sampleResult = data_.fit(minimizer, initBuf, modelVector);
if (s == central)
{
initBuf = sampleResult;
}
// store result
result[s] = sampleResult;

View File

@ -46,6 +46,7 @@ public:
const DSample & getChi2(const PlaceHolder ph) const;
double getChi2PerDof(const Index s = central) const;
DSample getChi2PerDof(const PlaceHolder ph) const;
double getNDof(void) const;
const DoubleFunction & getModel(const Index s = central,
const Index j = 0) const;
const DoubleFunctionSample & getModel(const PlaceHolder ph,

View File

@ -32,14 +32,14 @@ double FitResult::getChi2(void) const
return chi2_;
}
Index FitResult::getNDof(void) const
{
return nDof_;
}
double FitResult::getChi2PerDof(void) const
{
return chi2_/static_cast<double>(nDof_);
return chi2_/getNDof();
}
double FitResult::getNDof(void) const
{
return static_cast<double>(nDof_);
}
const DoubleFunction & FitResult::getModel(const Index j) const
@ -219,7 +219,6 @@ FitResult XYStatData::fit(Minimizer &minimizer, const DVec &init,
{
chi2_.requestInit();
}
// initial parameters
const Index nPoint = getNFitPoint();
DVec fullInit = init;

View File

@ -45,8 +45,8 @@ public:
virtual ~FitResult(void) = default;
// access
double getChi2(void) const;
Index getNDof(void) const;
double getChi2PerDof(void) const;
double getNDof(void) const;
const DoubleFunction & getModel(const Index j = 0) const;
private:
double chi2_{0.0};