76int AsymptoticCalculator::fgPrintLevel = 1;
85void AsymptoticCalculator::SetPrintLevel(
int level) {
97 fOneSided(false), fOneSidedDiscovery(false), fNominalAsimov(nominalAsimov),
99 fNLLObs(0), fNLLAsimov(0),
108 assert(nullSnapshot);
114 oocoutI((
TObject*)0,
InputArguments) <<
"AsymptotiCalculator: Minimum of POI is " << muNull->
getMin() <<
" corresponds to null snapshot - default configuration is one-sided discovery formulae " << std::endl;
152 if (!poi || poi->
getSize() == 0) {
158 <<
"The asymptotic calculator works for only one POI - consider as POI only the first parameter"
165 if(nullSnapshot == NULL || nullSnapshot->
getSize() == 0) {
166 oocoutE((
TObject*)0,
InputArguments) <<
"AsymptoticCalculator::Initialize - Null model needs a snapshot. Set using modelconfig->SetSnapshot(poi)." << endl;
189 oocoutP((
TObject*)0,
Eval) <<
"AsymptoticCalculator::Initialize - Find best unconditional NLL on observed data" << endl;
203 if(altSnapshot == NULL || altSnapshot->
getSize() == 0) {
210 oocoutP((
TObject*)0,
Eval) <<
"AsymptoticCalculator: Building Asimov data Set" << endl;
224 <<
" set the same data bins " <<
data.numEntries() <<
" in range "
225 <<
" [ " << xobs->
getMin() <<
" , " << xobs->
getMax() <<
" ]" << std::endl;
233 oocoutI((
TObject*)0,
InputArguments) <<
"AsymptoticCalculator: Asimov data will be generated using fitted nuisance parameter values" << endl;
241 oocoutI((
TObject*)0,
InputArguments) <<
"AsymptoticCalculator: Asimovdata set will be generated using nominal (current) nuisance parameter values" << endl;
242 nominalParams = poiAlt;
269 oocoutP((
TObject*)0,
Eval) <<
"AsymptoticCalculator::Initialize Find best conditional NLL on ASIMOV data set for given alt POI ( " <<
278 globObs = globObsSnapshot;
281 if (prevBins > 0 && xobs) xobs->
setBins(prevBins);
302 if (condObs) conditionalObs.
add(*condObs);
304 if (globObs) globalObs.
add(*globObs);
314 if (poiSet && poiSet->
getSize() > 0) {
320 paramsSetConstant.
add(*poiVar);
323 std::cout <<
"Model with more than one POI are not supported - ignore extra parameters, consider only first one" << std::endl;
352 bool skipFit = (nllParams.
getSize() == 0);
359 int minimPrintLevel = verbose;
366 tol = std::max(tol,1.0);
376 std::cout <<
"AsymptoticCalculator::EvaluateNLL ........ using " << minimizer <<
" / " << algorithm
377 <<
" with strategy " << strategy <<
" and tolerance " << tol << std::endl;
380 for (
int tries = 1, maxtries = 4; tries <= maxtries; ++tries) {
382 status = minim.
minimize(minimizer, algorithm);
388 printf(
" ----> Doing a re-scan first\n");
393 printf(
" ----> trying with strategy = 1\n");
400 printf(
" ----> trying with improve\n");
401 minimizer =
"Minuit";
402 algorithm =
"migradimproved";
411 result = minim.
save();
430 if (result)
delete result;
437 std::cout <<
"AsymptoticCalculator::EvaluateNLL - value = " << val;
440 std::cout <<
" for poi fixed at = " << muTest;
443 std::cout <<
"\tfit time : ";
447 std::cout << std::endl;
477 oocoutE((
TObject*)0,
InputArguments) <<
"AsymptoticCalculator::GetHypoTest - Error initializing Asymptotic calculator - return NULL result " << endl;
483 oocoutE((
TObject*)0,
InputArguments) <<
"AsymptoticCalculator::GetHypoTest - Asimov data set has not been generated - return NULL result " << endl;
496 assert(nullSnapshot && nullSnapshot->
getSize() > 0);
503 oocoutW((
TObject*)0,
InputArguments) <<
"AsymptoticCalculator::GetHypoTest: snapshot has more than one POI - assume as POI first parameter " << std::endl;
513 assert(muHat &&
"no best fit parameter defined");
515 assert(muTest &&
"poi snapshot is not existing");
520 std::cout << std::endl;
521 oocoutI((
TObject*)0,
Eval) <<
"AsymptoticCalculator::GetHypoTest: - perform an hypothesis test for POI ( " << muTest->
GetName() <<
" ) = " << muTest->
getVal() << std::endl;
522 oocoutP((
TObject*)0,
Eval) <<
"AsymptoticCalculator::GetHypoTest - Find best conditional NLL on OBSERVED data set ..... " << std::endl;
528 double qmu = 2.*(condNLL -
fNLLObs);
533 oocoutP((
TObject*)0,
Eval) <<
"\t OBSERVED DATA : qmu = " << qmu <<
" condNLL = " << condNLL <<
" uncond " <<
fNLLObs << std::endl;
541 oocoutW((
TObject*)0,
Minimization) <<
"AsymptoticCalculator: Found a negative value of the qmu - retry to do the unconditional fit "
552 <<
" old NLL = " <<
fNLLObs <<
" old muHat " << muHat->
getVal() << std::endl;
565 <<
" NLL = " <<
fNLLObs <<
" muHat " << muHat->
getVal() << std::endl;
571 oocoutP((
TObject*)0,
Eval) <<
"After unconditional refit, new qmu value is " << qmu << std::endl;
578 << muTest->
getVal() <<
" return a dummy result "
584 << muTest->
getVal() <<
" return a dummy result "
608 if (verbose > 0)
oocoutP((
TObject*)0,
Eval) <<
"AsymptoticCalculator::GetHypoTest -- Find best conditional NLL on ASIMOV data set .... " << std::endl;
621 oocoutW((
TObject*)0,
Minimization) <<
"AsymptoticCalculator: Found a negative value of the qmu Asimov- retry to do the unconditional fit "
624 oocoutW((
TObject*)0,
Minimization) <<
"AsymptoticCalculator: Fit failed for unconditional the qmu Asimov- retry unconditional fit "
642 oocoutP((
TObject*)0,
Eval) <<
"After unconditional Asimov refit, new qmu_A value is " << qmu_A << std::endl;
649 << muTest->
getVal() <<
" return a dummy result "
655 << muTest->
getVal() <<
" return a dummy result "
662 globObs = globObsSnapshot;
674 bool useQTilde =
false;
689 <<
" - using standard q asymptotic formulae " << std::endl;
700 <<
" muTest = " << muTest->
getVal() << std::endl;
707 <<
" muTest = " << muTest->
getVal() << std::endl;
713 if (qmu < 0 && qmu > -tol) qmu = 0;
714 if (qmu_A < 0 && qmu_A > -tol) qmu_A = 0;
721 double pnull = -1, palt = -1;
726 double sqrtqmu = (qmu > 0) ?
std::sqrt(qmu) : 0;
727 double sqrtqmu_A = (qmu_A > 0) ?
std::sqrt(qmu_A) : 0;
734 oocoutI((
TObject*)0,
Eval) <<
"Using one-sided limit asymptotic formula (qmu)" << endl;
736 oocoutI((
TObject*)0,
Eval) <<
"Using one-sided discovery asymptotic formula (q0)" << endl;
743 if (verbose > 2)
oocoutI((
TObject*)0,
Eval) <<
"Using two-sided asymptotic formula (tmu)" << endl;
753 if ( qmu > qmu_A && (qmu_A > 0 || qmu > tol) ) {
754 if (verbose > 2)
oocoutI((
TObject*)0,
Eval) <<
"Using qmu_tilde (qmu is greater than qmu_A)" << endl;
762 if ( qmu > qmu_A && (qmu_A > 0 || qmu > tol) ) {
763 if (verbose > 2)
oocoutI((
TObject*)0,
Eval) <<
"Using tmu_tilde (qmu is greater than qmu_A)" << endl;
775 string resultname =
"HypoTestAsymptotic_result";
781 <<
"poi = " << muTest->
getVal() <<
" qmu = " << qmu <<
" qmu_A = " << qmu_A
782 <<
" sigma = " << muTest->
getVal()/sqrtqmu_A
783 <<
" CLsplusb = " << pnull <<
" CLb = " << palt <<
" CLs = " << res->
CLs() << std::endl;
790 PaltFunction(
double offset,
double pval,
int icase) :
791 fOffset(offset), fPval(pval), fCase(icase) {}
808 if (!useCls)
return clsplusb;
810 return (clb == 0) ? -1 : clsplusb / clb;
821 PaltFunction
f( sqrttmu, palt, -1);
825 bool ret = brf.
Solve();
827 oocoutE((
TObject*)0,
Eval) <<
"Error finding expected p-values - return -1" << std::endl;
830 double sqrttmu_A = brf.
Root();
838 oocoutE((
TObject*)0,
Eval) <<
"Error finding expected p-values - return -1" << std::endl;
865 if (debug) cout <<
"looping on observable " <<
v->GetName() << endl;
866 for (
int i = 0; i <
v->getBins(); ++i) {
868 if (index < obs.
getSize() -1) {
870 double prevBinVolume = binVolume;
871 binVolume *=
v->getBinWidth(i);
874 binVolume = prevBinVolume;
879 double totBinVolume = binVolume *
v->getBinWidth(i);
880 double fval = pdf.
getVal(&obstmp)*totBinVolume;
883 if (fval*expectedEvents <= 0)
885 if (fval*expectedEvents < 0)
886 cout <<
"WARNING::Detected a bin with negative expected events! Please check your inputs." << endl;
888 cout <<
"WARNING::Detected a bin with zero expected events- skip it" << endl;
892 data.add(obs, fval*expectedEvents);
895 cout <<
"bin " << ibin <<
"\t";
896 for (
int j=0; j < obs.
getSize(); ++j) { cout <<
" " << ((
RooRealVar&) obs[j]).getVal(); }
897 cout <<
" w = " << fval*expectedEvents;
908 cout <<
"ending loop on .. " <<
v->GetName() << endl;
922 if (!
a->dependsOn(obs))
continue;
928 }
else if ((gaus =
dynamic_cast<RooGaussian *
>(
a)) != 0) {
937 <<
"the PDF " <<
a->GetName()
938 <<
" depends on the observables, but is not a Poisson, Gaussian or Product"
960 const char * pdfName = pdf.IsA()->
GetName();
965 oocoutF((
TObject*)0,
Generation) <<
"AsymptoticCalculator::SetObsExpected( " << pdfName <<
" ) : Has two observables ?? " << endl;
970 oocoutF((
TObject*)0,
Generation) <<
"AsymptoticCalculator::SetObsExpected( " << pdfName <<
" ) : Observable is not a RooRealVar??" << endl;
974 if (!
a->isConstant() ) {
976 oocoutE((
TObject*)0,
Generation) <<
"AsymptoticCalculator::SetObsExpected( " << pdfName <<
" ) : Has two non-const arguments " << endl;
981 oocoutF((
TObject*)0,
Generation) <<
"AsymptoticCalculator::SetObsExpected( " << pdfName <<
" ) : Expected is not a RooAbsReal??" << endl;
988 oocoutF((
TObject*)0,
Generation) <<
"AsymptoticCalculator::SetObsExpected( " << pdfName <<
" ) : No observable?" << endl;
992 oocoutF((
TObject*)0,
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.IsA()->
GetName() << std::endl;
1022 }
else if ((pois =
dynamic_cast<RooPoisson *
>(&pdf)) != 0) {
1026 }
else if ((gaus =
dynamic_cast<RooGaussian *
>(&pdf)) != 0) {
1060 obsAndWeight.
add(weightVar);
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;
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 ) {
1148 for (
int i=0;i<nrIndices;i++){
1153 assert(pdftmp != 0);
1157 cout <<
"on type " << channelCat.
getLabel() <<
" " << channelCat.
getIndex() << endl;
1163 if (!dataSinglePdf) {
1168 if (asimovDataMap.count(
string(channelCat.
getLabel())) != 0) {
1170 <<
" was already defined. It will be overridden. The faulty category definitions follow:" << endl;
1171 channelCat.
Print(
"V");
1178 cout <<
"channel: " << channelCat.
getLabel() <<
", data: ";
1179 dataSinglePdf->
Print();
1185 obsAndWeight.
add(*weightVar);
1191 for (
auto element : asimovDataMap) {
1192 delete element.second;
1220 std::cout <<
"MakeAsimov: Setting poi " << tmpPar->
GetName() <<
" to a constant value = " << tmpPar->
getVal() << std::endl;
1221 paramsSetConstant.
add(*tmpPar);
1225 bool hasFloatParams =
false;
1227 if (
model.GetNuisanceParameters()) {
1228 constrainParams.
add(*
model.GetNuisanceParameters());
1230 if (constrainParams.
getSize() > 0) hasFloatParams =
true;
1234 std::unique_ptr<RooArgSet> params(
model.GetPdf()->getParameters(realData));
1238 if ( rrv != 0 && rrv->
isConstant() == false ) { hasFloatParams =
true;
break; }
1241 if (hasFloatParams) {
1247 std::cout <<
"MakeAsimov: doing a conditional fit for finding best nuisance values " << std::endl;
1248 minimPrintLevel = verbose;
1250 std::cout <<
"POI values:\n"; poi.
Print(
"v");
1252 std::cout <<
"Nuis param values:\n";
1253 constrainParams.
Print(
"v");
1261 if (
model.GetConditionalObservables()) conditionalObs.
add(*
model.GetConditionalObservables());
1263 if (
model.GetGlobalObservables()) globalObs.
add(*
model.GetGlobalObservables());
1272 if (verbose>0) { std::cout <<
"fit time "; tw2.
Print();}
1275 if (
model.GetNuisanceParameters() ) {
1276 std::cout <<
"Nuisance parameters after fit for asimov dataset: " << std::endl;
1277 model.GetNuisanceParameters()->Print(
"V");
1293 if (genPoiValues) *allParams = *genPoiValues;
1319 if (allParamValues.
getSize() > 0) {
1321 *allVars = allParamValues;
1330 std::cout <<
"Generated Asimov data for observables "; (
model.GetObservables() )->
Print();
1333 std::cout <<
"--- Asimov data values \n";
1337 std::cout <<
"--- Asimov data numEntries = " << asimov->
numEntries() <<
" sumOfEntries = " << asimov->
sumEntries() << std::endl;
1339 std::cout <<
"\ttime for generating : "; tw.
Print();
1356 if (
model.GetGlobalObservables() &&
model.GetGlobalObservables()->getSize() > 0) {
1359 std::cout <<
"Generating Asimov data for global observables " << std::endl;
1371 if (
model.GetNuisanceParameters()) nuis.
add(*
model.GetNuisanceParameters());
1373 oocoutW((
TObject*)0,
Generation) <<
"AsymptoticCalculator::MakeAsimovData: model does not have nuisance parameters but has global observables"
1374 <<
" set global observables to model values " << endl;
1375 asimovGlobObs = gobs;
1381 if (nuispdf.get() == 0) {
1382 oocoutF((
TObject*)0,
Generation) <<
"AsymptoticCalculator::MakeAsimovData: model has nuisance parameters and global obs but no nuisance pdf "
1393 pdfList.
add(*nuispdf.get());
1398 assert(cterm &&
"AsimovUtils: a factor of the nuisance pdf is not a Pdf!");
1401 if (
typeid(*cterm) ==
typeid(
RooUniform))
continue;
1403 std::unique_ptr<RooArgSet> cpars(cterm->
getParameters(&gobs));
1405 if (cgobs->getSize() > 1) {
1407 <<
" has multiple global observables -cannot generate - skip it" << std::endl;
1410 else if (cgobs->getSize() == 0) {
1412 <<
" has no global observables - skip it" << std::endl;
1420 if (cpars->getSize() != 1) {
1422 << cterm->
GetName() <<
" has multiple floating params - cannot generate - skip it " << std::endl;
1426 bool foundServer =
false;
1429 TClass * cClass = cterm->IsA();
1430 if (verbose > 2) std::cout <<
"Constraint " << cterm->
GetName() <<
" of type " << cClass->
GetName() << std::endl;
1434 TString className = (cClass) ? cClass->
GetName() :
"undefined";
1436 << cterm->
GetName() <<
" of type " << className
1437 <<
" is a non-supported type - result might be not correct " << std::endl;
1455 << cterm->
GetName() <<
" has no direct dependence on global observable- cannot generate it " << std::endl;
1468 if (TString(a2->GetName()).Contains(
"theta") ) {
1473 if (thetaGamma == 0) {
1475 << cterm->
GetName() <<
" is a Gamma distribution and no server named theta is found. Assume that the Gamma scale is 1 " << std::endl;
1479 std::cout <<
"Gamma constraint has a scale " << thetaGamma->
GetName() <<
" = " << thetaGamma->
getVal() << std::endl;
1485 if (verbose > 2) std::cout <<
"Loop on constraint server term " << a2->
GetName() << std::endl;
1492 << cterm->
GetName() <<
" constraint term has more server depending on nuisance- cannot generate it " <<
1494 foundServer =
false;
1497 if (thetaGamma && thetaGamma->
getVal() > 0)
1504 std::cout <<
"setting global observable "<< rrv.
GetName() <<
" to value " << rrv.
getVal()
1505 <<
" which comes from " << rrv2->
GetName() << std::endl;
1510 oocoutE((
TObject*)0,
Generation) <<
"AsymptoticCalculator::MakeAsimovData - can't find nuisance for constraint term - global observables will not be set to Asimov value " << cterm->
GetName() << std::endl;
1511 std::cerr <<
"Parameters: " << std::endl;
1513 std::cerr <<
"Observables: " << std::endl;
1527 gobs = snapGlobalObsData;
1530 std::cout <<
"Generated Asimov data for global observables ";
1531 if (verbose == 1) gobs.
Print();
1535 std::cout <<
"\nGlobal observables for data: " << std::endl;
1537 std::cout <<
"\nGlobal observables for asimov: " << std::endl;
1538 asimovGlobObs.
Print(
"V");
TRObject operator()(const T1 &t1) const
Class for finding the root of a one dimensional function using the Brent algorithm.
double Root() const
Returns root value.
bool Solve(int maxIter=100, double absTol=1E-8, double relTol=1E-10)
Returns the X value corresponding to the function value fy for (xmin<x<xmax).
bool SetFunction(const ROOT::Math::IGenFunction &f, double xlow, double xup)
Sets the function for the rest of the algorithms.
static int DefaultPrintLevel()
static double DefaultTolerance()
static const std::string & DefaultMinimizerType()
static const std::string & DefaultMinimizerAlgo()
static int DefaultStrategy()
Template class to wrap any C++ callable object which takes one argument i.e.
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
Bool_t dependsOn(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=0, Bool_t valueOnly=kFALSE) const
Test whether we depend on (ie, are served by) any object in the specified collection.
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
RooArgSet * getParameters(const RooAbsData *data, Bool_t stripDisconnected=kTRUE) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
RooFIter serverMIterator() const
RooArgSet * getVariables(Bool_t stripDisconnected=kTRUE) const
Return RooArgSet with all variables (tree leaf nodes of expresssion tree)
Bool_t isConstant() const
RooAbsArg * findServer(const char *name) const
Int_t numTypes(const char *=0) const
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
Bool_t contains(const RooAbsArg &var) const
RooAbsCollection * snapshot(Bool_t deepCopy=kTRUE) const
Take a snap shot of current collection contents: An owning collection is returned containing clones o...
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
RooAbsArg * first() const
virtual void Print(Option_t *options=0) const
This method must be overridden when a class wants to print itself.
RooLinkedListIter iterator(Bool_t dir=kIterForward) const
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooAbsData is the common abstract base class for binned and unbinned datasets.
virtual const RooArgSet * get() const
virtual Double_t sumEntries() const =0
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
virtual Int_t numEntries() const
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
virtual RooAbsReal * createNLL(RooAbsData &data, const RooLinkedList &cmdList)
Construct representation of -log(L) of PDFwith given dataset.
Bool_t canBeExtended() const
virtual Double_t expectedEvents(const RooArgSet *nset) const
Return expected number of events from this p.d.f for use in extended likelihood calculations.
virtual Double_t getMax(const char *name=0) const
virtual Int_t getBins(const char *name=0) const
void setConstant(Bool_t value=kTRUE)
virtual Double_t getMin(const char *name=0) const
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
static void setHideOffset(Bool_t flag)
static Bool_t hideOffset()
Double_t getVal(const RooArgSet *set=0) const
Evaluate object. Returns either cached value or triggers a recalculation.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
RooCategory represents a fundamental (non-derived) discrete value object.
virtual const char * getLabel() const
Return label string of current state.
virtual Int_t getIndex() const
Return index number of current state.
virtual Bool_t setIndex(Int_t index, Bool_t printError=kTRUE)
Set value by specifying the index code of the desired state.
RooDataSet is a container class to hold unbinned data.
virtual Double_t sumEntries() const
virtual void add(const RooArgSet &row, Double_t weight=1.0, Double_t weightError=0)
Add a data point, with its coordinates specified in the 'data' argset, to the data set.
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
RooLinkedListIter is the TIterator implementation for RooLinkedList.
RooMinimizer is a wrapper class around ROOT::Fit:Fitter that provides a seamless interface between th...
RooFitResult * save(const char *name=0, const char *title=0)
Save and return a RooFitResult snaphot of current minimizer status.
Int_t minimize(const char *type, const char *alg=0)
void setEps(Double_t eps)
Change MINUIT epsilon.
Int_t setPrintLevel(Int_t newLevel)
Change the MINUIT internal printing level.
void optimizeConst(Int_t flag)
If flag is true, perform constant term optimization on function being minimized.
void setStrategy(Int_t strat)
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=kTRUE)
RooProdPdf is an efficient implementation of a product of PDFs of the form.
const RooArgList & pdfList() const
RooRealVar represents a fundamental (non-derived) real valued object.
void setBins(Int_t nBins, const char *name=0)
Double_t getError() const
virtual void setVal(Double_t value)
Set value of variable to 'value'.
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
const RooAbsCategoryLValue & indexCat() const
RooAbsPdf * getPdf(const char *catName) const
Return the p.d.f associated with the given index category name.
Hypothesis Test Calculator based on the asymptotic formulae for the profile likelihood ratio.
static RooAbsData * GenerateAsimovDataSinglePdf(const RooAbsPdf &pdf, const RooArgSet &obs, const RooRealVar &weightVar, RooCategory *channelCat=0)
compute the asimov data set for an observable of a pdf use the number of bins sets in the observables...
virtual HypoTestResult * GetHypoTest() const
re-implement HypoTest computation using the asymptotic
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 RooAbsData * MakeAsimovData(RooAbsData &data, const ModelConfig &model, const RooArgSet &poiValues, RooArgSet &globObs, const RooArgSet *genPoiValues=0)
make the asimov data from the ModelConfig and list of poi - return data set and snapshot of global ob...
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 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...
static RooAbsData * GenerateCountingAsimovData(RooAbsPdf &pdf, const RooArgSet &obs, const RooRealVar &weightVar, RooCategory *channelCat=0)
generate counting Asimov data for the case when the pdf cannot be extended assume pdf is a RooPoisson...
int fUseQTilde
flag to check if calculator is initialized
AsymptoticCalculator(RooAbsData &data, const ModelConfig &altModel, const ModelConfig &nullModel, bool nominalAsimov=false)
constructor for asymptotic calculator from Data set and ModelConfig
static void FillBins(const RooAbsPdf &pdf, const RooArgList &obs, RooAbsData &data, int &index, double &binVolume, int &ibin)
fill bins by looping recursively on observables
static double EvaluateNLL(RooAbsPdf &pdf, RooAbsData &data, const RooArgSet *condObs, const RooArgSet *globObs, const RooArgSet *poiSet=0)
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_t 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 * GetParametersOfInterest() const
get RooArgSet containing the parameter of interest (return NULL if not existing)
const RooArgSet * GetObservables() const
get RooArgSet for observables (return NULL if not existing)
const RooArgSet * GetSnapshot() const
get RooArgSet for parameters for a particular hypothesis (return NULL if not existing)
RooAbsPdf * GetPdf() const
get model PDF (return NULL if pdf has not been specified or does not exist)
The ROOT global object gROOT contains a list of all defined classes.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
void Print(Option_t *option="") const
Print the real and cpu time passed between the start and stop events.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
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...
void Print(std::ostream &os, const OptionType &opt)
RooCmdArg WeightVar(const char *name, Bool_t reinterpretAsWeight=kFALSE)
RooCmdArg Constrain(const RooArgSet ¶ms)
RooCmdArg Strategy(Int_t code)
RooCmdArg Index(RooCategory &icat)
RooCmdArg GlobalObservables(const RooArgSet &globs)
RooCmdArg Hesse(Bool_t flag=kTRUE)
RooCmdArg CloneData(Bool_t flag)
RooCmdArg PrintLevel(Int_t code)
RooCmdArg Import(const char *state, TH1 &histo)
RooCmdArg ConditionalObservables(const RooArgSet &set)
RooCmdArg Offset(Bool_t flag=kTRUE)
RooCmdArg Minimizer(const char *type, const char *alg=0)
@(#)root/roostats:$Id$ Author: George Lewis, Kyle Cranmer
bool SetAllConstant(const RooAbsCollection &coll, bool constant=true)
void RemoveConstantParameters(RooArgSet *set)
RooAbsPdf * MakeNuisancePdf(RooAbsPdf &pdf, const RooArgSet &observables, const char *name)
Double_t QuietNaN()
Returns a quiet NaN as defined by IEEE 754