CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
TestProposal Class Reference

#include <TestProposal.h>

Inheritance diagram for TestProposal:

Public Member Functions

virtual Double_t GetProposalDensity (RooArgSet &x1, RooArgSet &x2)
 
virtual Bool_t IsSymmetric (RooArgSet &x1, RooArgSet &x2)
 
virtual void Propose (RooArgSet &xPrime, RooArgSet &x)
 
 TestProposal ()
 
 TestProposal (double divisor, const RooRealVar *alwaysStepMe=0)
 
 TestProposal (double divisor, const RooArgList &alwaysStepMe)
 
virtual ~TestProposal ()
 

Public Attributes

ClassDef(TestProposal,
1) private RooArgList 
alwaysStepMe_
 

Detailed Description

Definition at line 12 of file TestProposal.h.

Constructor & Destructor Documentation

TestProposal::TestProposal ( )
inline

Definition at line 15 of file TestProposal.h.

15 : RooStats::ProposalFunction() {}
TestProposal::TestProposal ( double  divisor,
const RooRealVar *  alwaysStepMe = 0 
)

Definition at line 9 of file TestProposal.cc.

References alwaysStepMe_.

9  :
10  RooStats::ProposalFunction(),
11  divisor_(1./divisor),
12  poiDivisor_(divisor_)
13 {
14  alwaysStepMe_.add(*alwaysStepMe);
15 }
ClassDef(TestProposal, 1) private RooArgList alwaysStepMe_
Definition: TestProposal.h:33
TestProposal::TestProposal ( double  divisor,
const RooArgList &  alwaysStepMe 
)

Definition at line 17 of file TestProposal.cc.

References mathSSE::sqrt().

17  :
18  RooStats::ProposalFunction(),
19  divisor_(1./divisor),
20  poiDivisor_(divisor_),
21  alwaysStepMe_(alwaysStepMe)
22 {
23  if (alwaysStepMe.getSize() > 1) poiDivisor_ /= sqrt(double(alwaysStepMe.getSize()));
24 }
ClassDef(TestProposal, 1) private RooArgList alwaysStepMe_
Definition: TestProposal.h:33
T sqrt(T t)
Definition: SSEVec.h:46
virtual TestProposal::~TestProposal ( )
inlinevirtual

Definition at line 31 of file TestProposal.h.

31 {}

Member Function Documentation

Double_t TestProposal::GetProposalDensity ( RooArgSet &  x1,
RooArgSet &  x2 
)
virtual

Definition at line 62 of file TestProposal.cc.

64 {
65  return 1.0; // should not be needed
66 }
Bool_t TestProposal::IsSymmetric ( RooArgSet &  x1,
RooArgSet &  x2 
)
virtual

Definition at line 56 of file TestProposal.cc.

56  {
57  return true;
58 }
void TestProposal::Propose ( RooArgSet &  xPrime,
RooArgSet &  x 
)
virtual

Definition at line 28 of file TestProposal.cc.

References alwaysStepMe_, i, j, max(), min, n, and NULL.

29 {
30  RooStats::SetParameters(&x, &xPrime);
31  RooLinkedListIter it(xPrime.iterator());
32  RooRealVar* var;
33  int n = xPrime.getSize(), j = floor(RooRandom::uniform()*n);
34  for (int i = 0; (var = (RooRealVar*)it.Next()) != NULL; ++i) {
35  if (i == j) {
36  if (alwaysStepMe_.contains(*var)) break; // don't step twice
37  double val = var->getVal(), max = var->getMax(), min = var->getMin(), len = max - min;
38  val += RooRandom::gaussian() * len * divisor_;
39  while (val > max) val -= len;
40  while (val < min) val += len;
41  var->setVal(val);
42  break;
43  }
44  }
45  it = alwaysStepMe_.iterator();
46  for (RooRealVar *poi = (RooRealVar*)it.Next(); poi != NULL; poi = (RooRealVar*)it.Next()) {
47  RooRealVar *var = (RooRealVar*) xPrime.find(poi->GetName());
48  double val = var->getVal(), max = var->getMax(), min = var->getMin(), len = max - min;
49  val += RooRandom::gaussian() * len * poiDivisor_;
50  while (val > max) val -= len;
51  while (val < min) val += len;
52  var->setVal(val);
53  }
54 }
int i
Definition: DBlmapReader.cc:9
#define NULL
Definition: scimark2.h:8
#define min(a, b)
Definition: mlp_lapack.h:161
ClassDef(TestProposal, 1) private RooArgList alwaysStepMe_
Definition: TestProposal.h:33
const T & max(const T &a, const T &b)
int j
Definition: DBlmapReader.cc:9
Definition: DDAxes.h:10

Member Data Documentation

ClassDef (TestProposal,1) private RooArgList TestProposal::alwaysStepMe_

Definition at line 33 of file TestProposal.h.

Referenced by Propose(), and TestProposal().