Logo ROOT  
Reference Guide
RooStatsUtils.cxx
Go to the documentation of this file.
1// @(#)root/roostats:$Id$
2// Author: Kyle Cranmer 28/07/2008
3
4/*************************************************************************
5 * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "Rtypes.h"
13
14#if !defined(R__ALPHA) && !defined(R__SOLARIS) && !defined(R__ACC) && !defined(R__FBSD)
16#endif
17
18#include "TTree.h"
19#include "TBranch.h"
20
21#include "RooArgSet.h"
22#include "RooWorkspace.h"
23#include "RooAbsPdf.h"
24#include "RooUniform.h"
25#include "RooProdPdf.h"
26#include "RooExtendPdf.h"
27#include "RooSimultaneous.h"
30
31using namespace std;
32
33
34namespace {
35 template<class listT, class stringT> void getParameterNames(const listT* l,std::vector<stringT>& names){
36 // extract the parameter names from a list
37 if(!l) return;
38 RooAbsArg* obj;
39 RooFIter itr(l->fwdIterator());
40 while((obj = itr.next())){
41 names.push_back(obj->GetName());
42 }
43 }
44 void getArgs(RooWorkspace* ws, const std::vector<TString> names, RooArgSet& args){
45 for(const auto& p:names){
46 RooRealVar* v = ws->var(p.Data());
47 if(v){
48 args.add(*v);
49 }
50 }
51 }
52 }
53
54namespace RooStats {
55
57 static RooStatsConfig theConfig;
58 return theConfig;
59 }
60
62 // Asimov significance
63 // formula [10] and [20] from https://www.pp.rhul.ac.uk/~cowan/stat/notes/medsigNote.pdf
64 // case we have a sigma_b
65 double sb2 = sigma_b*sigma_b;
66 // formula below has a large error when sigma_b becomes zero
67 // better to use the approximation for sigma_b=0 for very small values
68 double r = sb2/b;
69 if (r > 1.E-12) {
70 double bpsb2 = b + sb2;
71 double b2 = b*b;
72 double spb = s+b;
73 double za2 = 2.*( (spb)* std::log( ( spb)*(bpsb2)/(b2+ spb*sb2) ) -
74 (b2/sb2) * std::log(1. + ( sb2 * s)/(b * bpsb2) ) );
75 return sqrt(za2);
76
77 }
78 // case when the background (b) is known
79 double za2 = 2.*( (s+b) * std::log(1. + s/b) -s );
80 return std::sqrt(za2);
81 }
82
83 /// Use an offset in NLL calculations.
84 void UseNLLOffset(bool on) {
86 }
87
88 /// Test of RooStats should by default offset NLL calculations.
89 bool IsNLLOffset() {
91 }
92
93 void FactorizePdf(const RooArgSet &observables, RooAbsPdf &pdf, RooArgList &obsTerms, RooArgList &constraints) {
94 // utility function to factorize constraint terms from a pdf
95 // (from G. Petrucciani)
96 if (auto prod = dynamic_cast<RooProdPdf *>(&pdf)) {
97 RooArgList list(prod->pdfList());
98 for (int i = 0, n = list.getSize(); i < n; ++i) {
99 RooAbsPdf *pdfi = (RooAbsPdf *) list.at(i);
100 FactorizePdf(observables, *pdfi, obsTerms, constraints);
101 }
102 } else if (dynamic_cast<RooExtendPdf *>(&pdf)) {
103 // extract underlying pdf which is extended; first server is the pdf; second server is the number of events variable
104 auto iter = pdf.servers().begin();
105 assert(iter != pdf.servers().end());
106 assert(dynamic_cast<RooAbsPdf*>(*iter));
107 FactorizePdf(observables, static_cast<RooAbsPdf&>(**iter), obsTerms, constraints);
108 } else if (auto sim = dynamic_cast<RooSimultaneous *>(&pdf)) { //|| dynamic_cast<RooSimultaneousOpt>(&pdf)) {
109 assert(sim != 0);
110 RooAbsCategoryLValue *cat = (RooAbsCategoryLValue *) sim->indexCat().clone(sim->indexCat().GetName());
111 for (int ic = 0, nc = cat->numBins((const char *)0); ic < nc; ++ic) {
112 cat->setBin(ic);
113 RooAbsPdf* catPdf = sim->getPdf(cat->getCurrentLabel());
114 // it is possible that a pdf is not defined for every category
115 if (catPdf != 0) FactorizePdf(observables, *catPdf, obsTerms, constraints);
116 }
117 delete cat;
118 } else if (pdf.dependsOn(observables)) {
119 if (!obsTerms.contains(pdf)) obsTerms.add(pdf);
120 } else {
121 if (!constraints.contains(pdf)) constraints.add(pdf);
122 }
123 }
124
125
126 void FactorizePdf(RooStats::ModelConfig &model, RooAbsPdf &pdf, RooArgList &obsTerms, RooArgList &constraints) {
127 // utility function to factorize constraint terms from a pdf
128 // (from G. Petrucciani)
129 if (!model.GetObservables() ) {
130 oocoutE((TObject*)0,InputArguments) << "RooStatsUtils::FactorizePdf - invalid input model: missing observables" << endl;
131 return;
132 }
133 return FactorizePdf(*model.GetObservables(), pdf, obsTerms, constraints);
134 }
135
136
137 RooAbsPdf * MakeNuisancePdf(RooAbsPdf &pdf, const RooArgSet &observables, const char *name) {
138 // make a nuisance pdf by factorizing out all constraint terms in a common pdf
139 RooArgList obsTerms, constraints;
140 FactorizePdf(observables, pdf, obsTerms, constraints);
141 if(constraints.getSize() == 0) {
142 oocoutW((TObject *)0, Eval) << "RooStatsUtils::MakeNuisancePdf - no constraints found on nuisance parameters in the input model" << endl;
143 return 0;
144 }
145 return new RooProdPdf(name,"", constraints);
146 }
147
149 // make a nuisance pdf by factorizing out all constraint terms in a common pdf
150 if (!model.GetPdf() || !model.GetObservables() ) {
151 oocoutE((TObject*)0, InputArguments) << "RooStatsUtils::MakeNuisancePdf - invalid input model: missing pdf and/or observables" << endl;
152 return 0;
153 }
154 return MakeNuisancePdf(*model.GetPdf(), *model.GetObservables(), name);
155 }
156
157 RooAbsPdf * StripConstraints(RooAbsPdf &pdf, const RooArgSet &observables) {
158
159 if (auto prod = dynamic_cast<RooProdPdf *>(&pdf)) {
160
161 RooArgList list(prod->pdfList()); RooArgList newList;
162
163 for (int i = 0, n = list.getSize(); i < n; ++i) {
164 RooAbsPdf *pdfi = (RooAbsPdf *) list.at(i);
165 RooAbsPdf *newPdfi = StripConstraints(*pdfi, observables);
166 if(newPdfi != NULL) newList.add(*newPdfi);
167 }
168
169 if(newList.getSize() == 0) return NULL; // only constraints in product
170 // return single component (no longer a product)
171 else if(newList.getSize() == 1) return dynamic_cast<RooAbsPdf *>(newList.at(0)->clone(TString::Format("%s_unconstrained",
172 newList.at(0)->GetName())));
173 else return new RooProdPdf(TString::Format("%s_unconstrained", prod->GetName()).Data(),
174 TString::Format("%s without constraints", prod->GetTitle()).Data(), newList);
175
176 } else if (dynamic_cast<RooExtendPdf*>(&pdf)) {
177
178 auto iter = pdf.servers().begin();
179 // extract underlying pdf which is extended; first server is the pdf; second server is the number of events variable
180 auto uPdf = dynamic_cast<RooAbsPdf *>(*(iter++));
181 auto extended_term = dynamic_cast<RooAbsReal *>(*(iter++));
182 assert(uPdf != nullptr);
183 assert(extended_term != nullptr);
184 assert(iter == pdf.servers().end());
185
186 RooAbsPdf *newUPdf = StripConstraints(*uPdf, observables);
187 if(newUPdf == NULL) return NULL; // only constraints in underlying pdf
188 else return new RooExtendPdf(TString::Format("%s_unconstrained", pdf.GetName()).Data(),
189 TString::Format("%s without constraints", pdf.GetTitle()).Data(), *newUPdf, *extended_term);
190
191 } else if (auto sim = dynamic_cast<RooSimultaneous *>(&pdf)) { //|| dynamic_cast<RooSimultaneousOpt *>(&pdf)) {
192
193 assert(sim != nullptr);
194 RooAbsCategoryLValue *cat = (RooAbsCategoryLValue *) sim->indexCat().Clone(); assert(cat != NULL);
195 RooArgList pdfList;
196
197 for (int ic = 0, nc = cat->numBins((const char *)NULL); ic < nc; ++ic) {
198 cat->setBin(ic);
199 RooAbsPdf* catPdf = sim->getPdf(cat->getCurrentLabel());
200 RooAbsPdf* newPdf = NULL;
201 // it is possible that a pdf is not defined for every category
202 if (catPdf != NULL) newPdf = StripConstraints(*catPdf, observables);
203 if (newPdf == NULL) { delete cat; return NULL; } // all channels must have observables
204 pdfList.add(*newPdf);
205 }
206
207 return new RooSimultaneous(TString::Format("%s_unconstrained", sim->GetName()).Data(),
208 TString::Format("%s without constraints", sim->GetTitle()).Data(), pdfList, *cat);
209
210 } else if (pdf.dependsOn(observables)) {
211 return (RooAbsPdf *) pdf.clone(TString::Format("%s_unconstrained", pdf.GetName()).Data());
212 }
213
214 return NULL; // just a constraint term
215 }
216
217 RooAbsPdf * MakeUnconstrainedPdf(RooAbsPdf &pdf, const RooArgSet &observables, const char *name) {
218 // make a clone pdf without all constraint terms in a common pdf
219 RooAbsPdf * unconstrainedPdf = StripConstraints(pdf, observables);
220 if(!unconstrainedPdf) {
221 oocoutE((TObject *)NULL, InputArguments) << "RooStats::MakeUnconstrainedPdf - invalid observable list passed (observables not found in original pdf) or invalid pdf passed (without observables)" << endl;
222 return NULL;
223 }
224 if(name != NULL) unconstrainedPdf->SetName(name);
225 return unconstrainedPdf;
226 }
227
229 // make a clone pdf without all constraint terms in a common pdf
230 if(!model.GetPdf() || !model.GetObservables()) {
231 oocoutE((TObject *)NULL, InputArguments) << "RooStatsUtils::MakeUnconstrainedPdf - invalid input model: missing pdf and/or observables" << endl;
232 return NULL;
233 }
234 return MakeUnconstrainedPdf(*model.GetPdf(), *model.GetObservables(), name);
235 }
236
237 // Helper class for GetAsTTree
239 public:
240 std::map<TString, Double_t> fVarVals;
241 double fInval;
243
244 BranchStore(const vector <TString> &params = vector <TString>(), double _inval = -999.) : fTree(0) {
245 fInval = _inval;
246 for(unsigned int i = 0;i<params.size();i++)
247 fVarVals[params[i]] = _inval;
248 }
249
251 if (fTree) {
252 for(std::map<TString, Double_t>::iterator it = fVarVals.begin();it!=fVarVals.end();++it) {
253 TBranch *br = fTree->GetBranch( it->first );
254 if (br) br->ResetAddress();
255 }
256 }
257 }
258
259 void AssignToTTree(TTree &myTree) {
260 fTree = &myTree;
261 for(std::map<TString, Double_t>::iterator it = fVarVals.begin();it!=fVarVals.end();++it) {
262 const TString& name = it->first;
263 myTree.Branch( name, &fVarVals[name], TString::Format("%s/D", name.Data()));
264 }
265 }
266 void ResetValues() {
267 for(std::map<TString, Double_t>::iterator it = fVarVals.begin();it!=fVarVals.end();++it) {
268 const TString& name = it->first;
270 }
271 }
272 };
273
275 if (data.numEntries() == 0) {
276 return new BranchStore;
277 }
278 vector <TString> V;
279 const RooArgSet* aset = data.get(0);
280 RooAbsArg *arg(0);
281 TIterator *it = aset->createIterator();
282 for(;(arg = dynamic_cast<RooAbsArg*>(it->Next()));) {
283 RooRealVar *rvar = dynamic_cast<RooRealVar*>(arg);
284 if (rvar == NULL)
285 continue;
286 V.push_back(rvar->GetName());
287 if (rvar->hasAsymError()) {
288 V.push_back(TString::Format("%s_errlo", rvar->GetName()));
289 V.push_back(TString::Format("%s_errhi", rvar->GetName()));
290 }
291 else if (rvar->hasError()) {
292 V.push_back(TString::Format("%s_err", rvar->GetName()));
293 }
294 }
295 delete it;
296 return new BranchStore(V);
297 }
298
299 void FillTree(TTree &myTree, const RooDataSet &data) {
300 BranchStore *bs = CreateBranchStore(data);
301 bs->AssignToTTree(myTree);
302
303 for(int entry = 0;entry<data.numEntries();entry++) {
304 bs->ResetValues();
305 const RooArgSet* aset = data.get(entry);
306 RooAbsArg *arg(0);
307 RooLinkedListIter it = aset->iterator();
308 for(;(arg = dynamic_cast<RooAbsArg*>(it.Next()));) {
309 RooRealVar *rvar = dynamic_cast<RooRealVar*>(arg);
310 if (rvar == NULL)
311 continue;
312 bs->fVarVals[rvar->GetName()] = rvar->getValV();
313 if (rvar->hasAsymError()) {
314 bs->fVarVals[TString::Format("%s_errlo", rvar->GetName())] = rvar->getAsymErrorLo();
315 bs->fVarVals[TString::Format("%s_errhi", rvar->GetName())] = rvar->getAsymErrorHi();
316 }
317 else if (rvar->hasError()) {
318 bs->fVarVals[TString::Format("%s_err", rvar->GetName())] = rvar->getError();
319 }
320 }
321 myTree.Fill();
322 }
323
324 delete bs;
325 }
326
328 TTree* myTree = new TTree(name, desc);
329 FillTree(*myTree, data);
330 return myTree;
331 }
332
333
334 // useful function to print in one line the content of a set with their values
335 void PrintListContent(const RooArgList & l, std::ostream & os ) {
336 bool first = true;
337 os << "( ";
338 for (int i = 0; i< l.getSize(); ++i) {
339 if (first) {
340 first=kFALSE ;
341 } else {
342 os << ", " ;
343 }
344 l[i].printName(os);
345 os << " = ";
346 l[i].printValue(os);
347 }
348 os << ")\n";
349 }
350
351 // clone a workspace, copying all needed components and discarding all others
352 // start off with the old workspace
353 RooWorkspace* MakeCleanWorkspace(RooWorkspace *oldWS, const char *newName,
354 bool copySnapshots, const char *mcname,
355 const char *newmcname) {
356 auto objects = oldWS->allGenericObjects();
357 RooStats::ModelConfig *oldMC =
358 dynamic_cast<RooStats::ModelConfig *>(oldWS->obj(mcname));
359 auto data = oldWS->allData();
360 for (auto it : objects) {
361 if (!oldMC) {
362 oldMC = dynamic_cast<RooStats::ModelConfig *>(it);
363 }
364 }
365 if (!oldMC)
366 throw std::runtime_error("unable to retrieve ModelConfig");
367
368 RooAbsPdf *origPdf = oldMC->GetPdf();
369
370 // start off with the old modelconfig
371 std::vector<TString> poilist;
372 std::vector<TString> nplist;
373 std::vector<TString> obslist;
374 std::vector<TString> globobslist;
375 RooAbsPdf *pdf = NULL;
376 if (oldMC) {
377 pdf = oldMC->GetPdf();
378 ::getParameterNames(oldMC->GetParametersOfInterest(), poilist);
379 ::getParameterNames(oldMC->GetNuisanceParameters(), nplist);
380 ::getParameterNames(oldMC->GetObservables(), obslist);
381 ::getParameterNames(oldMC->GetGlobalObservables(), globobslist);
382 }
383 if (!pdf) {
384 if (origPdf)
385 pdf = origPdf;
386 }
387 if (!pdf) {
388 return NULL;
389 }
390
391 // create them anew
392 RooWorkspace *newWS = new RooWorkspace(newName ? newName : oldWS->GetName());
393 newWS->autoImportClassCode(true);
394 RooStats::ModelConfig *newMC = new RooStats::ModelConfig(newmcname, newWS);
395
396 // Copy snapshots
397 if (copySnapshots) {
398 RooFIter itr(oldWS->getSnapshots().fwdIterator());
399 RooArgSet *snap;
400 while ((snap = (RooArgSet *)itr.next())) {
401 RooArgSet *snapClone = (RooArgSet *)snap->snapshot();
402 snapClone->setName(snap->GetName());
403 newWS->getSnapshots().Add(snapClone);
404 }
405 }
406
407 newWS->import(*pdf, RooFit::RecycleConflictNodes());
408 RooAbsPdf *newPdf = newWS->pdf(pdf->GetName());
409 newMC->SetPdf(*newPdf);
410
411 for (auto d : data) {
412 newWS->import(*d);
413 }
414
415 RooArgSet poiset;
416 ::getArgs(newWS, poilist, poiset);
417 RooArgSet npset;
418 ::getArgs(newWS, nplist, npset);
419 RooArgSet obsset;
420 ::getArgs(newWS, obslist, obsset);
421 RooArgSet globobsset;
422 ::getArgs(newWS, globobslist, globobsset);
423
424 newMC->SetParametersOfInterest(poiset);
425 newMC->SetNuisanceParameters(npset);
426 newMC->SetObservables(obsset);
427 newMC->SetGlobalObservables(globobsset);
428 newWS->import(*newMC);
429
430 return newWS;
431 }
432
433}
ROOT::R::TRInterface & r
Definition: Object.C:4
#define d(i)
Definition: RSha256.hxx:102
#define b(i)
Definition: RSha256.hxx:100
#define oocoutW(o, a)
Definition: RooMsgService.h:47
#define oocoutE(o, a)
Definition: RooMsgService.h:48
const Bool_t kFALSE
Definition: RtypesCore.h:101
double Double_t
Definition: RtypesCore.h:59
#define NamespaceImp(name)
Definition: Rtypes.h:379
char name[80]
Definition: TGX11.cxx:110
double sqrt(double)
double log(double)
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:72
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.
Definition: RooAbsArg.cxx:799
virtual TObject * Clone(const char *newname=0) const
Make a clone of an object using the Streamer facility.
Definition: RooAbsArg.h:84
const RefCountList_t & servers() const
List of all servers of this object.
Definition: RooAbsArg.h:199
virtual TObject * clone(const char *newname=0) const =0
void SetName(const char *name)
Set the name of the TNamed.
Definition: RooAbsArg.cxx:2324
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
virtual void setBin(Int_t ibin, const char *rangeName=0)
Set category to i-th fit bin, which is the i-th registered state.
virtual Int_t numBins(const char *rangeName) const
Return the number of fit bins ( = number of types )
virtual const char * getCurrentLabel() const
Return label string of current state.
Int_t getSize() const
Bool_t contains(const RooAbsArg &var) const
Check if collection contains an argument with the same name as var.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
const char * GetName() const
Returns name of object.
void setName(const char *name)
RooLinkedListIter iterator(Bool_t dir=kIterForward) const
TIterator-style iteration over contained elements.
TIterator * createIterator(Bool_t dir=kIterForward) const
TIterator-style iteration over contained elements.
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
Definition: RooAbsData.cxx:376
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:61
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:22
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
Definition: RooArgList.h:110
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:35
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
Definition: RooArgSet.h:154
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:36
virtual const RooArgSet * get(Int_t index) const override
Return RooArgSet with coordinates of event 'index'.
RooExtendPdf is a wrapper around an existing PDF that adds a parameteric extended likelihood term to ...
Definition: RooExtendPdf.h:22
A one-time forward iterator working on RooLinkedList or RooAbsCollection.
RooAbsArg * next()
Return next element or nullptr if at end.
A wrapper around TIterator derivatives.
TObject * Next() override
RooFIter fwdIterator() const
Create a one-time-use forward iterator for this list.
virtual void Add(TObject *arg)
Definition: RooLinkedList.h:67
RooProdPdf is an efficient implementation of a product of PDFs of the form.
Definition: RooProdPdf.h:37
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:39
Double_t getAsymErrorLo() const
Definition: RooRealVar.h:64
Bool_t hasAsymError(Bool_t allowZero=kTRUE) const
Definition: RooRealVar.h:66
Double_t getAsymErrorHi() const
Definition: RooRealVar.h:65
virtual Double_t getValV(const RooArgSet *nset=0) const
Return value of variable.
Definition: RooRealVar.cxx:217
Bool_t hasError(Bool_t allowZero=kTRUE) const
Definition: RooRealVar.h:61
Double_t getError() const
Definition: RooRealVar.h:60
Container_t::const_iterator begin() const
Iterator over contained objects.
Container_t::const_iterator end() const
End of contained objects.
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
void AssignToTTree(TTree &myTree)
BranchStore(const vector< TString > &params=vector< TString >(), double _inval=-999.)
std::map< TString, Double_t > fVarVals
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
Definition: ModelConfig.h:30
virtual void SetObservables(const RooArgSet &set)
Specify the observables.
Definition: ModelConfig.h:146
const RooArgSet * GetGlobalObservables() const
get RooArgSet for global observables (return NULL if not existing)
Definition: ModelConfig.h:255
virtual void SetParametersOfInterest(const RooArgSet &set)
Specify parameters of interest.
Definition: ModelConfig.h:100
const RooArgSet * GetParametersOfInterest() const
get RooArgSet containing the parameter of interest (return NULL if not existing)
Definition: ModelConfig.h:237
const RooArgSet * GetNuisanceParameters() const
get RooArgSet containing the nuisance parameters (return NULL if not existing)
Definition: ModelConfig.h:240
virtual void SetGlobalObservables(const RooArgSet &set)
Specify the global observables.
Definition: ModelConfig.h:172
const RooArgSet * GetObservables() const
get RooArgSet for observables (return NULL if not existing)
Definition: ModelConfig.h:249
RooAbsPdf * GetPdf() const
get model PDF (return NULL if pdf has not been specified or does not exist)
Definition: ModelConfig.h:234
virtual void SetNuisanceParameters(const RooArgSet &set)
Specify the nuisance parameters (parameters that are not POI).
Definition: ModelConfig.h:119
virtual void SetPdf(const RooAbsPdf &pdf)
Set the Pdf, add to the the workspace if not already there.
Definition: ModelConfig.h:81
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:43
std::list< RooAbsData * > allData() const
Return list of all dataset in the workspace.
Bool_t import(const RooAbsArg &arg, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg())
Import a RooAbsArg object, e.g.
std::list< TObject * > allGenericObjects() const
Return list of all generic objects in the workspace.
static void autoImportClassCode(Bool_t flag)
If flag is true, source code of classes not the the ROOT distribution is automatically imported if on...
RooLinkedList getSnapshots()
Definition: RooWorkspace.h:97
TObject * obj(const char *name) const
Return any type of object (RooAbsArg, RooAbsData or generic object) with given name)
RooAbsPdf * pdf(const char *name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
A TTree is a list of TBranches.
Definition: TBranch.h:89
virtual void ResetAddress()
Reset the address of the branch.
Definition: TBranch.cxx:2568
Iterator abstract base class.
Definition: TIterator.h:30
virtual TObject * Next()=0
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Mother of all ROOT objects.
Definition: TObject.h:37
Basic string class.
Definition: TString.h:136
const char * Data() const
Definition: TString.h:369
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition: TString.cxx:2336
A TTree represents a columnar dataset.
Definition: TTree.h:79
virtual Int_t Fill()
Fill all branches.
Definition: TTree.cxx:4572
virtual TBranch * GetBranch(const char *name)
Return pointer to the branch with the given name in this tree or its friends.
Definition: TTree.cxx:5257
TBranch * Branch(const char *name, T *obj, Int_t bufsize=32000, Int_t splitlevel=99)
Add a new branch, and infer the data type from the type of obj being passed.
Definition: TTree.h:350
RooCmdArg RecycleConflictNodes(Bool_t flag=kTRUE)
const Int_t n
Definition: legend1.C:16
@ InputArguments
Definition: RooGlobalFunc.h:61
Namespace for the RooStats classes.
Definition: Asimov.h:19
Double_t AsimovSignificance(Double_t s, Double_t b, Double_t sigma_b=0.0)
Compute the Asimov Median significance for a Poisson process with s = expected number of signal event...
TTree * GetAsTTree(TString name, TString desc, const RooDataSet &data)
RooAbsPdf * MakeUnconstrainedPdf(RooAbsPdf &pdf, const RooArgSet &observables, const char *name=NULL)
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)
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...
void UseNLLOffset(bool on)
Use an offset in NLL calculations.
bool IsNLLOffset()
Test of RooStats should by default offset NLL calculations.
RooWorkspace * MakeCleanWorkspace(RooWorkspace *oldWS, const char *newName, bool copySnapshots, const char *mcname, const char *newmcname)
void PrintListContent(const RooArgList &l, std::ostream &os=std::cout)
static constexpr double s
Definition: first.py:1
auto * l
Definition: textangle.C:4
void ws()
Definition: ws.C:66