BCPriorModel.h
1 #ifndef __BCPRIORMODEL__H
2 #define __BCPRIORMODEL__H
3 
14 /*
15  * Copyright (C) 2007-2018, the BAT core developer team
16  * All rights reserved.
17  *
18  * For the licensing terms see doc/COPYING.
19  * For documentation see http://mpp.mpg.de/bat
20  */
21 
22 // ---------------------------------------------------------
23 
24 #include <limits>
25 
26 #include "BCModel.h"
27 
28 // ---------------------------------------------------------
29 
30 class BCPriorModel : public BCModel
31 {
32 
33 public:
34 
42  BCPriorModel(BCModel& model, bool call_likelihood = false);
43 
48  virtual double LogAPrioriProbability(const std::vector<double>& /*parameters*/)
49  { return 0; }
50 
53  virtual double LogLikelihood(const std::vector<double>& parameters)
54  { return fModel.LogAPrioriProbability(parameters); }
55 
58  void CalculateObservables(const std::vector<double>& parameters);
59 
62  bool PreparePriorModel();
63 
66  void SetCallLikelihood(bool cl)
67  { fCallLikelihood = cl; }
68 
71  bool GetCallLikelihood() const
72  { return fCallLikelihood; }
73 
74 protected:
77 
80 
83 private:
84 
86  using BCModel::GetPrior;
88 
92 };
93 
94 #endif
virtual BCPriorModel * GetPriorModel(bool prepare=true, bool call_likelihood=false)
Definition: BCModel.cxx:223
void CalculateObservables(const std::vector< double > &parameters)
Calculates user observables according to the model.
Class for sampling from prior of a BCModel.
Definition: BCPriorModel.h:30
The base class for all user-defined models.
Definition: BCModel.h:39
BCModel & fModel
The original model on which we call the prior.
Definition: BCPriorModel.h:76
virtual double LogAPrioriProbability(const std::vector< double > &)
Returns a constant prior.
Definition: BCPriorModel.h:48
virtual double LogLikelihood(const std::vector< double > &parameters)
Returns prior of model as posterior of PriorModel.
Definition: BCPriorModel.h:53
virtual unsigned PrintKnowledgeUpdatePlots(const std::string &filename, unsigned hdiv=1, unsigned vdiv=1, bool call_likelihood=false)
Print a comparison of the prior knowledge to the posterior knowledge for each parameter.
Definition: BCModel.cxx:335
bool PreparePriorModel()
Prepare PriorModel from Model.
bool GetCallLikelihood() const
Definition: BCPriorModel.h:71
void SetCallLikelihood(bool cl)
Set calling of likelihood in model.
Definition: BCPriorModel.h:66
virtual double LogAPrioriProbability(const std::vector< double > &parameters)
Returns natural logarithm of the prior probability.
Definition: BCModel.h:178
BCPriorModel(BCModel &model, bool call_likelihood=false)
constructor.
bool fCallLikelihood
Call the likelihood of the original model when evaluating observables.
Definition: BCPriorModel.h:79
virtual BCH1D GetPrior(unsigned index)
Get prior of a variable as a BCH1D.
Definition: BCModel.cxx:234