meerkat is hosted by Hepforge, IPPP Durham
Meerkat  v1r3
Multidimensional kernel density estimation package
RooMeerkatPdf.cpp
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * *
4  * This code was autogenerated by RooClassFactory *
5  *****************************************************************************/
6 
7 // Your description goes here...
8 
9 #include "Riostream.h"
10 
11 #include "RooMeerkatPdf.hh"
12 #include "RooAbsReal.h"
13 #include "RooAbsCategory.h"
14 #include "RooListProxy.h"
15 #include <math.h>
16 #include "TMath.h"
17 
18 #include "AbsDensity.hh"
19 
21 
22 RooMeerkatPdf::RooMeerkatPdf(const char *name, const char *title,
23  RooArgList& varList, AbsDensity* density) :
24  RooAbsPdf(name,title),
25  _varList("varList","List of variables", this)
26 {
27  TIterator* varItr = varList.createIterator() ;
28  RooAbsArg* var ;
29  Int_t num = 0;
30  for (Int_t i=0; (var = (RooAbsArg*)varItr->Next()); ++i) {
31  if (!dynamic_cast<RooAbsReal*>(var)) {
32  coutE(InputArguments) << "RooMeerkatPdf::ctor(" << GetName() << ") ERROR: variable " << var->GetName()
33  << " is not of type RooAbsReal" << std::endl ;
34  assert(0) ;
35  }
36  _varList.add(*var) ;
37  num++;
38 // _varName.push_back(var->GetName());
39  }
40 
41  _varItr = _varList.createIterator();
42 
43  _dim = num;
44 
45  _density = density;
46 
47  delete varItr ;
48 }
49 
51 
52 }
53 
54 
55 RooMeerkatPdf::RooMeerkatPdf(const RooMeerkatPdf& other, const char* name) :
56  RooAbsPdf(other,name),
57  _varList("varList",this,other._varList)
58 {
59  _dim = other._dim;
60  _varItr = _varList.createIterator();
61  _density = other._density;
62 }
63 
64 Double_t RooMeerkatPdf::evaluate() const
65 {
66  // ENTER EXPRESSION IN TERMS OF VARIABLE ARGUMENTS HERE
67 
68  std::vector<Double_t> x;
69  x.resize(_dim);
70  _varItr->Reset();
71  RooAbsReal* var;
72  const RooArgSet* nset = _varList.nset();
73  for(Int_t j=0; (var=(RooAbsReal*)_varItr->Next()); ++j) {
74  x[j] = var->getVal(nset);
75  }
76 
77  return _density->density(x);
78 }
Abstract class which defines probability density interface.
Definition: AbsDensity.hh:16
RooListProxy _varList
ClassImp(RooMeerkatPdf) RooMeerkatPdf
Double_t evaluate() const
TIterator * _varItr
AbsDensity * _density
virtual ~RooMeerkatPdf()
virtual Double_t density(std::vector< Double_t > &x)=0
Calculate PDF value at the given point.