7 #include "Math/Minimizer.h"
15 template<
class T>
class _IOscCalcAdjustable;
32 double SimpleFOM(
const Spectrum& obs,
const Spectrum& unosc,
double pot = 0);
34 namespace{SystShifts junkShifts;}
37 class Fitter:
public ROOT::Math::IBaseFunctionMultiDim
61 std::vector<const IFitVar*> vars,
62 std::vector<const ISyst*> systs = {},
73 SystShifts& bestSysts = junkShifts,
74 const std::map<
const IFitVar*, std::vector<double>>& seedPts = {},
75 const std::vector<SystShifts>& systSeedPts = {},
83 return Fit(seed, systSeed, {}, std::vector<SystShifts>(1, systSeed), verb);
90 return Fit(seed, junkShifts, {}, {}, verb);
96 return Fit(0, systSeed, {}, std::vector<SystShifts>(1, systSeed), verb);
135 virtual double DoEval(
const double* pars)
const override;
142 std::cout <<
"Fitter::Clone() not implemented" << std::endl;
153 std::vector<double>>& seedPts,
154 std::vector<SystShifts> systSeedPts)
const;
157 std::unique_ptr<ROOT::Math::Minimizer>
165 const std::map<
const IFitVar*, std::vector<double>>& seedPts,
166 std::vector<SystShifts> systSeedPts,
232 int nbinsx,
double minx,
double maxx,
234 const std::vector<const IFitVar*>& profVars = {},
235 const std::vector<const ISyst*>& profSysts = {},
236 const std::map<const IFitVar*, std::vector<double>>& seedPts = {},
237 const std::vector<SystShifts>& systsSeedPts = {},
241 TH1*
Profile(
const IExperiment* expt,
244 int nbinsx,
double minx,
double maxx,
246 const std::vector<const IFitVar*>& profVars = {},
247 const std::vector<const ISyst*>& profSysts = {},
248 const std::map<const IFitVar*, std::vector<double>>& seedPts = {},
249 const std::vector<SystShifts>& systsSeedPts = {},
257 int nbinsx,
double minx,
double maxx,
259 std::vector<const IFitVar*> profVars = {},
260 std::vector<const ISyst*> profSysts = {},
261 const std::map<const IFitVar*, std::vector<double>>& seedPts = {},
262 const std::vector<SystShifts>& systsSeedPts = {},
269 int nbinsx,
double minx,
double maxx,
271 std::vector<const IFitVar*> profVars = {},
272 std::vector<const ISyst*> profSysts = {},
273 const std::map<const IFitVar*, std::vector<double>>& seedPts = {},
274 const std::vector<SystShifts>& systsSeedPts = {},
279 TH1*
Slice(
const IExperiment* expt,
281 int nbinsx,
double minx,
double maxx,
284 TH1*
Slice(
const IExperiment* expt,
286 int nbinsx,
double minx,
double maxx,
292 int nbinsx,
double minx,
double maxx,
double minchi = -1);
296 int nbinsx,
double minx,
double maxx,
double minchi = -1);
303 const IFitVar& scanVar,
304 const IFitVar& fitVar,
305 int nbinsx,
double xmin,
double xmax,
306 const std::vector<const IFitVar*>& profVars = {},
307 const std::vector<const ISyst*>& profSysts = {},
308 const std::map<const IFitVar*, std::vector<double>>& seedPts = {},
309 const std::vector<SystShifts>& systsSeedPts = {},
310 bool transpose =
false);
std::vector< std::pair< double, double > > fMinosErrors
_IOscCalcAdjustable< double > IOscCalcAdjustable
std::vector< std::pair< double, double > > fTempMinosErrors
TH1 * SqrtProfile(const IExperiment *expt, osc::IOscCalcAdjustable *calc, const IFitVar *v, int nbinsx, double minx, double maxx, double minchi, std::vector< const IFitVar * > profVars, std::vector< const ISyst * > profSysts, const std::map< const IFitVar *, std::vector< double >> &seedPts, const std::vector< SystShifts > &systSeedPts, std::map< const IFitVar *, TGraph * > &profVarsMap, std::map< const ISyst *, TGraph * > &systsMap)
Forward to Profile but sqrt the result for a crude significance.
double FitHelper(osc::IOscCalcAdjustable *seed, SystShifts &bestSysts, const std::map< const IFitVar *, std::vector< double >> &seedPts, std::vector< SystShifts > systSeedPts, Verbosity verb) const
Helper for Fit.
Fitter * Clone() const override
TGraph * FindValley(const IExperiment *expt, osc::IOscCalcAdjustable *calc, const IFitVar &scanVar, const IFitVar &fitVar, int nbinsx, double xmin, double xmax, const std::vector< const IFitVar * > &profVars, const std::vector< const ISyst * > &profSysts, const std::map< const IFitVar *, std::vector< double >> &seedPts, const std::vector< SystShifts > &systSeedPts, bool transpose)
Find the minimum in one variable as a function of another.
std::vector< double > GetPostFitValues()
Return the postfit values.
Fitter::Precision operator|(Fitter::Precision a, Fitter::Precision b)
Simple record of shifts applied to systematic parameters.
int GetCovarianceStatus()
covariance matrix status (0 = not valid, 1 approximate, 2, full but made pos def, 3 accurate and not ...
std::vector< double > GetPreFitValues()
Return the prefit values.
double Fit(osc::IOscCalcAdjustable *seed, SystShifts &bestSysts=junkShifts, const std::map< const IFitVar *, std::vector< double >> &seedPts={}, const std::vector< SystShifts > &systSeedPts={}, Verbosity verb=kVerbose) const
double Fit(osc::IOscCalcAdjustable *seed, SystShifts &systSeed, Verbosity verb) const
Variant with no seedPts.
std::vector< SeedPt > ExpandSeeds(const std::map< const IFitVar *, std::vector< double >> &seedPts, std::vector< SystShifts > systSeedPts) const
std::vector< double > FindCurveCrossings(TH1 *h, double critVal)
Intended for use on the output of Profile.
double Fit(osc::IOscCalcAdjustable *seed, Verbosity verb) const
Variant with no seedPts and no systematics result returned.
void SetPrecision(Precision prec)
process_name opflashCryoW ana
double GetEDM()
Return edm form the fit.
static std::map< const ISyst *, TGraph * > empty_syst_map
Perform MINUIT fits in one or two dimensions.
TH1 * Profile(const IExperiment *expt, osc::IOscCalcAdjustable *calc, const IFitVar *v, int nbinsx, double minx, double maxx, double input_minchi, const std::vector< const IFitVar * > &profVars, const std::vector< const ISyst * > &profSysts, const std::map< const IFitVar *, std::vector< double >> &seedPts, const std::vector< SystShifts > &systSeedPts, std::map< const IFitVar *, TGraph * > &profVarsMap, std::map< const ISyst *, TGraph * > &profSystsMap)
scan in one variable, profiling over all others
process_name pandoraGausCryo1 vertexChargeCryo1 vertexStubCryo1 xmin
SystShifts GetSystShifts() const
std::vector< double > GetPreFitErrors()
Return the prefit errors.
std::vector< double > fPreFitValues
TMatrixDSym * GetCovariance()
Return the fit covariance.
std::vector< const IFitVar * > fVars
static std::map< const IFitVar *, TGraph * > empty_vars_map
std::unique_ptr< ROOT::Math::Minimizer > FitHelperSeeded(osc::IOscCalcAdjustable *seed, SystShifts &systSeed, Verbosity verb) const
Helper for FitHelper.
std::vector< double > fPostFitValues
std::vector< double > fPreFitErrors
Fitter(const IExperiment *expt, std::vector< const IFitVar * > vars, std::vector< const ISyst * > systs={}, Precision prec=kNormal)
osc::IOscCalcAdjustable * fCalc
virtual unsigned int NDim() const override
TH1 * SqrtSlice(const IExperiment *expt, osc::IOscCalcAdjustable *calc, const IFitVar *v, int nbinsx, double minx, double maxx, double minchi)
Forward to Slice but sqrt the result for a crude significance.
void DecodePars(const double *pars) const
Updates mutable fCalc and fShifts.
std::vector< std::string > GetParamNames()
Return the fit names.
std::vector< double > GetPostFitErrors()
Return the postfit errors.
std::vector< const ISyst * > fSysts
std::vector< std::string > fParamNames
then echo File list $list not found else cat $list while read file do echo $file sed s
std::map< const IFitVar *, double > fitvars
double SimpleFOM(const Spectrum &obs, const Spectrum &unosc, double pot)
Figure-of-merit with no systematics, for binned data.
Base class defining interface for experiments.
const IExperiment * fExpt
Interface definition for fittable variables.
bool GetIsValid()
Say whether the fit was good.
std::vector< double > fPostFitErrors
double Fit(SystShifts &systSeed, Verbosity verb=kVerbose) const
Variant with no oscillations - useful for ND fits.
TH1 * Slice(const IExperiment *expt, osc::IOscCalcAdjustable *calc, const IFitVar *v, int nbinsx, double minx, double maxx, double minchi)
scan in one variable, holding all others constant
std::vector< std::pair< double, double > > GetMinosErrors()
Return the minos errors.
virtual double DoEval(const double *pars) const override
Evaluate the log-likelihood, as required by MINUT interface.
int GetNFCN()
Return number of function calls.
BEGIN_PROLOG could also be cout