// @(#)root/hist:$Id$
// Author: Frank Filthaut, Rene Brun   30/05/2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

//////////////////////////////////////////////////////////////////////////
//
// TBinomialEfficiencyFitter
//
// Binomial fitter for the division of two histograms.
// Use when you need to calculate a selection's efficiency from two histograms,
// one containing all entries, and one containing the subset of these entries
// that pass the selection, and when you have a parametrization available for
// the efficiency as a function of the variable(s) under consideration.
//
// A very common problem when estimating efficiencies is that of error estimation:
// when no other information is available than the total number of events N and
// the selected number n, the best estimate for the selection efficiency p is n/N.
// Standard binomial statistics dictates that the uncertainty (this presupposes
// sufficiently high statistics that an approximation by a normal distribution is
// reasonable) on p, given N, is
//Begin_Latex
//   #sqrt{#frac{p(1-p)}{N}}.
//End_Latex
// However, when p is estimated as n/N, fluctuations from the true p to its
// estimate become important, especially for low numbers of events, and giving
// rise to biased results.
//
// When fitting a parametrized efficiency, these problems can largely be overcome,
// as a hypothesized true efficiency is available by construction. Even so, simply
// using the corresponding uncertainty still presupposes that Gaussian errors
// yields a reasonable approximation. When using, instead of binned efficiency
// histograms, the original numerator and denominator histograms, a binned maximum
// likelihood can be constructed as the product of bin-by-bin binomial probabilities
// to select n out of N events. Assuming that a correct parametrization of the
// efficiency is provided, this construction in general yields less biased results
// (and is much less sensitive to binning details).
//
// A generic use of this method is given below (note that the method works for 2D
// and 3D histograms as well):
//
// {
//   TH1* denominator;              // denominator histogram
//   TH1* numerator;                // corresponding numerator histogram
//   TF1* eff;                      // efficiency parametrization
//   ....                           // set step sizes and initial parameter
//   ....                           //   values for the fit function
//   ....                           // possibly also set ranges, see TF1::SetRange()
//   TBinomialEfficiencyFitter* f = new TBinomialEfficiencyFitter(
//                                      numerator, denominator);
//   Int_t status = f->Fit(eff, "I");
//   if (status == 0) {
//      // if the fit was successful, display bin-by-bin efficiencies
//      // as well as the result of the fit
//      numerator->Sumw2();
//      TH1* hEff = dynamic_cast<TH1*>(numerator->Clone("heff"));
//      hEff->Divide(hEff, denominator, 1.0, 1.0, "B");
//      hEff->Draw("E");
//      eff->Draw("same");
//   }
// }
//
// Note that this method cannot be expected to yield reliable results when using
// weighted histograms (because the likelihood computation will be incorrect).
//////////////////////////////////////////////////////////////////////////

#include "TBinomialEfficiencyFitter.h"

#include "TMath.h"
#include "TPluginManager.h"
#include "TROOT.h"
#include "TH1.h"
#include "TF1.h"
#include "TF2.h"
#include "TF3.h"
#include "Fit/Fitter.h"
#include "TFitResult.h"
#include "Math/Functor.h"

#include <limits>


const Double_t kDefaultEpsilon = 1E-12;

ClassImp(TBinomialEfficiencyFitter)


//______________________________________________________________________________
TBinomialEfficiencyFitter::TBinomialEfficiencyFitter() {
   // default constructor
  
   fNumerator   = 0;
   fDenominator = 0;
   fFunction    = 0;
   fFitDone     = kFALSE;
   fAverage     = kFALSE;
   fRange       = kFALSE;
   fEpsilon     = kDefaultEpsilon;
   fFitter      = 0;
}

//______________________________________________________________________________
TBinomialEfficiencyFitter::TBinomialEfficiencyFitter(const TH1 *numerator, const TH1 *denominator) {
   // Constructor.
   //
   // Note that no objects are copied, so it is up to the user to ensure that the
   // histogram pointers remain valid.
   //
   // Both histograms need to be "consistent". This is not checked here, but in
   // TBinomialEfficiencyFitter::Fit().

   fEpsilon  = kDefaultEpsilon;
   fFunction = 0;
   fFitter   = 0;
   Set(numerator,denominator);
}

//______________________________________________________________________________
TBinomialEfficiencyFitter::~TBinomialEfficiencyFitter() {
   // destructor
   
   if (fFitter) delete fFitter; 
   fFitter = 0;
}

//______________________________________________________________________________
void TBinomialEfficiencyFitter::Set(const TH1 *numerator, const TH1 *denominator)
{
   // Initialize with a new set of inputs.

   fNumerator   = (TH1*)numerator;
   fDenominator = (TH1*)denominator;

   fFitDone     = kFALSE;
   fAverage     = kFALSE;
   fRange       = kFALSE;
}

//______________________________________________________________________________
void TBinomialEfficiencyFitter::SetPrecision(Double_t epsilon)
{
   // Set the required integration precision, see TF1::Integral()
   fEpsilon = epsilon;
}

//______________________________________________________________________________
ROOT::Fit::Fitter* TBinomialEfficiencyFitter::GetFitter()
{
   // Provide access to the underlying fitter object.
   // This may be useful e.g. for the retrieval of additional information (such
   // as the output covariance matrix of the fit).

   if (!fFitter)  fFitter = new ROOT::Fit::Fitter();
   return fFitter;
   
}

//______________________________________________________________________________
TFitResultPtr TBinomialEfficiencyFitter::Fit(TF1 *f1, Option_t* option) 
{
   // Carry out the fit of the given function to the given histograms.
   //
   // If option "I" is used, the fit function will be averaged over the
   // bin (the default is to evaluate it simply at the bin center).
   //
   // If option "R" is used, the fit range will be taken from the fit
   // function (the default is to use the entire histogram).
   //
   // If option "S" a TFitResult object is returned and it can be used to obtain
   //  additional fit information, like covariance or correlation matrix. 
   //
   // Note that all parameter values, limits, and step sizes are copied
   // from the input fit function f1 (so they should be set before calling
   // this method. This is particularly relevant for the step sizes, taken
   // to be the "error" set on input, as a null step size usually fixes the
   // corresponding parameter. That is protected against, but in such cases
   // an arbitrary starting step size will be used, and the reliability of
   // the fit should be questioned). If parameters are to be fixed, this
   // should be done by specifying non-null parameter limits, with lower
   // limits larger than upper limits.
   //
   // On output, f1 contains the fitted parameters and errors, as well as
   // the number of degrees of freedom, and the goodness-of-fit estimator
   // as given by S. Baker and R. Cousins, Nucl. Instr. Meth. A221 (1984) 437.

   TString opt = option;
   opt.ToUpper();
   fAverage  = opt.Contains("I");
   fRange    = opt.Contains("R");
   Bool_t verbose    = opt.Contains("V");
   Bool_t quiet      = opt.Contains("Q");
   Bool_t saveResult  = opt.Contains("S");
   if (!f1) return -1;
   fFunction = (TF1*)f1;
   Int_t i, npar;
   npar = f1->GetNpar();
   if (npar <= 0) {
      Error("Fit", "function %s has illegal number of parameters = %d", 
            f1->GetName(), npar);
      return -3;
   }

   // Check that function has same dimension as histogram
   if (!fNumerator || !fDenominator) {
      Error("Fit","No numerator or denominator histograms set");
      return -5;
   }
   if (f1->GetNdim() != fNumerator->GetDimension()) {
      Error("Fit","function %s dimension, %d, does not match histogram dimension, %d",
            f1->GetName(), f1->GetNdim(), fNumerator->GetDimension());
      return -4;
   }
   // Check that the numbers of bins for the histograms match
   if (fNumerator->GetNbinsX() != fDenominator->GetNbinsX() ||
       (f1->GetNdim() > 1 && fNumerator->GetNbinsY() != fDenominator->GetNbinsY()) ||
       (f1->GetNdim() > 2 && fNumerator->GetNbinsZ() != fDenominator->GetNbinsZ())) {
      Error("Fit", "numerator and denominator histograms do not have identical numbers of bins");
      return -6;
   }

   // initialize the fitter

   if (!fFitter) {
      fFitter = new ROOT::Fit::Fitter();
   }


   std::vector<ROOT::Fit::ParameterSettings> & parameters = fFitter->Config().ParamsSettings();
   parameters.reserve(npar);
   for (i = 0; i < npar; i++) {

      // assign an ARBITRARY starting error to ensure the parameter won't be fixed!
      Double_t we = f1->GetParError(i);
      if (we <= 0) we = 0.3*TMath::Abs(f1->GetParameter(i));
      if (we == 0) we = 0.01;

      parameters.push_back(ROOT::Fit::ParameterSettings(f1->GetParName(i), f1->GetParameter(i), we) );

      Double_t plow, pup; 
      f1->GetParLimits(i,plow,pup);
      if (plow*pup != 0 && plow >= pup) { // this is a limitation - cannot fix a parameter to zero value
         parameters.back().Fix();
      }
      else if (plow < pup ) { 
         parameters.back().SetLimits(plow,pup);
      }
   }

   // fcn must be set after setting the parameters 
   ROOT::Math::Functor fcnFunction(this, &TBinomialEfficiencyFitter::EvaluateFCN, npar);
   fFitter->SetFCN(static_cast<ROOT::Math::IMultiGenFunction&>(fcnFunction));


   // in case default value of 1.0 is used 
   if (fFitter->Config().MinimizerOptions().ErrorDef() == 1.0 ) { 
      fFitter->Config().MinimizerOptions().SetErrorDef(0.5);
   }

   if (verbose)   { 
      fFitter->Config().MinimizerOptions().SetPrintLevel(3);
   }
   else if (quiet) {
      fFitter->Config().MinimizerOptions().SetPrintLevel(0);
   }
   
      

   // perform the actual fit

   fFitDone = kTRUE;
   Bool_t status = fFitter->FitFCN();
   if ( !status && !quiet)
      Warning("Fit","Abnormal termination of minimization.");

   
   //Store fit results in fitFunction
   const ROOT::Fit::FitResult & fitResult = fFitter->Result(); 
   if (!fitResult.IsEmpty() ) { 
      // set in f1 the result of the fit      
      f1->SetNDF(fitResult.Ndf() );

      //f1->SetNumberFitPoints(...);  // this is set in ComputeFCN

      f1->SetParameters( &(fitResult.Parameters().front()) ); 
      if ( int( fitResult.Errors().size()) >= f1->GetNpar() ) 
         f1->SetParErrors( &(fitResult.Errors().front()) ); 

      f1->SetChisquare(2.*fitResult.MinFcnValue());    // store goodness of fit (Baker&Cousins)
      f1->SetNDF(f1->GetNumberFitPoints()- fitResult.NFreeParameters());
      Info("result"," chi2 %f ndf %d ",2.*fitResult.MinFcnValue(), fitResult.Ndf() );

   }
   // create a new result class if needed 
   if (saveResult) { 
      TFitResult* fr = new TFitResult(fitResult);
      TString name = TString::Format("TBinomialEfficiencyFitter_result_of_%s",f1->GetName() );
      fr->SetName(name); fr->SetTitle(name);
      return TFitResultPtr(fr);
   }
   else { 
      return TFitResultPtr(fitResult.Status() );
   }

}

//______________________________________________________________________________
void TBinomialEfficiencyFitter::ComputeFCN(Double_t& f, const Double_t* par)
{
   // Compute the likelihood.

   int nDim = fDenominator->GetDimension();

   int xlowbin  = fDenominator->GetXaxis()->GetFirst();
   int xhighbin = fDenominator->GetXaxis()->GetLast();
   int ylowbin = 0, yhighbin = 0, zlowbin = 0, zhighbin = 0;
   if (nDim > 1) {
      ylowbin  = fDenominator->GetYaxis()->GetFirst();
      yhighbin = fDenominator->GetYaxis()->GetLast();
      if (nDim > 2) {
         zlowbin  = fDenominator->GetZaxis()->GetFirst();
         zhighbin = fDenominator->GetZaxis()->GetLast();
      }
   }

   fFunction->SetParameters(par);

   if (fRange) {
      double xmin, xmax, ymin, ymax, zmin, zmax;

      // This way to ensure that a minimum range chosen exactly at a
      // bin boundary is far from elegant, but is hopefully adequate.

      if (nDim == 1) {
         fFunction->GetRange(xmin, xmax);
         xlowbin  = fDenominator->GetXaxis()->FindBin(xmin);
         xhighbin = fDenominator->GetXaxis()->FindBin(xmax);
      } else if (nDim == 2) {
         fFunction->GetRange(xmin, ymin, xmax, ymax);
         xlowbin  = fDenominator->GetXaxis()->FindBin(xmin);
         xhighbin = fDenominator->GetXaxis()->FindBin(xmax);
         ylowbin  = fDenominator->GetYaxis()->FindBin(ymin);
         yhighbin = fDenominator->GetYaxis()->FindBin(ymax);
      } else if (nDim == 3) {
         fFunction->GetRange(xmin, ymin, zmin, xmax, ymax, zmax);
         xlowbin  = fDenominator->GetXaxis()->FindBin(xmin);
         xhighbin = fDenominator->GetXaxis()->FindBin(xmax);
         ylowbin  = fDenominator->GetYaxis()->FindBin(ymin);
         yhighbin = fDenominator->GetYaxis()->FindBin(ymax);
         zlowbin  = fDenominator->GetZaxis()->FindBin(zmin);
         zhighbin = fDenominator->GetZaxis()->FindBin(zmax);
      }
   }

   // The coding below is perhaps somewhat awkward -- but it is done
   // so that 1D, 2D, and 3D cases can be covered in the same loops.

   f = 0.;

   Int_t npoints = 0;
   Double_t nmax = 0;
   for (int xbin = xlowbin; xbin <= xhighbin; ++xbin) {

      // compute the bin edges
      Double_t xlow = fDenominator->GetXaxis()->GetBinLowEdge(xbin);
      Double_t xup  = fDenominator->GetXaxis()->GetBinLowEdge(xbin+1);

      for (int ybin = ylowbin; ybin <= yhighbin; ++ybin) {

         // compute the bin edges (if applicable)
         Double_t ylow  = (nDim > 1) ? fDenominator->GetYaxis()->GetBinLowEdge(ybin) : 0;
         Double_t yup   = (nDim > 1) ? fDenominator->GetYaxis()->GetBinLowEdge(ybin+1) : 0;

         for (int zbin = zlowbin; zbin <= zhighbin; ++zbin) {

            // compute the bin edges (if applicable)
            Double_t zlow  = (nDim > 2) ? fDenominator->GetZaxis()->GetBinLowEdge(zbin) : 0;
            Double_t zup   = (nDim > 2) ? fDenominator->GetZaxis()->GetBinLowEdge(zbin+1) : 0;

            int bin = fDenominator->GetBin(xbin, ybin, zbin);
            Double_t nDen = fDenominator->GetBinContent(bin);
            Double_t nNum = fNumerator->GetBinContent(bin);

            // count maximum value to use in the likelihood for inf
            // i.e. a number much larger than the other terms  
            if (nDen> nmax) nmax = nDen; 
            if (nDen <= 0.) continue;
            npoints++;
      
            // mu is the average of the function over the bin OR
            // the function evaluated at the bin centre
            // As yet, there is nothing to prevent mu from being 
            // outside the range <0,1> !!

            Double_t mu = 0;
            switch (nDim) {
               case 1:
                  mu = (fAverage) ?
                     fFunction->Integral(xlow, xup, fEpsilon) 
                        / (xup-xlow) :
                     fFunction->Eval(fDenominator->GetBinCenter(bin));
                  break;
               case 2:
                  {
                     mu = (fAverage) ?
                        ((TF2*)fFunction)->Integral(xlow, xup, ylow, yup, fEpsilon) 
                        / ((xup-xlow)*(yup-ylow)) :
                     fFunction->Eval(fDenominator->GetXaxis()->GetBinCenter(xbin),
                     fDenominator->GetYaxis()->GetBinCenter(ybin));
                  }
                  break;
               case 3:
                  {
                     mu = (fAverage) ?
                        ((TF3*)fFunction)->Integral(xlow, xup, ylow, yup, zlow, zup, fEpsilon)
                           / ((xup-xlow)*(yup-ylow)*(zup-zlow)) :
                        fFunction->Eval(fDenominator->GetXaxis()->GetBinCenter(xbin),
                                 fDenominator->GetYaxis()->GetBinCenter(ybin),
                                 fDenominator->GetZaxis()->GetBinCenter(zbin));
                  }
            }

            // binomial formula (forgetting about the factorials)
            if (nNum != 0.) {
               if (mu > 0.)
                  f -= nNum * TMath::Log(mu*nDen/nNum);
               else
                  f -= nmax * -1E30; // crossing our fingers
            }
            if (nDen - nNum != 0.) {
               if (1. - mu > 0.)
                  f -= (nDen - nNum) * TMath::Log((1. - mu)*nDen/(nDen-nNum));
               else 
                  f -= nmax * -1E30; // crossing our fingers
            }
         }
      }
   }

   fFunction->SetNumberFitPoints(npoints);
}

 TBinomialEfficiencyFitter.cxx:1
 TBinomialEfficiencyFitter.cxx:2
 TBinomialEfficiencyFitter.cxx:3
 TBinomialEfficiencyFitter.cxx:4
 TBinomialEfficiencyFitter.cxx:5
 TBinomialEfficiencyFitter.cxx:6
 TBinomialEfficiencyFitter.cxx:7
 TBinomialEfficiencyFitter.cxx:8
 TBinomialEfficiencyFitter.cxx:9
 TBinomialEfficiencyFitter.cxx:10
 TBinomialEfficiencyFitter.cxx:11
 TBinomialEfficiencyFitter.cxx:12
 TBinomialEfficiencyFitter.cxx:13
 TBinomialEfficiencyFitter.cxx:14
 TBinomialEfficiencyFitter.cxx:15
 TBinomialEfficiencyFitter.cxx:16
 TBinomialEfficiencyFitter.cxx:17
 TBinomialEfficiencyFitter.cxx:18
 TBinomialEfficiencyFitter.cxx:19
 TBinomialEfficiencyFitter.cxx:20
 TBinomialEfficiencyFitter.cxx:21
 TBinomialEfficiencyFitter.cxx:22
 TBinomialEfficiencyFitter.cxx:23
 TBinomialEfficiencyFitter.cxx:24
 TBinomialEfficiencyFitter.cxx:25
 TBinomialEfficiencyFitter.cxx:26
 TBinomialEfficiencyFitter.cxx:27
 TBinomialEfficiencyFitter.cxx:28
 TBinomialEfficiencyFitter.cxx:29
 TBinomialEfficiencyFitter.cxx:30
 TBinomialEfficiencyFitter.cxx:31
 TBinomialEfficiencyFitter.cxx:32
 TBinomialEfficiencyFitter.cxx:33
 TBinomialEfficiencyFitter.cxx:34
 TBinomialEfficiencyFitter.cxx:35
 TBinomialEfficiencyFitter.cxx:36
 TBinomialEfficiencyFitter.cxx:37
 TBinomialEfficiencyFitter.cxx:38
 TBinomialEfficiencyFitter.cxx:39
 TBinomialEfficiencyFitter.cxx:40
 TBinomialEfficiencyFitter.cxx:41
 TBinomialEfficiencyFitter.cxx:42
 TBinomialEfficiencyFitter.cxx:43
 TBinomialEfficiencyFitter.cxx:44
 TBinomialEfficiencyFitter.cxx:45
 TBinomialEfficiencyFitter.cxx:46
 TBinomialEfficiencyFitter.cxx:47
 TBinomialEfficiencyFitter.cxx:48
 TBinomialEfficiencyFitter.cxx:49
 TBinomialEfficiencyFitter.cxx:50
 TBinomialEfficiencyFitter.cxx:51
 TBinomialEfficiencyFitter.cxx:52
 TBinomialEfficiencyFitter.cxx:53
 TBinomialEfficiencyFitter.cxx:54
 TBinomialEfficiencyFitter.cxx:55
 TBinomialEfficiencyFitter.cxx:56
 TBinomialEfficiencyFitter.cxx:57
 TBinomialEfficiencyFitter.cxx:58
 TBinomialEfficiencyFitter.cxx:59
 TBinomialEfficiencyFitter.cxx:60
 TBinomialEfficiencyFitter.cxx:61
 TBinomialEfficiencyFitter.cxx:62
 TBinomialEfficiencyFitter.cxx:63
 TBinomialEfficiencyFitter.cxx:64
 TBinomialEfficiencyFitter.cxx:65
 TBinomialEfficiencyFitter.cxx:66
 TBinomialEfficiencyFitter.cxx:67
 TBinomialEfficiencyFitter.cxx:68
 TBinomialEfficiencyFitter.cxx:69
 TBinomialEfficiencyFitter.cxx:70
 TBinomialEfficiencyFitter.cxx:71
 TBinomialEfficiencyFitter.cxx:72
 TBinomialEfficiencyFitter.cxx:73
 TBinomialEfficiencyFitter.cxx:74
 TBinomialEfficiencyFitter.cxx:75
 TBinomialEfficiencyFitter.cxx:76
 TBinomialEfficiencyFitter.cxx:77
 TBinomialEfficiencyFitter.cxx:78
 TBinomialEfficiencyFitter.cxx:79
 TBinomialEfficiencyFitter.cxx:80
 TBinomialEfficiencyFitter.cxx:81
 TBinomialEfficiencyFitter.cxx:82
 TBinomialEfficiencyFitter.cxx:83
 TBinomialEfficiencyFitter.cxx:84
 TBinomialEfficiencyFitter.cxx:85
 TBinomialEfficiencyFitter.cxx:86
 TBinomialEfficiencyFitter.cxx:87
 TBinomialEfficiencyFitter.cxx:88
 TBinomialEfficiencyFitter.cxx:89
 TBinomialEfficiencyFitter.cxx:90
 TBinomialEfficiencyFitter.cxx:91
 TBinomialEfficiencyFitter.cxx:92
 TBinomialEfficiencyFitter.cxx:93
 TBinomialEfficiencyFitter.cxx:94
 TBinomialEfficiencyFitter.cxx:95
 TBinomialEfficiencyFitter.cxx:96
 TBinomialEfficiencyFitter.cxx:97
 TBinomialEfficiencyFitter.cxx:98
 TBinomialEfficiencyFitter.cxx:99
 TBinomialEfficiencyFitter.cxx:100
 TBinomialEfficiencyFitter.cxx:101
 TBinomialEfficiencyFitter.cxx:102
 TBinomialEfficiencyFitter.cxx:103
 TBinomialEfficiencyFitter.cxx:104
 TBinomialEfficiencyFitter.cxx:105
 TBinomialEfficiencyFitter.cxx:106
 TBinomialEfficiencyFitter.cxx:107
 TBinomialEfficiencyFitter.cxx:108
 TBinomialEfficiencyFitter.cxx:109
 TBinomialEfficiencyFitter.cxx:110
 TBinomialEfficiencyFitter.cxx:111
 TBinomialEfficiencyFitter.cxx:112
 TBinomialEfficiencyFitter.cxx:113
 TBinomialEfficiencyFitter.cxx:114
 TBinomialEfficiencyFitter.cxx:115
 TBinomialEfficiencyFitter.cxx:116
 TBinomialEfficiencyFitter.cxx:117
 TBinomialEfficiencyFitter.cxx:118
 TBinomialEfficiencyFitter.cxx:119
 TBinomialEfficiencyFitter.cxx:120
 TBinomialEfficiencyFitter.cxx:121
 TBinomialEfficiencyFitter.cxx:122
 TBinomialEfficiencyFitter.cxx:123
 TBinomialEfficiencyFitter.cxx:124
 TBinomialEfficiencyFitter.cxx:125
 TBinomialEfficiencyFitter.cxx:126
 TBinomialEfficiencyFitter.cxx:127
 TBinomialEfficiencyFitter.cxx:128
 TBinomialEfficiencyFitter.cxx:129
 TBinomialEfficiencyFitter.cxx:130
 TBinomialEfficiencyFitter.cxx:131
 TBinomialEfficiencyFitter.cxx:132
 TBinomialEfficiencyFitter.cxx:133
 TBinomialEfficiencyFitter.cxx:134
 TBinomialEfficiencyFitter.cxx:135
 TBinomialEfficiencyFitter.cxx:136
 TBinomialEfficiencyFitter.cxx:137
 TBinomialEfficiencyFitter.cxx:138
 TBinomialEfficiencyFitter.cxx:139
 TBinomialEfficiencyFitter.cxx:140
 TBinomialEfficiencyFitter.cxx:141
 TBinomialEfficiencyFitter.cxx:142
 TBinomialEfficiencyFitter.cxx:143
 TBinomialEfficiencyFitter.cxx:144
 TBinomialEfficiencyFitter.cxx:145
 TBinomialEfficiencyFitter.cxx:146
 TBinomialEfficiencyFitter.cxx:147
 TBinomialEfficiencyFitter.cxx:148
 TBinomialEfficiencyFitter.cxx:149
 TBinomialEfficiencyFitter.cxx:150
 TBinomialEfficiencyFitter.cxx:151
 TBinomialEfficiencyFitter.cxx:152
 TBinomialEfficiencyFitter.cxx:153
 TBinomialEfficiencyFitter.cxx:154
 TBinomialEfficiencyFitter.cxx:155
 TBinomialEfficiencyFitter.cxx:156
 TBinomialEfficiencyFitter.cxx:157
 TBinomialEfficiencyFitter.cxx:158
 TBinomialEfficiencyFitter.cxx:159
 TBinomialEfficiencyFitter.cxx:160
 TBinomialEfficiencyFitter.cxx:161
 TBinomialEfficiencyFitter.cxx:162
 TBinomialEfficiencyFitter.cxx:163
 TBinomialEfficiencyFitter.cxx:164
 TBinomialEfficiencyFitter.cxx:165
 TBinomialEfficiencyFitter.cxx:166
 TBinomialEfficiencyFitter.cxx:167
 TBinomialEfficiencyFitter.cxx:168
 TBinomialEfficiencyFitter.cxx:169
 TBinomialEfficiencyFitter.cxx:170
 TBinomialEfficiencyFitter.cxx:171
 TBinomialEfficiencyFitter.cxx:172
 TBinomialEfficiencyFitter.cxx:173
 TBinomialEfficiencyFitter.cxx:174
 TBinomialEfficiencyFitter.cxx:175
 TBinomialEfficiencyFitter.cxx:176
 TBinomialEfficiencyFitter.cxx:177
 TBinomialEfficiencyFitter.cxx:178
 TBinomialEfficiencyFitter.cxx:179
 TBinomialEfficiencyFitter.cxx:180
 TBinomialEfficiencyFitter.cxx:181
 TBinomialEfficiencyFitter.cxx:182
 TBinomialEfficiencyFitter.cxx:183
 TBinomialEfficiencyFitter.cxx:184
 TBinomialEfficiencyFitter.cxx:185
 TBinomialEfficiencyFitter.cxx:186
 TBinomialEfficiencyFitter.cxx:187
 TBinomialEfficiencyFitter.cxx:188
 TBinomialEfficiencyFitter.cxx:189
 TBinomialEfficiencyFitter.cxx:190
 TBinomialEfficiencyFitter.cxx:191
 TBinomialEfficiencyFitter.cxx:192
 TBinomialEfficiencyFitter.cxx:193
 TBinomialEfficiencyFitter.cxx:194
 TBinomialEfficiencyFitter.cxx:195
 TBinomialEfficiencyFitter.cxx:196
 TBinomialEfficiencyFitter.cxx:197
 TBinomialEfficiencyFitter.cxx:198
 TBinomialEfficiencyFitter.cxx:199
 TBinomialEfficiencyFitter.cxx:200
 TBinomialEfficiencyFitter.cxx:201
 TBinomialEfficiencyFitter.cxx:202
 TBinomialEfficiencyFitter.cxx:203
 TBinomialEfficiencyFitter.cxx:204
 TBinomialEfficiencyFitter.cxx:205
 TBinomialEfficiencyFitter.cxx:206
 TBinomialEfficiencyFitter.cxx:207
 TBinomialEfficiencyFitter.cxx:208
 TBinomialEfficiencyFitter.cxx:209
 TBinomialEfficiencyFitter.cxx:210
 TBinomialEfficiencyFitter.cxx:211
 TBinomialEfficiencyFitter.cxx:212
 TBinomialEfficiencyFitter.cxx:213
 TBinomialEfficiencyFitter.cxx:214
 TBinomialEfficiencyFitter.cxx:215
 TBinomialEfficiencyFitter.cxx:216
 TBinomialEfficiencyFitter.cxx:217
 TBinomialEfficiencyFitter.cxx:218
 TBinomialEfficiencyFitter.cxx:219
 TBinomialEfficiencyFitter.cxx:220
 TBinomialEfficiencyFitter.cxx:221
 TBinomialEfficiencyFitter.cxx:222
 TBinomialEfficiencyFitter.cxx:223
 TBinomialEfficiencyFitter.cxx:224
 TBinomialEfficiencyFitter.cxx:225
 TBinomialEfficiencyFitter.cxx:226
 TBinomialEfficiencyFitter.cxx:227
 TBinomialEfficiencyFitter.cxx:228
 TBinomialEfficiencyFitter.cxx:229
 TBinomialEfficiencyFitter.cxx:230
 TBinomialEfficiencyFitter.cxx:231
 TBinomialEfficiencyFitter.cxx:232
 TBinomialEfficiencyFitter.cxx:233
 TBinomialEfficiencyFitter.cxx:234
 TBinomialEfficiencyFitter.cxx:235
 TBinomialEfficiencyFitter.cxx:236
 TBinomialEfficiencyFitter.cxx:237
 TBinomialEfficiencyFitter.cxx:238
 TBinomialEfficiencyFitter.cxx:239
 TBinomialEfficiencyFitter.cxx:240
 TBinomialEfficiencyFitter.cxx:241
 TBinomialEfficiencyFitter.cxx:242
 TBinomialEfficiencyFitter.cxx:243
 TBinomialEfficiencyFitter.cxx:244
 TBinomialEfficiencyFitter.cxx:245
 TBinomialEfficiencyFitter.cxx:246
 TBinomialEfficiencyFitter.cxx:247
 TBinomialEfficiencyFitter.cxx:248
 TBinomialEfficiencyFitter.cxx:249
 TBinomialEfficiencyFitter.cxx:250
 TBinomialEfficiencyFitter.cxx:251
 TBinomialEfficiencyFitter.cxx:252
 TBinomialEfficiencyFitter.cxx:253
 TBinomialEfficiencyFitter.cxx:254
 TBinomialEfficiencyFitter.cxx:255
 TBinomialEfficiencyFitter.cxx:256
 TBinomialEfficiencyFitter.cxx:257
 TBinomialEfficiencyFitter.cxx:258
 TBinomialEfficiencyFitter.cxx:259
 TBinomialEfficiencyFitter.cxx:260
 TBinomialEfficiencyFitter.cxx:261
 TBinomialEfficiencyFitter.cxx:262
 TBinomialEfficiencyFitter.cxx:263
 TBinomialEfficiencyFitter.cxx:264
 TBinomialEfficiencyFitter.cxx:265
 TBinomialEfficiencyFitter.cxx:266
 TBinomialEfficiencyFitter.cxx:267
 TBinomialEfficiencyFitter.cxx:268
 TBinomialEfficiencyFitter.cxx:269
 TBinomialEfficiencyFitter.cxx:270
 TBinomialEfficiencyFitter.cxx:271
 TBinomialEfficiencyFitter.cxx:272
 TBinomialEfficiencyFitter.cxx:273
 TBinomialEfficiencyFitter.cxx:274
 TBinomialEfficiencyFitter.cxx:275
 TBinomialEfficiencyFitter.cxx:276
 TBinomialEfficiencyFitter.cxx:277
 TBinomialEfficiencyFitter.cxx:278
 TBinomialEfficiencyFitter.cxx:279
 TBinomialEfficiencyFitter.cxx:280
 TBinomialEfficiencyFitter.cxx:281
 TBinomialEfficiencyFitter.cxx:282
 TBinomialEfficiencyFitter.cxx:283
 TBinomialEfficiencyFitter.cxx:284
 TBinomialEfficiencyFitter.cxx:285
 TBinomialEfficiencyFitter.cxx:286
 TBinomialEfficiencyFitter.cxx:287
 TBinomialEfficiencyFitter.cxx:288
 TBinomialEfficiencyFitter.cxx:289
 TBinomialEfficiencyFitter.cxx:290
 TBinomialEfficiencyFitter.cxx:291
 TBinomialEfficiencyFitter.cxx:292
 TBinomialEfficiencyFitter.cxx:293
 TBinomialEfficiencyFitter.cxx:294
 TBinomialEfficiencyFitter.cxx:295
 TBinomialEfficiencyFitter.cxx:296
 TBinomialEfficiencyFitter.cxx:297
 TBinomialEfficiencyFitter.cxx:298
 TBinomialEfficiencyFitter.cxx:299
 TBinomialEfficiencyFitter.cxx:300
 TBinomialEfficiencyFitter.cxx:301
 TBinomialEfficiencyFitter.cxx:302
 TBinomialEfficiencyFitter.cxx:303
 TBinomialEfficiencyFitter.cxx:304
 TBinomialEfficiencyFitter.cxx:305
 TBinomialEfficiencyFitter.cxx:306
 TBinomialEfficiencyFitter.cxx:307
 TBinomialEfficiencyFitter.cxx:308
 TBinomialEfficiencyFitter.cxx:309
 TBinomialEfficiencyFitter.cxx:310
 TBinomialEfficiencyFitter.cxx:311
 TBinomialEfficiencyFitter.cxx:312
 TBinomialEfficiencyFitter.cxx:313
 TBinomialEfficiencyFitter.cxx:314
 TBinomialEfficiencyFitter.cxx:315
 TBinomialEfficiencyFitter.cxx:316
 TBinomialEfficiencyFitter.cxx:317
 TBinomialEfficiencyFitter.cxx:318
 TBinomialEfficiencyFitter.cxx:319
 TBinomialEfficiencyFitter.cxx:320
 TBinomialEfficiencyFitter.cxx:321
 TBinomialEfficiencyFitter.cxx:322
 TBinomialEfficiencyFitter.cxx:323
 TBinomialEfficiencyFitter.cxx:324
 TBinomialEfficiencyFitter.cxx:325
 TBinomialEfficiencyFitter.cxx:326
 TBinomialEfficiencyFitter.cxx:327
 TBinomialEfficiencyFitter.cxx:328
 TBinomialEfficiencyFitter.cxx:329
 TBinomialEfficiencyFitter.cxx:330
 TBinomialEfficiencyFitter.cxx:331
 TBinomialEfficiencyFitter.cxx:332
 TBinomialEfficiencyFitter.cxx:333
 TBinomialEfficiencyFitter.cxx:334
 TBinomialEfficiencyFitter.cxx:335
 TBinomialEfficiencyFitter.cxx:336
 TBinomialEfficiencyFitter.cxx:337
 TBinomialEfficiencyFitter.cxx:338
 TBinomialEfficiencyFitter.cxx:339
 TBinomialEfficiencyFitter.cxx:340
 TBinomialEfficiencyFitter.cxx:341
 TBinomialEfficiencyFitter.cxx:342
 TBinomialEfficiencyFitter.cxx:343
 TBinomialEfficiencyFitter.cxx:344
 TBinomialEfficiencyFitter.cxx:345
 TBinomialEfficiencyFitter.cxx:346
 TBinomialEfficiencyFitter.cxx:347
 TBinomialEfficiencyFitter.cxx:348
 TBinomialEfficiencyFitter.cxx:349
 TBinomialEfficiencyFitter.cxx:350
 TBinomialEfficiencyFitter.cxx:351
 TBinomialEfficiencyFitter.cxx:352
 TBinomialEfficiencyFitter.cxx:353
 TBinomialEfficiencyFitter.cxx:354
 TBinomialEfficiencyFitter.cxx:355
 TBinomialEfficiencyFitter.cxx:356
 TBinomialEfficiencyFitter.cxx:357
 TBinomialEfficiencyFitter.cxx:358
 TBinomialEfficiencyFitter.cxx:359
 TBinomialEfficiencyFitter.cxx:360
 TBinomialEfficiencyFitter.cxx:361
 TBinomialEfficiencyFitter.cxx:362
 TBinomialEfficiencyFitter.cxx:363
 TBinomialEfficiencyFitter.cxx:364
 TBinomialEfficiencyFitter.cxx:365
 TBinomialEfficiencyFitter.cxx:366
 TBinomialEfficiencyFitter.cxx:367
 TBinomialEfficiencyFitter.cxx:368
 TBinomialEfficiencyFitter.cxx:369
 TBinomialEfficiencyFitter.cxx:370
 TBinomialEfficiencyFitter.cxx:371
 TBinomialEfficiencyFitter.cxx:372
 TBinomialEfficiencyFitter.cxx:373
 TBinomialEfficiencyFitter.cxx:374
 TBinomialEfficiencyFitter.cxx:375
 TBinomialEfficiencyFitter.cxx:376
 TBinomialEfficiencyFitter.cxx:377
 TBinomialEfficiencyFitter.cxx:378
 TBinomialEfficiencyFitter.cxx:379
 TBinomialEfficiencyFitter.cxx:380
 TBinomialEfficiencyFitter.cxx:381
 TBinomialEfficiencyFitter.cxx:382
 TBinomialEfficiencyFitter.cxx:383
 TBinomialEfficiencyFitter.cxx:384
 TBinomialEfficiencyFitter.cxx:385
 TBinomialEfficiencyFitter.cxx:386
 TBinomialEfficiencyFitter.cxx:387
 TBinomialEfficiencyFitter.cxx:388
 TBinomialEfficiencyFitter.cxx:389
 TBinomialEfficiencyFitter.cxx:390
 TBinomialEfficiencyFitter.cxx:391
 TBinomialEfficiencyFitter.cxx:392
 TBinomialEfficiencyFitter.cxx:393
 TBinomialEfficiencyFitter.cxx:394
 TBinomialEfficiencyFitter.cxx:395
 TBinomialEfficiencyFitter.cxx:396
 TBinomialEfficiencyFitter.cxx:397
 TBinomialEfficiencyFitter.cxx:398
 TBinomialEfficiencyFitter.cxx:399
 TBinomialEfficiencyFitter.cxx:400
 TBinomialEfficiencyFitter.cxx:401
 TBinomialEfficiencyFitter.cxx:402
 TBinomialEfficiencyFitter.cxx:403
 TBinomialEfficiencyFitter.cxx:404
 TBinomialEfficiencyFitter.cxx:405
 TBinomialEfficiencyFitter.cxx:406
 TBinomialEfficiencyFitter.cxx:407
 TBinomialEfficiencyFitter.cxx:408
 TBinomialEfficiencyFitter.cxx:409
 TBinomialEfficiencyFitter.cxx:410
 TBinomialEfficiencyFitter.cxx:411
 TBinomialEfficiencyFitter.cxx:412
 TBinomialEfficiencyFitter.cxx:413
 TBinomialEfficiencyFitter.cxx:414
 TBinomialEfficiencyFitter.cxx:415
 TBinomialEfficiencyFitter.cxx:416
 TBinomialEfficiencyFitter.cxx:417
 TBinomialEfficiencyFitter.cxx:418
 TBinomialEfficiencyFitter.cxx:419
 TBinomialEfficiencyFitter.cxx:420
 TBinomialEfficiencyFitter.cxx:421
 TBinomialEfficiencyFitter.cxx:422
 TBinomialEfficiencyFitter.cxx:423
 TBinomialEfficiencyFitter.cxx:424
 TBinomialEfficiencyFitter.cxx:425
 TBinomialEfficiencyFitter.cxx:426
 TBinomialEfficiencyFitter.cxx:427
 TBinomialEfficiencyFitter.cxx:428
 TBinomialEfficiencyFitter.cxx:429
 TBinomialEfficiencyFitter.cxx:430
 TBinomialEfficiencyFitter.cxx:431
 TBinomialEfficiencyFitter.cxx:432
 TBinomialEfficiencyFitter.cxx:433
 TBinomialEfficiencyFitter.cxx:434
 TBinomialEfficiencyFitter.cxx:435
 TBinomialEfficiencyFitter.cxx:436
 TBinomialEfficiencyFitter.cxx:437
 TBinomialEfficiencyFitter.cxx:438
 TBinomialEfficiencyFitter.cxx:439
 TBinomialEfficiencyFitter.cxx:440
 TBinomialEfficiencyFitter.cxx:441
 TBinomialEfficiencyFitter.cxx:442
 TBinomialEfficiencyFitter.cxx:443
 TBinomialEfficiencyFitter.cxx:444
 TBinomialEfficiencyFitter.cxx:445
 TBinomialEfficiencyFitter.cxx:446
 TBinomialEfficiencyFitter.cxx:447