44 std::vector<double>& samplingDist,
const char * varName) :
61 std::vector<double>& samplingDist, std::vector<double>& sampleWeights,
const char * varName) :
97 const char * _columnName,
103 if( dataSet.numEntries() == 0 || !dataSet.get()->first() ) {
108 TString columnName( _columnName );
110 if( !columnName.
Length() ) {
112 if( !dataSet.get()->find(columnName) ) {
113 columnName = dataSet.get()->first()->GetName();
124 for(
Int_t i=0; i < dataSet.numEntries(); i++) {
125 fSamplingDist.push_back(dataSet.get(i)->getRealValue(columnName));
135 TNamed(
"SamplingDistribution_DefaultName",
"SamplingDistribution")
168 for(
unsigned int i=0; i<newSamplingDist.size(); ++i){
203 std::vector<unsigned int>
index(
n);
207 fSumW = std::vector<double>(
n );
208 fSumW2 = std::vector<double>(
n );
210 std::vector<double> sortedDist(
n);
211 std::vector<double> sortedWeights(
n);
213 for(
unsigned int i=0; i <
n; i++) {
214 unsigned int j =
index[i];
243 error = numeric_limits<double>::infinity();
247 if (
int(
fSumW.size()) !=
n)
273 assert(indexLow <
n && indexHigh <
n);
278 if (indexHigh >= 0) {
290 double norm =
fSumW.back();
291 double norm2 =
fSumW2.back();
297 error = std::sqrt( sum2 * (1. - 2. *
sum) + norm2 *
sum *
sum ) / norm;
300 error = std::sqrt(sum2);
327 double sigmaVariation,
328 double& inverseWithVariation)
334 Warning(
"InverseCDF",
"Estimation of Quantiles (InverseCDF) for weighted events is not yet supported");
359 else if(pvalue < 0.5){
360 int delta = (
int)(sigmaVariation*sqrt(1.0*nominal));
361 int variation = nominal+delta;
365 else if(variation<=0)
372 else if(pvalue >= 0.5){
374 int variation = nominal+delta;
380 else if(variation<=0)
395 std::cout <<
"problem in SamplingDistribution::InverseCDF" << std::endl;
412 Warning(
"InverseCDFInterpolate",
"Estimation of Quantiles (InverseCDF) for weighted events is not yet supported.");
430 return (upperX-lowerX)/(upperY-lowerY)*(pvalue-lowerY)+lowerX;
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
RooDataSet is a container class to hold unbinned data.
static constexpr double infinity()
Return internal infinity representation.
This class simply holds a sampling distribution of some test statistic.
double Integral(double low, double high, bool normalize=true, bool lowClosed=true, bool highClosed=false) const
numerical integral in these limits
double CDF(double x) const
calculate CDF as a special case of Integral(...) with lower limit equal to -inf
~SamplingDistribution() override
Destructor of SamplingDistribution.
std::vector< double > fSumW2
! Cached vector with sum of the weight used to compute integral error
double InverseCDFInterpolate(double pvalue)
get the inverse of the Cumulative distribution function
std::vector< double > fSumW
! Cached vector with sum of the weight used to compute integral
SamplingDistribution()
Default constructor for SamplingDistribution.
std::vector< double > fSamplingDist
vector of points for the sampling distribution
double IntegralAndError(double &error, double low, double high, bool normalize=true, bool lowClosed=true, bool highClosed=false) const
numerical integral in these limits including error estimation
double InverseCDF(double pvalue)
get the inverse of the Cumulative distribution function
void Add(const SamplingDistribution *other)
merge two sampling distributions
const TString GetVarName() const
void SortValues() const
internal function to sort values
std::vector< double > fSampleWeights
vector of weights for the samples
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.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
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.
Bool_t AreEqualRel(Double_t af, Double_t bf, Double_t relPrec)
Comparing floating points.
static uint64_t sum(uint64_t i)