Logo ROOT  
Reference Guide
RooSegmentedIntegrator2D.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 RooSegmentedIntegrator2D.cxx
19 \class RooSegmentedIntegrator2D
20 \ingroup Roofitcore
21 
22 RooSegmentedIntegrator2D implements an adaptive one-dimensional
23 numerical integration algorithm.
24 **/
25 
26 
27 #include "RooFit.h"
28 #include "Riostream.h"
29 
30 #include "TClass.h"
32 #include "RooArgSet.h"
33 #include "RooIntegratorBinding.h"
34 #include "RooRealVar.h"
35 #include "RooNumber.h"
36 #include "RooNumIntFactory.h"
37 #include "RooMsgService.h"
38 
39 #include <assert.h>
40 
41 
42 
43 using namespace std;
44 
46 ;
47 
48 
49 ////////////////////////////////////////////////////////////////////////////////
50 /// Register RooSegmentedIntegrator2D, its parameters, dependencies and capabilities with RooNumIntFactory
51 
53 {
55 }
56 
57 
58 
59 ////////////////////////////////////////////////////////////////////////////////
60 /// Default constructor
61 
63  _xIntegrator(0), _xint(0)
64 {
65 }
66 
67 
68 ////////////////////////////////////////////////////////////////////////////////
69 /// Constructor of integral on given function binding and with given configuration. The
70 /// integration limits are taken from the definition in the function binding
71 
73  RooSegmentedIntegrator1D(*(_xint=new RooIntegratorBinding(*(_xIntegrator=new RooSegmentedIntegrator1D(function,config)))),config)
74 {
75 }
76 
77 
78 ////////////////////////////////////////////////////////////////////////////////
79 /// Constructor integral on given function binding, with given configuration and
80 /// explicit definition of integration range
81 
84  const RooNumIntConfig& config) :
85  RooSegmentedIntegrator1D(*(_xint=new RooIntegratorBinding(*(_xIntegrator=new RooSegmentedIntegrator1D(function,ymin,ymax,config)))),xmin,xmax,config)
86 {
87 }
88 
89 
90 ////////////////////////////////////////////////////////////////////////////////
91 /// Virtual constructor with given function and configuration. Needed by RooNumIntFactory
92 
94 {
95  return new RooSegmentedIntegrator2D(function,config) ;
96 }
97 
98 
99 
100 ////////////////////////////////////////////////////////////////////////////////
101 /// Destructor
102 
104 {
105  delete _xint ;
106  delete _xIntegrator ;
107 }
108 
109 
110 
111 ////////////////////////////////////////////////////////////////////////////////
112 /// Check that our integration range is finite and otherwise return kFALSE.
113 /// Update the limits from the integrand if requested.
114 
116 {
117  if(_useIntegrandLimits) {
118  assert(0 != integrand() && integrand()->isValid());
119  _xmin= integrand()->getMinLimit(0);
120  _xmax= integrand()->getMaxLimit(0);
121  }
122  _range= _xmax - _xmin;
123  if(_range <= 0) {
124  oocoutE((TObject*)0,InputArguments) << "RooIntegrator1D::checkLimits: bad range with min >= max" << endl;
125  return kFALSE;
126  }
128 
129  // Adjust component integrators, if already created
130  if (_array && ret) {
131  Double_t segSize = (_xmax - _xmin) / _nseg ;
132  Int_t i ;
133  for (i=0 ; i<_nseg ; i++) {
134  _array[i]->setLimits(_xmin+i*segSize,_xmin+(i+1)*segSize) ;
135  }
136  }
137 
138  return ret ;
139 }
140 
141 
142 
RooNumIntFactory
RooNumIntFactory is a factory to instantiate numeric integrators from a given function binding and a ...
Definition: RooNumIntFactory.h:30
RooAbsIntegrator::integrand
const RooAbsFunc * integrand() const
Definition: RooAbsIntegrator.h:40
RooSegmentedIntegrator2D
RooSegmentedIntegrator2D implements an adaptive one-dimensional numerical integration algorithm.
Definition: RooSegmentedIntegrator2D.h:23
RooAbsFunc::getMinLimit
virtual Double_t getMinLimit(UInt_t dimension) const =0
ymax
float ymax
Definition: THbookFile.cxx:95
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
RooIntegratorBinding.h
RooMsgService.h
RooFit.h
RooFit::InputArguments
@ InputArguments
Definition: RooGlobalFunc.h:61
RooArgSet.h
RooIntegrator1D::setLimits
Bool_t setLimits(Double_t *xmin, Double_t *xmax)
Change our integration limits.
Definition: RooIntegrator1D.cxx:240
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
RooAbsFunc::getMaxLimit
virtual Double_t getMaxLimit(UInt_t dimension) const =0
xmax
float xmax
Definition: THbookFile.cxx:95
TClass.h
RooSegmentedIntegrator2D::~RooSegmentedIntegrator2D
virtual ~RooSegmentedIntegrator2D()
Destructor.
Definition: RooSegmentedIntegrator2D.cxx:103
oocoutE
#define oocoutE(o, a)
Definition: RooMsgService.h:48
RooSegmentedIntegrator2D::clone
virtual RooAbsIntegrator * clone(const RooAbsFunc &function, const RooNumIntConfig &config) const
Virtual constructor with given function and configuration. Needed by RooNumIntFactory.
Definition: RooSegmentedIntegrator2D.cxx:93
bool
RooAbsFunc
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Definition: RooAbsFunc.h:27
RooSegmentedIntegrator1D::_xmax
Double_t _xmax
Definition: RooSegmentedIntegrator1D.h:52
RooSegmentedIntegrator2D::checkLimits
virtual Bool_t checkLimits() const
Check that our integration range is finite and otherwise return kFALSE.
Definition: RooSegmentedIntegrator2D.cxx:115
RooSegmentedIntegrator1D
RooSegmentedIntegrator1D implements an adaptive one-dimensional numerical integration algorithm.
Definition: RooSegmentedIntegrator1D.h:23
xmin
float xmin
Definition: THbookFile.cxx:95
RooSegmentedIntegrator2D.h
RooSegmentedIntegrator1D::_xmin
Double_t _xmin
Definition: RooSegmentedIntegrator1D.h:51
RooAbsIntegrator::isValid
Bool_t isValid() const
Definition: RooAbsIntegrator.h:31
RooNumber::isInfinite
static Int_t isInfinite(Double_t x)
Return true if x is infinite by RooNumBer internal specification.
Definition: RooNumber.cxx:58
RooSegmentedIntegrator2D::RooSegmentedIntegrator2D
RooSegmentedIntegrator2D()
Default constructor.
Definition: RooSegmentedIntegrator2D.cxx:62
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
ROOT::R::function
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Definition: RExports.h:151
RooNumIntFactory::storeProtoIntegrator
Bool_t storeProtoIntegrator(RooAbsIntegrator *proto, const RooArgSet &defConfig, const char *depName="")
Method accepting registration of a prototype numeric integrator along with a RooArgSet of its default...
Definition: RooNumIntFactory.cxx:119
RooSegmentedIntegrator2D::registerIntegrator
static void registerIntegrator(RooNumIntFactory &fact)
Register RooSegmentedIntegrator2D, its parameters, dependencies and capabilities with RooNumIntFactor...
Definition: RooSegmentedIntegrator2D.cxx:52
RooRealVar.h
ymin
float ymin
Definition: THbookFile.cxx:95
RooNumber.h
RooSegmentedIntegrator1D::_nseg
Int_t _nseg
Definition: RooSegmentedIntegrator1D.h:55
Double_t
double Double_t
Definition: RtypesCore.h:59
RooSegmentedIntegrator2D::_xIntegrator
RooSegmentedIntegrator1D * _xIntegrator
Definition: RooSegmentedIntegrator2D.h:47
RooSegmentedIntegrator1D::_range
Double_t _range
Definition: RooSegmentedIntegrator1D.h:53
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
RooIntegratorBinding
Function binding representing the output of a RooAbsIntegrator.
Definition: RooIntegratorBinding.h:22
RooNumIntConfig
RooNumIntConfig holds the configuration parameters of the various numeric integrators used by RooReal...
Definition: RooNumIntConfig.h:25
RooAbsIntegrator
RooAbsIntegrator is the abstract interface for integrators of real-valued functions that implement th...
Definition: RooAbsIntegrator.h:22
Class
void Class()
Definition: Class.C:29
Riostream.h
RooSegmentedIntegrator1D::_array
RooIntegrator1D ** _array
Definition: RooSegmentedIntegrator1D.h:59
RooSegmentedIntegrator2D::_xint
RooAbsFunc * _xint
Definition: RooSegmentedIntegrator2D.h:48
RooNumIntFactory.h
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:33
int
RooSegmentedIntegrator1D::_useIntegrandLimits
Bool_t _useIntegrandLimits
Definition: RooSegmentedIntegrator1D.h:56