72using std::cout, std::endl, std::string, std::unique_ptr;
97 fOneSided(false), fOneSidedDiscovery(false), fNominalAsimov(nominalAsimov),
99 fNLLObs(0), fNLLAsimov(0),
108 assert(nullSnapshot);
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"
165 if(nullSnapshot ==
nullptr || nullSnapshot->
empty()) {
166 oocoutE(
nullptr,InputArguments) <<
"AsymptoticCalculator::Initialize - Null model needs a snapshot. Set using modelconfig->SetSnapshot(poi)." << endl;
181 allParams->snapshot(nominalParams);
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;
202 if(altSnapshot ==
nullptr || altSnapshot->
empty()) {
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;
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;
241 nominalParams.
assign(poiAlt);
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;
279 globObs.
assign(globObsSnapshot);
282 if (prevBins > 0 && xobs) xobs->
setBins(prevBins);
308 std::unique_ptr<RooArgSet> attachedSet{nll->getVariables()};
313 if (poiSet && !poiSet->
empty()) {
319 paramsSetConstant.
add(*poiVar);
321 if (poiSet->
size() > 1)
322 std::cout <<
"Model with more than one POI are not supported - ignore extra parameters, consider only first one" << std::endl;
350 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 "
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;
607 oocoutP(
nullptr,Eval) <<
"\t ASIMOV data qmu_A = " << qmu_A <<
" condNLL = " << condNLL_A <<
" uncond " <<
fNLLAsimov << 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 "
655 globObs.
assign(globObsSnapshot);
667 bool useQTilde =
false;
675 assert(muAlt !=
nullptr );
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;
706 if (qmu < 0 && qmu > -tol) qmu = 0;
707 if (qmu_A < 0 && qmu_A > -tol) qmu_A = 0;
720 double sqrtqmu = (qmu > 0) ? std::sqrt(qmu) : 0;
721 double sqrtqmu_A = (qmu_A > 0) ? std::sqrt(qmu_A) : 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;
748 if ( qmu > qmu_A && (qmu_A > 0 || qmu > tol) ) {
749 if (verbose > 2)
oocoutI(
nullptr,Eval) <<
"Using qmu_tilde (qmu is greater than qmu_A)" << endl;
757 if ( qmu > qmu_A && (qmu_A > 0 || qmu > tol) ) {
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
776 <<
" sigma = " << muTest->
getVal() / sqrtqmu_A <<
" CLsplusb = " << pnull
777 <<
" CLb = " << palt <<
" CLs = " << res->
CLs() << std::endl;
786 fOffset(
offset), fPval(pval), fCase(icase) {}
803 if (!useCls)
return clsplusb;
805 return (clb == 0) ? -1 : clsplusb / clb;
820 bool ret = brf.
Solve();
822 oocoutE(
nullptr,Eval) <<
"Error finding expected p-values - return -1" << std::endl;
825 double sqrttmu_A = brf.
Root();
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) {
865 double prevBinVolume = binVolume;
866 binVolume *=
v->getBinWidth(i);
869 binVolume = prevBinVolume;
874 double totBinVolume = binVolume *
v->getBinWidth(i);
875 double fval = pdf.
getVal(&obstmp)*totBinVolume;
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;
893 data.add(obs, fval*expectedEvents);
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;
926 if ((pois =
dynamic_cast<RooPoisson *
>(
a)) !=
nullptr) {
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) {
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);
1061 obsAndWeight.
add(weightVar);
1066 asimovData =
new RooDataSet(std::string(
"AsimovData") + std::to_string(icat),
1067 std::string(
"combAsimovData") + std::to_string(icat),
1079 if (printLevel >= 2) {
1080 cout <<
"Generating Asimov data for pdf " << pdf.
GetName() << endl;
1081 cout <<
"list of observables " << endl;
1086 double binVolume = 1;
1088 FillBins(pdf, obsList, *asimovData, obsIndex, binVolume, nbins);
1089 if (printLevel >= 2)
1090 cout <<
"filled from " << pdf.
GetName() <<
" " << nbins <<
" nbins " <<
" volume is " << binVolume << endl;
1108 if (printLevel >= 1)
1110 asimovData->
Print();
1114 cout <<
"sum entries is nan"<<endl;
1117 asimovData =
nullptr;
1132 unique_ptr<RooRealVar> weightVar (
new RooRealVar(
"binWeightAsimov",
"binWeightAsimov", 1, 0, 1.E30 ));
1134 if (printLevel > 1) cout <<
" Generate Asimov data for observables"<<endl;
1142 std::map<std::string, RooDataSet*> asimovDataMap;
1146 int nrIndices = channelCat.
numTypes();
1147 if( nrIndices == 0 ) {
1148 oocoutW(
nullptr,Generation) <<
"Simultaneous pdf does not contain any categories." << endl;
1150 for (
int i=0;i<nrIndices;i++){
1155 assert(pdftmp !=
nullptr);
1165 if (!dataSinglePdf) {
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;
1173 channelCat.
Print(
"V");
1181 dataSinglePdf->
Print();
1187 obsAndWeight.
add(*weightVar);
1193 for (
auto &element : asimovDataMap) {
1194 delete element.second;
1223 for (
auto *tmpPar : static_range_cast<RooRealVar *>(poi)) {
1224 tmpPar->setConstant();
1226 std::cout <<
"MakeAsimov: Setting poi " << tmpPar->
GetName() <<
" to a constant value = " << tmpPar->getVal() << std::endl;
1227 paramsSetConstant.
add(*tmpPar);
1231 bool hasFloatParams =
false;
1236 if (!constrainParams.
empty()) hasFloatParams =
true;
1241 for (
auto const *rrv : dynamic_range_cast<RooRealVar *>(*params)) {
1242 if ( rrv !=
nullptr && rrv->isConstant() == false ) { hasFloatParams =
true;
break; }
1245 if (hasFloatParams) {
1251 std::cout <<
"MakeAsimov: doing a conditional fit for finding best nuisance values " << std::endl;
1252 minimPrintLevel = verbose;
1254 std::cout <<
"POI values:\n"; poi.
Print(
"v");
1256 std::cout <<
"Nuis param values:\n";
1257 constrainParams.
Print(
"v");
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;
1308 allParams->assign(*genPoiValues);
1334 if (!allParamValues.
empty()) {
1336 allVars->assign(allParamValues);
1344 std::cout <<
"Generated Asimov data for observables "; (model.
GetObservables() )->
Print();
1347 std::cout <<
"--- Asimov data values \n";
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;
1389 asimovGlobObs.
assign(gobs);
1395 if (nuispdf ==
nullptr) {
1396 oocoutF(
nullptr, Generation) <<
"AsymptoticCalculator::MakeAsimovData: model has nuisance parameters and "
1397 "global obs but no nuisance pdf "
1407 pdfList.
add(*nuispdf);
1410 for (
auto *cterm : static_range_cast<RooAbsPdf *>(pdfList)) {
1412 "AsimovUtils: a factor of the nuisance pdf is not a Pdf!");
1414 if (!cterm->dependsOn(nuis))
continue;
1416 if (
typeid(*cterm) ==
typeid(
RooUniform))
continue;
1418 std::unique_ptr<RooArgSet> cpars(cterm->getParameters(&gobs));
1419 std::unique_ptr<RooArgSet> cgobs(cterm->getObservables(&gobs));
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;
1443 bool foundServer =
false;
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;
1473 <<
"AsymptoticCalculator::MakeAsimovData:constraint term "
1474 << cterm->
GetName() <<
" has no direct dependence on global observable- cannot generate it " << std::endl;
1485 for (
RooAbsArg *a2 : cterm->servers()) {
1491 if (thetaGamma ==
nullptr) {
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;
1501 for (
RooAbsArg *a2 : cterm->servers()) {
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 " <<
1512 foundServer =
false;
1515 if (thetaGamma && thetaGamma->
getVal() > 0) {
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;
1547 gobs.
assign(snapGlobalObsData);
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;
1558 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
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.
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.
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)
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.
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.
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.
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...
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
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)