Logo ROOT   6.08/07
Reference Guide
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 ////////////////////////////////////////////////////////////////////////////////
13 
14 
15 #ifndef ROOT_Rtypes
16 #include "Rtypes.h"
17 #endif
18 
19 #ifndef RooStats_RooStatsUtils
20 #include "RooStats/RooStatsUtils.h"
21 #endif
22 #ifndef ROOSTATS_UniformProposal
24 #endif
25 #ifndef ROO_ARG_SET
26 #include "RooArgSet.h"
27 #endif
28 #ifndef ROO_MSG_SERVICE
29 #include "RooMsgService.h"
30 #endif
31 #ifndef ROO_REAL_VAR
32 #include "RooRealVar.h"
33 #endif
34 #ifndef ROOT_TIterator
35 #include "TIterator.h"
36 #endif
37 
38 using namespace std;
39 
41 
42 using namespace RooFit;
43 using namespace RooStats;
44 
45 // Populate xPrime with a new proposed point
46 void UniformProposal::Propose(RooArgSet& xPrime, RooArgSet& /* x */)
47 {
48  // kbelasco: remember xPrime and x have not been checked for containing
49  // only RooRealVars
51 }
52 
53 // Determine whether or not the proposal density is symmetric for
54 // points x1 and x2 - that is, whether the probabilty of reaching x2
55 // from x1 is equal to the probability of reaching x1 from x2
56 Bool_t UniformProposal::IsSymmetric(RooArgSet& /* x1 */ , RooArgSet& /* x2 */)
57 {
58  return true;
59 }
60 
61 // Return the probability of proposing the point x1 given the starting
62 // point x2
63 Double_t UniformProposal::GetProposalDensity(RooArgSet& /* x1 */,
64  RooArgSet& x2)
65 {
66  // For a uniform proposal, all points have equal probability and the
67  // value of the proposal density function is:
68  // 1 / (N-dimensional volume of interval)
69  Double_t volume = 1.0;
70  TIterator* it = x2.createIterator();
71  RooRealVar* var;
72  while ((var = (RooRealVar*)it->Next()) != NULL)
73  volume *= (var->getMax() - var->getMin());
74  delete it;
75  return 1.0 / volume;
76 }
virtual Double_t getMin(const char *name=0) const
TIterator * createIterator(Bool_t dir=kIterForward) const
virtual Double_t getMax(const char *name=0) const
UniformProposal is a concrete implementation of the ProposalFunction interface for use with a Markov ...
bool Bool_t
Definition: RtypesCore.h:59
STL namespace.
Iterator abstract base class.
Definition: TIterator.h:32
static const double x2[5]
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:37
void RandomizeCollection(RooAbsCollection &set, Bool_t randomizeConstants=kTRUE)
Namespace for the RooStats classes.
Definition: Asimov.h:20
#define ClassImp(name)
Definition: Rtypes.h:279
double Double_t
Definition: RtypesCore.h:55
virtual TObject * Next()=0
#define NULL
Definition: Rtypes.h:82