1#ifndef ROOT_TEfficiency_cxx 
    2#define ROOT_TEfficiency_cxx 
  700fPassedHistogram(nullptr),
 
  701fTotalHistogram(nullptr),
 
 
  756         Info(
"TEfficiency",
"given histograms are filled with weights");
 
  761      Error(
"TEfficiency(const TH1&,const TH1&)",
"histograms are not consistent -> results are useless");
 
  762      Warning(
"TEfficiency(const TH1&,const TH1&)",
"using two empty TH1D('h1','h1',10,0,10)");
 
 
  984      fTotalHistogram = 
new TH3D(
"total",
"total",
nbinsx,xlow,xup,
nbinsy,ylow,yup,
nbinsz,
zlow,
zup);
 
  985      fPassedHistogram = 
new TH3D(
"passed",
"passed",
nbinsx,xlow,xup,
nbinsy,ylow,yup,
nbinsz,
zlow,
zup);
 
 
 1024fPaintGraph(nullptr),
 
 1025fPaintHisto(nullptr),
 
 
 1059   fBeta_alpha(
rEff.fBeta_alpha),
 
 1060   fBeta_beta(
rEff.fBeta_beta),
 
 1061   fBeta_bin_params(
rEff.fBeta_bin_params),
 
 1062   fConfLevel(
rEff.fConfLevel),
 
 1063   fDirectory(nullptr),
 
 1064   fFunctions(nullptr),
 
 1065   fPaintGraph(nullptr),
 
 1066   fPaintHisto(nullptr),
 
 1067   fWeight(
rEff.fWeight)
 
 1070   rEff.TObject::Copy(*
this);
 
 1083   title += 
rEff.GetTitle();
 
 1091   rEff.TAttLine::Copy(*
this);
 
 1092   rEff.TAttFill::Copy(*
this);
 
 1093   rEff.TAttMarker::Copy(*
this);
 
 
 1158      return ((
mode + delta) > 1) ? 1.0 : (
mode + delta);
 
 1160      return ((
mode - delta) < 0) ? 0.0 : (
mode - delta);
 
 
 1177      ::Error(
"FeldmanCousins",
"Error running FC method - return 0 or 1");
 
 
 1208   double alpha = 1.-level;
 
 
 1232   const double alpha = 1. - level;
 
 1235   const double tol = 1
e-9; 
 
 
 1351      if((
a > 0) && (
b > 0))
 
 1354         gROOT->Error(
"TEfficiency::BayesianCentral",
"Invalid input parameters - return 1");
 
 1359      if((
a > 0) && (
b > 0))
 
 1362         gROOT->Error(
"TEfficiency::BayesianCentral",
"Invalid input parameters - return 0");
 
 
 1406   if (
a <= 0 || 
b <= 0) {
 
 1408      gROOT->Error(
"TEfficiency::BayesianShortest",
"Invalid input parameters - return [0,1]");
 
 1427   if ( 
a==
b && 
a<=1.0) {
 
 1441   bool ret = 
minim.Minimize(100, 1.E-10,1.E-10);
 
 1443      gROOT->Error(
"TEfficiency::BayesianShortes",
"Error finding the shortest interval");
 
 
 1460   if (
a <= 0 || 
b <= 0 ) {
 
 1461      gROOT->Error(
"TEfficiency::BayesianMean",
"Invalid input parameters - return 0");
 
 
 1483   if (
a <= 0 || 
b <= 0 ) {
 
 1484      gROOT->Error(
"TEfficiency::BayesianMode",
"Invalid input parameters - return 0");
 
 1487   if ( 
a <= 1 || 
b <= 1) {
 
 1488      if ( 
a < 
b) 
return 0;
 
 1489      if ( 
a > 
b) 
return 1;
 
 1490      if (
a == 
b) 
return 0.5; 
 
 
 1550      if(
ax1->GetNbins() != 
ax2->GetNbins()) {
 
 1551         gROOT->Info(
"TEfficiency::CheckBinning",
"Histograms are not consistent: they have different number of bins");
 
 1555      for(
Int_t i = 1; i <= 
ax1->GetNbins() + 1; ++i)
 
 1557            gROOT->Info(
"TEfficiency::CheckBinning",
"Histograms are not consistent: they have different bin edges");
 
 
 1578   if(
pass.GetDimension() != 
total.GetDimension()) {
 
 1579      gROOT->Error(
"TEfficiency::CheckConsistency",
"passed TEfficiency objects have different dimensions");
 
 1584      gROOT->Error(
"TEfficiency::CheckConsistency",
"passed TEfficiency objects have different binning");
 
 1589      gROOT->Error(
"TEfficiency::CheckConsistency",
"passed TEfficiency objects do not have consistent bin contents");
 
 
 1618   switch(
pass.GetDimension()) {
 
 1619      case 1: nbins = 
nbinsx + 2; 
break;
 
 1625   for(
Int_t i = 0; i < nbins; ++i) {
 
 1626      if(
pass.GetBinContent(i) > 
total.GetBinContent(i)) {
 
 1627         gROOT->Info(
"TEfficiency::CheckEntries",
"Histograms are not consistent: passed bin content > total bin content");
 
 
 1640   if (
pass.GetSumw2N() == 0 && 
total.GetSumw2N() == 0) 
return false;
 
 
 1670      Error(
"CreatePaintingGraph",
"Call this function only for dimension == 1");
 
 1676   graph->SetName(
"eff_graph");
 
 
 1689      Error(
"CreatePaintingGraph",
"Call this function only for dimension == 2");
 
 1695   graph->SetName(
"eff_graph");
 
 
 1719   double * px = 
graph->GetX();
 
 1720   double * py = 
graph->GetY();
 
 1721   double * pz = 
graph->GetZ();
 
 1802   graph->GetHistogram();
 
 
 1823   double * px = 
graph->GetX();
 
 1824   double * py = 
graph->GetY();
 
 1839      if (
j >= 
graph->GetN() ) {
 
 1841         graph->SetPointError(
j,xlow,xup,ylow,yup);
 
 1884   graph->GetHistogram();
 
 
 1895      Error(
"CreatePaintingistogram",
"Call this function only for dimension == 2");
 
 1903   TH2 * hist = 
nullptr;
 
 1905   if (
xaxis->IsVariableBinSize() && 
yaxis->IsVariableBinSize() )
 
 1908   else if (
xaxis->IsVariableBinSize() && ! 
yaxis->IsVariableBinSize() )
 
 1911   else if (!
xaxis->IsVariableBinSize() &&  
yaxis->IsVariableBinSize() )
 
 
 2018   Double_t alpha = (1.0 - level) / 2;
 
 
 2129   for (
int i = 0; i < 
n ; ++i) {
 
 2131         ::Error(
"TEfficiency::Combine",
"total events = %i < passed events %i",
total[i],
pass[i]);
 
 2132         ::Info(
"TEfficiency::Combine",
"stop combining");
 
 2147      ::Info(
"TEfficiency::Combine",
"stop combining");
 
 2151   double a = 
ktot + alpha;
 
 2154   double mean = 
a/(
a+
b);
 
 
 2236      level = atof( opt(pos,opt.
Length() ).
Data() );
 
 2237      if((level <= 0) || (level >= 1))
 
 2245      for(
Int_t k = 0; k < 
n; ++k) {
 
 2249            gROOT->Error(
"TEfficiency::Combine",
"invalid custom weight found w = %.2lf",
w[k]);
 
 2250            gROOT->Info(
"TEfficiency::Combine",
"stop combining");
 
 2259   while((obj = next())) {
 
 2263         if(
pEff->GetDimension() > 1)
 
 2265         if(!level) level = 
pEff->GetConfidenceLevel();
 
 2267         if(alpha<1) alpha = 
pEff->GetBetaAlpha();
 
 2268         if(beta<1) beta = 
pEff->GetBetaBeta();
 
 2272            if(alpha != 
pEff->GetBetaAlpha())
 
 2274            if(beta != 
pEff->GetBetaBeta())
 
 2276            if(!
pEff->UsesBayesianStat())
 
 2301      gROOT->Error(
"TEfficiency::Combine",
"no TEfficiency objects in given list");
 
 2302      gROOT->Info(
"TEfficiency::Combine",
"stop combining");
 
 2308      gROOT->Error(
"TEfficiency::Combine",
"number of weights n=%i differs from number of TEfficiency objects k=%i which should be combined",
n,(
Int_t)
vTotal.size());
 
 2309      gROOT->Info(
"TEfficiency::Combine",
"stop combining");
 
 2317         gROOT->Warning(
"TEfficiency::Combine",
"histograms have not the same binning -> results may be useless");
 
 2323      gROOT->Info(
"TEfficiency::Combine",
"combining %i TEfficiency objects",(
Int_t)
vTotal.size());
 
 2325         gROOT->Info(
"TEfficiency::Combine",
"using custom weights");
 
 2327         gROOT->Info(
"TEfficiency::Combine",
"using the following prior probability for the efficiency: P(e) ~ Beta(e,%.3lf,%.3lf)",alpha,beta);
 
 2330         gROOT->Info(
"TEfficiency::Combine",
"using individual priors of each TEfficiency object");
 
 2331      gROOT->Info(
"TEfficiency::Combine",
"confidence level = %.2lf",level);
 
 2345   std::vector<Int_t> 
pass(num);
 
 2346   std::vector<Int_t> 
total(num);
 
 2353      x[i-1] = 
vTotal.at(0)->GetBinCenter(i);
 
 2354      xlow[i-1] = 
x[i-1] - 
vTotal.at(0)->GetBinLowEdge(i);
 
 2355      xhigh[i-1] = 
vTotal.at(0)->GetBinWidth(i) - xlow[i-1];
 
 2365      if(
eff[i-1] == -1) {
 
 2366         gROOT->Error(
"TEfficiency::Combine",
"error occurred during combining");
 
 2367         gROOT->Info(
"TEfficiency::Combine",
"stop combining");
 
 
 2562   if(
option.Contains(
"+")) {
 
 2563      option.ReplaceAll(
"+",
"");
 
 2572   if (!
option.Contains(
"N")) { 
 
 2579         while((obj = next())) {
 
 
 2702         double norm = 
tw/
tw2;
 
 2703         aa =  
pw * norm + alpha;
 
 2704         bb =  (
tw - 
pw) * norm + beta;
 
 
 2752         if (
tw2 <= 0) 
return 0;
 
 2773            Warning(
"GetEfficiencyErrorLow",
"frequentist confidence intervals for weights are only supported by the normal approximation");
 
 2774            Info(
"GetEfficiencyErrorLow",
"setting statistic option to kFNormal");
 
 2785         return (
eff - delta < 0) ? 
eff : delta;
 
 
 2832         if (
tw2 <= 0) 
return 0;
 
 2853            Warning(
"GetEfficiencyErrorUp",
"frequentist confidence intervals for weights are only supported by the normal approximation");
 
 2854            Info(
"GetEfficiencyErrorUp",
"setting statistic option to kFNormal");
 
 2864         return (
eff + delta > 1) ? 1.-
eff : delta;
 
 
 2917   if(!
pList->IsEmpty()) {
 
 2921      while((obj = next())) {
 
 
 2961      return ((average + delta) > 1) ? 1.0 : (average + delta);
 
 2963      return ((average - delta) < 0) ? 0.0 : (average - delta);
 
 
 2988      Fatal(
"operator+=",
"Adding to a non consistent TEfficiency object which has not a total or a passed histogram ");
 
 2992   if (
rhs.fTotalHistogram == 
nullptr && 
rhs.fPassedHistogram == 
nullptr ) {
 
 2993      Warning(
"operator+=",
"no operation: adding an empty object");
 
 2996   else  if (
rhs.fTotalHistogram == 
nullptr  || 
rhs.fPassedHistogram == 
nullptr ) {
 
 2997      Fatal(
"operator+=",
"Adding a non consistent TEfficiency object which has not a total or a passed histogram ");
 
 
 3055      rhs.TAttLine::Copy(*
this);
 
 3056      rhs.TAttFill::Copy(*
this);
 
 3057      rhs.TAttMarker::Copy(*
this);
 
 
 3110         while ((obj = next())) {
 
 3113               ((
TF1 *)obj)->Paint(
"sameC");
 
 3122      if (
option.Contains(
"GRAPH")) {
 
 3123         option.ReplaceAll(
"GRAPH",
"");
 
 3149   Warning(
"Paint",
"Painting 3D efficiency is not implemented");
 
 
 3190         if (i != 0) out << 
", ";
 
 3193      out << 
"}; " << std::endl;
 
 3199            if (i != 0) out << 
", ";
 
 3202         out << 
"}; " << std::endl;
 
 3209            if (i != 0) out << 
", ";
 
 3212         out << 
"}; " << std::endl;
 
 3225   const char quote = 
'"';
 
 3226   out << 
indent << std::endl;
 
 3256   out << 
");" << std::endl;
 
 3257   out << 
indent << std::endl;
 
 3271      out << 
indent << 
name << 
"->SetUseWeightedEvents();" << std::endl;
 
 3288   for(
Int_t i = 0; i < nbins; ++i) {
 
 3289      out << 
indent << 
name <<
"->SetTotalEvents(" << i << 
"," <<
 
 3291      out << 
indent << 
name <<
"->SetPassedEvents(" << i << 
"," <<
 
 3298   while((obj = next())) {
 
 3301         out << 
indent << 
name << 
"->GetListOfFunctions()->Add(" 
 3302         << obj->
GetName() << 
");" << std::endl;
 
 3314   if (!
option.Contains(
"nodraw"))
 
 
 3334      Warning(
"SetBetaAlpha(Double_t)",
"invalid shape parameter %.2lf",alpha);
 
 
 3352      Warning(
"SetBetaBeta(Double_t)",
"invalid shape parameter %.2lf",beta);
 
 
 3392      Error(
"SetBins",
"Using wrong SetBins function for a %d-d histogram",
GetDimension());
 
 3396      Warning(
"SetBins",
"Histogram entries will be lost after SetBins");
 
 
 3412      Error(
"SetBins",
"Using wrong SetBins function for a %d-d histogram",
GetDimension());
 
 3416      Warning(
"SetBins",
"Histogram entries will be lost after SetBins");
 
 
 3432      Error(
"SetBins",
"Using wrong SetBins function for a %d-d histogram",
GetDimension());
 
 3436      Warning(
"SetBins",
"Histogram entries will be lost after SetBins");
 
 
 3452      Error(
"SetBins",
"Using wrong SetBins function for a %d-d histogram",
GetDimension());
 
 3456      Warning(
"SetBins",
"Histogram entries will be lost after SetBins");
 
 
 3473      Error(
"SetBins",
"Using wrong SetBins function for a %d-d histogram",
GetDimension());
 
 3477      Warning(
"SetBins",
"Histogram entries will be lost after SetBins");
 
 
 3494      Error(
"SetBins",
"Using wrong SetBins function for a %d-d histogram",
GetDimension());
 
 3498      Warning(
"SetBins",
"Histogram entries will be lost after SetBins");
 
 
 3513   if((level > 0) && (level < 1))
 
 3516      Warning(
"SetConfidenceLevel(Double_t)",
"invalid confidence level %.2lf",level);
 
 
 3828       gROOT->Info(
"TEfficiency::SetUseWeightedEvents",
"Handle weighted events for computing efficiency");
 
 
 3848      Warning(
"SetWeight",
"invalid weight %.2lf",weight);
 
 
 3882                                                              * (1 - average) + kappa * kappa / 4);
 
 3884      return ((
mode + delta) > 1) ? 1.0 : (
mode + delta);
 
 3886      return ((
mode - delta) < 0) ? 0.0 : (
mode - delta);
 
 
static void indent(ostringstream &buf, int indent_level)
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
 
const TEfficiency operator+(const TEfficiency &lhs, const TEfficiency &rhs)
Addition operator.
 
const Double_t kDefBetaAlpha
 
const Double_t kDefWeight
 
const Double_t kDefBetaBeta
 
const TEfficiency::EStatOption kDefStatOpt
 
const Double_t kDefConfLevel
 
static unsigned int total
 
winID h TVirtualViewer3D TVirtualGLPainter p
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
 
Option_t Option_t TPoint TPoint const char mode
 
User class for performing function minimization.
 
Template class to wrap any C++ callable object which takes one argument i.e.
 
Fill Area Attributes class.
 
void Copy(TAttFill &attfill) const
Copy this fill attributes to a new TAttFill.
 
virtual void SaveFillAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
Save fill attributes as C++ statement(s) on output stream out.
 
void Copy(TAttLine &attline) const
Copy this line attributes to a new TAttLine.
 
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
Save line attributes as C++ statement(s) on output stream out.
 
virtual void SaveMarkerAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t sizdef=1)
Save line attributes as C++ statement(s) on output stream out.
 
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
 
void Copy(TAttMarker &attmarker) const
Copy this marker attributes to a new TAttMarker.
 
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
 
Class to manage histogram axis.
 
virtual void SetBinLabel(Int_t bin, const char *label)
Set label for bin.
 
const char * GetTitle() const override
Returns title of object.
 
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
 
const TArrayD * GetXbins() const
 
const char * GetBinLabel(Int_t bin) const
Return label for bin.
 
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
 
virtual Int_t FindFixBin(Double_t x) const
Find bin number corresponding to abscissa x.
 
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
 
THashList * GetLabels() const
 
Binomial fitter for the division of two histograms.
 
TFitResultPtr Fit(TF1 *f1, Option_t *option="")
Carry out the fit of the given function to the given histograms.
 
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
 
Collection abstract base class.
 
TDirectory::TContext keeps track and restore the current directory.
 
Describe directory structure in memory.
 
virtual void Append(TObject *obj, Bool_t replace=kFALSE)
Append object to this directory.
 
virtual TObject * Remove(TObject *)
Remove an object from the in-memory list.
 
Class to handle efficiency histograms.
 
void FillGraph2D(TGraph2DAsymmErrors *graph, Option_t *opt) const
Fill the graph to be painted with information from TEfficiency Internal method called by TEfficiency:...
 
void Draw(Option_t *opt="") override
Draws the current TEfficiency object.
 
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
 
static Bool_t FeldmanCousinsInterval(Double_t total, Double_t passed, Double_t level, Double_t &lower, Double_t &upper)
Calculates the interval boundaries using the frequentist methods of Feldman-Cousins.
 
static Double_t BetaMode(Double_t alpha, Double_t beta)
Compute the mode of the beta distribution.
 
Bool_t SetPassedEvents(Int_t bin, Int_t events)
Sets the number of passed events in the given global bin.
 
TH2 * CreateHistogram(Option_t *opt="") const
Create the histogram used to be painted (for dim=2 TEfficiency) The return object is managed by the c...
 
static Bool_t BetaShortestInterval(Double_t level, Double_t alpha, Double_t beta, Double_t &lower, Double_t &upper)
Calculates the boundaries for a shortest confidence interval for a Beta distribution.
 
static Bool_t CheckWeights(const TH1 &pass, const TH1 &total)
Check if both histogram are weighted.
 
static Double_t BetaMean(Double_t alpha, Double_t beta)
Compute the mean (average) of the beta distribution.
 
TEfficiency()
Default constructor.
 
Double_t GetBetaAlpha(Int_t bin=-1) const
 
void FillWeighted(Bool_t bPassed, Double_t weight, Double_t x, Double_t y=0, Double_t z=0)
This function is used for filling the two histograms with a weight.
 
~TEfficiency() override
default destructor
 
TList * GetListOfFunctions()
 
static Double_t Bayesian(Double_t total, Double_t passed, Double_t level, Double_t alpha, Double_t beta, Bool_t bUpper, Bool_t bShortest=false)
Calculates the boundaries for a Bayesian confidence interval (shortest or central interval depending ...
 
static Double_t AgrestiCoull(Double_t total, Double_t passed, Double_t level, Bool_t bUpper)
Calculates the boundaries for the frequentist Agresti-Coull interval.
 
Long64_t Merge(TCollection *list)
Merges the TEfficiency objects in the given list to the given TEfficiency object using the operator+=...
 
std::vector< std::pair< Double_t, Double_t > > fBeta_bin_params
Parameter for prior beta distribution different bin by bin (default vector is empty)
 
static Double_t FeldmanCousins(Double_t total, Double_t passed, Double_t level, Bool_t bUpper)
Calculates the boundaries for the frequentist Feldman-Cousins interval.
 
EStatOption fStatisticOption
Defines how the confidence intervals are determined.
 
void SetStatisticOption(EStatOption option)
Sets the statistic option which affects the calculation of the confidence interval.
 
void Paint(Option_t *opt) override
Paints this TEfficiency object.
 
void SetWeight(Double_t weight)
Sets the global weight for this TEfficiency object.
 
TH1 * fTotalHistogram
Histogram for total number of events.
 
Int_t GetDimension() const
returns the dimension of the current TEfficiency object
 
TGraph2DAsymmErrors * fPaintGraph2D
! Temporary graph for painting
 
TEfficiency & operator+=(const TEfficiency &rhs)
Adds the histograms of another TEfficiency object to current histograms.
 
Bool_t SetBins(Int_t nx, Double_t xmin, Double_t xmax)
Set the bins for the underlined passed and total histograms If the class have been already filled the...
 
void Build(const char *name, const char *title)
Building standard data structure of a TEfficiency object.
 
TH1 * GetCopyPassedHisto() const
Returns a cloned version of fPassedHistogram.
 
Double_t GetEfficiencyErrorUp(Int_t bin) const
Returns the upper error on the efficiency in the given global bin.
 
Double_t fBeta_alpha
Global parameter for prior beta distribution (default = 1)
 
void SavePrimitive(std::ostream &out, Option_t *opt="") override
Have histograms fixed bins along each axis?
 
void SetBetaBeta(Double_t beta)
Sets the shape parameter β.
 
static Bool_t CheckBinning(const TH1 &pass, const TH1 &total)
Checks binning for each axis.
 
void SetName(const char *name) override
Sets the name.
 
TGraph2DAsymmErrors * CreateGraph2D(Option_t *opt="") const
Create the graph used be painted (for dim=1 TEfficiency) The return object is managed by the caller.
 
static Double_t BetaCentralInterval(Double_t level, Double_t alpha, Double_t beta, Bool_t bUpper)
Calculates the boundaries for a central confidence interval for a Beta distribution.
 
Int_t GetGlobalBin(Int_t binx, Int_t biny=0, Int_t binz=0) const
Returns the global bin number which can be used as argument for the following functions:
 
TH1 * fPassedHistogram
Histogram for events which passed certain criteria.
 
static Double_t MidPInterval(Double_t total, Double_t passed, Double_t level, Bool_t bUpper)
Calculates the boundaries using the mid-P binomial interval (Lancaster method) from B.
 
void SetBetaAlpha(Double_t alpha)
Sets the shape parameter α.
 
@ kIsBayesian
Bayesian statistics are used.
 
@ kUseWeights
Use weights.
 
@ kPosteriorMode
Use posterior mean for best estimate (Bayesian statistics)
 
@ kUseBinPrior
Use a different prior for each bin.
 
@ kShortestInterval
Use shortest interval.
 
static Bool_t CheckEntries(const TH1 &pass, const TH1 &total, Option_t *opt="")
Checks whether bin contents are compatible with binomial statistics.
 
static Double_t Normal(Double_t total, Double_t passed, Double_t level, Bool_t bUpper)
Returns the confidence limits for the efficiency supposing that the efficiency follows a normal distr...
 
Double_t fWeight
Weight for all events (default = 1)
 
Bool_t SetPassedHistogram(const TH1 &rPassed, Option_t *opt)
Sets the histogram containing the passed events.
 
Double_t GetBetaBeta(Int_t bin=-1) const
 
Double_t(* fBoundary)(Double_t, Double_t, Double_t, Bool_t)
! Pointer to a method calculating the boundaries of confidence intervals
 
void FillGraph(TGraphAsymmErrors *graph, Option_t *opt) const
Fill the graph to be painted with information from TEfficiency Internal method called by TEfficiency:...
 
static Double_t Combine(Double_t &up, Double_t &low, Int_t n, const Int_t *pass, const Int_t *total, Double_t alpha, Double_t beta, Double_t level=0.683, const Double_t *w=nullptr, Option_t *opt="")
 
void FillHistogram(TH2 *h2) const
Fill the 2d histogram to be painted with information from TEfficiency 2D Internal method called by TE...
 
Int_t FindFixBin(Double_t x, Double_t y=0, Double_t z=0) const
Returns the global bin number containing the given values.
 
TDirectory * fDirectory
! Pointer to directory holding this TEfficiency object
 
void SetUseWeightedEvents(Bool_t on=kTRUE)
 
static Double_t Wilson(Double_t total, Double_t passed, Double_t level, Bool_t bUpper)
Calculates the boundaries for the frequentist Wilson interval.
 
TEfficiency & operator=(const TEfficiency &rhs)
Assignment operator.
 
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to a graph.
 
Double_t fConfLevel
Confidence level (default = 0.683, 1 sigma)
 
Double_t fBeta_beta
Global parameter for prior beta distribution (default = 1)
 
Double_t GetEfficiency(Int_t bin) const
Returns the efficiency in the given global bin.
 
Bool_t SetTotalHistogram(const TH1 &rTotal, Option_t *opt)
Sets the histogram containing all events.
 
void Fill(Bool_t bPassed, Double_t x, Double_t y=0, Double_t z=0)
This function is used for filling the two histograms.
 
void SetDirectory(TDirectory *dir)
Sets the directory holding this TEfficiency object.
 
TGraphAsymmErrors * fPaintGraph
! Temporary graph for painting
 
TGraphAsymmErrors * CreateGraph(Option_t *opt="") const
Create the graph used be painted (for dim=1 TEfficiency) The return object is managed by the caller.
 
TList * fFunctions
->Pointer to list of functions
 
Bool_t SetTotalEvents(Int_t bin, Double_t events)
Sets the number of total events in the given global bin.
 
void SetBetaBinParameters(Int_t bin, Double_t alpha, Double_t beta)
Sets different shape parameter α and β for the prior distribution for each bin.
 
static Bool_t CheckConsistency(const TH1 &pass, const TH1 &total, Option_t *opt="")
Checks the consistence of the given histograms.
 
TH1 * GetCopyTotalHisto() const
Returns a cloned version of fTotalHistogram.
 
static Double_t ClopperPearson(Double_t total, Double_t passed, Double_t level, Bool_t bUpper)
Calculates the boundaries for the frequentist Clopper-Pearson interval.
 
void SetConfidenceLevel(Double_t level)
Sets the confidence level (0 < level < 1) The default value is 1-sigma :~ 0.683.
 
Double_t GetEfficiencyErrorLow(Int_t bin) const
Returns the lower error on the efficiency in the given global bin.
 
EStatOption
Enumeration type for different statistic options for calculating confidence intervals kF* ....
 
@ kBJeffrey
Jeffrey interval (Prior ~ Beta(0.5,0.5)
 
@ kFWilson
Wilson interval.
 
@ kFAC
Agresti-Coull interval.
 
@ kMidP
Mid-P Lancaster interval.
 
@ kBUniform
Prior ~ Uniform = Beta(1,1)
 
@ kFFC
Feldman-Cousins interval.
 
@ kBBayesian
User specified Prior ~ Beta(fBeta_alpha,fBeta_beta)
 
@ kFNormal
Normal approximation.
 
@ kFCP
Clopper-Pearson interval (recommended by PDG)
 
void SetTitle(const char *title) override
Sets the title.
 
TFitResultPtr Fit(TF1 *f1, Option_t *opt="")
Fits the efficiency using the TBinomialEfficiencyFitter class.
 
TH2 * fPaintHisto
! Temporary histogram for painting
 
void Copy(TObject &f1) const override
Copy this F1 to a new F1.
 
TClass * IsA() const override
 
Provides an indirection to the TFitResult class and with a semantics identical to a TFitResult pointe...
 
Graph 2D class with errors.
 
void Paint(Option_t *option="") override
Paints this 2D graph with its current attributes.
 
TGraph with asymmetric error bars.
 
void Paint(Option_t *chopt="") override
Draw this graph with its current attributes.
 
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
 
virtual void PaintStats(TF1 *fit)
Draw the stats.
 
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to a graph.
 
1-D histogram with a double per channel (see TH1 documentation)
 
1-D histogram with a float per channel (see TH1 documentation)
 
TH1 is the base class of all histogram classes in ROOT.
 
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
 
virtual void SetNormFactor(Double_t factor=1)
 
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
 
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to a line.
 
void SetTitle(const char *title) override
Change/set the title.
 
virtual Int_t GetNbinsY() const
 
virtual Int_t GetNbinsZ() const
 
virtual Int_t GetDimension() const
 
@ kIsAverage
Bin contents are average (used by Add)
 
virtual void Reset(Option_t *option="")
Reset this histogram: contents, errors, etc.
 
virtual Int_t GetNcells() const
 
virtual Int_t GetBin(Int_t binx, Int_t biny=0, Int_t binz=0) const
Return Global bin number corresponding to binx,y,z.
 
virtual Int_t GetNbinsX() const
 
virtual Bool_t Add(TF1 *h1, Double_t c1=1, Option_t *option="")
Performs the operation: this = this + c1*f1 if errors are defined (see TH1::Sumw2),...
 
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
 
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
 
virtual Double_t GetBinLowEdge(Int_t bin) const
Return bin lower edge for 1D histogram.
 
virtual Double_t GetEntries() const
Return the current number of entries.
 
void SetName(const char *name) override
Change the name of this histogram.
 
void Paint(Option_t *option="") override
Control routine to paint any kind of histograms.
 
@ kNstat
Size of statistics data (up to TProfile3D)
 
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
 
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
 
virtual TArrayD * GetSumw2()
 
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width for 1D histogram.
 
virtual Int_t GetSumw2N() const
 
TObject * Clone(const char *newname="") const override
Make a complete copy of the underlying object.
 
virtual void SetBins(Int_t nx, Double_t xmin, Double_t xmax)
Redefine x axis parameters.
 
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
 
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
 
2-D histogram with a double per channel (see TH1 documentation)
 
2-D histogram with a float per channel (see TH1 documentation)
 
Service class for 2-D histogram classes.
 
void SetBinContent(Int_t bin, Double_t content) override
Set bin content.
 
3-D histogram with a double per channel (see TH1 documentation)
 
The 3-D histogram classes derived from the 1-D histogram classes.
 
void Add(TObject *obj) override
 
TObject * Remove(TObject *obj) override
Remove object from the list.
 
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
 
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
 
The TNamed class is the base class for all named ROOT classes.
 
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
 
const char * GetName() const override
Returns name of object.
 
const char * GetTitle() const override
Returns title of object.
 
virtual void SetName(const char *name)
Set the name of the TNamed.
 
Mother of all ROOT objects.
 
virtual const char * GetName() const
Returns name of object.
 
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
 
virtual const char * ClassName() const
Returns name of class to which the object belongs.
 
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
 
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
 
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
 
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
 
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
 
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
 
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
 
@ kInvalidObject
if object ctor succeeded but object should not be used
 
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
 
void ToLower()
Change string to lower-case.
 
const char * Data() const
 
TString & ReplaceAll(const TString &s1, const TString &s2)
 
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
 
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
 
double beta_pdf(double x, double a, double b)
Probability density function of the beta distribution.
 
double beta_cdf(double x, double a, double b)
Cumulative distribution function of the beta distribution Upper tail of the integral of the beta_pdf.
 
double beta_cdf_c(double x, double a, double b)
Complement of the cumulative distribution function of the beta distribution.
 
double normal_quantile(double z, double sigma)
Inverse ( ) of the cumulative distribution function of the lower tail of the normal (Gaussian) distri...
 
double normal_quantile_c(double z, double sigma)
Inverse ( ) of the cumulative distribution function of the upper tail of the normal (Gaussian) distri...
 
double beta_quantile_c(double x, double a, double b)
Inverse ( ) of the cumulative distribution function of the lower tail of the beta distribution (beta_...
 
double beta_quantile(double x, double a, double b)
Inverse ( ) of the cumulative distribution function of the upper tail of the beta distribution (beta_...
 
R__ALWAYS_INLINE bool HasBeenDeleted(const TObject *obj)
Check if the TObject's memory has been deleted.
 
Bool_t AreEqualRel(Double_t af, Double_t bf, Double_t relPrec)
Comparing floating points.
 
Beta_interval_length(Double_t level, Double_t alpha, Double_t beta)
 
Double_t operator()(double lower) const