72using std::cout, std::endl, std::string, std::unique_ptr;
99 fNLLObs(0), fNLLAsimov(0),
114 oocoutI(
nullptr,InputArguments) <<
"AsymptotiCalculator: Minimum of POI is " <<
muNull->getMin() <<
" corresponds to null snapshot - default configuration is one-sided discovery formulae " << std::endl;
134 oocoutP(
nullptr,Eval) <<
"AsymptoticCalculator::Initialize...." << std::endl;
139 oocoutE(
nullptr,InputArguments) <<
"AsymptoticCalculator::Initialize - ModelConfig has not a pdf defined" << std::endl;
144 oocoutE(
nullptr,InputArguments) <<
"AsymptoticCalculator::Initialize - data set has not been defined" << std::endl;
152 if (!poi || poi->
empty()) {
153 oocoutE(
nullptr,InputArguments) <<
"AsymptoticCalculator::Initialize - ModelConfig has not POI defined." << endl;
156 if (poi->
size() > 1) {
157 oocoutW(
nullptr,InputArguments) <<
"AsymptoticCalculator::Initialize - ModelConfig has more than one POI defined \n\t"
158 <<
"The asymptotic calculator works for only one POI - consider as POI only the first parameter"
166 oocoutE(
nullptr,InputArguments) <<
"AsymptoticCalculator::Initialize - Null model needs a snapshot. Set using modelconfig->SetSnapshot(poi)." << endl;
178 std::unique_ptr<RooArgSet> allParams{
nullPdf->getParameters(
data)};
189 oocoutP(
nullptr,Eval) <<
"AsymptoticCalculator::Initialize - Find best unconditional NLL on observed data" << endl;
196 oocoutP(
nullptr,Eval) <<
"Best fitted POI value = " <<
muBest->getVal() <<
" +/- " <<
muBest->getError() << std::endl;
203 oocoutE(
nullptr,InputArguments) <<
"Alt (Background) model needs a snapshot. Set using modelconfig->SetSnapshot(poi)." << endl;
209 oocoutP(
nullptr,Eval) <<
"AsymptoticCalculator: Building Asimov data Set" << endl;
220 if (
data.numEntries() !=
xobs->getBins() ) {
222 oocoutW(
nullptr,InputArguments) <<
"AsymptoticCalculator: number of bins in " <<
xobs->GetName() <<
" are different than data bins "
223 <<
" set the same data bins " <<
data.numEntries() <<
" in range "
224 <<
" [ " <<
xobs->getMin() <<
" , " <<
xobs->getMax() <<
" ]" << std::endl;
232 oocoutI(
nullptr,InputArguments) <<
"AsymptoticCalculator: Asimov data will be generated using fitted nuisance parameter values" << endl;
240 oocoutI(
nullptr,InputArguments) <<
"AsymptoticCalculator: Asimovdata set will be generated using nominal (current) nuisance parameter values" << endl;
246 oocoutE(
nullptr,InputArguments) <<
"AsymptoticCalculator: Error : Asimov data set could not be generated " << endl;
269 <<
"AsymptoticCalculator::Initialize Find best conditional NLL on ASIMOV data set for given alt POI ( "
270 <<
muAlt->GetName() <<
" ) = " <<
muAlt->getVal() << std::endl;
308 std::unique_ptr<RooArgSet>
attachedSet{nll->getVariables()};
322 std::cout <<
"Model with more than one POI are not supported - ignore extra parameters, consider only first one" << std::endl;
361 minim.setEvalErrorWall(config.useEvalErrorWall);
369 minim.optimizeConst(2);
374 std::cout <<
"AsymptoticCalculator::EvaluateNLL ........ using " << minimizer <<
" / " <<
algorithm
375 <<
" with strategy " <<
strategy <<
" and tolerance " <<
tol << std::endl;
386 printf(
" ----> Doing a re-scan first\n");
387 minim.minimize(minimizer,
"Scan");
391 printf(
" ----> trying with strategy = 1\n");
392 minim.setStrategy(1);
398 printf(
" ----> trying with improve\n");
399 minimizer =
"Minuit";
405 std::unique_ptr<RooFitResult>
result;
409 result = std::unique_ptr<RooFitResult>{
minim.save()};
423 oocoutE(
nullptr,Fitting) <<
"FIT FAILED !- return a NaN NLL " << std::endl;
427 minim.optimizeConst(
false);
432 std::cout <<
"AsymptoticCalculator::EvaluateNLL - value = " << val;
435 std::cout <<
" for poi fixed at = " <<
muTest;
438 std::cout <<
"\tfit time : ";
442 std::cout << std::endl;
469 oocoutE(
nullptr,InputArguments) <<
"AsymptoticCalculator::GetHypoTest - Error initializing Asymptotic calculator - return nullptr result " << endl;
475 oocoutE(
nullptr,InputArguments) <<
"AsymptoticCalculator::GetHypoTest - Asimov data set has not been generated - return nullptr result " << endl;
495 oocoutW(
nullptr,InputArguments) <<
"AsymptoticCalculator::GetHypoTest: snapshot has more than one POI - assume as POI first parameter " << std::endl;
498 std::unique_ptr<RooArgSet> allParams{
nullPdf->getParameters(*
GetData() )};
511 std::cout << std::endl;
512 oocoutI(
nullptr,Eval) <<
"AsymptoticCalculator::GetHypoTest: - perform an hypothesis test for POI ( " <<
muTest->GetName() <<
" ) = " <<
muTest->getVal() << std::endl;
513 oocoutP(
nullptr,Eval) <<
"AsymptoticCalculator::GetHypoTest - Find best conditional NLL on OBSERVED data set ..... " << std::endl;
524 oocoutP(
nullptr,Eval) <<
"\t OBSERVED DATA : qmu = " << qmu <<
" condNLL = " <<
condNLL <<
" uncond " <<
fNLLObs << std::endl;
532 oocoutW(
nullptr,Minimization) <<
"AsymptoticCalculator: Found a negative value of the qmu - retry to do the unconditional fit "
536 <<
"AsymptoticCalculator: unconditional fit failed before - retry to do it now " << std::endl;
542 oocoutW(
nullptr,Minimization) <<
"AsymptoticCalculator: Found a better unconditional minimum "
543 <<
" old NLL = " <<
fNLLObs <<
" old muHat " <<
muHat->getVal() << std::endl;
555 oocoutW(
nullptr,Minimization) <<
"AsymptoticCalculator: New minimum found for "
556 <<
" NLL = " <<
fNLLObs <<
" muHat " <<
muHat->getVal() << std::endl;
562 oocoutP(
nullptr,Eval) <<
"After unconditional refit, new qmu value is " << qmu << std::endl;
568 oocoutE(
nullptr,Minimization) <<
"AsymptoticCalculator: qmu is still < 0 for mu = "
569 <<
muTest->getVal() <<
" return a dummy result "
574 oocoutE(
nullptr,Minimization) <<
"AsymptoticCalculator: failure in fitting for qmu or qmuA "
575 <<
muTest->getVal() <<
" return a dummy result "
599 if (verbose > 0)
oocoutP(
nullptr,Eval) <<
"AsymptoticCalculator::GetHypoTest -- Find best conditional NLL on ASIMOV data set .... " << std::endl;
613 <<
"AsymptoticCalculator: Found a negative value of the qmu Asimov- retry to do the unconditional fit "
617 <<
"AsymptoticCalculator: Fit failed for unconditional the qmu Asimov- retry unconditional fit "
624 oocoutW(
nullptr,Minimization) <<
"AsymptoticCalculator: Found a better unconditional minimum for Asimov data set"
630 oocoutW(
nullptr,Minimization) <<
"AsymptoticCalculator: New minimum found for "
635 oocoutP(
nullptr,Eval) <<
"After unconditional Asimov refit, new qmu_A value is " <<
qmu_A << std::endl;
641 oocoutE(
nullptr,Minimization) <<
"AsymptoticCalculator: qmu_A is still < 0 for mu = "
642 <<
muTest->getVal() <<
" return a dummy result "
647 oocoutE(
nullptr,Minimization) <<
"AsymptoticCalculator: failure in fitting for qmu or qmuA "
648 <<
muTest->getVal() <<
" return a dummy result "
678 oocoutI(
nullptr,InputArguments) <<
"Minimum of POI is " <<
muTest->getMin() <<
" corresponds to alt snapshot - using qtilde asymptotic formulae " << std::endl;
681 oocoutI(
nullptr,InputArguments) <<
"Minimum of POI is " <<
muTest->getMin() <<
" is different to alt snapshot " <<
muAlt->getVal()
682 <<
" - using standard q asymptotic formulae " << std::endl;
692 oocoutI(
nullptr,Eval) <<
"Using one-sided qmu - setting qmu to zero muHat = " <<
muHat->getVal()
693 <<
" muTest = " <<
muTest->getVal() << std::endl;
699 oocoutI(
nullptr,Eval) <<
"Using one-sided discovery qmu - setting qmu to zero muHat = " <<
muHat->getVal()
700 <<
" muTest = " <<
muTest->getVal() << std::endl;
720 double sqrtqmu = (qmu > 0) ? std::sqrt(qmu) : 0;
728 oocoutI(
nullptr,Eval) <<
"Using one-sided limit asymptotic formula (qmu)" << endl;
730 oocoutI(
nullptr, Eval) <<
"Using one-sided discovery asymptotic formula (q0)" << endl;
738 if (verbose > 2)
oocoutI(
nullptr,Eval) <<
"Using two-sided asymptotic formula (tmu)" << endl;
749 if (verbose > 2)
oocoutI(
nullptr,Eval) <<
"Using qmu_tilde (qmu is greater than qmu_A)" << endl;
758 if (verbose > 2)
oocoutI(
nullptr,Eval) <<
"Using tmu_tilde (qmu is greater than qmu_A)" << endl;
770 string resultname =
"HypoTestAsymptotic_result";
775 oocoutP(
nullptr, Eval) <<
"poi = " <<
muTest->getVal() <<
" qmu = " << qmu <<
" qmu_A = " <<
qmu_A
777 <<
" CLb = " <<
palt <<
" CLs = " << res->
CLs() << std::endl;
819 brf.SetFunction(
wf, 0, 20);
822 oocoutE(
nullptr,Eval) <<
"Error finding expected p-values - return -1" << std::endl;
830 brf.SetFunction(
wf2,0,20);
833 oocoutE(
nullptr,Eval) <<
"Error finding expected p-values - return -1" << std::endl;
860 if (
debug) cout <<
"looping on observable " <<
v->GetName() << endl;
861 for (
int i = 0; i <
v->getBins(); ++i) {
866 binVolume *=
v->getBinWidth(i);
878 if (
fval*expectedEvents <= 0)
880 if (
fval*expectedEvents < 0) {
881 oocoutW(
nullptr,InputArguments)
882 <<
"AsymptoticCalculator::" <<
__func__
883 <<
"(): Detected a bin with negative expected events! Please check your inputs." << endl;
886 oocoutW(
nullptr,InputArguments)
887 <<
"AsymptoticCalculator::" <<
__func__
888 <<
"(): Detected a bin with zero expected events- skip it" << endl;
896 cout <<
"bin " <<
ibin <<
"\t";
897 for (std::size_t
j=0;
j < obs.
size(); ++
j) { cout <<
" " << (
static_cast<RooRealVar&
>( obs[
j])).getVal(); }
898 cout <<
" w = " <<
fval*expectedEvents;
909 cout <<
"ending loop on .. " <<
v->GetName() << endl;
923 if (!
a->dependsOn(obs))
continue;
928 pois->setNoRounding(
true);
929 }
else if ((gauss =
dynamic_cast<RooGaussian *
>(
a)) !=
nullptr) {
937 oocoutE(
nullptr, InputArguments)
938 <<
"Illegal term in counting model: "
939 <<
"the PDF " <<
a->GetName() <<
" depends on the observables, but is not a Poisson, Gaussian or Product"
964 if (
myobs !=
nullptr) {
965 oocoutF(
nullptr,Generation) <<
"AsymptoticCalculator::SetObsExpected( " <<
pdfName <<
" ) : Has two observables ?? " << endl;
969 if (
myobs ==
nullptr) {
970 oocoutF(
nullptr,Generation) <<
"AsymptoticCalculator::SetObsExpected( " <<
pdfName <<
" ) : Observable is not a RooRealVar??" << endl;
974 if (!
a->isConstant() ) {
975 if (
myexp !=
nullptr) {
976 oocoutE(
nullptr,Generation) <<
"AsymptoticCalculator::SetObsExpected( " <<
pdfName <<
" ) : Has two non-const arguments " << endl;
980 if (
myexp ==
nullptr) {
981 oocoutF(
nullptr,Generation) <<
"AsymptoticCalculator::SetObsExpected( " <<
pdfName <<
" ) : Expected is not a RooAbsReal??" << endl;
987 if (
myobs ==
nullptr) {
988 oocoutF(
nullptr,Generation) <<
"AsymptoticCalculator::SetObsExpected( " <<
pdfName <<
" ) : No observable?" << endl;
991 if (
myexp ==
nullptr) {
992 oocoutF(
nullptr,Generation) <<
"AsymptoticCalculator::SetObsExpected( " <<
pdfName <<
" ) : No observable?" << endl;
999 std::cout <<
"SetObsToExpected : setting " <<
myobs->GetName() <<
" to expected value " <<
myexp->getVal() <<
" of " <<
myexp->GetName() << std::endl;
1017 std::cout <<
"generate counting Asimov data for pdf of type " << pdf.
ClassName() << std::endl;
1020 if (prod !=
nullptr) {
1022 }
else if ((
pois =
dynamic_cast<RooPoisson *
>(&pdf)) !=
nullptr) {
1025 pois->setNoRounding(
true);
1026 }
else if ((gauss =
dynamic_cast<RooGaussian *
>(&pdf)) !=
nullptr) {
1029 oocoutE(
nullptr,InputArguments) <<
"A counting model pdf must be either a RooProdPdf or a RooPoisson or a RooGaussian" << endl;
1031 if (!
r)
return nullptr;
1038 std::string(
"CountingAsimovData") + std::to_string(
icat), obs);
1067 std::string(
"combAsimovData") + std::to_string(
icat),
1080 cout <<
"Generating Asimov data for pdf " << pdf.
GetName() << endl;
1081 cout <<
"list of observables " << endl;
1086 double binVolume = 1;
1090 cout <<
"filled from " << pdf.
GetName() <<
" " << nbins <<
" nbins " <<
" volume is " << binVolume << endl;
1114 cout <<
"sum entries is nan"<<endl;
1134 if (
printLevel > 1) cout <<
" Generate Asimov data for observables"<<endl;
1148 oocoutW(
nullptr,Generation) <<
"Simultaneous pdf does not contain any categories." << endl;
1159 cout <<
"on type " <<
channelCat.getCurrentLabel() <<
" " <<
channelCat.getCurrentIndex() << endl;
1166 oocoutE(
nullptr,Generation) <<
"Error generating an Asimov data set for pdf " <<
pdftmp->GetName() << endl;
1171 oocoutE(
nullptr,Generation) <<
"AsymptoticCalculator::GenerateAsimovData(): The PDF for " <<
channelCat.getCurrentLabel()
1172 <<
" was already defined. It will be overridden. The faulty category definitions follow:" << endl;
1180 cout <<
"channel: " <<
channelCat.getCurrentLabel() <<
", data: ";
1226 std::cout <<
"MakeAsimov: Setting poi " <<
tmpPar->GetName() <<
" to a constant value = " <<
tmpPar->getVal() << std::endl;
1251 std::cout <<
"MakeAsimov: doing a conditional fit for finding best nuisance values " << std::endl;
1254 std::cout <<
"POI values:\n"; poi.
Print(
"v");
1256 std::cout <<
"Nuis param values:\n";
1270 std::vector<RooCmdArg> args;
1282 for (
auto& arg : args) {
1286 if (verbose>0) { std::cout <<
"fit time ";
tw2.Print();}
1290 std::cout <<
"Nuisance parameters after fit for asimov dataset: " << std::endl;
1344 std::cout <<
"Generated Asimov data for observables "; (model.
GetObservables() )->
Print();
1347 std::cout <<
"--- Asimov data values \n";
1348 asimov->
get()->Print(
"v");
1351 std::cout <<
"--- Asimov data numEntries = " << asimov->
numEntries() <<
" sumOfEntries = " << asimov->
sumEntries() << std::endl;
1353 std::cout <<
"\ttime for generating : ";
tw.Print();
1373 std::cout <<
"Generating Asimov data for global observables " << std::endl;
1387 oocoutW(
nullptr,Generation) <<
"AsymptoticCalculator::MakeAsimovData: model does not have nuisance parameters but has global observables"
1388 <<
" set global observables to model values " << endl;
1396 oocoutF(
nullptr, Generation) <<
"AsymptoticCalculator::MakeAsimovData: model has nuisance parameters and "
1397 "global obs but no nuisance pdf "
1412 "AsimovUtils: a factor of the nuisance pdf is not a Pdf!");
1420 if (
cgobs->size() > 1) {
1421 oocoutE(
nullptr,Generation) <<
"AsymptoticCalculator::MakeAsimovData: constraint term " <<
cterm->GetName()
1422 <<
" has multiple global observables -cannot generate - skip it" << std::endl;
1425 else if (
cgobs->empty()) {
1427 <<
"AsymptoticCalculator::MakeAsimovData: constraint term " <<
cterm->GetName()
1428 <<
" has no global observables - skip it" << std::endl;
1436 if (
cpars->size() != 1) {
1438 <<
"AsymptoticCalculator::MakeAsimovData:constraint term "
1439 <<
cterm->GetName() <<
" has multiple floating params - cannot generate - skip it " << std::endl;
1447 if (verbose > 2) std::cout <<
"Constraint " <<
cterm->GetName() <<
" of type " <<
cClass->GetName() << std::endl;
1453 <<
"AsymptoticCalculator::MakeAsimovData:constraint term "
1454 <<
cterm->GetName() <<
" of type " << className
1455 <<
" is a non-supported type - result might be not correct " << std::endl;
1462 pois->setNoRounding(
true);
1473 <<
"AsymptoticCalculator::MakeAsimovData:constraint term "
1474 <<
cterm->GetName() <<
" has no direct dependence on global observable- cannot generate it " << std::endl;
1493 <<
"AsymptoticCalculator::MakeAsimovData:constraint term "
1494 <<
cterm->GetName() <<
" is a Gamma distribution and no server named theta is found. Assume that the Gamma scale is 1 " << std::endl;
1498 std::cout <<
"Gamma constraint has a scale " <<
thetaGamma->GetName() <<
" = " <<
thetaGamma->getVal() << std::endl;
1503 if (verbose > 2) std::cout <<
"Loop on constraint server term " <<
a2->GetName() << std::endl;
1509 oocoutE(
nullptr,Generation) <<
"AsymptoticCalculator::MakeAsimovData:constraint term "
1510 <<
cterm->GetName() <<
" constraint term has more server depending on nuisance- cannot generate it " <<
1523 std::cout <<
"setting global observable " <<
rrv.GetName() <<
" to value " <<
rrv.getVal()
1524 <<
" which comes from " <<
rrv2->GetName() << std::endl;
1530 oocoutE(
nullptr,Generation) <<
"AsymptoticCalculator::MakeAsimovData - can't find nuisance for constraint term - global observables will not be set to Asimov value " <<
cterm->GetName() << std::endl;
1531 std::cerr <<
"Parameters: " << std::endl;
1533 std::cerr <<
"Observables: " << std::endl;
1550 std::cout <<
"Generated Asimov data for global observables ";
1551 if (verbose == 1)
gobs.Print();
1555 std::cout <<
"\nGlobal observables for data: " << std::endl;
1557 std::cout <<
"\nGlobal observables for asimov: " << std::endl;
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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 offset
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 r
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 char Point_t Rectangle_t WindowAttributes_t index
void Print(GNN_Data &d, std::string txt="")
TRObject operator()(const T1 &t1) const
Class for finding the root of a one dimensional function using the Brent algorithm.
static int DefaultPrintLevel()
static double DefaultTolerance()
static const std::string & DefaultMinimizerAlgo()
static int DefaultStrategy()
Template class to wrap any C++ callable object which takes one argument i.e.
Common abstract base class for objects that represent a value and a "shape" in RooFit.
RooFit::OwningPtr< RooArgSet > getParameters(const RooAbsData *data, bool stripDisconnected=true) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
RooFit::OwningPtr< RooArgSet > getObservables(const RooArgSet &set, bool valueOnly=true) const
Given a set of possible observables, return the observables that this PDF depends on.
const RefCountList_t & servers() const
List of all servers of this object.
RooFit::OwningPtr< RooArgSet > getVariables(bool stripDisconnected=true) const
Return RooArgSet with all variables (tree leaf nodes of expression tree)
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
bool contains(const RooAbsArg &var) const
Check if collection contains an argument with the same name as var.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
void assign(const RooAbsCollection &other) const
Sets the value, cache and constant attribute of any argument in our set that also appears in the othe...
Storage_t::size_type size() const
RooAbsArg * first() const
void Print(Option_t *options=nullptr) const override
This method must be overridden when a class wants to print itself.
Abstract base class for binned and unbinned datasets.
virtual double sumEntries() const =0
Return effective number of entries in dataset, i.e., sum all weights.
virtual const RooArgSet * get() const
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
Abstract interface for all probability density functions.
virtual double expectedEvents(const RooArgSet *nset) const
Return expected number of events to be used in calculation of extended likelihood.
bool canBeExtended() const
If true, PDF can provide extended likelihood term.
RooFit::OwningPtr< RooFitResult > fitTo(RooAbsData &data, CmdArgs_t const &... cmdArgs)
Fit PDF to given dataset.
Abstract base class for objects that represent a real value and implements functionality common to al...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
static void setHideOffset(bool flag)
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
Object to represent discrete states.
Container class to hold unbinned data.
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
virtual void Add(TObject *arg)
Wrapper class around ROOT::Math::Minimizer that provides a seamless interface between the minimizer f...
static RooMsgService & instance()
Return reference to singleton instance.
Efficient implementation of a product of PDFs of the form.
const RooArgList & pdfList() const
Variable that can be changed from the outside.
Facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
Hypothesis Test Calculator based on the asymptotic formulae for the profile likelihood ratio.
static double GetExpectedPValues(double pnull, double palt, double nsigma, bool usecls, bool oneSided=true)
function given the null and the alt p value - return the expected one given the N - sigma value
static double EvaluateNLL(RooStats::ModelConfig const &modelConfig, RooAbsData &data, const RooArgSet *poiSet=nullptr)
static int fgPrintLevel
control print level (0 minimal, 1 normal, 2 debug)
static bool SetObsToExpected(RooAbsPdf &pdf, const RooArgSet &obs)
set observed value to the expected one works for Gaussian, Poisson or LogNormal assumes mean paramete...
static void SetPrintLevel(int level)
set print level (static function)
RooArgSet fAsimovGlobObs
snapshot of Asimov global observables
static RooAbsData * GenerateAsimovData(const RooAbsPdf &pdf, const RooArgSet &observables)
generate the asimov data for the observables (not the global ones) need to deal with the case of a si...
int fUseQTilde
flag to indicate if using qtilde or not (-1 (default based on RooRealVar)), 0 false,...
static RooAbsData * GenerateAsimovDataSinglePdf(const RooAbsPdf &pdf, const RooArgSet &obs, const RooRealVar &weightVar, RooCategory *channelCat=nullptr)
Compute the asimov data set for an observable of a pdf.
bool fIsInitialized
! flag to check if calculator is initialized
HypoTestResult * GetHypoTest() const override
re-implement HypoTest computation using the asymptotic
bool fOneSided
for one sided PL test statistic (upper limits)
RooArgSet fBestFitParams
snapshot of all best fitted Parameter values
AsymptoticCalculator(RooAbsData &data, const ModelConfig &altModel, const ModelConfig &nullModel, bool nominalAsimov=false)
constructor for asymptotic calculator from Data set and ModelConfig
static RooAbsData * GenerateCountingAsimovData(RooAbsPdf &pdf, const RooArgSet &obs, const RooRealVar &weightVar, RooCategory *channelCat=nullptr)
Generate counting Asimov data for the case when the pdf cannot be extended.
bool fOneSidedDiscovery
for one sided PL test statistic (for discovery)
RooAbsData * fAsimovData
asimov data set
RooArgSet fBestFitPoi
snapshot of best fitted POI values
static RooAbsData * MakeAsimovData(RooAbsData &data, const ModelConfig &model, const RooArgSet &poiValues, RooArgSet &globObs, const RooArgSet *genPoiValues=nullptr)
Make Asimov data.
static void FillBins(const RooAbsPdf &pdf, const RooArgList &obs, RooAbsData &data, int &index, double &binVolume, int &ibin)
fill bins by looping recursively on observables
bool fNominalAsimov
make Asimov at nominal parameter values
bool Initialize() const
initialize the calculator by performing a global fit and make the Asimov data set
Common base class for the Hypothesis Test Calculators.
const ModelConfig * GetNullModel(void) const
const ModelConfig * GetAlternateModel(void) const
const RooAbsData * GetData(void) const
HypoTestResult is a base class for results from hypothesis tests.
virtual double CLs() const
is simply (not a method, but a quantity)
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
const RooArgSet * GetConditionalObservables() const
get RooArgSet for conditional observables (return nullptr if not existing)
const RooArgSet * GetGlobalObservables() const
get RooArgSet for global observables (return nullptr if not existing)
const RooArgSet * GetParametersOfInterest() const
get RooArgSet containing the parameter of interest (return nullptr if not existing)
const RooArgSet * GetNuisanceParameters() const
get RooArgSet containing the nuisance parameters (return nullptr if not existing)
const RooArgSet * GetObservables() const
get RooArgSet for observables (return nullptr if not existing)
const RooArgSet * GetSnapshot() const
get RooArgSet for parameters for a particular hypothesis (return nullptr if not existing)
RooAbsPdf * GetPdf() const
get model PDF (return nullptr if pdf has not been specified or does not exist)
TClass instances represent classes, structs and namespaces in the ROOT type system.
const char * GetName() const override
Returns name of object.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
RooCmdArg Index(RooCategory &icat)
RooCmdArg WeightVar(const char *name="weight", bool reinterpretAsWeight=false)
RooCmdArg Import(const char *state, TH1 &histo)
RooCmdArg Offset(std::string const &mode)
RooCmdArg Constrain(const RooArgSet ¶ms)
RooCmdArg Minimizer(const char *type, const char *alg=nullptr)
RooCmdArg Hesse(bool flag=true)
RooCmdArg Strategy(Int_t code)
RooCmdArg GlobalObservables(Args_t &&... argsOrArgSet)
RooCmdArg EvalErrorWall(bool flag)
RooCmdArg PrintLevel(Int_t code)
RooCmdArg ConditionalObservables(Args_t &&... argsOrArgSet)
Create a RooCmdArg to declare conditional observables.
double normal_cdf_c(double x, double sigma=1, double x0=0)
Complement of the cumulative distribution function of the normal (Gaussian) distribution (upper tail)...
double normal_cdf(double x, double sigma=1, double x0=0)
Cumulative distribution function of the normal (Gaussian) distribution (lower tail).
double normal_quantile(double z, double sigma)
Inverse ( ) of the cumulative distribution function of the lower tail of the normal (Gaussian) distri...
double normal_quantile_c(double z, double sigma)
Inverse ( ) of the cumulative distribution function of the upper tail of the normal (Gaussian) distri...
MsgLevel
Verbosity level for RooMsgService::StreamConfig in RooMsgService.
Namespace for the RooStats classes.
bool SetAllConstant(const RooAbsCollection &coll, bool constant=true)
utility function to set all variable constant in a collection (from G.
void RemoveConstantParameters(RooArgSet *set)
RooAbsPdf * MakeNuisancePdf(RooAbsPdf &pdf, const RooArgSet &observables, const char *name)
extract constraint terms from pdf
RooStatsConfig & GetGlobalRooStatsConfig()
Retrieve the config object which can be used to set flags for things like offsetting the likelihood o...
bool IsNLLOffset()
function returning if the flag to check if the flag to use NLLOffset is set
Double_t QuietNaN()
Returns a quiet NaN as defined by IEEE 754.
PaltFunction(double offset, double pval, int icase)