125 Set(numerator,denominator);
207 npar =
f1->GetNpar();
209 Error(
"Fit",
"function %s has illegal number of parameters = %d",
210 f1->GetName(), npar);
216 Error(
"Fit",
"No numerator or denominator histograms set");
220 Error(
"Fit",
"function %s dimension, %d, does not match histogram dimension, %d",
228 Error(
"Fit",
"numerator and denominator histograms do not have identical numbers of bins");
239 std::vector<ROOT::Fit::ParameterSettings> & parameters =
fFitter->Config().ParamsSettings();
240 parameters.reserve(npar);
241 for (
i = 0;
i < npar;
i++) {
246 if (we == 0) we = 0.01;
251 f1->GetParLimits(
i,plow,pup);
254 if (plow >= pup && (plow==
f1->GetParameter(
i) || pup==
f1->GetParameter(
i) ||
255 (
f1->GetParameter(
i) == 0 && plow==1. && pup == 1.) ) ) {
256 parameters.back().Fix();
257 Info(
"Fit",
"Fixing parameter %s to value %f",
f1->GetParName(
i),
f1->GetParameter(
i));
258 }
else if (plow < pup) {
259 parameters.back().SetLimits(plow,pup);
260 Info(
"Fit",
"Setting limits for parameter %s to [%f,%f]",
f1->GetParName(
i), plow,pup);
272 if (
fFitter->Config().MinimizerOptions().ErrorDef() == 1.0 ) {
273 fFitter->Config().MinimizerOptions().SetErrorDef(0.5);
277 fFitter->Config().MinimizerOptions().SetPrintLevel(3);
280 fFitter->Config().MinimizerOptions().SetPrintLevel(0);
289 if ( !status && !quiet)
290 Warning(
"Fit",
"Abnormal termination of minimization.");
296 fFitter->SetNumberOfFitPoints(
f1->GetNumberFitPoints());
301 f1->SetNDF(fitResult.
Ndf() );
302 f1->SetChisquare(fitResult.
Chi2());
305 if (
int( fitResult.
Errors().size()) >=
f1->GetNpar() )
306 f1->SetParErrors( &(fitResult.
Errors().front()) );
309 Info(
"Fit",
"Successful Result from Binomial Efficiency fitter of function %s",
f1->GetName());
310 fitResult.
Print(std::cout);
335 int ylowbin = 0, yhighbin = 0, zlowbin = 0, zhighbin = 0;
357 }
else if (nDim == 2) {
363 }
else if (nDim == 3) {
381 for (
int xbin = xlowbin; xbin <= xhighbin; ++xbin) {
387 for (
int ybin = ylowbin; ybin <= yhighbin; ++ybin) {
393 for (
int zbin = zlowbin; zbin <= zhighbin; ++zbin) {
405 if (nDen> nmax) nmax = nDen;
406 if (nDen <= 0.)
continue;
426 / ((xup-xlow)*(yup-ylow)) :
435 / ((xup-xlow)*(yup-ylow)*(zup-zlow)) :
449 if (nDen - nNum != 0.) {
451 f -= (nDen - nNum) *
TMath::Log((1. - mu)*nDen/(nDen-nNum));
const Double_t kDefaultEpsilon
class containing the result of the fit and all the related information (fitted parameter values,...
bool IsEmpty() const
True if a fit result does not exist (even invalid) with parameter values.
const std::vector< double > & Errors() const
parameter errors (return st::vector)
const std::vector< double > & Parameters() const
parameter values (return std::vector)
unsigned int Ndf() const
Number of degree of freedom.
double Chi2() const
Return the Chi2 value after fitting In case of unbinned fits (or not defined one, see the documentati...
void Print(std::ostream &os, bool covmat=false) const
print the result and optionally covariance matrix and correlations
int Status() const
minimizer status code
Fitter class, entry point for performing all type of fits.
Class, describing value, limits and step size of the parameters Provides functionality also to set/re...
Documentation for class Functor class.
Binomial fitter for the division of two histograms.
Double_t fEpsilon
Precision required for function integration (option "I")
void Set(const TH1 *numerator, const TH1 *denominator)
Initialize with a new set of inputs.
ROOT::Fit::Fitter * fFitter
pointer to the real fitter
TH1 * fDenominator
Denominator histogram.
Bool_t fRange
True if the fit range must be taken from the function range.
Bool_t fAverage
True if the fit function must be averaged over the bin.
~TBinomialEfficiencyFitter() override
destructor
TBinomialEfficiencyFitter()
default constructor
ROOT::Fit::Fitter * GetFitter()
Provide access to the underlying fitter object.
Double_t EvaluateFCN(const Double_t *par)
void SetPrecision(Double_t epsilon)
Set the required integration precision, see TF1::Integral()
Bool_t fFitDone
Set to kTRUE when the fit has been done.
void ComputeFCN(Double_t &f, const Double_t *par)
Compute the likelihood.
TF1 * fFunction
Function to fit.
TFitResultPtr Fit(TF1 *f1, Option_t *option="")
Carry out the fit of the given function to the given histograms.
TH1 * fNumerator
Numerator histogram.
A 2-Dim function with parameters.
A 3-Dim function with parameters.
Provides an indirection to the TFitResult class and with a semantics identical to a TFitResult pointe...
Extends the ROOT::Fit::Result class with a TNamed inheritance providing easy possibility for I/O.
TH1 is the base class of all histogram classes in ROOT.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
void ToUpper()
Change string to upper case.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
IMultiGenFunctionTempl< double > IMultiGenFunction
WrappedMultiTF1Templ< double > WrappedMultiTF1
Double_t Log(Double_t x)
Returns the natural logarithm of x.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.