124 Set(numerator,denominator);
206 npar =
f1->GetNpar();
208 Error(
"Fit",
"function %s has illegal number of parameters = %d",
209 f1->GetName(), npar);
215 Error(
"Fit",
"No numerator or denominator histograms set");
219 Error(
"Fit",
"function %s dimension, %d, does not match histogram dimension, %d",
227 Error(
"Fit",
"numerator and denominator histograms do not have identical numbers of bins");
238 std::vector<ROOT::Fit::ParameterSettings> & parameters =
fFitter->Config().ParamsSettings();
239 parameters.reserve(npar);
240 for (i = 0; i < npar; i++) {
245 if (we == 0) we = 0.01;
250 f1->GetParLimits(i,plow,pup);
253 if (plow >= pup && (plow==
f1->GetParameter(i) || pup==
f1->GetParameter(i) ||
254 (
f1->GetParameter(i) == 0 && plow==1. && pup == 1.) ) ) {
255 parameters.back().Fix();
256 Info(
"Fit",
"Fixing parameter %s to value %f",
f1->GetParName(i),
f1->GetParameter(i));
257 }
else if (plow < pup) {
258 parameters.back().SetLimits(plow,pup);
259 Info(
"Fit",
"Setting limits for parameter %s to [%f,%f]",
f1->GetParName(i), plow,pup);
271 if (
fFitter->Config().MinimizerOptions().ErrorDef() == 1.0 ) {
272 fFitter->Config().MinimizerOptions().SetErrorDef(0.5);
276 fFitter->Config().MinimizerOptions().SetPrintLevel(3);
279 fFitter->Config().MinimizerOptions().SetPrintLevel(0);
288 if ( !status && !quiet)
289 Warning(
"Fit",
"Abnormal termination of minimization.");
295 fFitter->SetNumberOfFitPoints(
f1->GetNumberFitPoints());
300 f1->SetNDF(fitResult.
Ndf() );
301 f1->SetChisquare(fitResult.
Chi2());
304 if (
int( fitResult.
Errors().size()) >=
f1->GetNpar() )
305 f1->SetParErrors( &(fitResult.
Errors().front()) );
308 Info(
"Fit",
"Successful Result from Binomial Efficiency fitter of function %s",
f1->GetName());
309 fitResult.
Print(std::cout);
334 int ylowbin = 0, yhighbin = 0, zlowbin = 0, zhighbin = 0;
356 }
else if (nDim == 2) {
362 }
else if (nDim == 3) {
380 for (
int xbin = xlowbin; xbin <= xhighbin; ++xbin) {
386 for (
int ybin = ylowbin; ybin <= yhighbin; ++ybin) {
392 for (
int zbin = zlowbin; zbin <= zhighbin; ++zbin) {
404 if (nDen> nmax) nmax = nDen;
405 if (nDen <= 0.)
continue;
425 / ((xup-xlow)*(yup-ylow)) :
434 / ((xup-xlow)*(yup-ylow)*(zup-zlow)) :
448 if (nDen - nNum != 0.) {
450 f -= (nDen - nNum) *
TMath::Log((1. - mu)*nDen/(nDen-nNum));
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
const char Option_t
Option string (const char).
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.
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.
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.