Perform MINUIT fits in one or two dimensions. More...
#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-01-16/CAFAna/Fit/MinuitFitter.h"
Classes | |
class | MinuitFitSummary |
Concrete instance of IFitSummary for use in MinuitFitter. More... | |
Public Types | |
enum | FitOpts { kNormal = 0, kCareful = 1, kFast = 2, kGradDesc = 3, kPrecisionMask = 3, kPrefitSysts = 4 } |
enum | Verbosity { kQuiet, kVerbose } |
Public Member Functions | |
void | SetFitOpts (FitOpts opts) |
MinuitFitter (const IExperiment *expt, std::vector< const IFitVar * > vars, std::vector< const ISyst * > systs={}, FitOpts opts=kNormal) | |
~MinuitFitter () | |
virtual double | operator() (const std::vector< double > &pars) const override |
Evaluate the log-likelihood, as required by MINUT interface. More... | |
std::vector< double > | Gradient (const std::vector< double > &pars) const override |
bool | CheckGradient () const override |
TMatrixDSym | GetCovariance () const |
virtual double | Up () const override |
Definition of one-sigma, required by MINUIT. More... | |
virtual std::unique_ptr< IFitSummary > | Fit (osc::IOscCalcAdjustable *seed, SystShifts &bestSysts=junkShifts, const SeedList &seedPts=SeedList(), const std::vector< SystShifts > &systSeedPts={}, Verbosity verb=kVerbose) const |
Master fitting method. Depends on FitHelper and FitHelperSeeded. More... | |
virtual std::unique_ptr< IFitSummary > | Fit (osc::IOscCalcAdjustable *seed, SystShifts &systSeed, Verbosity verb) const |
Variant with no seedPts. More... | |
virtual std::unique_ptr< IFitSummary > | Fit (osc::IOscCalcAdjustable *seed, Verbosity verb) const |
Variant with no seedPts and no systematics result returned. More... | |
virtual std::unique_ptr< IFitSummary > | Fit (SystShifts &systSeed, Verbosity verb=kVerbose) const |
Variant with no oscillations - useful for ND fits. More... | |
std::unique_ptr< SystShifts > | GetSystShifts () const |
Protected Member Functions | |
int | GetMINUITPrecision () const |
void | DecodePars (const std::vector< double > &pars, osc::IOscCalcAdjustable *calc) const |
Stuff the parameters into the calculator and/or syst shifts object. More... | |
std::unique_ptr< IFitSummary > | FitHelperSeeded (osc::IOscCalcAdjustable *seed, SystShifts &systSeed, Verbosity verb) const override |
Helper for FitHelper. More... | |
bool | SupportsDerivatives () const |
std::vector< SeedPt > | ExpandSeeds (const SeedList &seedPts, const std::vector< SystShifts > &systSeedPts) const |
virtual std::unique_ptr< IFitSummary > | FitHelper (osc::IOscCalcAdjustable *seed, SystShifts &bestSysts, const SeedList &seedPts, const std::vector< SystShifts > &systSeedPts, Verbosity verb) const |
Helper for Fit. More... | |
void | ValidateSeeds (osc::IOscCalcAdjustable *seed, const SeedList &seedPts, const std::vector< SystShifts > &systSeedPts) const |
Check that the seeds that were specified are compatible with the vars being fitted. More... | |
Protected Attributes | |
osc::IOscCalcAdjustable * | fCalc |
const IExperiment * | fExpt |
FitOpts | fFitOpts |
bool | fSupportsDerivatives |
int | fNEval = 0 |
int | fNEvalGrad = 0 |
int | fNEvalFiniteDiff = 0 |
TMatrixDSym | fCovariance |
std::vector< const IFitVar * > | fVars |
std::vector< const ISyst * > | fSysts |
std::unique_ptr< SystShifts > | fShifts |
Verbosity | fVerb |
Static Protected Attributes | |
static SystShifts | junkShifts = SystShifts() |
Perform MINUIT fits in one or two dimensions.
Definition at line 17 of file MinuitFitter.h.
Enumerator | |
---|---|
kNormal |
default if un-specified |
kCareful | |
kFast | |
kGradDesc | |
kPrecisionMask | |
kPrefitSysts |
Definition at line 21 of file MinuitFitter.h.
|
inherited |
Enumerator | |
---|---|
kQuiet | |
kVerbose |
Definition at line 22 of file IFitter.h.
ana::MinuitFitter::MinuitFitter | ( | const IExperiment * | expt, |
std::vector< const IFitVar * > | vars, | ||
std::vector< const ISyst * > | systs = {} , |
||
FitOpts | opts = kNormal |
||
) |
Definition at line 64 of file MinuitFitter.cxx.
ana::MinuitFitter::~MinuitFitter | ( | ) |
Definition at line 76 of file MinuitFitter.cxx.
|
inlineoverride |
Definition at line 49 of file MinuitFitter.h.
References fFitOpts, kFast, and kPrecisionMask.
|
protected |
Stuff the parameters into the calculator and/or syst shifts object.
Definition at line 283 of file MinuitFitter.cxx.
References ana::assert(), ana::IFitter::fShifts, ana::IFitter::fSysts, ana::IFitter::fVars, MECModelEnuComparisons::i, calib::j, and febshutoff_auto::val.
Referenced by GetMINUITPrecision(), and operator()().
|
protectedinherited |
Definition at line 46 of file IFitter.cxx.
References ana::SeedList::GetSeeds(), ana::SystShifts::Nominal(), gen_hdf5record::pt, runNovaSAM::ret, and seed.
Referenced by ana::IFitter::FitHelper().
|
virtualinherited |
Master fitting method. Depends on FitHelper and FitHelperSeeded.
[out] | seed | Seed parameter and output best-fit point |
[out] | bestSysts | Best systematics result returned here |
seedPts | List of oscillation parameter seeds | |
systSeedPts | If non-empty, try fit starting at each of these | |
verb | If quiet, no printout |
Reimplemented in ana::StanFitter.
Definition at line 69 of file IFitter.cxx.
References om::cout, allTimeWatchdog::endl, ana::IFitter::FitHelper(), ana::IFitter::fSysts, ana::IFitter::fVars, ana::IFitter::fVerb, ana::SystShifts::GetShift(), ana::IFitter::kVerbose, registry_explorer::v, and ana::IFitter::ValidateSeeds().
Referenced by BlessedPlotsAna(), BlessedPlotsAnaByPeriod(), cc(), ana::CovMxSurface::CovMxSurface(), fake_future_data(), FCContour(), FCTutorial2020(), fill_col(), ana::FrequentistSurface::FillSurfacePoint(), ana::FrequentistSurface::FindMinimum(), ana::FindValley(), ana::IFitter::Fit(), ana::StanFitter::Fit(), FitHelperSeeded(), getBestFit(), joint_fit_2017_contours(), joint_fit_2017_make_fc_slice(), joint_fit_2017_make_fc_surf(), joint_fit_2017_slices(), joint_fit_2018_contours(), joint_fit_2018_slices(), joint_fit_future_bestfit_univ(), joint_fit_future_contour_univ(), make_fc_mass_and_oct_nersc_2018(), make_fc_mh_nersc_2018(), make_fc_nus_surfs_nersc_2018(), make_fc_nus_surfs_nersc_2019(), make_fc_oct_nersc_2018(), make_fc_slices_nersc_2018(), make_fc_slices_nersc_2018_stats(), make_fc_surfaces_2020(), make_fc_surfaces_2020_validation(), make_fc_surfaces_nersc_2018(), make_fc_surfaces_nersc_2018_stats(), make_nus17_fc_surfs(), make_nus_fc_surfs(), make_starplots(), MakeCAFSensitivities_for_FNEX(), numu_sig_nonmax(), plot_shifts(), PlotNus17Prediction(), ana::Profile(), reach_2018_dCPfractions(), ana::RefineSeeds(), run_joint_fit_2020_bestfit(), run_joint_fit_2020_contours(), run_joint_fit_2020_slices(), RunFitter(), sensitivity2018(), sensitivity2020(), starPlot(), syst_test(), and test_ana().
|
inlinevirtualinherited |
Variant with no seedPts.
Definition at line 61 of file IFitter.h.
References ana::IFitter::Fit().
|
inlinevirtualinherited |
Variant with no seedPts and no systematics result returned.
Definition at line 69 of file IFitter.h.
References ana::IFitter::Fit().
|
inlinevirtualinherited |
Variant with no oscillations - useful for ND fits.
Definition at line 76 of file IFitter.h.
References ana::IFitter::Fit().
|
protectedvirtualinherited |
Definition at line 117 of file IFitter.cxx.
References ana::assert(), ana::SystShifts::Copy(), osc::_IOscCalcAdjustable< T >::Copy(), ana::IFitter::ExpandSeeds(), ana::IFitter::FitHelperSeeded(), ana::IFitter::fShifts, ana::IFitter::fSysts, ana::IFitter::fVars, MECModelEnuComparisons::i, gen_hdf5record::pt, seed, ana::SystShifts::SetShift(), and registry_explorer::v.
Referenced by ana::IFitter::Fit().
|
overrideprotectedvirtual |
Implements ana::IFitter.
Definition at line 103 of file MinuitFitter.cxx.
References ana::assert(), om::cout, allTimeWatchdog::endl, fCalc, fCovariance, fExpt, fFitOpts, ana::IFitter::Fit(), ana::IFitter::fShifts, fSupportsDerivatives, ana::IFitter::fSysts, ana::IFitter::fVars, ana::IFitter::fVerb, runNovaSAM::gErrorIgnoreLevel, GetMINUITPrecision(), ana::SystShifts::GetShift(), MECModelEnuComparisons::i, calib::j, kGradDesc, kPrecisionMask, kPrefitSysts, elec2geo::pos, seed, ana::SystShifts::SetShift(), registry_explorer::v, and febshutoff_auto::val.
|
inline |
|
inlineprotected |
Convert from our enum order to MINUIT's codes (0=fast, 1=normal, 2=careful)
Definition at line 58 of file MinuitFitter.h.
References calc, DecodePars(), fFitOpts, kPrecisionMask, and pars().
Referenced by FitHelperSeeded().
|
inlineinherited |
Definition at line 82 of file IFitter.h.
References ana::IFitter::fShifts.
Referenced by plot_shifts().
|
override |
Definition at line 237 of file MinuitFitter.cxx.
|
overridevirtual |
Evaluate the log-likelihood, as required by MINUT interface.
Definition at line 217 of file MinuitFitter.cxx.
References ana::assert(), ana::IExperiment::ChiSq(), DecodePars(), fCalc, fExpt, fNEval, ana::IFitter::fShifts, ana::IFitter::fSysts, ana::IFitter::fVars, and MECModelEnuComparisons::i.
Definition at line 201 of file MinuitFitter.cxx.
References om::cout, allTimeWatchdog::endl, fFitOpts, fSupportsDerivatives, ana::IFitter::fSysts, kGradDesc, kPrecisionMask, and plot_validation_datamc::opts.
Referenced by ana::FrequentistSurface::FillSurfacePoint(), and ana::FrequentistSurface::FindMinimum().
|
protected |
Intended to be called only once (from constructor) to initialize fSupportsDerivatives
Definition at line 81 of file MinuitFitter.cxx.
|
inlineoverridevirtual |
Definition of one-sigma, required by MINUIT.
Definition at line 53 of file MinuitFitter.h.
|
protectedinherited |
Check that the seeds that were specified are compatible with the vars being fitted.
Definition at line 170 of file IFitter.cxx.
References ana::SeedList::ActiveFitVars(), om::cout, allTimeWatchdog::endl, ana::IFitter::fSysts, ana::IFitter::fVars, gen_hdf5record::pt, and registry_explorer::v.
Referenced by ana::IFitter::Fit().
|
mutableprotected |
Definition at line 88 of file MinuitFitter.h.
Referenced by FitHelperSeeded(), and operator()().
|
mutableprotected |
Definition at line 98 of file MinuitFitter.h.
Referenced by FitHelperSeeded(), and GetCovariance().
|
protected |
Definition at line 89 of file MinuitFitter.h.
Referenced by FitHelperSeeded(), and operator()().
|
protected |
Definition at line 91 of file MinuitFitter.h.
Referenced by CheckGradient(), FitHelperSeeded(), GetMINUITPrecision(), and SetFitOpts().
|
mutableprotected |
Definition at line 95 of file MinuitFitter.h.
Referenced by operator()().
|
mutableprotected |
Definition at line 97 of file MinuitFitter.h.
|
mutableprotected |
Definition at line 96 of file MinuitFitter.h.
|
mutableprotectedinherited |
Definition at line 116 of file IFitter.h.
Referenced by DecodePars(), ana::IFitter::FitHelper(), FitHelperSeeded(), ana::StanFitter::FitHelperSeeded(), ana::IFitter::GetSystShifts(), ana::StanFitter::log_prob(), operator()(), and ana::StanFitter::TestGradients().
|
protected |
Definition at line 93 of file MinuitFitter.h.
Referenced by FitHelperSeeded(), and SetFitOpts().
|
protectedinherited |
Definition at line 115 of file IFitter.h.
Referenced by ana::StanFitter::BuildInitContext(), DecodePars(), ana::IFitter::Fit(), ana::IFitter::FitHelper(), FitHelperSeeded(), ana::StanFitter::FitHelperSeeded(), ana::StanFitter::get_param_names(), ana::StanFitter::log_prob(), operator()(), SetFitOpts(), ana::StanFitter::transform_inits(), and ana::IFitter::ValidateSeeds().
|
protectedinherited |
Definition at line 114 of file IFitter.h.
Referenced by ana::StanFitter::BuildInitContext(), DecodePars(), ana::IFitter::Fit(), ana::IFitter::FitHelper(), FitHelperSeeded(), ana::StanFitter::FitHelperSeeded(), ana::StanFitter::get_param_names(), ana::StanFitter::log_prob(), operator()(), ana::StanFitter::transform_inits(), ana::IFitter::ValidateSeeds(), and ana::StanFitter::write_array().
|
mutableprotectedinherited |
Definition at line 117 of file IFitter.h.
Referenced by ana::IFitter::Fit(), and FitHelperSeeded().
|
staticprotectedinherited |