CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Private Attributes
BayesianFlatPrior Class Reference

#include <BayesianFlatPrior.h>

Inheritance diagram for BayesianFlatPrior:
LimitAlgo

Public Member Functions

 BayesianFlatPrior ()
 
virtual const std::string & name () const
 
virtual bool run (RooWorkspace *w, RooStats::ModelConfig *mc_s, RooStats::ModelConfig *mc_b, RooAbsData &data, double &limit, double &limitErr, const double *hint)
 
- Public Member Functions inherited from LimitAlgo
virtual void applyDefaultOptions ()
 
virtual void applyOptions (const boost::program_options::variables_map &vm)
 
 LimitAlgo ()
 
 LimitAlgo (const char *desc)
 
const
boost::program_options::options_description & 
options () const
 
virtual void setNToys (const int)
 
virtual void setToyNumber (const int)
 

Static Private Attributes

static int maxDim_ = 4
 

Additional Inherited Members

- Protected Attributes inherited from LimitAlgo
boost::program_options::options_description options_
 

Detailed Description

abstract interface for physics objects

Author
Luca Lista (INFN), from initial implementation by Giovanni Petrucciani (UCSD)

Definition at line 13 of file BayesianFlatPrior.h.

Constructor & Destructor Documentation

BayesianFlatPrior::BayesianFlatPrior ( )

Definition at line 21 of file BayesianFlatPrior.cc.

References maxDim_, and LimitAlgo::options_.

21  :
22  LimitAlgo("BayesianSimple specific options")
23 {
24  options_.add_options()
25  ("maxDim", boost::program_options::value<int>(&maxDim_)->default_value(maxDim_), "Maximum number of dimensions to try doing the integration")
26  ;
27 }
LimitAlgo()
Definition: LimitAlgo.h:19
boost::program_options::options_description options_
Definition: LimitAlgo.h:31

Member Function Documentation

virtual const std::string& BayesianFlatPrior::name ( void  ) const
inlinevirtual

Implements LimitAlgo.

Definition at line 17 of file BayesianFlatPrior.h.

Referenced by BeautifulSoup.Tag::_invert().

17  {
18  static const std::string name("BayesianSimple");
19  return name;
20  }
virtual const std::string & name() const
bool BayesianFlatPrior::run ( RooWorkspace *  w,
RooStats::ModelConfig *  mc_s,
RooStats::ModelConfig *  mc_b,
RooAbsData &  data,
double &  limit,
double &  limitErr,
const double *  hint 
)
virtual

Implements LimitAlgo.

Definition at line 29 of file BayesianFlatPrior.cc.

References alignmentValidation::c1, dtNoiseDBValidation_cfg::cerr, cl, gather_cfg::cout, maxDim_, alignCSCRings::r, and withSystematics.

29  {
30  RooArgSet poi(*mc_s->GetParametersOfInterest());
31 
32  int dim = poi.getSize();
33  if (withSystematics) dim += mc_s->GetNuisanceParameters()->getSize();
34  if (dim >= maxDim_) {
35  std::cerr << "ERROR: Your model has more parameters than the maximum allowed in the BayesianSimple method. \n" <<
36  " N(params) = " << dim << ", maxDim = " << maxDim_ << "\n" <<
37  " Please use MarkovChainMC or BayesianToyMC method to compute Bayesian limits instead of BayesianSimple.\n" <<
38  " If you really want to run BayesianSimple, change the value of the 'maxDim' option, \n"
39  " but note that it's really not supposed to work for N(params) above 5 or so " << std::endl;
40  throw std::logic_error("Too many parameters for BayesianSimple method. Use MarkovChainMC or BayesianToyMC method to compute Bayesian limits instead.");
41  }
42 
43  RooRealVar *r = dynamic_cast<RooRealVar *>(poi.first());
44  double rMax = r->getMax();
45  std::auto_ptr<RooStats::ModelConfig> mc_noNuis(0);
46  if (!withSystematics && mc_s->GetNuisanceParameters() != 0) {
47  mc_noNuis.reset(new RooStats::ModelConfig(w));
48  mc_noNuis->SetPdf(*mc_s->GetPdf());
49  mc_noNuis->SetObservables(*mc_s->GetObservables());
50  mc_noNuis->SetParametersOfInterest(*mc_s->GetParametersOfInterest());
51  mc_noNuis->SetPriorPdf(*mc_s->GetPriorPdf());
52  mc_s = mc_noNuis.get();
53  }
54  for (;;) {
55  BayesianCalculator bcalc(data, *mc_s);
56  bcalc.SetLeftSideTailFraction(0);
57  bcalc.SetConfidenceLevel(cl);
58  std::auto_ptr<SimpleInterval> bcInterval(bcalc.GetInterval());
59  if (bcInterval.get() == 0) return false;
60  limit = bcInterval->UpperLimit();
61  if (limit >= 0.5*r->getMax()) {
62  std::cout << "Limit " << r->GetName() << " < " << limit << "; " << r->GetName() << " max < " << r->getMax() << std::endl;
63  if (r->getMax()/rMax > 20) return false;
64  r->setMax(r->getMax()*2);
65  continue;
66  }
67  if (verbose > -1) {
68  std::cout << "\n -- BayesianSimple -- " << "\n";
69  std::cout << "Limit: " << r->GetName() << " < " << limit << " @ " << cl * 100 << "% CL" << std::endl;
70  }
71  if (verbose > 200) {
72  // FIXME!!!!!
73  TCanvas c1("c1", "c1");
74  std::auto_ptr<RooPlot> bcPlot(bcalc.GetPosteriorPlot(true, 0.1));
75  bcPlot->Draw();
76  c1.Print("plots/bc_plot.png");
77  }
78  break;
79  }
80  return true;
81 }
bool withSystematics
Definition: Combine.cc:68
float cl
Definition: Combine.cc:71
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
tuple cout
Definition: gather_cfg.py:121
T w() const

Member Data Documentation

int BayesianFlatPrior::maxDim_ = 4
staticprivate

Definition at line 22 of file BayesianFlatPrior.h.

Referenced by BayesianFlatPrior(), and run().