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 
22 RooAbsIntegrator is the abstract interface for integrators of real-valued
23 functions that implement the RooAbsFunc interface.
24 **/
25 
26 #include "RooFit.h"
27 
28 #include "Riostream.h"
29 
30 
31 #include "RooAbsIntegrator.h"
32 #include "RooMsgService.h"
33 #include "TClass.h"
34 
35 using namespace std;
36 
38 ;
39 
40 
41 ////////////////////////////////////////////////////////////////////////////////
42 /// Default constructor
43 
44 RooAbsIntegrator::RooAbsIntegrator() : _function(0), _valid(kFALSE), _printEvalCounter(kFALSE)
45 {
46 }
47 
48 
49 
50 ////////////////////////////////////////////////////////////////////////////////
51 /// Copy constructor
52 
53 RooAbsIntegrator::RooAbsIntegrator(const RooAbsFunc& function, Bool_t doPrintEvalCounter) :
54  _function(&function), _valid(function.isValid()), _printEvalCounter(doPrintEvalCounter)
55 {
56 }
57 
58 
59 
60 ////////////////////////////////////////////////////////////////////////////////
61 /// Calculate integral value with given array of parameter values
62 
64 {
65  integrand()->resetNumCall() ;
66 
67  integrand()->saveXVec() ;
68  Double_t ret = integral(yvec) ;
69  integrand()->restoreXVec() ;
70 
71  cxcoutD(NumIntegration) << IsA()->GetName() << "::calculate(" << _function->getName() << ") number of function calls = " << integrand()->numCall()<<", result = "<<ret << endl ;
72  return ret ;
73 }
74 
75 
76 
77 ////////////////////////////////////////////////////////////////////////////////
78 /// Interface to set limits on integration
79 
81 {
82  return setLimits(&xmin,&xmax) ;
83 }
84 
85 
86 
87 ////////////////////////////////////////////////////////////////////////////////
88 /// Interface function that allows to defer limit definition to integrand definition
89 
91 {
92  return kFALSE ;
93 }
RooAbsIntegrator::integrand
const RooAbsFunc * integrand() const
Definition: RooAbsIntegrator.h:54
RooMsgService.h
RooFit.h
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
RooAbsFunc::restoreXVec
virtual void restoreXVec() const
Definition: RooAbsFunc.h:54
xmax
float xmax
Definition: THbookFile.cxx:95
TClass.h
RooAbsFunc::saveXVec
virtual void saveXVec() const
Definition: RooAbsFunc.h:51
RooFit::NumIntegration
@ NumIntegration
Definition: RooGlobalFunc.h:69
bool
RooAbsFunc
Definition: RooAbsFunc.h:23
RooAbsIntegrator::_function
const RooAbsFunc * _function
Definition: RooAbsIntegrator.h:81
RooAbsIntegrator::calculate
Double_t calculate(const Double_t *yvec=0)
Calculate integral value with given array of parameter values.
Definition: RooAbsIntegrator.cxx:63
RooAbsIntegrator::setLimits
virtual Bool_t setLimits(Double_t *, Double_t *)
Definition: RooAbsIntegrator.h:75
xmin
float xmin
Definition: THbookFile.cxx:95
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
ROOT::R::function
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Definition: RExports.h:151
RooAbsFunc::resetNumCall
void resetNumCall() const
Definition: RooAbsFunc.h:46
RooAbsIntegrator.h
Double_t
double Double_t
Definition: RtypesCore.h:59
RooAbsIntegrator::integral
virtual Double_t integral(const Double_t *yvec=0)=0
RooAbsFunc::numCall
Int_t numCall() const
Definition: RooAbsFunc.h:42
RooAbsIntegrator
Definition: RooAbsIntegrator.h:22
RooAbsIntegrator::setUseIntegrandLimits
virtual Bool_t setUseIntegrandLimits(Bool_t flag)
Interface function that allows to defer limit definition to integrand definition.
Definition: RooAbsIntegrator.cxx:90
RooAbsFunc::getName
virtual const char * getName() const
Definition: RooAbsFunc.h:59
Riostream.h
RooAbsIntegrator::RooAbsIntegrator
RooAbsIntegrator()
Default constructor.
Definition: RooAbsIntegrator.cxx:44
cxcoutD
#define cxcoutD(a)
Definition: RooMsgService.h:81