ROOT logo
// @(#)root/roostats:$Id: ProposalFunction.h 26805 2009-06-17 14:31:02Z kbelasco $
// Authors: Kevin Belasco        17/06/2009
// Authors: Kyle Cranmer         17/06/2009
/*************************************************************************
 * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOSTATS_ProposalFunction
#define ROOSTATS_ProposalFunction

#ifndef ROOT_Rtypes
#include "Rtypes.h"
#endif

#include "RooArgSet.h"
#include "RooMsgService.h"
#include "TIterator.h"
#include "RooRealVar.h"

using namespace std;

namespace RooStats {

   class ProposalFunction : public TObject {

   public:
      //Default constructor
      ProposalFunction() {}

      virtual ~ProposalFunction() {}

      // Populate xPrime with the new proposed point,
      // possibly based on the current point x
      virtual void Propose(RooArgSet& xPrime, RooArgSet& x) = 0;
      
      // Determine whether or not the proposal density is symmetric for
      // points x1 and x2 - that is, whether the probabilty of reaching x2
      // from x1 is equal to the probability of reaching x1 from x2
      virtual Bool_t IsSymmetric(RooArgSet& x1, RooArgSet& x2) = 0;

      // Return the probability of reaching the point xPrime given the starting
      // point x
      virtual Double_t GetProposalDensity(RooArgSet& xPrime, RooArgSet& x) = 0;

      // Check the parameters for which the ProposalFunction will
      // propose values to make sure they are all RooRealVars
      // Return true if all objects are RooRealVars, false otherwise
      virtual bool CheckParameters(RooArgSet& params)
      {
         TIterator* it = params.createIterator();
         TObject* obj;
         while ((obj = it->Next()) != NULL) {
            if (!dynamic_cast<RooRealVar*>(obj)) {
               coutE(Eval) << "Error when checking parameters in"
                           << "ProposalFunction: "
                           << "Object \"" << obj->GetName() << "\" not of type "
                           << "RooRealVar" << endl;
               return false;
            }
         }
         // Made it here, so all parameters are RooRealVars
         return true;
      }

   protected:
      // Assuming all values in coll are RooRealVars, randomize their values.
      virtual void randomizeSet(RooArgSet& set);

      ClassDef(ProposalFunction,1) // Interface for the proposal function used with Markov Chain Monte Carlo
   };
}

#endif
 ProposalFunction.h:1
 ProposalFunction.h:2
 ProposalFunction.h:3
 ProposalFunction.h:4
 ProposalFunction.h:5
 ProposalFunction.h:6
 ProposalFunction.h:7
 ProposalFunction.h:8
 ProposalFunction.h:9
 ProposalFunction.h:10
 ProposalFunction.h:11
 ProposalFunction.h:12
 ProposalFunction.h:13
 ProposalFunction.h:14
 ProposalFunction.h:15
 ProposalFunction.h:16
 ProposalFunction.h:17
 ProposalFunction.h:18
 ProposalFunction.h:19
 ProposalFunction.h:20
 ProposalFunction.h:21
 ProposalFunction.h:22
 ProposalFunction.h:23
 ProposalFunction.h:24
 ProposalFunction.h:25
 ProposalFunction.h:26
 ProposalFunction.h:27
 ProposalFunction.h:28
 ProposalFunction.h:29
 ProposalFunction.h:30
 ProposalFunction.h:31
 ProposalFunction.h:32
 ProposalFunction.h:33
 ProposalFunction.h:34
 ProposalFunction.h:35
 ProposalFunction.h:36
 ProposalFunction.h:37
 ProposalFunction.h:38
 ProposalFunction.h:39
 ProposalFunction.h:40
 ProposalFunction.h:41
 ProposalFunction.h:42
 ProposalFunction.h:43
 ProposalFunction.h:44
 ProposalFunction.h:45
 ProposalFunction.h:46
 ProposalFunction.h:47
 ProposalFunction.h:48
 ProposalFunction.h:49
 ProposalFunction.h:50
 ProposalFunction.h:51
 ProposalFunction.h:52
 ProposalFunction.h:53
 ProposalFunction.h:54
 ProposalFunction.h:55
 ProposalFunction.h:56
 ProposalFunction.h:57
 ProposalFunction.h:58
 ProposalFunction.h:59
 ProposalFunction.h:60
 ProposalFunction.h:61
 ProposalFunction.h:62
 ProposalFunction.h:63
 ProposalFunction.h:64
 ProposalFunction.h:65
 ProposalFunction.h:66
 ProposalFunction.h:67
 ProposalFunction.h:68
 ProposalFunction.h:69
 ProposalFunction.h:70
 ProposalFunction.h:71
 ProposalFunction.h:72
 ProposalFunction.h:73
 ProposalFunction.h:74
 ProposalFunction.h:75
 ProposalFunction.h:76
 ProposalFunction.h:77