14#if !defined(R__ALPHA) && !defined(R__SOLARIS) && !defined(R__ACC) && !defined(R__FBSD)
31using std::endl, std::vector;
38 for (
auto const *obj : *
l) {
39 names.push_back(obj->GetName());
43 for(
const auto&
p:names){
77 double za2 = 2.*( (s+
b) * std::log(1. + s/
b) -s );
78 return std::sqrt(
za2);
84 if (
auto prod =
dynamic_cast<RooProdPdf *
>(&pdf)) {
86 for (
int i = 0,
n = list.size(); i <
n; ++i) {
99 for (
int ic = 0, nc = cat->
numBins((
const char *)
nullptr);
ic < nc; ++
ic) {
109 if (!constraints.
contains(pdf)) constraints.
add(pdf);
118 oocoutE(
nullptr,InputArguments) <<
"RooStatsUtils::FactorizePdf - invalid input model: missing observables" << std::endl;
130 if(constraints.
empty()) {
131 oocoutW(
nullptr, Eval) <<
"RooStatsUtils::MakeNuisancePdf - no constraints found on nuisance parameters in the input model" << std::endl;
140 oocoutE(
nullptr, InputArguments) <<
"RooStatsUtils::MakeNuisancePdf - invalid input model: missing pdf and/or observables" << std::endl;
148 if (
auto prod =
dynamic_cast<RooProdPdf *
>(&pdf)) {
152 for (
int i = 0,
n = list.size(); i <
n; ++i) {
161 }
else if (
newList.size() == 1) {
180 if(
newUPdf ==
nullptr)
return nullptr;
190 for (
int ic = 0, nc = cat->
numBins((
const char *)
nullptr);
ic < nc; ++
ic) {
196 if (
newPdf ==
nullptr) {
delete cat;
return nullptr; }
214 oocoutE(
nullptr, InputArguments) <<
"RooStats::MakeUnconstrainedPdf - invalid observable list passed (observables not found in original pdf) or invalid pdf passed (without observables)" << std::endl;
224 oocoutE(
nullptr, InputArguments) <<
"RooStatsUtils::MakeUnconstrainedPdf - invalid input model: missing pdf and/or observables" << std::endl;
239 for (
unsigned int i = 0; i < params.size(); i++)
245 for(std::map<TString, double>::iterator it =
fVarVals.begin();it!=
fVarVals.end();++it) {
247 if (
br)
br->ResetAddress();
254 for(std::map<TString, double>::iterator it =
fVarVals.begin();it!=
fVarVals.end();++it) {
260 for(std::map<TString, double>::iterator it =
fVarVals.begin();it!=
fVarVals.end();++it) {
268 if (
data.numEntries() == 0) {
275 V.push_back(rvar->GetName());
276 if (rvar->hasAsymError()) {
280 else if (rvar->hasError()) {
296 bs->fVarVals[rvar->GetName()] = rvar->getValV();
297 if (rvar->hasAsymError()) {
298 bs->fVarVals[
TString::Format(
"%s_errlo", rvar->GetName())] = rvar->getAsymErrorLo();
299 bs->fVarVals[
TString::Format(
"%s_errhi", rvar->GetName())] = rvar->getAsymErrorHi();
301 else if (rvar->hasError()) {
322 for (std::size_t i = 0; i<
l.size(); ++i) {
349 throw std::runtime_error(
"unable to retrieve ModelConfig");
355 std::vector<TString>
nplist;
360 pdf =
oldMC->GetPdf();
376 newWS->autoImportClassCode(
true);
391 for (
auto d :
oldWS->allData()) {
#define NamespaceImp(name)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
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 r
const_iterator begin() const
const_iterator end() const
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.
virtual TObject * clone(const char *newname=nullptr) const =0
const RefCountList_t & servers() const
List of all servers of this object.
Abstract base class for objects that represent a discrete value that can be set from the outside,...
Int_t numBins(const char *rangeName=nullptr) const override
Return the number of fit bins ( = number of types )
void setBin(Int_t ibin, const char *rangeName=nullptr) override
Set category to i-th fit bin, which is the i-th registered state.
virtual const char * getCurrentLabel() const
Return label string of current state.
bool contains(const RooAbsArg &var) const
Check if collection contains an argument with the same name as var.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Abstract interface for all probability density functions.
Abstract base class for objects that represent a real value and implements functionality common to al...
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Container class to hold unbinned data.
RooExtendPdf is a wrapper around an existing PDF that adds a parameteric extended likelihood term to ...
Efficient implementation of a product of PDFs of the form.
Variable that can be changed from the outside.
Facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
std::map< TString, double > fVarVals
void AssignToTTree(TTree &myTree)
BranchStore(const vector< TString > ¶ms=vector< TString >(), double _inval=-999.)
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
const RooArgSet * GetObservables() const
get RooArgSet for observables (return nullptr if not existing)
RooAbsPdf * GetPdf() const
get model PDF (return nullptr if pdf has not been specified or does not exist)
Persistable container for RooFit projects.
RooRealVar * var(RooStringView name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found.
A TTree is a list of TBranches.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
A TTree represents a columnar dataset.
virtual TBranch * GetBranch(const char *name)
Return pointer to the branch with the given name in this tree or its friends.
RooCmdArg RecycleConflictNodes(bool flag=true)
Namespace for the RooStats classes.
TTree * GetAsTTree(TString name, TString desc, const RooDataSet &data)
Create a TTree with the given name and description. All RooRealVars in the RooDataSet are represented...
void FillTree(TTree &myTree, const RooDataSet &data)
BranchStore * CreateBranchStore(const RooDataSet &data)
RooAbsPdf * StripConstraints(RooAbsPdf &pdf, const RooArgSet &observables)
RooAbsPdf * MakeNuisancePdf(RooAbsPdf &pdf, const RooArgSet &observables, const char *name)
extract constraint terms from pdf
void FactorizePdf(const RooArgSet &observables, RooAbsPdf &pdf, RooArgList &obsTerms, RooArgList &constraints)
RooStatsConfig & GetGlobalRooStatsConfig()
Retrieve the config object which can be used to set flags for things like offsetting the likelihood o...
double AsimovSignificance(double s, double b, double sigma_b=0.0)
Compute the Asimov Median significance for a Poisson process with s = expected number of signal event...
RooAbsPdf * MakeUnconstrainedPdf(RooAbsPdf &pdf, const RooArgSet &observables, const char *name=nullptr)
remove constraints from pdf and return the unconstrained pdf
RooWorkspace * MakeReducedWorkspace(RooWorkspace *oldWS, const char *newName, bool copySnapshots, const char *mcname, const char *newmcname, bool copyData=true)
function that clones a workspace, copying all needed components and discarding all others
void PrintListContent(const RooArgList &l, std::ostream &os=std::cout)
useful function to print in one line the content of a set with their values