11 #include <TGraphErrors.h>
16 #include <Math/ProbFuncMathCore.h>
18 #include "../../BAT/BCLog.h"
19 #include "../../BAT/BCDataSet.h"
20 #include "../../BAT/BCDataPoint.h"
21 #include "../../BAT/BCMath.h"
32 , fGraphFitFunction(0)
45 , fGraphFitFunction(0)
58 , fGraphFitFunction(0)
74 , fGraphFitFunction(0)
92 int npoints = graph->GetN();
106 double * x =
fGraph->GetX();
107 double * y =
fGraph->GetY();
108 double * ex =
fGraph->GetEX();
109 double * ey =
fGraph->GetEY();
125 for (
int i = 0; i < npoints; ++i)
128 double errx = ex ? ex[i] : 0.;
140 else if(x[i]+errx > xmax)
143 if(y[i] - 5.*ey[i] < ymin)
144 ymin = y[i] - 5.*ey[i];
145 else if(y[i] + 5.*ey[i] > ymax)
146 ymax = y[i] + 5.*ey[i];
171 int npar = func->GetNpar();
189 for (
int i = 0; i < npar; ++i)
273 BCLog::OutError(
"BCEfficiencyFitter::Fit : Fit function not defined.");
291 BCLog::OutError(
"BCEfficiencyFitter::Fit : Fit function not defined.");
301 Form(
"Number of parameters (%d) lower than or equal to number of points (%d)."
345 TString opt = options;
349 if(!opt.Contains(
"same"))
369 TLegend * legend =
new TLegend(0.25, 0.75, 0.55, 0.95);
370 legend->SetBorderSize(0);
371 legend->SetFillColor(kWhite);
372 legend->AddEntry(
fGraph,
"Data",
"P");
374 legend->AddEntry(
fErrorBand,
"Error band",
"F");
389 BCLog::OutWarning(
"BCGraphFitter::CDF: Non-zero errors in x-direction are ignored!");
392 double yObs = values.at(1);
397 return ROOT::Math::normal_cdf(yObs, values.at(3), yExp);