Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooTFoamBinding.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * @(#)root/roofitcore:$Id$
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16
17/// \cond ROOFIT_INTERNAL
18
19/**
20\file RooTFoamBinding.cxx
21\class RooTFoamBinding
22\ingroup Roofitcore
23
24Lightweight interface adaptor that binds a RooAbsPdf to TFOAM
25**/
26
27
28#include "Riostream.h"
29
30#include "RooTFoamBinding.h"
31#include "RooRealBinding.h"
32#include "RooAbsReal.h"
33#include "RooAbsPdf.h"
34#include "RooArgSet.h"
35
36#include <cassert>
37
38
39
40using namespace std;
41
42
43////////////////////////////////////////////////////////////////////////////////
44
45RooTFoamBinding::RooTFoamBinding(const RooAbsReal& pdf, const RooArgSet& observables)
46{
47 _nset.add(observables) ;
48 _binding = new RooRealBinding(pdf,observables,&_nset,false,nullptr) ;
49}
50
51
52////////////////////////////////////////////////////////////////////////////////
53/// Destructor
54
55RooTFoamBinding::~RooTFoamBinding()
56{
57 delete _binding ;
58}
59
60
61
62////////////////////////////////////////////////////////////////////////////////
63
64double RooTFoamBinding::Density(Int_t ndim, double *xvec)
65{
66 double x[10] ;
67 for (int i=0 ; i<ndim ; i++) {
68 x[i] = xvec[i]*(_binding->getMaxLimit(i)-_binding->getMinLimit(i)) + _binding->getMinLimit(i) ;
69 //cout << "RTFB::Density xvec[" << i << "] = " << xvec[i] << " x[i] = " << x[i] << endl ;
70 }
71 double ret = (*_binding)(x) ;
72 return ret<0?0:ret ;
73}
74
75/// \endcond
int Int_t
Definition RtypesCore.h:45
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition RooAbsReal.h:59
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
Lightweight interface adaptor that binds a RooAbsReal object to a subset of its servers and present i...
Double_t x[n]
Definition legend1.C:17