ROOT  6.06/09
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 //
19 // BEGIN_HTML
20 // RooSegmentedIntegrator2D implements an adaptive one-dimensional
21 // numerical integration algorithm.
22 // END_HTML
23 //
24 
25 
26 #include "RooFit.h"
27 #include "Riostream.h"
28 
29 #include "TClass.h"
31 #include "RooArgSet.h"
32 #include "RooIntegratorBinding.h"
33 #include "RooRealVar.h"
34 #include "RooNumber.h"
35 #include "RooNumIntFactory.h"
36 #include "RooMsgService.h"
37 
38 #include <assert.h>
39 
40 
41 
42 using namespace std;
43 
45 ;
46 
47 
48 ////////////////////////////////////////////////////////////////////////////////
49 /// Register RooSegmentedIntegrator2D, its parameters, dependencies and capabilities with RooNumIntFactory
50 
52 {
54 }
55 
56 
57 
58 ////////////////////////////////////////////////////////////////////////////////
59 /// Default constructor
60 
62  _xIntegrator(0), _xint(0)
63 {
64 }
65 
66 
67 ////////////////////////////////////////////////////////////////////////////////
68 /// Constructor of integral on given function binding and with given configuration. The
69 /// integration limits are taken from the definition in the function binding
70 
72  RooSegmentedIntegrator1D(*(_xint=new RooIntegratorBinding(*(_xIntegrator=new RooSegmentedIntegrator1D(function,config)))),config)
73 {
74 }
75 
76 
77 ////////////////////////////////////////////////////////////////////////////////
78 /// Constructor integral on given function binding, with given configuration and
79 /// explicit definition of integration range
80 
83  const RooNumIntConfig& config) :
84  RooSegmentedIntegrator1D(*(_xint=new RooIntegratorBinding(*(_xIntegrator=new RooSegmentedIntegrator1D(function,ymin,ymax,config)))),xmin,xmax,config)
85 {
86 }
87 
88 
89 ////////////////////////////////////////////////////////////////////////////////
90 /// Virtual constructor with given function and configuration. Needed by RooNumIntFactory
91 
93 {
94  return new RooSegmentedIntegrator2D(function,config) ;
95 }
96 
97 
98 
99 ////////////////////////////////////////////////////////////////////////////////
100 /// Destructor
101 
103 {
104  delete _xint ;
105  delete _xIntegrator ;
106 }
107 
108 
109 
110 ////////////////////////////////////////////////////////////////////////////////
111 /// Check that our integration range is finite and otherwise return kFALSE.
112 /// Update the limits from the integrand if requested.
113 
115 {
116  if(_useIntegrandLimits) {
117  assert(0 != integrand() && integrand()->isValid());
118  _xmin= integrand()->getMinLimit(0);
119  _xmax= integrand()->getMaxLimit(0);
120  }
121  _range= _xmax - _xmin;
122  if(_range <= 0) {
123  oocoutE((TObject*)0,InputArguments) << "RooIntegrator1D::checkLimits: bad range with min >= max" << endl;
124  return kFALSE;
125  }
127 
128  // Adjust component integrators, if already created
129  if (_array && ret) {
130  Double_t segSize = (_xmax - _xmin) / _nseg ;
131  Int_t i ;
132  for (i=0 ; i<_nseg ; i++) {
133  _array[i]->setLimits(_xmin+i*segSize,_xmin+(i+1)*segSize) ;
134  }
135  }
136 
137  return ret ;
138 }
139 
140 
141 
float xmin
Definition: THbookFile.cxx:93
virtual ~RooSegmentedIntegrator2D()
Destructor.
RooSegmentedIntegrator2D()
Default constructor.
float ymin
Definition: THbookFile.cxx:93
#define assert(cond)
Definition: unittest.h:542
virtual RooAbsIntegrator * clone(const RooAbsFunc &function, const RooNumIntConfig &config) const
Virtual constructor with given function and configuration. Needed by RooNumIntFactory.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
static Int_t isInfinite(Double_t x)
Return true if x is infinite by RooNumBer internal specification.
Definition: RooNumber.cxx:57
STL namespace.
void Class()
Definition: Class.C:29
#define oocoutE(o, a)
Definition: RooMsgService.h:48
float ymax
Definition: THbookFile.cxx:93
void function(const char *name_, T fun, const char *docstring=0)
Definition: RExports.h:159
virtual Double_t getMinLimit(UInt_t dimension) const =0
float xmax
Definition: THbookFile.cxx:93
Bool_t setLimits(Double_t *xmin, Double_t *xmax)
Change our integration limits.
virtual Bool_t checkLimits() const
Check that our integration range is finite and otherwise return kFALSE.
virtual Double_t getMaxLimit(UInt_t dimension) const =0
double Double_t
Definition: RtypesCore.h:55
ClassImp(RooSegmentedIntegrator2D)
static void registerIntegrator(RooNumIntFactory &fact)
Register RooSegmentedIntegrator2D, its parameters, dependencies and capabilities with RooNumIntFactor...
Mother of all ROOT objects.
Definition: TObject.h:58
const RooAbsFunc * integrand() const
RooSegmentedIntegrator1D * _xIntegrator
Bool_t isValid() const
const Bool_t kTRUE
Definition: Rtypes.h:91
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...