1 #ifndef ROOT_TEfficiency
2 #define ROOT_TEfficiency
21 #ifndef ROOT_TAttMarker
74 void Build(
const char*
name,
const char* title);
82 const Double_t* xbins);
86 Double_t xlow,Double_t xup,
Int_t nbinsy,Double_t ylow,
89 const Double_t* xbins,
Int_t nbinsy,
const Double_t* ybins);
91 Double_t xlow,Double_t xup,
Int_t nbinsy,Double_t ylow,
92 Double_t yup,
Int_t nbinsz,Double_t zlow,Double_t zup);
94 const Double_t* xbins,
Int_t nbinsy,
const Double_t* ybins,
95 Int_t nbinsz,
const Double_t* zbins);
106 void Fill(
Bool_t bPassed,Double_t
x,Double_t
y=0,Double_t z=0);
152 Int_t nz, Double_t zmin, Double_t zmax);
154 const Double_t *zBins);
172 Double_t alpha,Double_t
beta,Double_t level=0.683,
173 const Double_t* w=0,
Option_t* opt=
"");
179 static Double_t
Normal(Double_t
total,Double_t passed,Double_t level,
Bool_t bUpper);
180 static Double_t
Wilson(Double_t
total,Double_t passed,Double_t level,
Bool_t bUpper);
185 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);
void SetConfidenceLevel(Double_t level)
Sets the confidence level (0 < level < 1) The default value is 1-sigma :~ 0.683.
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 Bool_t CheckEntries(const TH1 &pass, const TH1 &total, Option_t *opt="")
Checks whether bin contents are compatible with binomial statistics.
void FillGraph(TGraphAsymmErrors *graph, Option_t *opt) const
Fill the graph to be painted with information from TEfficiency Internal metyhod called by TEfficiency...
Double_t GetEfficiency(Int_t bin) const
Returns the efficiency in the given global bin.
void Build(const char *name, const char *title)
Building standard data structure of a TEfficiency object.
Class to handle efficiency histograms.
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
const TEfficiency operator+(const TEfficiency &lhs, const TEfficiency &rhs)
Addition operator.
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 GetDimension() const
returns the dimension of the current TEfficiency object
Bool_t UsesPosteriorAverage() const
EStatOption GetStatisticOption() const
static Bool_t CheckBinning(const TH1 &pass, const TH1 &total)
Checks binning for each axis.
TEfficiency & operator+=(const TEfficiency &rhs)
Adds the histograms of another TEfficiency object to current histograms.
TH2 * GetPaintedHistogram() const
TH1 * GetCopyPassedHisto() const
Returns a cloned version of fPassedHistogram.
void SetBetaBinParameters(Int_t bin, Double_t alpha, Double_t beta)
Sets different shape parameter α and β for the prior distribution for each bin.
~TEfficiency()
default destructor
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: ...
EStatOption fStatisticOption
void Browse(TBrowser *)
Browse object. May be overridden for another default action.
Bool_t SetPassedEvents(Int_t bin, Int_t events)
Sets the number of passed events in the given global bin.
void SetPosteriorAverage(Bool_t on=true)
Double_t(* fBoundary)(Double_t, Double_t, Double_t, Bool_t)
TGraphAsymmErrors * CreateGraph(Option_t *opt="") const
Create the graph used be painted (for dim=1 TEfficiency) The return object is managed by the caller...
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
double beta(double x, double y)
Calculates the beta function.
TGraph with assymetric error bars.
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=0, Option_t *opt="")
Calculates the combined efficiency and its uncertainties.
Fill Area Attributes class.
TGraphAsymmErrors * fPaintGraph
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.
The TNamed class is the base class for all named ROOT classes.
TH1 * fPassedHistogram
temporary histogram for painting
TDirectory * GetDirectory() const
Bool_t UsesBayesianStat() const
TH2 * fPaintHisto
temporary graph for painting
TList * GetListOfFunctions()
TList * fFunctions
pointer to directory holding this TEfficiency object
Double_t GetEfficiencyErrorUp(Int_t bin) const
Returns the upper error on the efficiency in the given global bin.
Bool_t SetPassedHistogram(const TH1 &rPassed, Option_t *opt)
Sets the histogram containing the passed events.
void SetTitle(const char *title)
Sets the title.
static Double_t BetaMean(Double_t alpha, Double_t beta)
Compute the mean (average) of the beta distribution.
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...
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...
Bool_t UsesWeights() const
void SetStatisticOption(EStatOption option)
Sets the statistic option which affects the calculation of the confidence interval.
Double_t fConfLevel
pointer to a method calculating the boundaries of confidence intervals
Bool_t SetTotalEvents(Int_t bin, Int_t events)
Sets the number of total events in the given global bin.
Int_t FindFixBin(Double_t x, Double_t y=0, Double_t z=0) const
Returns the global bin number containing the given values.
void SetWeight(Double_t weight)
Sets the global weight for this TEfficiency object.
Using a TBrowser one can browse all ROOT objects.
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.
Service class for 2-Dim histogram classes.
void SetBetaAlpha(Double_t alpha)
Sets the shape parameter α.
Bool_t UsesCentralInterval() const
const TH1 * GetTotalHistogram() const
Double_t GetWeight() const
void SetPosteriorMode(Bool_t on=true)
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...
Collection abstract base class.
void Add(const TEfficiency &rEff)
Double_t GetBetaAlpha(Int_t bin=-1) const
Bool_t TestBit(UInt_t f) const
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a graph.
void SavePrimitive(std::ostream &out, Option_t *opt="")
Have histograms fixed bins along each axis?
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 unsigned int total
void SetUseWeightedEvents()
void SetDirectory(TDirectory *dir)
Sets the directory holding this TEfficiency object.
Bool_t SetTotalHistogram(const TH1 &rTotal, Option_t *opt)
Sets the histogram containing all events.
Describe directory structure in memory.
void SetShortestInterval(Bool_t on=true)
TEfficiency & operator=(const TEfficiency &rhs)
Assignment operator.
Int_t Fit(TF1 *f1, Option_t *opt="")
Fits the efficiency using the TBinomialEfficiencyFitter class.
void SetBetaBeta(Double_t beta)
Sets the shape parameter β.
Long64_t Merge(TCollection *list)
Merges the TEfficiency objects in the given list to the given TEfficiency object using the operator+=...
Bool_t UsesPosteriorMode() const
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.
void SetName(const char *name)
Sets the name.
Double_t GetBetaBeta(Int_t bin=-1) const
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.
void Draw(Option_t *opt="")
Draws the current TEfficiency object.
void Paint(Option_t *opt)
Paints this TEfficiency object.
Bool_t UsesShortestInterval() const
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 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.
const TH1 * GetPassedHistogram() const
void SetCentralInterval(Bool_t on=true)
TGraphAsymmErrors * GetPaintedGraph() const
Double_t GetEfficiencyErrorLow(Int_t bin) const
Returns the lower error on the efficiency in the given global bin.
std::vector< std::pair< Double_t, Double_t > > fBeta_bin_params
Double_t GetConfidenceLevel() const
void FillHistogram(TH2 *h2) const
Fill the 2d histogram to be painted with information from TEfficiency 2D Internal metyhod called by T...
TH1 * GetCopyTotalHisto() const
Returns a cloned version of fTotalHistogram.
static Double_t BetaMode(Double_t alpha, Double_t beta)
Compute the mode of the beta distribution.
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.
static Double_t Wilson(Double_t total, Double_t passed, Double_t level, Bool_t bUpper)
Calculates the boundaries for the frequentist Wilson interval.
static Bool_t CheckConsistency(const TH1 &pass, const TH1 &total, Option_t *opt="")
Checks the consistence of the given histograms.