15#ifdef XROOFIT_USE_PRAGMA_ONCE
18#if !defined(XROOFIT_XROONLLVAR_H) || defined(XROOFIT_USE_PRAGMA_ONCE)
19#ifndef XROOFIT_USE_PRAGMA_ONCE
20#define XROOFIT_XROONLLVAR_H
51class HypoTestInverterResult;
65 xRooNLLVar(
const std::shared_ptr<RooAbsPdf> &pdf,
const std::shared_ptr<RooAbsData> &
data,
67 xRooNLLVar(
const std::shared_ptr<RooAbsPdf> &pdf,
68 const std::pair<std::shared_ptr<RooAbsData>, std::shared_ptr<const RooAbsCollection>> &
data,
81 std::pair<std::shared_ptr<RooAbsData>, std::shared_ptr<const RooAbsCollection>>
83 std::pair<std::shared_ptr<RooAbsData>, std::shared_ptr<const RooAbsCollection>>
84 generate(
bool expected =
false,
int seed = 0);
94 std::shared_ptr<xRooNode>
fNode;
97 xRooFitResult minimize(
const std::shared_ptr<ROOT::Fit::FitConfig> & =
nullptr);
99 void SetFitConfig(
const std::shared_ptr<ROOT::Fit::FitConfig> &in) { fFitConfig = in; }
100 std::shared_ptr<ROOT::Fit::FitConfig> fitConfig();
113 std::pair<double, double> pll(
bool readOnly =
false);
114 std::pair<double, double> sigma_mu(
bool readOnly =
false);
115 std::shared_ptr<const RooFitResult> ufit(
bool readOnly =
false);
116 std::shared_ptr<const RooFitResult> cfit_null(
bool readOnly =
false);
117 std::shared_ptr<const RooFitResult> cfit_alt(
bool readOnly =
false);
119 std::pair<std::shared_ptr<RooAbsData>, std::shared_ptr<const RooAbsCollection>>
data;
121 std::pair<double, double> getVal(
const char *
what);
124 std::pair<double, double> pNull_asymp(
double nSigma = std::numeric_limits<double>::quiet_NaN());
125 std::pair<double, double> pAlt_asymp(
double nSigma = std::numeric_limits<double>::quiet_NaN());
126 std::pair<double, double> pCLs_asymp(
double nSigma = std::numeric_limits<double>::quiet_NaN());
127 std::pair<double, double>
128 ts_asymp(
double nSigma = std::numeric_limits<double>::quiet_NaN());
130 std::pair<double, double> pNull_toys(
double nSigma = std::numeric_limits<double>::quiet_NaN());
131 std::pair<double, double> pAlt_toys(
double nSigma = std::numeric_limits<double>::quiet_NaN());
132 std::pair<double, double>
pCLs_toys(
double nSigma = std::numeric_limits<double>::quiet_NaN())
134 if (fNullVal() == fAltVal())
135 return std::pair(1, 0);
136 auto null = pNull_toys(nSigma);
137 auto alt = pAlt_toys(nSigma);
138 double pval = (null.first == 0) ? 0 : null.first / alt.first;
140 return std::make_pair(pval, pval * sqrt(pow(null.second / null.first, 2) + pow(alt.second / alt.first, 2)));
142 std::pair<double, double>
143 ts_toys(
double nSigma = std::numeric_limits<double>::quiet_NaN());
151 void addNullToys(
int nToys = 1,
int seed = 0);
152 void addAltToys(
int nToys = 1,
int seed = 0);
158 std::shared_ptr<xRooHypoPoint>
159 asimov(
bool readOnly =
163 const char *fPOIName();
169 std::shared_ptr<const RooAbsCollection>
coords;
171 std::shared_ptr<const RooFitResult> fUfit, fNull_cfit,
fAlt_cfit;
173 bool isExpected =
false;
175 std::shared_ptr<xRooHypoPoint>
179 std::vector<std::tuple<int, double, double>>
nullToys;
181 std::vector<std::tuple<int, double, double>>
altToys;
183 std::shared_ptr<xRooNLLVar> nllVar =
nullptr;
186 std::pair<double, double> pX_toys(
bool alt,
double nSigma = std::numeric_limits<double>::quiet_NaN());
187 void addToys(
bool alt,
int nToys,
int initialSeed = 0);
194 double alt_value = std::numeric_limits<double>::quiet_NaN(),
197 xRooHypoPoint hypoPoint(
double value,
double alt_value = std::numeric_limits<double>::quiet_NaN(),
204 public std::vector<xRooHypoPoint> {
211 bool AddModel(
const xRooNode &pdf,
const char *validity =
"");
213 void LoadFits(
const char *apath);
216 int AddPoints(
const char *parName,
size_t nPoints,
double low,
double high);
218 void Print(
Option_t *opt =
"")
const override;
223 std::shared_ptr<RooArgSet>
pars()
const {
return fPars; };
236 std::shared_ptr<TGraphErrors> BuildGraph(
const char *opt);
241 static std::pair<double, double> GetLimit(
const TGraph &pValues,
double target = 0.05);
245 std::pair<double, double> FindLimit(
const char *opt,
double relUncert = std::numeric_limits<double>::infinity());
248 std::map<std::string, std::pair<double, double>> limits(
const char *opt =
"cls",
double relUncert = 0.1);
251 std::shared_ptr<xRooNode> pdf(
const char *parValues =
"")
const;
262 std::map<std::shared_ptr<xRooNode>, std::shared_ptr<xRooNLLVar>>
fNlls;
266 std::set<std::pair<std::shared_ptr<RooArgList>, std::shared_ptr<xRooNode>>>
fPdfs;
269 xRooHypoSpace hypoSpace(
const char *parName,
int nPoints,
double low,
double high,
270 double alt_value = std::numeric_limits<double>::quiet_NaN(),
274 xRooHypoSpace hypoSpace(
int nPoints,
double low,
double high,
275 double alt_value = std::numeric_limits<double>::quiet_NaN(),
278 std::shared_ptr<RooArgSet> pars(
bool stripGlobalObs =
true);
282 std::shared_ptr<RooAbsReal> func()
const;
283 std::shared_ptr<RooAbsPdf>
pdf()
const {
return fPdf; }
295 double getEntryVal(
size_t entry);
296 double extendedTerm()
const;
297 double simTerm()
const;
298 double binnedDataTerm()
const;
301 Bool_t setData(
const std::pair<std::shared_ptr<RooAbsData>, std::shared_ptr<const RooAbsCollection>> &_data);
302 Bool_t setData(
const std::shared_ptr<RooAbsData> &
data,
const std::shared_ptr<const RooAbsCollection> &globs)
304 return setData(std::make_pair(
data, globs));
310 std::shared_ptr<RooAbsPdf>
fPdf;
312 std::shared_ptr<const RooAbsCollection>
fGlobs;
314 std::shared_ptr<RooLinkedList>
fOpts;
322 bool kReuseNLL =
true;
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
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 result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Generic interface for defining configuration options of a numerical algorithm.
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
RooAbsData is the common abstract base class for binned and unbinned datasets.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
RooConstraintSum calculates the sum of the -(log) likelihoods of a set of RooAbsPfs that represent co...
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
std::shared_ptr< xRooNode > fNode
std::pair< double, double > pCLs_toys(double nSigma=std::numeric_limits< double >::quiet_NaN())
std::shared_ptr< const RooAbsCollection > coords
std::shared_ptr< const RooFitResult > fAlt_cfit
std::pair< std::shared_ptr< RooAbsData >, std::shared_ptr< const RooAbsCollection > > data
std::vector< std::tuple< int, double, double > > altToys
std::shared_ptr< const RooFitResult > fGenFit
std::vector< std::tuple< int, double, double > > nullToys
std::shared_ptr< xRooHypoPoint > fAsimov
static std::set< int > allowedStatusCodes
xRooHypoPoint & point(size_t i)
std::shared_ptr< RooArgSet > pars() const
std::set< std::pair< std::shared_ptr< RooArgList >, std::shared_ptr< xRooNode > > > fPdfs
std::set< std::shared_ptr< xRooNode > > fWorkspaces
bool AddWorkspace(const char *wsFilename, const char *extraPars="")
std::shared_ptr< RooArgSet > fPars
std::map< std::shared_ptr< xRooNode >, std::shared_ptr< xRooNLLVar > > fNlls
std::shared_ptr< RooAbsCollection > fFuncGlobs
std::shared_ptr< RooAbsCollection > fFuncVars
std::shared_ptr< RooAbsPdf > fPdf
std::shared_ptr< RooAbsCollection > fConstVars
std::shared_ptr< const RooAbsCollection > fGlobs
std::shared_ptr< RooAbsData > fData
std::shared_ptr< RooAbsPdf > pdf() const
std::shared_ptr< RooLinkedList > fOpts
std::string fFuncCreationLog
RooAbsReal * operator->() const
Bool_t setData(const std::shared_ptr< RooAbsData > &data, const std::shared_ptr< const RooAbsCollection > &globs)
void SetFitConfig(const std::shared_ptr< ROOT::Fit::FitConfig > &in)
std::shared_ptr< ROOT::Fit::FitConfig > fFitConfig
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Class RooNLLVar implements a -log(likelihood) calculation from a dataset and a PDF.
RooRealVar represents a variable that can be changed from the outside.
HypoTestInverterResult class holds the array of hypothesis test results and compute a confidence inte...
HypoTestResult is a base class for results from hypothesis tests.
Fill Area Attributes class.
A TGraphErrors is a TGraph with error bars.
A TGraph is an object made of two arrays X and Y with npoints each.
The TNamed class is the base class for all named ROOT classes.
Namespace for the RooStats classes.
#define BEGIN_XROOFIT_NAMESPACE
#define END_XROOFIT_NAMESPACE