1 #include "../interface/JacknifeQuantile.h"
6 #include <Math/QuantFuncMathMore.h>
7 #include <RooAbsData.h>
8 #include <RooRealVar.h>
30 if (lastEntry == -1) lastEntry = data.numEntries();
31 const RooArgSet *
set = data.get();
32 const RooRealVar *
x =
dynamic_cast<const RooRealVar *
>(set->find(varName));
35 throw std::logic_error(
"Parameter of interest not in the idataset");
38 if (firstEntry < lastEntry) {
39 points_.resize(lastEntry - firstEntry);
40 for (
int i = firstEntry,
j = 0;
i < lastEntry; ++
i, ++
j) {
59 return std::pair<double,double>(
quantiles_[0], 0);
66 for (
int i = 0;
i <
m; ++
i) {
71 for (
int i = 0;
i <
m; ++
i) {
74 rms =
sqrt(rms/(m*(m-1)));
75 double onesigma = ROOT::Math::tdistribution_quantile_c(0.16, m-1);
76 return std::pair<double,double>(avg, rms * onesigma);
78 return std::pair<double,double>(0,-1);
84 double smallnum = size *
std::min(quantile, 1-quantile);
88 std::cout <<
" ..... will split the " << size <<
" events in " << n <<
" subsets, smallnum is " << smallnum << std::endl;
95 int n = values.size();
98 for (
int i = 0;
i <
n; ++
i) {
100 points_[
i].w = weights.empty() ? 1 : weights[
i];
112 double alpha = double(m)/
n;
113 for (
int i = 0,
j = 0;
i <
n; ++
i) {
133 for (
int j = 0;
j <=
m; ++
j) {
134 double runningSum = 0;
136 int ilow = 0, ihigh = n-1;
137 for (
int i = 0;
i <
n; ++
i) {
140 if (runningSum +
points_[
i].
w <= threshold) {
148 if (runningSum == threshold) {
154 for (
int j = 0;
j <=
m; ++
j) {
159 for (
int j = 0;
j <
m; ++
j) {
161 printf(
" ... jacknife quantile of section %d: %6.3f\n",
j,
quantiles_[
j]);
void import(const std::vector< T > &values, const std::vector< T > &weights)
std::vector< float > quantiles_
void partition(int m, bool doJacknife)
std::pair< double, double > quantileAndError(double quantile, Method method)
std::vector< double > sumw_
void quantiles(double quantile, bool doJacknife)
std::vector< point > points_
char data[epos_bytes_allocation]
void randomizePoints()
Randomize points before sectioning.
tuple size
Write out results.
void set(const std::string &name, int value)
set the flag, with a run-time name
int guessPartitions(int size, double quantile)