8 #include "Utilities/func/MathUtil.h" 16 : fGrad(1), fGradX(1), fGradY(1)
42 double R2 = 0, ZR = 0;
43 double X2 = 0, XY = 0,
Y2 = 0, ZX = 0, ZY = 0;
44 for(
unsigned int ai = 0; ai <
fPts.size(); ++ai){
45 for(
unsigned int bi = ai+1; bi <
fPts.size(); ++bi){
67 if(R2)
fGrad = ZR / R2;
70 if(
fPts.size() < 10)
return;
73 M(0, 0) =
X2; M(0, 1) = XY;
v(0) = ZX;
74 M(1, 0) = XY; M(1, 1) =
Y2;
v(1) = ZY;
89 const std::vector<const IFitVar*>& profVars,
90 const std::vector<const ISyst*>& profSysts,
92 const std::vector<SystShifts>& systSeedPts,
95 fLogX = fLogY =
false;
100 CreateHistograms(
FitAxis(xvar, nbinsx, xmin, xmax, fLogX),
101 FitAxis(yvar, nbinsy, ymin, ymax, fLogY),
102 profVars, profSysts);
108 for(
const IFitVar*
v: profVars) fSeedValues.push_back(
v->GetValue( calc));
110 FillSurface(expt, calc, xvar, yvar, profVars, profSysts, seedPts, systSeedPts);
112 FindMinimum(expt, calc, xvar, yvar, profVars, profSysts, seedPts, systSeedPts);
126 const std::vector<const IFitVar*>& profVars,
127 const std::vector<const ISyst*>& profSysts,
129 const std::vector<SystShifts>& systSeedPts)
135 return kern(x1, y1, x2, y2);
139 int targetx = fHist->GetNbinsX()/2;
140 int targety = fHist->GetNbinsY()/2;
142 Progress prog(ProgressBarTitle(xvar, yvar, profVars, profSysts));
145 const int maxPass = 100;
147 for(
int pass = 0; pass < maxPass; ++pass){
151 const double targetz = FillSurfacePoint(expt, calc,
152 xvar, BinCenterX(targetx),
153 yvar, BinCenterY(targety),
155 seedPts, systSeedPts);
157 kriger.AddPoint(targetx, targety, targetz);
159 kern.
AddPoint(targetx, targety, targetz);
166 for(
int ix = 1; ix <= fHist->GetNbinsX(); ++ix){
167 for(
int iy = 1; iy <= fHist->GetNbinsY(); ++iy){
170 const double z = kriger.Predict(ix, iy, &err);
173 fHist->SetBinContent(ix, iy, z);
174 fErr->SetBinContent(ix, iy, err);
const std::string & LatexName() const
Cuts and Vars for the 2020 FD DiF Study.
std::map< std::string, double > xmax
fvar< T > fabs(const fvar< T > &x)
Float_t y1[n_points_granero]
Float_t x1[n_points_granero]
void AddPoint(double x, double y, double z)
double operator()(double x1, double y1, double x2, double y2) const
T sqr(T x)
More efficient square function than pow(x,2)
TH2F * ExpandedHistogram(const std::string &title, int nbinsx, double xmin, double xmax, bool xlog, int nbinsy, double ymin, double ymax, bool ylog)
Internal helper for Surface and FCSurface.
void FillSurface(const IExperiment *expt, osc::IOscCalcAdjustable *calc, const IFitVar *xvar, const IFitVar *yvar, const std::vector< const IFitVar * > &profVars, const std::vector< const ISyst * > &profSysts, const SeedList &seedPts, const std::vector< SystShifts > &systSeedPts) override
https://en.wikipedia.org/wiki/Kriging
void FindMinimum(TH1 *&h, const int minx, const int maxx)
void SetProgress(double frac)
Update the progress fraction between zero and one.
double pythag(double x, double y)
2D Euclidean distance
Base class defining interface for experiments.
A simple ascii-art progress bar.
Interface definition for fittable variables.
SurfaceKrige(const IExperiment *expt, osc::IOscCalcAdjustable *calc, const IFitVar *xvar, int nbinsx, double xmin, double xmax, const IFitVar *yvar, int nbinsy, double ymin, double ymax, const std::vector< const IFitVar * > &profVars={}, const std::vector< const ISyst * > &profSysts={}, const SeedList &seedPts=SeedList(), const std::vector< SystShifts > &systSeedPts={}, MinuitFitter::FitOpts opts=MinuitFitter::kNormal)
Collect information describing the axis of a fit variable.