14 #if !defined(R__ALPHA) && !defined(R__SOLARIS) && !defined(R__ACC) && !defined(R__FBSD) 40 double sb2 = sigma_b*sigma_b;
45 double bpsb2 = b + sb2;
48 double za2 = 2.*( (spb)*
std::log( ( spb)*(bpsb2)/(b2+ spb*sb2) ) -
49 (b2/sb2) *
std::log(1. + ( sb2 * s)/(b * bpsb2) ) );
54 double za2 = 2.*( (s+
b) *
std::log(1. + s/b) -
s );
71 const std::type_info &
id =
typeid(pdf);
75 for (
int i = 0,
n = list.getSize(); i <
n; ++i) {
90 for (
int ic = 0, nc = cat->
numBins((
const char *)0); ic < nc; ++ic) {
94 if (catPdf != 0)
FactorizePdf(observables, *catPdf, obsTerms, constraints);
100 if (!constraints.
contains(pdf)) constraints.
add(pdf);
120 if(constraints.
getSize() == 0) {
121 oocoutW((
TObject *)0,
Eval) <<
"RooStatsUtils::MakeNuisancePdf - no constraints found on nuisance parameters in the input model" << endl;
123 }
else if(constraints.
getSize() == 1) {
139 const std::type_info &
id =
typeid(pdf);
146 for (
int i = 0,
n = list.getSize(); i <
n; ++i) {
149 if(newPdfi != NULL) newList.add(*newPdfi);
152 if(newList.getSize() == 0)
return NULL;
154 else if(newList.getSize() == 1)
return dynamic_cast<RooAbsPdf *>(newList.at(0)->clone(
TString::Format(
"%s_unconstrained",
155 newList.at(0)->GetName())));
165 assert(uPdf != NULL); assert(extended_term != NULL); assert(iter->
Next() == NULL);
169 if(newUPdf == NULL)
return NULL;
179 for (
int ic = 0, nc = cat->
numBins((
const char *)NULL); ic < nc; ++ic) {
185 if (newPdf == NULL) {
delete cat;
return NULL; }
186 pdfList.
add(*newPdf);
202 if(!unconstrainedPdf) {
203 oocoutE((
TObject *)NULL,
InputArguments) <<
"RooStats::MakeUnconstrainedPdf - invalid observable list passed (observables not found in original pdf) or invalid pdf passed (without observables)" << endl;
206 if(name != NULL) unconstrainedPdf->
SetName(name);
207 return unconstrainedPdf;
213 oocoutE((
TObject *)NULL,
InputArguments) <<
"RooStatsUtils::MakeUnconstrainedPdf - invalid input model: missing pdf and/or observables" << endl;
222 std::map<TString, Double_t> fVarVals;
226 BranchStore(
const vector <TString> ¶ms = vector <TString>(),
double _inval = -999.) : fTree(0) {
228 for(
unsigned int i = 0;i<params.size();i++)
229 fVarVals[params[i]] = _inval;
234 for(std::map<TString, Double_t>::iterator it = fVarVals.begin();it!=fVarVals.end();it++) {
235 TBranch *br = fTree->GetBranch( it->first );
241 void AssignToTTree(TTree &myTree) {
243 for(std::map<TString, Double_t>::iterator it = fVarVals.begin();it!=fVarVals.end();it++) {
244 const TString&
name = it->first;
245 myTree.Branch( name, &fVarVals[name],
TString::Format(
"%s/D", name.Data()));
249 for(std::map<TString, Double_t>::iterator it = fVarVals.begin();it!=fVarVals.end();it++) {
250 const TString&
name = it->first;
251 fVarVals[
name] = fInval;
258 return new BranchStore;
278 return new BranchStore(V);
283 bs->AssignToTTree(myTree);
285 for(
int entry = 0;entry<data.
numEntries();entry++) {
310 TTree* myTree =
new TTree(name, desc);
320 for (
int i = 0; i< l.
getSize(); ++i) {
virtual TObject * clone(const char *newname=0) const =0
virtual const char * GetName() const
Returns name of object.
TIterator * createIterator(Bool_t dir=kIterForward) const
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
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 NULL if not existing)
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.
RooAbsPdf * MakeNuisancePdf(RooAbsPdf &pdf, const RooArgSet &observables, const char *name)
RooProdPdf is an efficient implementation of a product of PDFs of the form.
virtual void printValue(std::ostream &os) const
Print value of collection, i.e.
virtual TObject * Clone(const char *newname=0) const
Make a clone of an object using the Streamer facility.
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...
virtual Double_t getValV(const RooArgSet *nset=0) const
Return value of variable.
TTree * GetAsTTree(TString name, TString desc, const RooDataSet &data)
Iterator abstract base class.
void FactorizePdf(const RooArgSet &observables, RooAbsPdf &pdf, RooArgList &obsTerms, RooArgList &constraints)
virtual Int_t numBins(const char *rangeName) const
Returm the number of fit bins ( = number of types )
RooAbsPdf * StripConstraints(RooAbsPdf &pdf, const RooArgSet &observables)
Bool_t hasAsymError(Bool_t allowZero=kTRUE) const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
Bool_t hasError(Bool_t allowZero=kTRUE) const
RooRealVar represents a fundamental (non-derived) real valued object.
virtual void printName(std::ostream &os) const
Return collection name.
RooAbsPdf * MakeUnconstrainedPdf(RooAbsPdf &pdf, const RooArgSet &observables, const char *name=NULL)
Double_t getAsymErrorHi() const
const RooAbsCategoryLValue & indexCat() const
RooAbsArg * first() const
const RooArgList & pdfList() const
BranchStore * CreateBranchStore(const RooDataSet &data)
void SetName(const char *name)
Set the name of the TNamed.
void PrintListContent(const RooArgList &l, std::ostream &os=std::cout)
#define NamespaceImp(name)
virtual const char * getLabel() const
Return label string of current state.
RooDataSet is a container class to hold unbinned data.
void UseNLLOffset(bool on)
TIterator * serverIterator() const
virtual const RooArgSet * get(Int_t index) const
Return RooArgSet with coordinates of event 'index'.
Namespace for the RooStats classes.
RooAbsPdf * GetPdf() const
get model PDF (return NULL if pdf has not been specified or does not exist)
virtual void ResetAddress()
Reset the address of the branch.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
static constexpr double s
Mother of all ROOT objects.
RooAbsPdf * getPdf(const char *catName) const
Return the p.d.f associated with the given index category name.
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
void FillTree(TTree &myTree, const RooDataSet &data)
RooLinkedListIter iterator(Bool_t dir=kIterForward) const
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 TObject * Next()=0
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Bool_t contains(const RooAbsArg &var) const
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
A TTree is a list of TBranches.
Double_t getError() const
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset...
Double_t getAsymErrorLo() const
RooLinkedListIter is the TIterator implementation for RooLinkedList.
virtual Int_t numEntries() const
virtual const char * GetTitle() const
Returns title of object.