Changeset View
Changeset View
Standalone View
Standalone View
src/LauSimFitCoordinator.cc
Show First 20 Lines • Show All 639 Lines • ▼ Show 20 Lines | |||||
void LauSimFitCoordinator::fitExpt() | void LauSimFitCoordinator::fitExpt() | ||||
{ | { | ||||
// Routine to perform the actual fit for the given experiment | // Routine to perform the actual fit for the given experiment | ||||
// Instruct the tasks to update initial fit parameters if required (e.g. if using random numbers). | // Instruct the tasks to update initial fit parameters if required (e.g. if using random numbers). | ||||
this->checkInitFitParams(); | this->checkInitFitParams(); | ||||
// Initialise the fitter | // Initialise the fitter | ||||
LauFitter::fitter()->useAsymmFitErrors( this->useAsymmFitErrors() ); | LauFitter::fitter().useAsymmFitErrors( this->useAsymmFitErrors() ); | ||||
LauFitter::fitter()->twoStageFit( this->twoStageFit() ); | LauFitter::fitter().twoStageFit( this->twoStageFit() ); | ||||
LauFitter::fitter()->initialise( this, params_ ); | LauFitter::fitter().initialise( this, params_ ); | ||||
this->startNewFit( LauFitter::fitter()->nParameters(), LauFitter::fitter()->nFreeParameters() ); | this->startNewFit( LauFitter::fitter().nParameters(), LauFitter::fitter().nFreeParameters() ); | ||||
// Now ready for minimisation step | // Now ready for minimisation step | ||||
std::cout << "\nINFO in LauSimFitCoordinator::fitExpt : Start minimisation...\n"; | std::cout << "\nINFO in LauSimFitCoordinator::fitExpt : Start minimisation...\n"; | ||||
LauAbsFitter::FitStatus fitResult = LauFitter::fitter()->minimise(); | LauAbsFitter::FitStatus fitResult = LauFitter::fitter().minimise(); | ||||
// If we're doing a two stage fit we can now release (i.e. float) | // If we're doing a two stage fit we can now release (i.e. float) | ||||
// the 2nd stage parameters and re-fit | // the 2nd stage parameters and re-fit | ||||
if (this->twoStageFit()) { | if (this->twoStageFit()) { | ||||
if ( fitResult.status != 3 ) { | if ( fitResult.status != 3 ) { | ||||
std::cerr << "ERROR in LauSimFitCoordinator:fitExpt : Not running second stage fit since first stage failed." << std::endl; | std::cerr << "ERROR in LauSimFitCoordinator:fitExpt : Not running second stage fit since first stage failed." << std::endl; | ||||
LauFitter::fitter()->releaseSecondStageParameters(); | LauFitter::fitter().releaseSecondStageParameters(); | ||||
} else { | } else { | ||||
LauFitter::fitter()->releaseSecondStageParameters(); | LauFitter::fitter().releaseSecondStageParameters(); | ||||
this->startNewFit( LauFitter::fitter()->nParameters(), LauFitter::fitter()->nFreeParameters() ); | this->startNewFit( LauFitter::fitter().nParameters(), LauFitter::fitter().nFreeParameters() ); | ||||
fitResult = LauFitter::fitter()->minimise(); | fitResult = LauFitter::fitter().minimise(); | ||||
} | } | ||||
} | } | ||||
const TMatrixD& covMat = LauFitter::fitter()->covarianceMatrix(); | const TMatrixD& covMat = LauFitter::fitter().covarianceMatrix(); | ||||
this->storeFitStatus( fitResult, covMat ); | this->storeFitStatus( fitResult, covMat ); | ||||
// Store the final fit results and errors into protected internal vectors that | // Store the final fit results and errors into protected internal vectors that | ||||
// all sub-classes can use within their own finalFitResults implementation | // all sub-classes can use within their own finalFitResults implementation | ||||
// used below (e.g. putting them into an ntuple in a root file) | // used below (e.g. putting them into an ntuple in a root file) | ||||
LauFitter::fitter()->updateParameters(); | LauFitter::fitter().updateParameters(); | ||||
} | } | ||||
void LauSimFitCoordinator::setParsFromMinuit(Double_t* par, Int_t npar) | void LauSimFitCoordinator::setParsFromMinuit(Double_t* par, Int_t npar) | ||||
{ | { | ||||
// This function sets the internal parameters based on the values | // This function sets the internal parameters based on the values | ||||
// that Minuit is using when trying to minimise the total likelihood function. | // that Minuit is using when trying to minimise the total likelihood function. | ||||
// MINOS reports different numbers of free parameters depending on the | // MINOS reports different numbers of free parameters depending on the | ||||
▲ Show 20 Lines • Show All 365 Lines • Show Last 20 Lines |