Logo ROOT  
Reference Guide
RooAbsIntegrator.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * @(#)root/roofitcore:$Id$
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
17/**
18\file RooAbsIntegrator.cxx
19\class RooAbsIntegrator
20\ingroup Roofitcore
21
22RooAbsIntegrator is the abstract interface for integrators of real-valued
23functions that implement the RooAbsFunc interface.
24**/
25
26#include "Riostream.h"
27
28#include "RooAbsIntegrator.h"
29#include "RooMsgService.h"
30#include "TClass.h"
31
32using namespace std;
33
35;
36
37
38////////////////////////////////////////////////////////////////////////////////
39/// Default constructor
40
41RooAbsIntegrator::RooAbsIntegrator() : _function(0), _valid(false), _printEvalCounter(false)
42{
43}
44
45
46
47////////////////////////////////////////////////////////////////////////////////
48/// Copy constructor
49
50RooAbsIntegrator::RooAbsIntegrator(const RooAbsFunc& function, bool doPrintEvalCounter) :
51 _function(&function), _valid(function.isValid()), _printEvalCounter(doPrintEvalCounter)
52{
53}
54
55
56
57////////////////////////////////////////////////////////////////////////////////
58/// Calculate integral value with given array of parameter values
59
60double RooAbsIntegrator::calculate(const double *yvec)
61{
64 integrand()->saveXVec() ;
65 double ret = integral(yvec) ;
67
68 cxcoutD(NumIntegration) << ClassName() << "::calculate(" << _function->getName() << ") number of function calls = " << integrand()->numCall()<<", result = "<<ret << endl ;
69 return ret ;
70}
71
72
73
74////////////////////////////////////////////////////////////////////////////////
75/// Interface to set limits on integration
76
78{
79 return setLimits(&xmin,&xmax) ;
80}
81
82
83
84////////////////////////////////////////////////////////////////////////////////
85/// Interface function that allows to defer limit definition to integrand definition
86
88{
89 return false ;
90}
#define cxcoutD(a)
Definition: RooMsgService.h:85
#define ClassImp(name)
Definition: Rtypes.h:375
float xmin
Definition: THbookFile.cxx:95
float xmax
Definition: THbookFile.cxx:95
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Definition: RooAbsFunc.h:27
virtual void saveXVec() const
Definition: RooAbsFunc.h:56
void resetNumCall() const
Reset function call counter.
Definition: RooAbsFunc.h:52
Int_t numCall() const
Return number of function calls since last reset.
Definition: RooAbsFunc.h:47
virtual void restoreXVec() const
Definition: RooAbsFunc.h:59
virtual const char * getName() const
Name of function binding.
Definition: RooAbsFunc.h:65
RooAbsIntegrator is the abstract interface for integrators of real-valued functions that implement th...
virtual bool setUseIntegrandLimits(bool flag)
Interface function that allows to defer limit definition to integrand definition.
double calculate(const double *yvec=nullptr)
Calculate integral value with given array of parameter values.
virtual double integral(const double *yvec=nullptr)=0
const RooAbsFunc * _function
Pointer to function binding of integrand.
RooAbsIntegrator()
Default constructor.
const RooAbsFunc * integrand() const
Return integrand function binding.
virtual bool setLimits(double *, double *)
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:207
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Definition: RExports.h:167
@ NumIntegration
Definition: RooGlobalFunc.h:64