98 coutE(
Eval) <<
"Critical members uninitialized: parameters, proposal " <<
99 " function, or (log) likelihood function" << endl;
103 coutE(
Eval) <<
"Please set type and sign of your function using "
104 <<
"MetropolisHastings::SetType() and MetropolisHastings::SetSign()" <<
123 double xL = 0.0, xPrimeL = 0.0,
a = 0.0;
140 bool hadEvalError =
true;
150 while (i < 1000 && hadEvalError) {
160 hadEvalError =
false;
165 hadEvalError =
false;
168 hadEvalError =
false;
173 coutE(
Eval) <<
"Problem finding a good starting point in " <<
174 "MetropolisHastings::ConstructChain() " << endl;
183 hadEvalError =
false;
249 coutI(
Eval) <<
"Proposal acceptance rate: " <<
251 coutI(
Eval) <<
"Number of steps in chain: " << numAccepted << endl;
278 if (-1.0 * rand >=
a)
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
virtual RooAbsArg * addClone(const RooAbsArg &var, bool silent=false)
Add a clone of the specified argument to list.
Abstract base class for objects that represent a real value and implements functionality common to al...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
static Int_t numEvalErrors()
Return the number of logged evaluation errors since the last clearing.
static void setEvalErrorLoggingMode(ErrorLoggingMode m)
Set evaluation error logging mode.
static void clearEvalErrorLog()
Clear the stack of evaluation error messages.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
static RooMsgService & instance()
Return reference to singleton instance.
void setGlobalKillBelow(RooFit::MsgLevel level)
RooFit::MsgLevel globalKillBelow() const
static constexpr double infinity()
Return internal infinity representation.
static double uniform(TRandom *generator=randomGenerator())
Return a number uniformly distributed from (0,1)
Stores the steps in a Markov Chain of points.
virtual void Add(RooArgSet &entry, double nllValue, double weight=1.0)
safely add an entry to the chain
virtual void SetParameters(RooArgSet ¶meters)
set which of your parameters this chain should store
virtual Int_t Size() const
get the number of steps in the chain
This class uses the Metropolis-Hastings algorithm to construct a Markov Chain of data points using Mo...
RooArgSet fParameters
RooRealVars that define all parameter space.
virtual void SetProposalFunction(ProposalFunction &proposalFunction)
set the proposal function for suggesting new points for the MCMC
Int_t fNumIters
number of iterations to run metropolis algorithm
RooAbsReal * fFunction
function that will generate likelihood values
virtual void SetParameters(const RooArgSet &set)
specify all the parameters of interest in the interval
virtual MarkovChain * ConstructChain()
main purpose of MetropolisHastings - run Metropolis-Hastings algorithm to generate Markov Chain of po...
enum FunctionType fType
whether the likelihood is on a regular, log, (or other) scale
enum FunctionSign fSign
whether the likelihood is negative (like NLL) or positive
RooArgSet fChainParams
RooRealVars that are stored in the chain.
virtual bool ShouldTakeStep(double d)
virtual double CalcNLL(double xL)
MetropolisHastings()
default constructor
Int_t fNumBurnInSteps
number of iterations to discard as burn-in, starting from the first
ProposalFunction * fPropFunc
Proposal function for MCMC integration.
ProposalFunction is an interface for all proposal functions that would be used with a Markov Chain Mo...
virtual void Propose(RooArgSet &xPrime, RooArgSet &x)=0
Populate xPrime with the new proposed point, possibly based on the current point x.
virtual double GetProposalDensity(RooArgSet &x1, RooArgSet &x2)=0
Return the probability of proposing the point x1 given the starting point x2.
virtual bool IsSymmetric(RooArgSet &x1, RooArgSet &x2)=0
Determine whether or not the proposal density is symmetric for points x1 and x2 - that is,...
Mother of all ROOT objects.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
MsgLevel
Verbosity level for RooMsgService::StreamConfig in RooMsgService.
Namespace for the RooStats classes.
void SetParameters(const RooArgSet *desiredVals, RooArgSet *paramsToChange)
void RandomizeCollection(RooAbsCollection &set, bool randomizeConstants=true)
assuming all values in set are RooRealVars, randomize their values
Double_t Log(Double_t x)
Returns the natural logarithm of x.