Logo ROOT  
Reference Guide
RooAbsFunc.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooAbsFunc.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_ABS_FUNC
17 #define ROO_ABS_FUNC
18 
19 #include "Rtypes.h"
20 #include "RooSpan.h"
21 
22 #include <list>
23 #include <vector>
24 
25 class RooAbsRealLValue ;
26 
27 class RooAbsFunc {
28 public:
29  inline RooAbsFunc(UInt_t dimension) : _ncall(0), _dimension(dimension), _valid(kTRUE) { }
30  inline RooAbsFunc(const RooAbsFunc& other) : _ncall(0), _dimension(other._dimension), _valid(kTRUE) { }
31 
32  inline virtual ~RooAbsFunc() { }
33  inline UInt_t getDimension() const {
34  // Dimension of function
35  return _dimension;
36  }
37  inline Bool_t isValid() const {
38  // Is function in valid state
39  return _valid;
40  }
41 
42  virtual Double_t operator()(const Double_t xvector[]) const = 0;
43  virtual RooSpan<const double> getValues(std::vector<RooSpan<const double>> /*coordinates*/) const {
44  throw std::logic_error("Not implemented.");
45  }
46  virtual Double_t getMinLimit(UInt_t dimension) const = 0;
47  virtual Double_t getMaxLimit(UInt_t dimension) const = 0;
48 
49  Int_t numCall() const {
50  // Return number of function calls since last reset
51  return _ncall ;
52  }
53  void resetNumCall() const {
54  // Reset function call counter
55  _ncall = 0 ;
56  }
57 
58  virtual void saveXVec() const {
59  // Interface to save current values of observables (if supported by binding implementation)
60  } ;
61  virtual void restoreXVec() const {
62  // Interface to restore observables to saved values (if supported
63  // by binding implementation)
64  } ;
65 
66  virtual const char* getName() const {
67  // Name of function binding
68  return "(unnamed)" ;
69  }
70 
71  virtual std::list<Double_t>* binBoundaries(Int_t) const { return 0 ; }
72 
73  virtual std::list<Double_t>* plotSamplingHint(RooAbsRealLValue& /*obs*/, Double_t /*xlo*/, Double_t /*xhi*/) const {
74  // Interface for returning an optional hint for initial sampling points when constructing a curve
75  // projected on observable.
76  return 0 ;
77  }
78 
79 protected:
80  mutable Int_t _ncall ; // Function call counter
81  UInt_t _dimension; // Number of observables
82  Bool_t _valid; // Is binding in valid state?
83  ClassDef(RooAbsFunc,0) // Abstract real-valued function interface
84 };
85 
86 #endif
87 
RooAbsFunc::_ncall
Int_t _ncall
Definition: RooAbsFunc.h:80
RooAbsFunc::getMinLimit
virtual Double_t getMinLimit(UInt_t dimension) const =0
RooAbsFunc::getValues
virtual RooSpan< const double > getValues(std::vector< RooSpan< const double >>) const
Definition: RooAbsFunc.h:43
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
RooAbsFunc::getDimension
UInt_t getDimension() const
Definition: RooAbsFunc.h:33
RooAbsFunc::~RooAbsFunc
virtual ~RooAbsFunc()
Definition: RooAbsFunc.h:32
RooAbsFunc::binBoundaries
virtual std::list< Double_t > * binBoundaries(Int_t) const
Definition: RooAbsFunc.h:71
RooAbsFunc::getMaxLimit
virtual Double_t getMaxLimit(UInt_t dimension) const =0
RooAbsFunc::restoreXVec
virtual void restoreXVec() const
Definition: RooAbsFunc.h:61
RooAbsFunc::plotSamplingHint
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &, Double_t, Double_t) const
Definition: RooAbsFunc.h:73
RooAbsFunc::operator()
virtual Double_t operator()(const Double_t xvector[]) const =0
RooAbsFunc::saveXVec
virtual void saveXVec() const
Definition: RooAbsFunc.h:58
RooAbsFunc::_valid
Bool_t _valid
Definition: RooAbsFunc.h:82
bool
RooAbsFunc
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Definition: RooAbsFunc.h:27
RooAbsFunc::_dimension
UInt_t _dimension
Definition: RooAbsFunc.h:81
RooAbsFunc::resetNumCall
void resetNumCall() const
Definition: RooAbsFunc.h:53
unsigned int
RooAbsFunc::isValid
Bool_t isValid() const
Definition: RooAbsFunc.h:37
Double_t
double Double_t
Definition: RtypesCore.h:59
RooAbsFunc::RooAbsFunc
RooAbsFunc(const RooAbsFunc &other)
Definition: RooAbsFunc.h:30
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
RooAbsFunc::numCall
Int_t numCall() const
Definition: RooAbsFunc.h:49
RooSpan.h
RooAbsFunc::getName
virtual const char * getName() const
Definition: RooAbsFunc.h:66
RooAbsRealLValue
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
Definition: RooAbsRealLValue.h:31
RooAbsFunc::RooAbsFunc
RooAbsFunc(UInt_t dimension)
Definition: RooAbsFunc.h:29
Rtypes.h
RooSpan
A simple container to hold a batch of data values.
Definition: RooSpan.h:34
int