1 #include "../interface/DebugProposal.h"
2 #include <RooAbsData.h>
6 #include <RooStats/RooStatsUtils.h>
9 RooStats::ProposalFunction(), prop_(p), pdf_(pdf), tries_(tries)
12 nll_.reset(pdf->createNLL(*data));
13 RooArgSet *par = pdf->getParameters(*data);
14 RooStats::RemoveConstantParameters(par);
26 prop_->Propose(xPrime,x);
28 std::cout <<
"DebugProposal::Propose: x'" << std::endl; xPrime.Print(
"V");
29 std::cout <<
"DebugProposal::Propose: x " << std::endl; x.Print(
"V");
31 RooStats::SetParameters(&xPrime, &
params_);
32 double nllXP =
nll_->getVal();
33 RooStats::SetParameters(&x, &
params_);
34 double nllX =
nll_->getVal();
35 std::cout <<
"DebugProposal::Propose: NLL(x) = " << nllX << std::endl;
36 std::cout <<
"DebugProposal::Propose: NLL(x') = " << nllXP << std::endl;
37 std::cout <<
"DebugProposal::Propose: uncorrected acc prob. = " <<
exp(nllX - nllXP) << std::endl;
38 std::cout <<
"DebugProposal::Propose: tracing NLL(x')" << std::endl;
39 RooStats::SetParameters(&xPrime, &
params_);
41 std::cout <<
"DebugProposal::Propose: tracing NLL(x)" << std::endl;
42 RooStats::SetParameters(&x, &
params_);
55 std::cout <<
"DebugProposal::GetProposalDensity: x1" << std::endl; x1.Print(
"V");
56 std::cout <<
"DebugProposal::GetProposalDensity: x2" << std::endl; x2.Print(
"V");
58 Double_t
ret = prop_->GetProposalDensity(x1,x2);
59 if (
tries_ > 0) {
std::cout <<
"DebugProposal::GetProposalDensity: return " << ret << std::endl; }
66 std::cout <<
"DebugProposal::IsSymmetric: x1" << std::endl; x1.Print(
"V");
67 std::cout <<
"DebugProposal::IsSymmetric: x2" << std::endl; x2.Print(
"V");
69 Bool_t
ret = prop_->IsSymmetric(x1,x2);
70 if (
tries_ > 0) {
std::cout <<
"DebugProposal::IsSymmetric: return " << ret << std::endl; }
77 pdf->treeNodeServerList(&deps);
78 for (
int i = 0,
n = deps.getSize();
i <
n; ++
i) {
79 RooAbsReal *rar =
dynamic_cast<RooAbsReal *
>(deps.at(
i));
80 if (
typeid(*rar) ==
typeid(RooRealVar) || rar->isConstant())
continue;
82 std::cout <<
" " << rar->GetName() <<
" = " << rar->getVal() << std::endl;
virtual void Propose(RooArgSet &xPrime, RooArgSet &x)
virtual Double_t GetProposalDensity(RooArgSet &x1, RooArgSet &x2)
virtual Bool_t IsSymmetric(RooArgSet &x1, RooArgSet &x2)
void tracePdf(RooAbsReal *pdf)
char data[epos_bytes_allocation]
ClassDef(DebugProposal, 1) private std::auto_ptr< RooAbsReal > nll_