36 #define FUNC x[0]+x[1]
42 #define FUNC1D std::exp(x);
43 #define FUNC std::exp( x[0] + x[1] );
77 double Derivative(
const double *
x,
int )
const {
return FUNC; }
78 double Eval(
const double *
x)
const {
return FUNC; }
80 struct MyDerivFunction {
101 double Derivative(
double x)
const {
return FUNC1D; }
111 unsigned int NDim()
const {
return 2; }
113 DerivFunction *
Clone()
const {
114 return new DerivFunction();
120 double DoEval(
const double *
x)
const {
131 DerivFunction1D *
Clone()
const {
132 return new DerivFunction1D();
138 double DoEval(
double x)
const {
145 double Eval(
double x) {
153 template <
class Func>
157 std::vector<double>
x(Ntimes);
163 for (
int ipass = 0; ipass <
NLOOP; ++ipass) {
164 for (
int i = 0; i < Ntimes-1; ++i) {
165 const double * xx = &x[i];
171 std::cout <<
"Time for " <<
typeid(
f).
name() <<
"\t: " << w.
RealTime() <<
" " << w.
CpuTime() << std::endl;
172 std::cout << s << std::endl;
175 template <
class PFunc>
179 std::vector<double>
x(Ntimes);
186 for (
int ipass = 0; ipass <
NLOOP; ++ipass) {
187 for (
int i = 0; i < Ntimes-1; ++i) {
188 double y =
f(&x[i],p);
193 std::cout <<
"Time for " <<
typeid(
f).
name() <<
"\t: " << w.
RealTime() <<
" " << w.
CpuTime() << std::endl;
194 std::cout << s << std::endl;
205 std::vector<double>
x(Ntimes);
211 for (
int ipass = 0; ipass <
NLOOP; ++ipass) {
212 for (
int i = 0; i < Ntimes-1; ++i) {
218 std::cout <<
"Time for " <<
"TF1\t\t" <<
"\t: " << w.
RealTime() <<
" " << w.
CpuTime() << std::endl;
219 std::cout << s << std::endl;
225 std::vector<double>
x(Ntimes);
237 for (
int ipass = 0; ipass <
NLOOP; ++ipass) {
238 for (
int i = 0; i < Ntimes-1; ++i) {
245 std::cout <<
"Time for " <<
"RooPdf\t\t" <<
"\t: " << w.
RealTime() <<
" " << w.
CpuTime() << std::endl;
246 std::cout << s << std::endl;
255 std::cout <<
"\n**************************************************************\n";
256 std::cout <<
"Test of Multi-dim functors" << std::endl;
257 std::cout <<
"***************************************************************\n\n";
284 MyDerivFunction myderf;
293 std::cout <<
"\n**************************************************************\n";
294 std::cout <<
"Test of 1D functors" << std::endl;
295 std::cout <<
"***************************************************************\n\n";
334 std::cout <<
"\n**************************************************************\n";
335 std::cout <<
"Extra functor tests" << std::endl;
336 std::cout <<
"***************************************************************\n\n";
389 FunctorNV<GradFunc, MyFunction>
f5(myf);
393 Functor<GenFunc>
f6(
f3);
448 TestTimeRooPdf(rooExp,&x);
double freeRootFunc2D(const double *x, const double *)
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
GradFunctor class for Multidimensional gradient functions.
GradFunctor1D class for one-dimensional gradient functions.
Documentation for class Functor class.
Class to Wrap a ROOT Function class (like TF1) in a IParamMultiFunction interface of multi-dimensions...
Random number generator class based on the maximally quidistributed combined Tausworthe generator by ...
Class to Wrap a ROOT Function class (like TF1) in a IParamFunction interface of one dimensions to be ...
Double_t CpuTime()
Stop the stopwatch (if it is running) and return the cputime (in seconds) passed between the start an...
double freeFunction1D(double x)
Template class to wrap any C++ callable object which takes one argument i.e.
void Stop()
Stop the stopwatch.
double freeRootFunc1D(const double *xx, const double *)
Double_t getVal(const RooArgSet *set=0) const
double freeFunction(const double *x)
RooRealVar represents a fundamental (non-derived) real valued object.
virtual void setVal(Double_t value)
Set value of variable to 'value'.
void TestTimePF(PFunc &f)
IParamFunction interface (abstract class) describing multi-dimensional parameteric functions It is a ...
virtual unsigned int NDim() const =0
Retrieve the dimension of the function.
virtual void RndmArray(Int_t n, Float_t *array)
Return an array of n random numbers uniformly distributed in ]0,1].
TRObject operator()(const T1 &t1) const
void TestTime(const Func &f)
double freeParamFunc1D(double x, double *)
virtual double DoEval(double x) const =0
implementation of the evaluation function. Must be implemented by derived classes ...
Template class to wrap any C++ callable object implementing operator() (const double * x) in a multi-...
void TestTimeGF(const ROOT::Math::IGenFunction &f)
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Param Functor class for Multidimensional functions.
virtual IBaseFunctionOneDim * Clone() const =0
Clone a function.
Functor1D class for one-dimensional functions.
unsigned int NDim() const
function dimension
Documentation for the abstract class IBaseFunctionMultiDim.
virtual Double_t EvalPar(const Double_t *x, const Double_t *params=0)
Evaluate function with given coordinates and parameters.
Template class to wrap any member function of a class taking a double and returning a double in a 1D ...
virtual double DoEval(const double *x) const =0
Implementation of the evaluation function.
WrappedParamFunction class to wrap any multi-dimensional function pbject implementing the operator()(...
virtual IBaseFunctionMultiDim * Clone() const =0
Clone a function.