98 fOneSided(false), fOneSidedDiscovery(false), fNominalAsimov(nominalAsimov),
100 fNLLObs(0), fNLLAsimov(0),
109 assert(nullSnapshot);
115 oocoutI(
nullptr,InputArguments) <<
"AsymptotiCalculator: Minimum of POI is " << muNull->
getMin() <<
" corresponds to null snapshot - default configuration is one-sided discovery formulae " << std::endl;
135 oocoutP(
nullptr,Eval) <<
"AsymptoticCalculator::Initialize...." << std::endl;
140 oocoutE(
nullptr,InputArguments) <<
"AsymptoticCalculator::Initialize - ModelConfig has not a pdf defined" << std::endl;
145 oocoutE(
nullptr,InputArguments) <<
"AsymptoticCalculator::Initialize - data set has not been defined" << std::endl;
153 if (!poi || poi->
empty()) {
154 oocoutE(
nullptr,InputArguments) <<
"AsymptoticCalculator::Initialize - ModelConfig has not POI defined." << endl;
157 if (poi->
size() > 1) {
158 oocoutW(
nullptr,InputArguments) <<
"AsymptoticCalculator::Initialize - ModelConfig has more than one POI defined \n\t"
159 <<
"The asymptotic calculator works for only one POI - consider as POI only the first parameter"
166 if(nullSnapshot ==
nullptr || nullSnapshot->
empty()) {
167 oocoutE(
nullptr,InputArguments) <<
"AsymptoticCalculator::Initialize - Null model needs a snapshot. Set using modelconfig->SetSnapshot(poi)." << endl;
182 allParams->snapshot(nominalParams);
190 oocoutP(
nullptr,Eval) <<
"AsymptoticCalculator::Initialize - Find best unconditional NLL on observed data" << endl;
197 oocoutP(
nullptr,Eval) <<
"Best fitted POI value = " << muBest->
getVal() <<
" +/- " << muBest->
getError() << std::endl;
203 if(altSnapshot ==
nullptr || altSnapshot->
empty()) {
204 oocoutE(
nullptr,InputArguments) <<
"Alt (Background) model needs a snapshot. Set using modelconfig->SetSnapshot(poi)." << endl;
210 oocoutP(
nullptr,Eval) <<
"AsymptoticCalculator: Building Asimov data Set" << endl;
223 oocoutW(
nullptr,InputArguments) <<
"AsymptoticCalculator: number of bins in " << xobs->
GetName() <<
" are different than data bins "
224 <<
" set the same data bins " <<
data.numEntries() <<
" in range "
225 <<
" [ " << xobs->
getMin() <<
" , " << xobs->
getMax() <<
" ]" << std::endl;
233 oocoutI(
nullptr,InputArguments) <<
"AsymptoticCalculator: Asimov data will be generated using fitted nuisance parameter values" << endl;
241 oocoutI(
nullptr,InputArguments) <<
"AsymptoticCalculator: Asimovdata set will be generated using nominal (current) nuisance parameter values" << endl;
242 nominalParams.
assign(poiAlt);
247 oocoutE(
nullptr,InputArguments) <<
"AsymptoticCalculator: Error : Asimov data set could not be generated " << endl;
269 oocoutP(
nullptr,Eval) <<
"AsymptoticCalculator::Initialize Find best conditional NLL on ASIMOV data set for given alt POI ( " <<
278 globObs.
assign(globObsSnapshot);
281 if (prevBins > 0 && xobs) xobs->
setBins(prevBins);
307 std::unique_ptr<RooArgSet> attachedSet{nll->getVariables()};
312 if (poiSet && !poiSet->
empty()) {
318 paramsSetConstant.
add(*poiVar);
320 if (poiSet->
size() > 1)
321 std::cout <<
"Model with more than one POI are not supported - ignore extra parameters, consider only first one" << std::endl;
349 bool skipFit = (nllParams.
empty());
356 int minimPrintLevel = verbose;
364 tol = std::max(tol,1.0);
374 std::cout <<
"AsymptoticCalculator::EvaluateNLL ........ using " << minimizer <<
" / " << algorithm
375 <<
" with strategy " << strategy <<
" and tolerance " << tol << std::endl;
378 for (
int tries = 1, maxtries = 4; tries <= maxtries; ++tries) {
380 status = minim.
minimize(minimizer, algorithm);
386 printf(
" ----> Doing a re-scan first\n");
391 printf(
" ----> trying with strategy = 1\n");
398 printf(
" ----> trying with improve\n");
399 minimizer =
"Minuit";
400 algorithm =
"migradimproved";
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;
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;
488 assert(nullSnapshot && !nullSnapshot->
empty());
494 if (poiTest.
size() > 1) {
495 oocoutW(
nullptr,InputArguments) <<
"AsymptoticCalculator::GetHypoTest: snapshot has more than one POI - assume as POI first parameter " << std::endl;
504 assert(muHat &&
"no best fit parameter defined");
506 assert(muTest &&
"poi snapshot is not existing");
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;
519 double qmu = 2.*(condNLL -
fNLLObs);
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 "
535 oocoutW(
nullptr,Minimization) <<
"AsymptoticCalculator: unconditional fit failed before - retry to do it now "
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;
607 oocoutP(
nullptr,Eval) <<
"\t ASIMOV data qmu_A = " << qmu_A <<
" condNLL = " << condNLL_A <<
" uncond " <<
fNLLAsimov << std::endl;
612 oocoutW(
nullptr,Minimization) <<
"AsymptoticCalculator: Found a negative value of the qmu Asimov- retry to do the unconditional fit "
615 oocoutW(
nullptr,Minimization) <<
"AsymptoticCalculator: Fit failed for unconditional the qmu Asimov- retry unconditional fit "
622 oocoutW(
nullptr,Minimization) <<
"AsymptoticCalculator: Found a better unconditional minimum for Asimov data set"
628 oocoutW(
nullptr,Minimization) <<
"AsymptoticCalculator: New minimum found for "
633 oocoutP(
nullptr,Eval) <<
"After unconditional Asimov refit, new qmu_A value is " << qmu_A << std::endl;
639 oocoutE(
nullptr,Minimization) <<
"AsymptoticCalculator: qmu_A is still < 0 for mu = "
640 << muTest->
getVal() <<
" return a dummy result "
645 oocoutE(
nullptr,Minimization) <<
"AsymptoticCalculator: failure in fitting for qmu or qmuA "
646 << muTest->
getVal() <<
" return a dummy result "
653 globObs.
assign(globObsSnapshot);
665 bool useQTilde =
false;
673 assert(muAlt !=
nullptr );
676 oocoutI(
nullptr,InputArguments) <<
"Minimum of POI is " << muTest->
getMin() <<
" corresponds to alt snapshot - using qtilde asymptotic formulae " << std::endl;
679 oocoutI(
nullptr,InputArguments) <<
"Minimum of POI is " << muTest->
getMin() <<
" is different to alt snapshot " << muAlt->
getVal()
680 <<
" - using standard q asymptotic formulae " << std::endl;
690 oocoutI(
nullptr,Eval) <<
"Using one-sided qmu - setting qmu to zero muHat = " << muHat->
getVal()
691 <<
" muTest = " << muTest->
getVal() << std::endl;
697 oocoutI(
nullptr,Eval) <<
"Using one-sided discovery qmu - setting qmu to zero muHat = " << muHat->
getVal()
698 <<
" muTest = " << muTest->
getVal() << std::endl;
704 if (qmu < 0 && qmu > -tol) qmu = 0;
705 if (qmu_A < 0 && qmu_A > -tol) qmu_A = 0;
712 double pnull = -1, palt = -1;
717 double sqrtqmu = (qmu > 0) ? std::sqrt(qmu) : 0;
718 double sqrtqmu_A = (qmu_A > 0) ? std::sqrt(qmu_A) : 0;
725 oocoutI(
nullptr,Eval) <<
"Using one-sided limit asymptotic formula (qmu)" << endl;
727 oocoutI(
nullptr,Eval) <<
"Using one-sided discovery asymptotic formula (q0)" << endl;
734 if (verbose > 2)
oocoutI(
nullptr,Eval) <<
"Using two-sided asymptotic formula (tmu)" << endl;
744 if ( qmu > qmu_A && (qmu_A > 0 || qmu > tol) ) {
745 if (verbose > 2)
oocoutI(
nullptr,Eval) <<
"Using qmu_tilde (qmu is greater than qmu_A)" << endl;
753 if ( qmu > qmu_A && (qmu_A > 0 || qmu > tol) ) {
754 if (verbose > 2)
oocoutI(
nullptr,Eval) <<
"Using tmu_tilde (qmu is greater than qmu_A)" << endl;
766 string resultname =
"HypoTestAsymptotic_result";
772 <<
"poi = " << muTest->
getVal() <<
" qmu = " << qmu <<
" qmu_A = " << qmu_A
773 <<
" sigma = " << muTest->
getVal()/sqrtqmu_A
774 <<
" CLsplusb = " << pnull <<
" CLb = " << palt <<
" CLs = " << res->
CLs() << std::endl;
782 fOffset(
offset), fPval(pval), fCase(icase) {}
799 if (!useCls)
return clsplusb;
801 return (clb == 0) ? -1 : clsplusb / clb;
816 bool ret = brf.
Solve();
818 oocoutE(
nullptr,Eval) <<
"Error finding expected p-values - return -1" << std::endl;
821 double sqrttmu_A = brf.
Root();
829 oocoutE(
nullptr,Eval) <<
"Error finding expected p-values - return -1" << std::endl;
856 if (debug) cout <<
"looping on observable " <<
v->GetName() << endl;
857 for (
int i = 0; i <
v->getBins(); ++i) {
861 double prevBinVolume = binVolume;
862 binVolume *=
v->getBinWidth(i);
865 binVolume = prevBinVolume;
870 double totBinVolume = binVolume *
v->getBinWidth(i);
871 double fval = pdf.
getVal(&obstmp)*totBinVolume;
874 if (fval*expectedEvents <= 0)
876 if (fval*expectedEvents < 0) {
877 oocoutW(
nullptr,InputArguments)
878 <<
"AsymptoticCalculator::" << __func__
879 <<
"(): Detected a bin with negative expected events! Please check your inputs." << endl;
882 oocoutW(
nullptr,InputArguments)
883 <<
"AsymptoticCalculator::" << __func__
884 <<
"(): Detected a bin with zero expected events- skip it" << endl;
889 data.add(obs, fval*expectedEvents);
892 cout <<
"bin " << ibin <<
"\t";
893 for (
int j=0; j < obs.
getSize(); ++j) { cout <<
" " << ((
RooRealVar&) obs[j]).getVal(); }
894 cout <<
" w = " << fval*expectedEvents;
905 cout <<
"ending loop on .. " <<
v->GetName() << endl;
919 if (!
a->dependsOn(obs))
continue;
922 if ((pois =
dynamic_cast<RooPoisson *
>(
a)) !=
nullptr) {
925 }
else if ((gauss =
dynamic_cast<RooGaussian *
>(
a)) !=
nullptr) {
933 oocoutE(
nullptr, InputArguments)
934 <<
"Illegal term in counting model: "
935 <<
"the PDF " <<
a->GetName()
936 <<
" depends on the observables, but is not a Poisson, Gaussian or Product"
962 if (myobs !=
nullptr) {
963 oocoutF(
nullptr,Generation) <<
"AsymptoticCalculator::SetObsExpected( " << pdfName <<
" ) : Has two observables ?? " << endl;
967 if (myobs ==
nullptr) {
968 oocoutF(
nullptr,Generation) <<
"AsymptoticCalculator::SetObsExpected( " << pdfName <<
" ) : Observable is not a RooRealVar??" << endl;
972 if (!
a->isConstant() ) {
973 if (myexp !=
nullptr) {
974 oocoutE(
nullptr,Generation) <<
"AsymptoticCalculator::SetObsExpected( " << pdfName <<
" ) : Has two non-const arguments " << endl;
978 if (myexp ==
nullptr) {
979 oocoutF(
nullptr,Generation) <<
"AsymptoticCalculator::SetObsExpected( " << pdfName <<
" ) : Expected is not a RooAbsReal??" << endl;
985 if (myobs ==
nullptr) {
986 oocoutF(
nullptr,Generation) <<
"AsymptoticCalculator::SetObsExpected( " << pdfName <<
" ) : No observable?" << endl;
989 if (myexp ==
nullptr) {
990 oocoutF(
nullptr,Generation) <<
"AsymptoticCalculator::SetObsExpected( " << pdfName <<
" ) : No observable?" << endl;
997 std::cout <<
"SetObsToExpected : setting " << myobs->
GetName() <<
" to expected value " << myexp->
getVal() <<
" of " << myexp->
GetName() << std::endl;
1015 std::cout <<
"generate counting Asimov data for pdf of type " << pdf.
ClassName() << std::endl;
1018 if (prod !=
nullptr) {
1020 }
else if ((pois =
dynamic_cast<RooPoisson *
>(&pdf)) !=
nullptr) {
1024 }
else if ((gauss =
dynamic_cast<RooGaussian *
>(&pdf)) !=
nullptr) {
1027 oocoutE(
nullptr,InputArguments) <<
"A counting model pdf must be either a RooProdPdf or a RooPoisson or a RooGaussian" << endl;
1029 if (!
r)
return nullptr;
1036 std::string(
"CountingAsimovData") + std::to_string(icat), obs);
1059 obsAndWeight.
add(weightVar);
1064 asimovData =
new RooDataSet(std::string(
"AsimovData") + std::to_string(icat),
1065 std::string(
"combAsimovData") + std::to_string(icat),
1077 if (printLevel >= 2) {
1078 cout <<
"Generating Asimov data for pdf " << pdf.
GetName() << endl;
1079 cout <<
"list of observables " << endl;
1084 double binVolume = 1;
1086 FillBins(pdf, obsList, *asimovData, obsIndex, binVolume, nbins);
1087 if (printLevel >= 2)
1088 cout <<
"filled from " << pdf.
GetName() <<
" " << nbins <<
" nbins " <<
" volume is " << binVolume << endl;
1106 if (printLevel >= 1)
1108 asimovData->
Print();
1112 cout <<
"sum entries is nan"<<endl;
1115 asimovData =
nullptr;
1130 unique_ptr<RooRealVar> weightVar (
new RooRealVar(
"binWeightAsimov",
"binWeightAsimov", 1, 0, 1.E30 ));
1132 if (printLevel > 1) cout <<
" Generate Asimov data for observables"<<endl;
1140 std::map<std::string, RooDataSet*> asimovDataMap;
1144 int nrIndices = channelCat.
numTypes();
1145 if( nrIndices == 0 ) {
1146 oocoutW(
nullptr,Generation) <<
"Simultaneous pdf does not contain any categories." << endl;
1148 for (
int i=0;i<nrIndices;i++){
1153 assert(pdftmp !=
nullptr);
1163 if (!dataSinglePdf) {
1164 oocoutE(
nullptr,Generation) <<
"Error generating an Asimov data set for pdf " << pdftmp->
GetName() << endl;
1169 oocoutE(
nullptr,Generation) <<
"AsymptoticCalculator::GenerateAsimovData(): The PDF for " << channelCat.
getCurrentLabel()
1170 <<
" was already defined. It will be overridden. The faulty category definitions follow:" << endl;
1171 channelCat.
Print(
"V");
1179 dataSinglePdf->
Print();
1185 obsAndWeight.
add(*weightVar);
1191 for (
auto &element : asimovDataMap) {
1192 delete element.second;
1221 for (
auto *tmpPar : static_range_cast<RooRealVar *>(poi)) {
1222 tmpPar->setConstant();
1224 std::cout <<
"MakeAsimov: Setting poi " << tmpPar->
GetName() <<
" to a constant value = " << tmpPar->getVal() << std::endl;
1225 paramsSetConstant.
add(*tmpPar);
1229 bool hasFloatParams =
false;
1234 if (!constrainParams.
empty()) hasFloatParams =
true;
1239 for (
auto const *rrv : dynamic_range_cast<RooRealVar *>(*params)) {
1240 if ( rrv !=
nullptr && rrv->isConstant() == false ) { hasFloatParams =
true;
break; }
1243 if (hasFloatParams) {
1249 std::cout <<
"MakeAsimov: doing a conditional fit for finding best nuisance values " << std::endl;
1250 minimPrintLevel = verbose;
1252 std::cout <<
"POI values:\n"; poi.
Print(
"v");
1254 std::cout <<
"Nuis param values:\n";
1255 constrainParams.
Print(
"v");
1268 std::vector<RooCmdArg> args;
1280 for (
auto& arg : args) {
1284 if (verbose>0) { std::cout <<
"fit time "; tw2.
Print();}
1288 std::cout <<
"Nuisance parameters after fit for asimov dataset: " << std::endl;
1306 allParams->assign(*genPoiValues);
1332 if (!allParamValues.
empty()) {
1334 allVars->assign(allParamValues);
1342 std::cout <<
"Generated Asimov data for observables "; (model.
GetObservables() )->Print();
1345 std::cout <<
"--- Asimov data values \n";
1349 std::cout <<
"--- Asimov data numEntries = " << asimov->
numEntries() <<
" sumOfEntries = " << asimov->
sumEntries() << std::endl;
1351 std::cout <<
"\ttime for generating : "; tw.
Print();
1371 std::cout <<
"Generating Asimov data for global observables " << std::endl;
1385 oocoutW(
nullptr,Generation) <<
"AsymptoticCalculator::MakeAsimovData: model does not have nuisance parameters but has global observables"
1386 <<
" set global observables to model values " << endl;
1387 asimovGlobObs.
assign(gobs);
1393 if (nuispdf.get() ==
nullptr) {
1394 oocoutF(
nullptr,Generation) <<
"AsymptoticCalculator::MakeAsimovData: model has nuisance parameters and global obs but no nuisance pdf "
1405 pdfList.
add(*nuispdf.get());
1407 for (
auto *cterm : static_range_cast<RooAbsPdf *>(pdfList)) {
1409 "AsimovUtils: a factor of the nuisance pdf is not a Pdf!");
1411 if (!cterm->dependsOn(nuis))
continue;
1413 if (
typeid(*cterm) ==
typeid(
RooUniform))
continue;
1415 std::unique_ptr<RooArgSet> cpars(cterm->getParameters(&gobs));
1416 std::unique_ptr<RooArgSet> cgobs(cterm->getObservables(&gobs));
1417 if (cgobs->size() > 1) {
1418 oocoutE(
nullptr,Generation) <<
"AsymptoticCalculator::MakeAsimovData: constraint term " << cterm->GetName()
1419 <<
" has multiple global observables -cannot generate - skip it" << std::endl;
1422 else if (cgobs->empty()) {
1424 <<
"AsymptoticCalculator::MakeAsimovData: constraint term " << cterm->GetName()
1425 <<
" has no global observables - skip it" << std::endl;
1433 if (cpars->size() != 1) {
1435 <<
"AsymptoticCalculator::MakeAsimovData:constraint term "
1436 << cterm->GetName() <<
" has multiple floating params - cannot generate - skip it " << std::endl;
1440 bool foundServer =
false;
1444 if (verbose > 2) std::cout <<
"Constraint " << cterm->
GetName() <<
" of type " << cClass->
GetName() << std::endl;
1450 <<
"AsymptoticCalculator::MakeAsimovData:constraint term "
1451 << cterm->GetName() <<
" of type " << className
1452 <<
" is a non-supported type - result might be not correct " << std::endl;
1470 <<
"AsymptoticCalculator::MakeAsimovData:constraint term "
1471 << cterm->
GetName() <<
" has no direct dependence on global observable- cannot generate it " << std::endl;
1482 RooFIter itc(cterm->serverMIterator() );
1489 if (thetaGamma ==
nullptr) {
1491 <<
"AsymptoticCalculator::MakeAsimovData:constraint term "
1492 << cterm->
GetName() <<
" is a Gamma distribution and no server named theta is found. Assume that the Gamma scale is 1 " << std::endl;
1496 std::cout <<
"Gamma constraint has a scale " << thetaGamma->
GetName() <<
" = " << thetaGamma->
getVal() << std::endl;
1499 RooFIter iter2(cterm->serverMIterator() );
1502 if (verbose > 2) std::cout <<
"Loop on constraint server term " << a2->
GetName() << std::endl;
1508 oocoutE(
nullptr,Generation) <<
"AsymptoticCalculator::MakeAsimovData:constraint term "
1509 << cterm->GetName() <<
" constraint term has more server depending on nuisance- cannot generate it " <<
1511 foundServer =
false;
1514 if (thetaGamma && thetaGamma->
getVal() > 0)
1521 std::cout <<
"setting global observable "<< rrv.
GetName() <<
" to value " << rrv.
getVal()
1522 <<
" which comes from " << rrv2->
GetName() << std::endl;
1527 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;
1528 std::cerr <<
"Parameters: " << std::endl;
1530 std::cerr <<
"Observables: " << std::endl;
1544 gobs.
assign(snapGlobalObsData);
1547 std::cout <<
"Generated Asimov data for global observables ";
1548 if (verbose == 1) gobs.
Print();
1552 std::cout <<
"\nGlobal observables for data: " << std::endl;
1554 std::cout <<
"\nGlobal observables for asimov: " << std::endl;
1555 asimovGlobObs.
Print(
"V");
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
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
TRObject operator()(const T1 &t1) const
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.
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.
void Print(Option_t *options=nullptr) const override
Print the object to the defaultPrintStream().
bool dependsOn(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=nullptr, bool valueOnly=false) const
Test whether we depend on (ie, are served by) any object in the specified collection.
bool isConstant() const
Check if the "Constant" attribute is set.
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.
RooFIter serverMIterator() const
RooFit::OwningPtr< RooArgSet > getVariables(bool stripDisconnected=true) const
Return RooArgSet with all variables (tree leaf nodes of expression tree)
RooAbsArg * findServer(const char *name) const
Return server of this with name name. Returns nullptr if not found.
virtual const char * getCurrentLabel() const
Return label string of current state.
Int_t numTypes(const char *=nullptr) const
Return number of types defined (in range named rangeName if rangeName!=nullptr)
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.
Int_t getSize() const
Return the number of elements in the collection.
const char * GetName() const override
Returns name of object.
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
RooAbsArg * find(const char *name) const
Find object with given name in list.
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
void Print(Option_t *options=nullptr) const override
This method must be overridden when a class wants to print itself.
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.
virtual Int_t getBins(const char *name=nullptr) const
Get number of bins of currently defined range.
void setConstant(bool value=true)
virtual double getMax(const char *name=nullptr) const
Get maximum of currently defined range.
virtual double getMin(const char *name=nullptr) const
Get minimum of currently defined range.
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.
bool setIndex(Int_t index, bool printError=true) override
Set value by specifying the index code of the desired state.
value_type getCurrentIndex() const final
Return current index.
RooDataSet is a container class to hold unbinned data.
double sumEntries() const override
Return effective number of entries in dataset, i.e., sum all weights.
void add(const RooArgSet &row, double weight, double weightError)
Add one ore more rows of data.
A one-time forward iterator working on RooLinkedList or RooAbsCollection.
RooAbsArg * next()
Return next element or nullptr if at end.
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
virtual void Add(TObject *arg)
RooMinimizer is a wrapper class around ROOT::Fit:Fitter that provides a seamless interface between th...
void optimizeConst(int flag)
If flag is true, perform constant term optimization on function being minimized.
RooFit::OwningPtr< RooFitResult > save(const char *name=nullptr, const char *title=nullptr)
Save and return a RooFitResult snapshot of current minimizer status.
void setEvalErrorWall(bool flag)
void setEps(double eps)
Change MINUIT epsilon.
void setPrintLevel(int newLevel)
Change the MINUIT internal printing level.
int minimize(const char *type, const char *alg=nullptr)
Minimise the function passed in the constructor.
void setStrategy(int istrat)
Change MINUIT strategy to istrat.
static RooMsgService & instance()
Return reference to singleton instance.
void setGlobalKillBelow(RooFit::MsgLevel level)
RooFit::MsgLevel globalKillBelow() const
void setNoRounding(bool flag=true)
Switch off/on rounding of x to the nearest integer.
Efficient implementation of a product of PDFs of the form.
const RooArgList & pdfList() const
RooRealVar represents a variable that can be changed from the outside.
void setVal(double value) override
Set value of variable to 'value'.
void setBins(Int_t nBins, const char *name=nullptr)
Create a uniform binning under name 'name' for this variable.
Facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
RooAbsPdf * getPdf(RooStringView catName) const
Return the p.d.f associated with the given index category name.
const RooAbsCategoryLValue & indexCat() const
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)
std::unique_ptr< RooAbsReal > createNLL(RooAbsData &data, CmdArgs_t const &...cmdArgs) const
Wrapper around RooAbsPdf::createNLL(), where the pdf and some configuration options are retrieved fro...
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.
TClass * IsA() const override
const char * GetName() const override
Returns name of object.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
void Print(Option_t *option="") const override
Print the real and cpu time passed between the start and stop events.
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)