Logo ROOT  
Reference Guide
Go to the documentation of this file.
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 *****************************************************************************/
19#include "RooAbsFunc.h"
20#include "RooSpan.h"
21#include <vector>
22#include <memory>
25class RooAbsReal;
26class RooArgSet;
27namespace RooBatchCompute{ struct RunContext; }
29class RooRealBinding : public RooAbsFunc {
31 RooRealBinding(const RooAbsReal& func, const RooArgSet &vars, const RooArgSet* nset=nullptr, bool clipInvalid=false, const TNamed* rangeName=nullptr);
32 RooRealBinding(const RooRealBinding& other, const RooArgSet* nset=nullptr) ;
33 ~RooRealBinding() override;
35 double operator()(const double xvector[]) const override;
36 virtual RooSpan<const double> getValues(std::vector<RooSpan<const double>> coordinates) const;
38 double getMinLimit(UInt_t dimension) const override;
39 double getMaxLimit(UInt_t dimension) const override;
41 void saveXVec() const override ;
42 void restoreXVec() const override ;
44 const char* getName() const override ;
46 std::list<double>* binBoundaries(Int_t) const override ;
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 std::list<double>* plotSamplingHint(RooAbsRealLValue& /*obs*/, double /*xlo*/, double /*xhi*/) const override ;
53 void loadValues(const double xvector[]) const;
55 std::vector<RooAbsRealLValue*> _vars; ///< Non-owned pointers to variables
57 mutable bool _xvecValid;
59 mutable double* _xsave ;
60 const TNamed* _rangeName ; ///<!
62 mutable std::vector<RooAbsReal*> _compList ; ///<!
63 mutable std::vector<double> _compSave ; ///<!
64 mutable double _funcSave ; ///<!
65 mutable std::unique_ptr<RooBatchCompute::RunContext> _evalData; ///< Memory for batch evaluations
67 ClassDefOverride(RooRealBinding,0) // Function binding to RooAbsReal object
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
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:60
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:56
Lightweight interface adaptor that binds a RooAbsReal object to a subset of its servers and present i...
std::list< double > * plotSamplingHint(RooAbsRealLValue &, double, double) const override
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
double getMinLimit(UInt_t dimension) const override
Return lower limit on i-th variable.
~RooRealBinding() override
double operator()(const double xvector[]) const override
Evaluate the bound RooAbsReal at the variable values provided in xvector.
double getMaxLimit(UInt_t dimension) const override
Return upper limit on i-th variable.
RooRealBinding(const RooAbsReal &func, const RooArgSet &vars, const RooArgSet *nset=nullptr, bool clipInvalid=false, const TNamed *rangeName=nullptr)
Construct a lightweight function binding of RooAbsReal func to variables 'vars'.
void restoreXVec() const override
Restore value of all variables to previously saved values by saveXVec()
std::list< double > * binBoundaries(Int_t) const override
std::vector< RooAbsRealLValue * > _vars
Non-owned pointers to variables.
RooAbsRealLValue * observable(unsigned int i) const
Return a pointer to the observable that defines the i-th dimension of the function.
std::vector< RooAbsReal * > _compList
std::vector< double > _compSave
const char * getName() const override
Return name of function.
RooSpan< const double > getValuesOfBoundFunction(RooBatchCompute::RunContext &evalData) const
Evaluate the bound object at all locations indicated by the data in evalData.
void loadValues(const double xvector[]) const
Load the vector of variable values into the RooRealVars associated as variables with the bound RooAbs...
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
Memory for batch evaluations.
const TNamed * _rangeName
void saveXVec() const override
Save value of all variables.
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:32