13 double sigma,
double low,
double high)
19 double targetTailIntegral = pValue;
23 double prob_in_delta =
Phi_m(poiVal, poiPrimeVal, std::numeric_limits<double>::infinity(),
sigma, compatRegions);
32 if (prob_in_delta > 1 - targetTailIntegral) {
36 struct TailIntegralFunction {
37 TailIntegralFunction(
double _poiVal,
double _alt_val,
double _sigma_mu,
double _low,
double _high,
45 cFunc(_compatibilityFunction)
51 double val =
PValue(cFunc,
x, poiVal, alt_val, sigma_mu, low, high);
57 double poiVal, alt_val, sigma_mu, low, high, target;
62 TailIntegralFunction
f(poiVal, poiPrimeVal,
sigma, low, high, compatRegions, targetTailIntegral);
71 double _prev_pll = _pll;
75 _pll = 2. * (_pll + 1.);
76 }
else if (currVal < -1
e-4) {
86 _pll = std::numeric_limits<double>::quiet_NaN();
94 Warning(
"Asymptotics::k",
"Reached limit pValue=%g pll=%g", pValue, _pll);
97 }
while (std::abs(wf(_pll)) > 1
e-4 && std::abs(wf(_pll)) < std::abs(wf(_prev_pll)) * 0.99);
103 double sigma,
double lowBound,
double upBound)
123 if (lowBound != -std::numeric_limits<double>::infinity() || upBound != std::numeric_limits<double>::infinity()) {
125 }
else if (std::abs(poiVal - poi_primeVal) > 1
e-12) {
134 if (std::abs(poiVal - poi_primeVal) > 1
e-12)
135 Lambda_y = (poiVal - poi_primeVal) /
sigma;
137 if (std::isnan(Lambda_y))
140 double k_low = (lowBound == -std::numeric_limits<double>::infinity()) ? std::numeric_limits<double>::infinity()
141 : pow((poiVal - lowBound) /
sigma, 2);
142 double k_high = (upBound == std::numeric_limits<double>::infinity()) ? std::numeric_limits<double>::infinity()
143 : pow((upBound - poiVal) /
sigma, 2);
145 double out =
Phi_m(poiVal, poi_primeVal, std::numeric_limits<double>::infinity(),
sigma, compatRegions) - 1;
157 out += 1.0 -
Phi_m(poiVal, poi_primeVal, Lambda_y + sqrt(
k),
sigma, compatRegions);
159 double Lambda_high = (poiVal - upBound) * (poiVal + upBound - 2. * poi_primeVal) / (
sigma *
sigma);
160 double sigma_high = 2. * (upBound - poiVal) /
sigma;
162 out += 1.0 -
Phi_m(poiVal, poi_primeVal, (
k - Lambda_high) / sigma_high,
sigma, compatRegions);
167 out += 1.0 +
Phi_m(poiVal, poi_primeVal, Lambda_y - sqrt(
k),
sigma, compatRegions);
169 double Lambda_low = (poiVal - lowBound) * (poiVal + lowBound - 2. * poi_primeVal) / (
sigma *
sigma);
170 double sigma_low = 2. * (poiVal - lowBound) /
sigma;
172 out += 1.0 +
Phi_m(poiVal, poi_primeVal, (Lambda_low -
k) / sigma_low,
sigma, compatRegions);
203 double lowEdge = std::numeric_limits<double>::quiet_NaN();
204 for (
auto &transition : compatRegions) {
205 if (transition.first >= (
a *
sigma + mu_prime))
207 if (transition.second == 0 && std::isnan(lowEdge)) {
208 lowEdge = transition.first;
209 }
else if (!std::isnan(lowEdge)) {
212 lowEdge = std::numeric_limits<double>::quiet_NaN();
215 if (!std::isnan(lowEdge)) {
224 if (std::isnan(mu_hat))
227 for (
auto &transition : func) {
228 if (transition.first > mu_hat)
230 out = transition.second;
externInt_t gErrorIgnoreLevel
errors with level below this value will be ignored. Default is kUnset.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
TRObject operator()(const T1 &t1) const
static double k(const IncompatFunc &compatRegions, double pValue, double poiVal, double poiPrimeVal, double sigma_mu=0, double mu_low=-std::numeric_limits< double >::infinity(), double mu_high=std::numeric_limits< double >::infinity())
static IncompatFunc IncompatibilityFunction(const PLLType &type, double mu)
static double PValue(const IncompatFunc &compatRegions, double k, double mu, double mu_prime, double sigma_mu=0, double mu_low=-std::numeric_limits< double >::infinity(), double mu_high=std::numeric_limits< double >::infinity())
std::vector< std::pair< double, int > > IncompatFunc
static int CompatFactor(const IncompatFunc &func, double mu_hat)
static double Phi_m(double mu, double mu_prime, double a, double sigma, const IncompatFunc &compatRegions)
Class for finding the root of a one dimensional function using the Brent algorithm.
bool SetFunction(const ROOT::Math::IGenFunction &f, double xlow, double xup) override
Sets the function for the rest of the algorithms.
bool Solve(int maxIter=100, double absTol=1E-8, double relTol=1E-10) override
Returns the X value corresponding to the function value fy for (xmin<x<xmax).
double Root() const override
Returns root value.
Template class to wrap any C++ callable object which takes one argument i.e.
double normal_cdf(double x, double sigma=1, double x0=0)
Cumulative distribution function of the normal (Gaussian) distribution (lower tail).
double gaussian_cdf(double x, double sigma=1, double x0=0)
Alternative name for same function.
double gaussian_cdf_c(double x, double sigma=1, double x0=0)
Alternative name for same function.
#define BEGIN_XROOFIT_NAMESPACE
#define END_XROOFIT_NAMESPACE