56 _nset(
"nset",
"nset",this,false,false),
57 _func(
"function",
"function",this,func),
61 throw std::runtime_error(
Form(
"RooDerivative::ctor(%s) ERROR, derivation order must be 1,2 or 3",
name)) ;
96 _rd = std::make_unique<ROOT::Math::RichardsonDerivator>(wf,
_eps,
true);
102 double valMin = xVar.
getMin();
103 double valMax = xVar.getMax();
104 bool isCloseLo = val - valMin <
_eps;
105 bool isCloseHi = valMax - val <
_eps;
108 if (isCloseLo && isCloseHi) {
109 std::stringstream errMsg;
110 errMsg <<
"error in numerical derivator: 2 * epsilon is larger than the variable range!";
111 coutE(Eval) << errMsg.str() << std::endl;
112 throw std::runtime_error(errMsg.str());
116 if (isCloseLo || isCloseHi) {
121 return isCloseLo ?
_rd->DerivativeForward(val) :
_rd->DerivativeBackward(val);
125 const double eps = std::numeric_limits<double>::epsilon();
126 const double yval1 =
_ftor->eval(val);
128 if (std::abs(yval2 - yval1) <=
eps) {
133 std::stringstream errMsg;
134 errMsg <<
"error in numerical derivator: variable value is to close to limits to compute finite differences";
135 coutE(Eval) << errMsg.str() << std::endl;
136 throw std::runtime_error(errMsg.str());
140 case 1:
return _rd->Derivative1(val);
141 case 2:
return _rd->Derivative2(val);
142 case 3:
return _rd->Derivative3(val);
int Int_t
Signed integer 4 bytes (int).
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Template class to wrap any C++ callable object which takes one argument i.e.
friend class RooAbsCollection
virtual double getMin(const char *name=nullptr) const
Get minimum of currently defined range.
RooAbsReal()
coverity[UNINIT_CTOR] Default constructor
bool redirectServersHook(const RooAbsCollection &newServerList, bool mustReplaceAll, bool nameChange, bool isRecursiveStep) override
Function that is called at the end of redirectServers().
RooArgSet is a container object that can hold multiple RooAbsArg objects.
std::unique_ptr< ROOT::Math::RichardsonDerivator > _rd
! Derivator
~RooDerivative() override
RooDerivative()
Default constructor.
std::unique_ptr< RooFunctor > _ftor
! Functor binding of RooAbsReal
RooSetProxy _nset
Normalization set (optional).
bool redirectServersHook(const RooAbsCollection &, bool, bool, bool) override
Zap functor and derivator ;.
Int_t _order
Derivation order.
double evaluate() const override
Calculate value.
RooRealProxy _func
Input function.
RooRealProxy _x
Observable.
Variable that can be changed from the outside.