44 std::vector<Double_t>& samplingDist,
const char * varName) :
61 std::vector<Double_t>& samplingDist, std::vector<Double_t>& sampleWeights,
const char * varName) :
97 const char * _columnName,
108 TString columnName( _columnName );
110 if( !columnName.
Length() ) {
112 if( !dataSet.
get()->
find(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_t>::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);
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;
Double_t getRealValue(const char *name, Double_t defVal=0, Bool_t verbose=kFALSE) const
Get value of a RooAbsReal stored in set with given name.
RooAbsArg * first() const
RooAbsArg * find(const char *name) const
Find object with given name in list.
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
RooDataSet is a container class to hold unbinned data.
virtual const RooArgSet * get(Int_t index) const override
Return RooArgSet with coordinates of event 'index'.
virtual Double_t weight() const override
Return event weight of current event.
static Double_t infinity()
Return internal infinity representation.
This class simply holds a sampling distribution of some test statistic.
virtual ~SamplingDistribution()
Destructor of SamplingDistribution.
Double_t InverseCDF(Double_t pvalue)
get the inverse of the Cumulative distribution function
Double_t Integral(Double_t low, Double_t high, Bool_t normalize=kTRUE, Bool_t lowClosed=kTRUE, Bool_t highClosed=kFALSE) const
numerical integral in these limits
Double_t IntegralAndError(Double_t &error, Double_t low, Double_t high, Bool_t normalize=kTRUE, Bool_t lowClosed=kTRUE, Bool_t highClosed=kFALSE) const
numerical integral in these limits including error estimation
SamplingDistribution()
Default constructor for SamplingDistribution.
Double_t CDF(Double_t x) const
calculate CDF as a special case of Integral(...) with lower limit equal to -inf
std::vector< Double_t > fSumW
std::vector< Double_t > fSumW2
Cached vector with sum of the weight used to compute integral.
TString fVarName
vector of weights for the samples
Double_t InverseCDFInterpolate(Double_t pvalue)
get the inverse of the Cumulative distribution function
void Add(const SamplingDistribution *other)
merge two sampling distributions
std::vector< Double_t > fSampleWeights
vector of points for the sampling distribution
const TString GetVarName() const
void SortValues() const
Cached vector with sum of the weight used to compute integral error.
std::vector< Double_t > fSamplingDist
The TNamed class is the base class for all named ROOT classes.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
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)
Bool_t AreEqualRel(Double_t af, Double_t bf, Double_t relPrec)
static uint64_t sum(uint64_t i)