59   fInterpolateLowerLimit(
true),
 
   60   fInterpolateUpperLimit(
true),
 
   61   fFittedLowerLimit(
false),
 
   62   fFittedUpperLimit(
false),
 
   63   fInterpolOption(kLinear),
 
   66   fCLsCleanupThreshold(0.005)
 
 
   80     fUseCLs(
other.fUseCLs),
 
   81     fIsTwoSided(
other.fIsTwoSided),
 
   82     fInterpolateLowerLimit(
other.fInterpolateLowerLimit),
 
   83     fInterpolateUpperLimit(
other.fInterpolateUpperLimit),
 
   84     fFittedLowerLimit(
other.fFittedLowerLimit),
 
   85     fFittedUpperLimit(
other.fFittedUpperLimit),
 
   86     fInterpolOption(
other.fInterpolOption),
 
   87     fLowerLimitError(
other.fLowerLimitError),
 
   88     fUpperLimitError(
other.fUpperLimitError),
 
   89     fCLsCleanupThreshold(
other.fCLsCleanupThreshold),
 
   90     fXValues(
other.fXValues)
 
   96   for (
int i = 0; i < 
nOther; ++i)
 
 
  132  for (
int i=0; i < 
nOther; ++i) {
 
 
  155   fInterpolateLowerLimit(
true),
 
  156   fInterpolateUpperLimit(
true),
 
  157   fFittedLowerLimit(
false),
 
  158   fFittedUpperLimit(
false),
 
  159   fInterpolOption(kLinear),
 
  160   fLowerLimitError(-1),
 
  161   fUpperLimitError(-1),
 
  162   fCLsCleanupThreshold(0.005)
 
 
  216    if ( !
r->GetNullDistribution() && !
r->GetAltDistribution() ) {
 
  226    const double x = *
itr;
 
  236       coutE(
Eval) << 
"HypoTestInverterResult::ExclusionCleanup - invalid size of sampling distribution" << std::endl;
 
  258      double * z = 
const_cast<double *
>(&values[0] ); 
 
  273    } 
else if (
CLsobs >= 0.) {
 
 
  321   if (
nOther == 0) 
return true;
 
  330                                << 
" in " << 
GetName() << std::endl;
 
  336      coutI(
Eval) << 
"HypoTestInverterResult::Add - merging also the expected p-values from pseudo-data" << std::endl;
 
  343      for (
int i = 0; i < 
nOther; ++i)
 
  350      for (
int i = 0; i < 
nOther; ++i) {
 
  370                     coutW(
Eval) << 
"HypoTestInverterResult::Add expected p values have been generated with different toys " << 
thisNToys << 
" , " << 
otherNToys << std::endl;
 
  389      coutI(
Eval) << 
"HypoTestInverterResult::Add  - new number of points is " << 
fXValues.size()
 
  392      coutI(
Eval) << 
"HypoTestInverterResult::Add  - new toys/point is " 
 
  414      if (!
r) 
return false;
 
 
  451      return result->CLsplusb();  
 
 
  466        return result->CLsError();
 
  468        return result->CLsplusbError();
 
 
  493    return result->CLsplusb();
 
 
  517    return result->CLbError();
 
 
  529    return result->CLsplusbError();
 
 
  541    return result->CLsError();
 
 
  564  const double tol = 1.E-12;
 
 
  583   std::cout << 
"using graph for search " << 
lowSearch << 
" min " << 
axmin << 
" max " << 
axmax << std::endl;
 
  588   const double * 
y = graph.
GetY();
 
  589   int n = graph.
GetN();
 
  591      ooccoutE(
this,
Eval) << 
"HypoTestInverterResult::GetGraphX - need at least 2 points for interpolation (n=" << 
n << 
")\n";
 
  592      return (
n>0) ?  
y[0] : 0;
 
  622      std::cout << 
"No range given - check if extrapolation is needed " << std::endl;
 
  628      double yfirst = graph.
GetY()[0];
 
  629      double ylast = graph.
GetY()[
n-1];
 
  644   auto func = [&](
double x) {
 
  651   brf.SetNpx(std::max(graph.
GetN()*2,100) );
 
  654             << 
" , " << graph.
Eval(
xmax) << 
" target " << 
y0 << std::endl;
 
  657   bool ret = 
brf.Solve(100, 1.E-16, 1.E-6);
 
  659      ooccoutE(
this,
Eval) << 
"HypoTestInverterResult - interpolation failed for interval [" << 
xmin << 
"," << 
xmax 
  661                          << 
" target=" << 
y0 << 
" return inf" << std::endl
 
  662                          << 
"One may try to clean up invalid points using HypoTestInverterResult::ExclusionCleanup()." << std::endl;
 
  665   double limit =  
brf.Root();
 
  668   if (
lowSearch) std::cout << 
"lower limit search : ";
 
  669   else std::cout << 
"Upper limit search :  ";
 
  670   std::cout << 
"interpolation done between " << 
xmin << 
"  and " << 
xmax 
  671             << 
"\n Found limit using RootFinder is " << limit << std::endl;
 
  677      graph.
Write(
"graph");
 
  686   std::cout << 
"do new interpolation dividing from " << 
index << 
"  and " << 
y[
index] << std::endl;
 
 
  723      coutW(
Eval) << 
"HypoTestInverterResult::FindInterpolatedLimit" 
  724                         << 
" - not enough points to get the inverted interval - return " 
  733   std::vector<unsigned int> 
index(
n );
 
  737   for (
int i = 0; i < 
n; ++i)
 
  798      std::cout << 
" found xmin, xmax  = " << 
xmin << 
"  " << 
xmax << 
" for search " << 
lowSearch << std::endl;
 
  823   std::cout << 
"finding " << 
lowSearch << 
" limit between " << 
xmin << 
"  " << 
xmax << std::endl;
 
  834   ooccoutD(
this,
Eval) << 
"HypoTestInverterResult::FindInterpolateLimit " 
  835      << 
"the computed " << 
limitType << 
" limit is " << limit << 
" +/- " << error << std::endl;
 
  838   std::cout << 
"Found limit is " << limit << 
" +/- " << error << std::endl;
 
 
  911  std::vector<unsigned int> 
indx(
n);
 
 
  975     coutW(
Eval) << 
"HypoTestInverterResult::CalculateEstimateError" 
  976                        << 
"Empty result \n";
 
  981     coutW(
Eval) << 
"HypoTestInverterResult::CalculateEstimateError" 
  982                        << 
" only  points - return its error\n";
 
  992  std::cout << 
"calculate estimate error " << 
type << 
" between " << 
xmin << 
" and " << 
xmax << std::endl;
 
 1014  if (graph.
GetN() < 2) {
 
 1015     if (
np >= 2) 
coutW(
Eval) << 
"HypoTestInverterResult::CalculateEstimatedError - no valid points - cannot estimate  the " << 
type << 
" limit error " << std::endl;
 
 1026  TF1 fct(
"fct", 
"exp([0] * (x - [2] ) + [1] * (x-[2])**2)", 
minX, 
maxX);
 
 1031     fct.SetParLimits(1,0, 10./
scale); }
 
 1034     fct.SetParLimits(0,-100./
scale, 0);
 
 1035     fct.SetParLimits(1,-100./
scale, 0); }
 
 1037  if (graph.
GetN() < 3) 
fct.FixParameter(1,0.);
 
 1046  std::cout << 
"fitting for limit " << 
type << 
"between " << 
minX << 
" , " << 
maxX << 
" points considered " << graph.
GetN() <<  std::endl;
 
 1067     coutW(
Eval) << 
"HypoTestInverterResult::CalculateEstimatedError - cannot estimate  the " << 
type << 
" limit error " << std::endl;
 
 
 1119   if (!
result) 
return nullptr;
 
 1120   return !
result->GetBackGroundIsAlt() ? 
result->GetAltDistribution() : 
result->GetNullDistribution();
 
 
 1167   std::vector<double> values(
npoints);
 
 1168   for (
int i = 0; i < 
npoints; ++i) {
 
 1171      if (
pval < 0) { 
return nullptr;}
 
 1174   return new SamplingDistribution(
"Asymptotic expected values",
"Asymptotic expected values",values);
 
 
 1184      coutE(
Eval) << 
"HypoTestInverterResult::GetLimitDistribution" 
 1185                         << 
" not  enough points -  return 0 " << std::endl;
 
 1189   ooccoutD(
this,
Eval) << 
"HypoTestInverterResult - computing  limit distribution...." << std::endl;
 
 1196   for (
unsigned int i = 0; i < 
distVec.size(); ++i) {
 
 1208      ooccoutW(
this,
InputArguments) << 
"HypoTestInverterResult - set a minimum size of 10 for limit distribution" <<   std::endl;
 
 1217  for (
int i = 0; i <  
npoints; ++i) {
 
 1222     std::vector<double> 
pvalues = 
distVec[i]->GetSamplingDistribution();
 
 1232        p[0] = std::min( (
ibin+1) * 1./
double(
size), 1.0);
 
 1248  std::vector<double> limits(
size);
 
 1250  for (
int j = 0; 
j < 
size; ++
j ) {
 
 1253     for (
int k = 0; k < 
npoints ; ++k) {
 
 
 1319   if (!
r->GetNullDistribution() && !
r->GetAltDistribution() ) {
 
 1324      const std::vector<double> & values = 
limitDist->GetSamplingDistribution();
 
 1325      if (values.size() <= 1) 
return 0;
 
 1342   if (
option.Contains(
"P")) {
 
 1354            ooccoutI(
this,
Eval) << 
"HypoTestInverterResult - cannot compute expected p value distribution for point, x = " 
 1355                                << 
GetXValue(i)  << 
" skip it " << std::endl;
 
 1359         double * 
x = 
const_cast<double *
>(&values[0]); 
 
 1365         ooccoutE(
this,
Eval) << 
"HypoTestInverterResult - cannot compute limits , not enough points, n =  " << 
g.GetN() << std::endl;
 
 1377   const std::vector<double> & values = 
limitDist->GetSamplingDistribution();
 
 1378   double * 
x = 
const_cast<double *
>(&values[0]); 
 
 
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
 
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 Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
 
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 Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
 
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 r
 
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 char Point_t Rectangle_t WindowAttributes_t index
 
Option_t Option_t TPoint TPoint const char mode
 
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 Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
 
Class for finding the root of a one dimensional function using the Brent algorithm.
 
Functor1D class for one-dimensional functions.
 
const_iterator begin() const
 
const_iterator end() const
 
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
 
RooAbsArg * first() const
 
virtual bool addOwned(RooAbsArg &var, bool silent=false)
Add an argument and transfer the ownership to the collection.
 
virtual double getMax(const char *name=nullptr) const
Get maximum of currently defined range.
 
virtual double getMin(const char *name=nullptr) const
Get minimum of currently defined range.
 
Variable that can be changed from the outside.
 
static double GetExpectedPValues(double pnull, double palt, double nsigma, bool usecls, bool oneSided=true)
function given the null and the alt p value - return the expected one given the N - sigma value
 
HypoTestInverterResult class holds the array of hypothesis test results and compute a confidence inte...
 
bool fInterpolateUpperLimit
 
double GetYValue(int index) const
function to return the value of the confidence level for the i^th entry in the results
 
double LowerLimitEstimatedError()
rough estimation of the error on the computed bound of the confidence interval Estimate of lower limi...
 
double FindInterpolatedLimit(double target, bool lowSearch=false, double xmin=1, double xmax=0.0)
interpolate to find a limit value Use a linear or a spline interpolation depending on the interpolati...
 
double UpperLimitEstimatedError()
Estimate of lower limit error function evaluates only a rough error on the lower limit.
 
SamplingDistribution * GetSignalAndBackgroundTestStatDist(int index) const
get the signal and background test statistic distribution
 
double fCLsCleanupThreshold
 
HypoTestResult * GetResult(int index) const
return a pointer to the i^th result object
 
HypoTestInverterResult & operator=(const HypoTestInverterResult &other)
operator =
 
InterpolOption_t fInterpolOption
interpolation option (linear or spline)
 
int ArraySize() const
number of entries in the results array
 
bool fInterpolateLowerLimit
 
std::vector< double > fXValues
 
double CLsplusbError(int index) const
return the observed CLsplusb value for the i-th entry
 
double CLsError(int index) const
return the observed CLb value for the i-th entry
 
double GetGraphX(const TGraph &g, double y0, bool lowSearch, double &xmin, double &xmax) const
return the X value of the given graph for the target value y0 the graph is evaluated using linear int...
 
double CLbError(int index) const
return the observed CLb value for the i-th entry
 
double GetExpectedUpperLimit(double nsig=0, const char *opt="") const
get Limit value corresponding at the desired nsigma level (0) is median -1 sigma is 1 sigma
 
HypoTestInverterResult(const char *name=nullptr)
default constructor
 
double GetXValue(int index) const
function to return the value of the parameter of interest for the i^th entry in the results
 
double UpperLimit() override
return the interval upper limit
 
bool Add(const HypoTestInverterResult &otherResult)
merge with the content of another HypoTestInverterResult object
 
int FindClosestPointIndex(double target, int mode=0, double xtarget=0)
 
TList fExpPValues
list of expected sampling distribution for each point
 
double GetExpectedLowerLimit(double nsig=0, const char *opt="") const
get Limit value corresponding at the desired nsigma level (0) is median -1 sigma is 1 sigma
 
bool fIsTwoSided
two sided scan (look for lower/upper limit)
 
double CalculateEstimatedError(double target, bool lower=true, double xmin=1, double xmax=0.0)
Return an error estimate on the upper(lower) limit.
 
static int fgAsymptoticNumPoints
number of points used to build expected p-values
 
static double fgAsymptoticMaxSigma
max sigma value used to scan asymptotic expected p values
 
int ExclusionCleanup()
remove points that appear to have failed.
 
double LowerLimit() override
lower and upper bound of the confidence interval (to get upper/lower limits, multiply the size( = 1-c...
 
double CLs(int index) const
return the observed CLb value for the i-th entry
 
int FindIndex(double xvalue) const
find the index corresponding at the poi value xvalue If no points is found return -1 Note that a tole...
 
double GetYError(int index) const
function to return the estimated error on the value of the confidence level for the i^th entry in the...
 
double CLb(int index) const
return the observed CLb value for the i-th entry
 
TList fYObjects
list of HypoTestResult for each point
 
double GetExpectedLimit(double nsig, bool lower, const char *opt="") const
get expected limit (lower/upper) depending on the flag for asymptotic is a special case (the distribu...
 
SamplingDistribution * GetExpectedPValueDist(int index) const
return expected distribution of p-values (Cls or Clsplusb)
 
double CLsplusb(int index) const
return the observed CLsplusb value for the i-th entry
 
SamplingDistribution * GetLimitDistribution(bool lower) const
get the limit distribution (lower/upper depending on the flag) by interpolating the expected p values...
 
SamplingDistribution * GetNullTestStatDist(int index) const
same in terms of alt and null
 
SamplingDistribution * GetBackgroundTestStatDist(int index) const
get the background test statistic distribution
 
~HypoTestInverterResult() override
destructor
 
HypoTestResult is a base class for results from hypothesis tests.
 
TObject * Clone(const char *newname=nullptr) const override
clone method, required since some data members cannot rely on the streamers to copy them
 
This class simply holds a sampling distribution of some test statistic.
 
const std::vector< double > & GetSamplingDistribution() const
Get test statistics values.
 
SimpleInterval is a concrete implementation of the ConfInterval interface.
 
double fUpperLimit
upper interval limit
 
RooArgSet fParameters
set containing the parameter of interest
 
double ConfidenceLevel() const override
return the confidence interval
 
double fLowerLimit
lower interval limit
 
double fConfidenceLevel
confidence level
 
SimpleInterval & operator=(const SimpleInterval &other)
default constructor
 
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
 
virtual void RemoveAll(TCollection *col)
Remove all objects in collection col from this collection.
 
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
 
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
 
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
 
A TGraphErrors is a TGraph with error bars.
 
void Print(Option_t *chopt="") const override
Print graph and errors values.
 
virtual void SetPointError(Double_t ex, Double_t ey)
Set ex and ey values for point pointed by the mouse.
 
A TGraph is an object made of two arrays X and Y with npoints each.
 
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
 
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Axis_t xmin=0, Axis_t xmax=0)
Fit this graph with function with name fname.
 
virtual Double_t Eval(Double_t x, TSpline *spline=nullptr, Option_t *option="") const
Interpolate points in this graph at x using a TSpline.
 
void Draw(Option_t *chopt="") override
Draw this graph with its current attributes.
 
void Add(TObject *obj) override
 
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.
 
TObject * At(Int_t idx) const override
Returns the object at position idx. Returns 0 if idx is out of range.
 
const char * GetName() const override
Returns name of object.
 
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
 
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
 
virtual TObject * RemoveAt(Int_t idx)
 
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
 
double normal_cdf(double x, double sigma=1, double x0=0)
Cumulative distribution function of the normal (Gaussian) distribution (lower tail).
 
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
 
Namespace for the RooStats classes.
 
void SortItr(Iterator first, Iterator last, IndexIterator index, Bool_t down=kTRUE)
Sort the n1 elements of the Short_t array defined by its iterators.
 
Double_t QuietNaN()
Returns a quiet NaN as defined by IEEE 754.
 
Double_t Floor(Double_t x)
Rounds x downward, returning the largest integral value that is not greater than x.
 
T MinElement(Long64_t n, const T *a)
Returns minimum of array a of length n.
 
void Quantiles(Int_t n, Int_t nprob, Double_t *x, Double_t *quantiles, Double_t *prob, Bool_t isSorted=kTRUE, Int_t *index=nullptr, Int_t type=7)
Computes sample quantiles, corresponding to the given probabilities.
 
Bool_t AreEqualRel(Double_t af, Double_t bf, Double_t relPrec)
Comparing floating points.
 
Bool_t AreEqualAbs(Double_t af, Double_t bf, Double_t epsilon)
Comparing floating points.
 
T MaxElement(Long64_t n, const T *a)
Returns maximum of array a of length n.
 
Long64_t BinarySearch(Long64_t n, const T *array, T value)
Binary search in an array of n values to locate value.
 
Double_t Infinity()
Returns an infinity as defined by the IEEE standard.
 
static uint64_t sum(uint64_t i)