Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooFunctor.h
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#ifndef ROO_FUNCTOR
17#define ROO_FUNCTOR
18
19#include "RooArgSet.h"
20#include "RooAbsReal.h"
21
22class RooAbsFunc ;
23class RooAbsPdf ;
24
26
27public:
28 RooFunctor(const RooAbsFunc& func) ;
29 RooFunctor(const RooAbsReal& func, const RooArgList& observables, const RooArgList& parameters) ;
30 RooFunctor(const RooAbsReal& func, const RooArgList& observables, const RooArgList& parameters, const RooArgSet& nset) ;
31 RooFunctor(const RooFunctor&) ;
32 virtual ~RooFunctor() ;
33
34 Int_t nObs() const {
35 // Number of observables
36 return _nobs ;
37 }
38 Int_t nPar() const {
39 // Number of parameters;
40 return _npar ;
41 }
42
43 double operator()(double x) const { return eval(x) ; }
44 double operator()(const double* x, const double* p) const { return eval(x,p) ; }
45 double operator()(const double* x) const { return eval(x) ; }
46
47 double eval(const double* /*x*/, const double* /*p*/) const ;
48 double eval(const double* /*x*/) const ;
49 double eval(double /*x*/) const ;
50
52 inline RooAbsFunc const& binding() const { return _ownedBinding ? *_ownedBinding : *_binding; }
53
54protected:
55
56 std::unique_ptr<RooAbsFunc> _ownedBinding; ///< Do we own the binding function
57 RooArgSet _nset; ///< Normalization observables
58 RooAbsFunc *_binding = nullptr; ///< Function binding
59 mutable std::vector<double> _x; ///<! Transfer array ;
60 Int_t _npar = 0; ///<! Number of parameters ;
61 Int_t _nobs; ///<! Number of observables ;
62
63 ClassDef(RooFunctor,0) // Export RooAbsReal as functor
64};
65
66#endif
#define ClassDef(name, id)
Definition Rtypes.h:337
winID h TVirtualViewer3D TVirtualGLPainter p
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Definition RooAbsFunc.h:27
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
Lightweight interface adaptor that exports a RooAbsPdf as a functor.
Definition RooFunctor.h:25
std::unique_ptr< RooAbsFunc > _ownedBinding
Do we own the binding function.
Definition RooFunctor.h:56
RooAbsFunc const & binding() const
Definition RooFunctor.h:52
Int_t nPar() const
Definition RooFunctor.h:38
RooAbsFunc * _binding
Function binding.
Definition RooFunctor.h:58
Int_t nObs() const
Definition RooFunctor.h:34
double operator()(double x) const
Definition RooFunctor.h:43
Int_t _npar
! Number of parameters ;
Definition RooFunctor.h:60
RooAbsFunc & binding()
Definition RooFunctor.h:51
std::vector< double > _x
! Transfer array ;
Definition RooFunctor.h:59
virtual ~RooFunctor()
double operator()(const double *x) const
Definition RooFunctor.h:45
Int_t _nobs
! Number of observables ;
Definition RooFunctor.h:61
RooArgSet _nset
Normalization observables.
Definition RooFunctor.h:57
double eval(const double *, const double *) const
double operator()(const double *x, const double *p) const
Definition RooFunctor.h:44
Double_t x[n]
Definition legend1.C:17