Logo ROOT  
Reference Guide
RooRealBinding.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooRealBinding.h,v 1.9 2007/05/11 09:11:30 verkerke Exp $
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_REAL_BINDING
17#define ROO_REAL_BINDING
18
19#include "RooAbsFunc.h"
20#include "RooSpan.h"
21#include <vector>
22#include <memory>
23
25class RooAbsReal;
26class RooArgSet;
27namespace RooBatchCompute{ struct RunContext; }
28
29class RooRealBinding : public RooAbsFunc {
30public:
31 RooRealBinding(const RooAbsReal& func, const RooArgSet &vars, const RooArgSet* nset=0, Bool_t clipInvalid=kFALSE, const TNamed* rangeName=0);
32 RooRealBinding(const RooRealBinding& other, const RooArgSet* nset=0) ;
33 virtual ~RooRealBinding();
34
35 virtual Double_t operator()(const Double_t xvector[]) const;
36 virtual RooSpan<const double> getValues(std::vector<RooSpan<const double>> coordinates) const;
38 virtual Double_t getMinLimit(UInt_t dimension) const;
39 virtual Double_t getMaxLimit(UInt_t dimension) const;
40
41 virtual void saveXVec() const ;
42 virtual void restoreXVec() const ;
43
44 virtual const char* getName() const ;
45
46 virtual std::list<Double_t>* binBoundaries(Int_t) const ;
47 /// Return a pointer to the observable that defines the `i`-th dimension of the function.
48 RooAbsRealLValue* observable(unsigned int i) const { return i < _vars.size() ? _vars[i] : nullptr; }
49 virtual std::list<Double_t>* plotSamplingHint(RooAbsRealLValue& /*obs*/, Double_t /*xlo*/, Double_t /*xhi*/) const ;
50
51protected:
52
53 void loadValues(const Double_t xvector[]) const;
55 std::vector<RooAbsRealLValue*> _vars; // Non-owned pointers to variables
59 mutable Double_t* _xsave ;
60 const TNamed* _rangeName ; //!
61
62 mutable std::vector<RooAbsReal*> _compList ; //!
63 mutable std::vector<Double_t> _compSave ; //!
64 mutable Double_t _funcSave ; //!
65 mutable std::unique_ptr<RooBatchCompute::RunContext> _evalData; /// Memory for batch evaluations
66
67 ClassDef(RooRealBinding,0) // Function binding to RooAbsReal object
68};
69
70#endif
71
int Int_t
Definition: RtypesCore.h:45
unsigned int UInt_t
Definition: RtypesCore.h:46
const Bool_t kFALSE
Definition: RtypesCore.h:101
bool Bool_t
Definition: RtypesCore.h:63
double Double_t
Definition: RtypesCore.h:59
#define ClassDef(name, id)
Definition: Rtypes.h:325
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Definition: RooAbsFunc.h:27
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:61
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:35
Lightweight interface adaptor that binds a RooAbsReal object to a subset of its servers and present i...
Double_t _funcSave
virtual ~RooRealBinding()
Destructor.
virtual void restoreXVec() const
Restore value of all variables to previously saved values by saveXVec()
void loadValues(const Double_t xvector[]) const
Load the vector of variable values into the RooRealVars associated as variables with the bound RooAbs...
virtual std::list< Double_t > * binBoundaries(Int_t) const
Double_t * _xsave
virtual void saveXVec() const
Save value of all variables.
virtual const char * getName() const
Return name of function.
std::vector< RooAbsRealLValue * > _vars
RooAbsRealLValue * observable(unsigned int i) const
Return a pointer to the observable that defines the i-th dimension of the function.
RooRealBinding(const RooAbsReal &func, const RooArgSet &vars, const RooArgSet *nset=0, Bool_t clipInvalid=kFALSE, const TNamed *rangeName=0)
Construct a lightweight function binding of RooAbsReal func to variables 'vars'.
std::vector< RooAbsReal * > _compList
virtual Double_t getMinLimit(UInt_t dimension) const
Return lower limit on i-th variable.
virtual Double_t operator()(const Double_t xvector[]) const
Evaluate the bound RooAbsReal at the variable values provided in xvector.
RooSpan< const double > getValuesOfBoundFunction(RooBatchCompute::RunContext &evalData) const
Evaluate the bound object at all locations indicated by the data in evalData.
std::vector< Double_t > _compSave
const RooArgSet * _nset
virtual RooSpan< const double > getValues(std::vector< RooSpan< const double > > coordinates) const
Evaluate the bound object at all locations indicated by the data in coordinates.
const RooAbsReal * _func
std::unique_ptr< RooBatchCompute::RunContext > _evalData
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &, Double_t, Double_t) const
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
const TNamed * _rangeName
virtual Double_t getMaxLimit(UInt_t dimension) const
Return upper limit on i-th variable.
A simple container to hold a batch of data values.
Definition: RooSpan.h:34
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
Namespace for dispatching RooFit computations to various backends.
This struct enables passing computation data around between elements of a computation graph.
Definition: RunContext.h:31