00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "RooFit.h"
00027 #include "Riostream.h"
00028
00029 #include "TClass.h"
00030 #include "RooSegmentedIntegrator2D.h"
00031 #include "RooArgSet.h"
00032 #include "RooIntegratorBinding.h"
00033 #include "RooRealVar.h"
00034 #include "RooNumber.h"
00035 #include "RooNumIntFactory.h"
00036 #include "RooMsgService.h"
00037
00038 #include <assert.h>
00039
00040
00041
00042 ClassImp(RooSegmentedIntegrator2D)
00043 ;
00044
00045
00046
00047 void RooSegmentedIntegrator2D::registerIntegrator(RooNumIntFactory& fact)
00048 {
00049
00050
00051 fact.storeProtoIntegrator(new RooSegmentedIntegrator2D(),RooArgSet(),RooSegmentedIntegrator1D::Class()->GetName()) ;
00052 }
00053
00054
00055
00056
00057 RooSegmentedIntegrator2D::RooSegmentedIntegrator2D() :
00058 _xIntegrator(0), _xint(0)
00059 {
00060
00061 }
00062
00063
00064
00065 RooSegmentedIntegrator2D::RooSegmentedIntegrator2D(const RooAbsFunc& function, const RooNumIntConfig& config) :
00066 RooSegmentedIntegrator1D(*(_xint=new RooIntegratorBinding(*(_xIntegrator=new RooSegmentedIntegrator1D(function,config)))),config)
00067 {
00068
00069
00070 }
00071
00072
00073
00074 RooSegmentedIntegrator2D::RooSegmentedIntegrator2D(const RooAbsFunc& function, Double_t xmin, Double_t xmax,
00075 Double_t ymin, Double_t ymax,
00076 const RooNumIntConfig& config) :
00077 RooSegmentedIntegrator1D(*(_xint=new RooIntegratorBinding(*(_xIntegrator=new RooSegmentedIntegrator1D(function,ymin,ymax,config)))),xmin,xmax,config)
00078 {
00079
00080
00081 }
00082
00083
00084
00085 RooAbsIntegrator* RooSegmentedIntegrator2D::clone(const RooAbsFunc& function, const RooNumIntConfig& config) const
00086 {
00087
00088
00089 return new RooSegmentedIntegrator2D(function,config) ;
00090 }
00091
00092
00093
00094
00095 RooSegmentedIntegrator2D::~RooSegmentedIntegrator2D()
00096 {
00097
00098
00099 delete _xint ;
00100 delete _xIntegrator ;
00101 }
00102
00103
00104
00105
00106 Bool_t RooSegmentedIntegrator2D::checkLimits() const
00107 {
00108
00109
00110
00111 if(_useIntegrandLimits) {
00112 assert(0 != integrand() && integrand()->isValid());
00113 _xmin= integrand()->getMinLimit(0);
00114 _xmax= integrand()->getMaxLimit(0);
00115 }
00116 _range= _xmax - _xmin;
00117 if(_range <= 0) {
00118 oocoutE((TObject*)0,InputArguments) << "RooIntegrator1D::checkLimits: bad range with min >= max" << endl;
00119 return kFALSE;
00120 }
00121 Bool_t ret = (RooNumber::isInfinite(_xmin) || RooNumber::isInfinite(_xmax)) ? kFALSE : kTRUE;
00122
00123
00124 if (_array && ret) {
00125 Double_t segSize = (_xmax - _xmin) / _nseg ;
00126 Int_t i ;
00127 for (i=0 ; i<_nseg ; i++) {
00128 _array[i]->setLimits(_xmin+i*segSize,_xmin+(i+1)*segSize) ;
00129 }
00130 }
00131
00132 return ret ;
00133 }
00134
00135
00136