Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
UniformProposal.cxx
Go to the documentation of this file.
1// @(#)root/roostats:$Id$
2// Authors: Kevin Belasco 17/06/2009
3// Authors: Kyle Cranmer 17/06/2009
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/** \class RooStats::UniformProposal
13 \ingroup Roostats
14
15UniformProposal is a concrete implementation of the ProposalFunction interface
16for use with a Markov Chain Monte Carlo algorithm. This proposal function is
17a uniformly random distribution over the parameter space. The proposal
18ignores the current point when it proposes a new point. The proposal
19function is symmetric, though it may not cause a MetropolisHastings run to
20converge as quickly as other proposal functions.
21
22*/
23
24#include "Rtypes.h"
25
28#include "RooArgSet.h"
29#include "RooMsgService.h"
30#include "RooRealVar.h"
31
32
33using namespace RooFit;
34using namespace RooStats;
35
36////////////////////////////////////////////////////////////////////////////////
37/// Populate xPrime with a new proposed point
38
40{
41 // kbelasco: remember xPrime and x have not been checked for containing
42 // only RooRealVars
44}
45
46////////////////////////////////////////////////////////////////////////////////
47/// Determine whether or not the proposal density is symmetric for
48/// points x1 and x2 - that is, whether the probability of reaching x2
49/// from x1 is equal to the probability of reaching x1 from x2
50
52{
53 return true;
54}
55
56////////////////////////////////////////////////////////////////////////////////
57/// Return the probability of proposing the point x1 given the starting
58/// point x2
59
62{
63 // For a uniform proposal, all points have equal probability and the
64 // value of the proposal density function is:
65 // 1 / (N-dimensional volume of interval)
66 double volume = 1.0;
67 for (auto const *var : static_range_cast<RooRealVar *> (x2))
68 volume *= (var->getMax() - var->getMin());
69 return 1.0 / volume;
70}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char x2
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
void Propose(RooArgSet &xPrime, RooArgSet &x) override
Populate xPrime with a new proposed point.
double GetProposalDensity(RooArgSet &x1, RooArgSet &x2) override
Return the probability of proposing the point x1 given the starting point x2.
bool IsSymmetric(RooArgSet &x1, RooArgSet &x2) override
Determine whether or not the proposal density is symmetric for points x1 and x2 - that is,...
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition CodegenImpl.h:64
Namespace for the RooStats classes.
Definition CodegenImpl.h:58
void RandomizeCollection(RooAbsCollection &set, bool randomizeConstants=true)
assuming all values in set are RooRealVars, randomize their values