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);
173 Double_t alpha,Double_t beta,Double_t level=0.683,
174 const Double_t* w=0,
Option_t* opt=
"");
178 static Double_t
AgrestiCoull(Double_t total,Double_t passed,Double_t level,
Bool_t bUpper);
180 static Double_t
Normal(Double_t total,Double_t passed,Double_t level,
Bool_t bUpper);
181 static Double_t
Wilson(Double_t total,Double_t passed,Double_t level,
Bool_t bUpper);
184 static Double_t
MidPInterval(Double_t total,Double_t passed,Double_t level,
Bool_t bUpper);
186 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);
190 static Double_t
BetaMean(Double_t alpha,Double_t beta);
191 static Double_t
BetaMode(Double_t alpha,Double_t beta);
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 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 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 TH1 * GetPassedHistogram() const
const TEfficiency operator+(const TEfficiency &lhs, const TEfficiency &rhs)
Addition operator.
Bool_t UsesCentralInterval() const
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.
Bool_t TestBit(UInt_t f) 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.
Double_t GetBetaBeta(Int_t bin=-1) const
void FillGraph(TGraphAsymmErrors *graph, Option_t *opt) const
Fill the graph to be painted with information from TEfficiency Internal method called by TEfficiency:...
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
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)
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.
Bool_t UsesWeights() const
Double_t GetWeight() const
TH1 * GetCopyPassedHisto() const
Returns a cloned version of fPassedHistogram.
TGraph with asymmetric error bars.
EStatOption GetStatisticOption() const
Double_t GetEfficiency(Int_t bin) const
Returns the efficiency in the given global bin.
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.
#define ClassDef(name, id)
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.
static Bool_t CheckWeights(const TH1 &pass, const TH1 &total)
Check if both histogram are weighted.
TH1 * fPassedHistogram
temporary histogram for painting
Bool_t UsesPosteriorAverage() const
TH2 * fPaintHisto
temporary graph for painting
TList * GetListOfFunctions()
const TH1 * GetTotalHistogram() const
TList * fFunctions
pointer to directory holding this TEfficiency object
Bool_t UsesBayesianStat() const
TH2 * GetPaintedHistogram() const
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.
TDirectory * GetDirectory() const
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...
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
TH1 * GetCopyTotalHisto() const
Returns a cloned version of fTotalHistogram.
Bool_t SetTotalEvents(Int_t bin, Int_t events)
Sets the number of total events in the given global bin.
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 α.
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)
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a graph.
void FillHistogram(TH2 *h2) const
Fill the 2d histogram to be painted with information from TEfficiency 2D Internal method called by TE...
void SavePrimitive(std::ostream &out, Option_t *opt="")
Have histograms fixed bins along each axis?
Int_t FindFixBin(Double_t x, Double_t y=0, Double_t z=0) const
Returns the global bin number containing the given values.
static unsigned int total
Bool_t UsesPosteriorMode() const
Bool_t UsesShortestInterval() const
void SetDirectory(TDirectory *dir)
Sets the directory holding this TEfficiency object.
void SetUseWeightedEvents(Bool_t on=kTRUE)
Bool_t SetTotalHistogram(const TH1 &rTotal, Option_t *opt)
Sets the histogram containing all events.
Describe directory structure in memory.
Double_t GetEfficiencyErrorUp(Int_t bin) const
Returns the upper error on the efficiency in the given global bin.
Double_t GetConfidenceLevel() const
void SetShortestInterval(Bool_t on=true)
Double_t GetBetaAlpha(Int_t bin=-1) const
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+=...
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 Double_t FeldmanCousins(Double_t total, Double_t passed, Double_t level, Bool_t bUpper)
Calculates the boundaries for the frequentist Feldman-Cousins interval.
you should not use this method at all Int_t Int_t z
Double_t GetEfficiencyErrorLow(Int_t bin) const
Returns the lower error on the efficiency in the given global bin.
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: ...
void SetName(const char *name)
Sets the name.
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.
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.
void SetCentralInterval(Bool_t on=true)
std::vector< std::pair< Double_t, Double_t > > fBeta_bin_params
Int_t GetDimension() const
returns the dimension of the current TEfficiency object
TEfficiency()
default constructor
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.
TGraphAsymmErrors * GetPaintedGraph() const