RooSegmentedIntegrator2D.cxx

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  * @(#)root/roofitcore:$Id: RooSegmentedIntegrator2D.cxx 24285 2008-06-16 15:05:15Z wouter $
00005  * Authors:                                                                  *
00006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
00007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
00008  *                                                                           *
00009  * Copyright (c) 2000-2005, Regents of the University of California          *
00010  *                          and Stanford University. All rights reserved.    *
00011  *                                                                           *
00012  * Redistribution and use in source and binary forms,                        *
00013  * with or without modification, are permitted according to the terms        *
00014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
00015  *****************************************************************************/
00016 
00017 //////////////////////////////////////////////////////////////////////////////
00018 //
00019 // BEGIN_HTML
00020 // RooSegmentedIntegrator2D implements an adaptive one-dimensional 
00021 // numerical integration algorithm.
00022 // END_HTML
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   // Register RooSegmentedIntegrator2D, its parameters, dependencies and capabilities with RooNumIntFactory
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   // Default constructor
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   // Constructor of integral on given function binding and with given configuration. The
00069   // integration limits are taken from the definition in the function binding
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   // Constructor integral on given function binding, with given configuration and
00080   // explicit definition of integration range
00081 } 
00082 
00083 
00084 //_____________________________________________________________________________
00085 RooAbsIntegrator* RooSegmentedIntegrator2D::clone(const RooAbsFunc& function, const RooNumIntConfig& config) const
00086 {
00087   // Virtual constructor with given function and configuration. Needed by RooNumIntFactory
00088 
00089   return new RooSegmentedIntegrator2D(function,config) ;
00090 }
00091 
00092 
00093 
00094 //_____________________________________________________________________________
00095 RooSegmentedIntegrator2D::~RooSegmentedIntegrator2D() 
00096 {
00097   // Destructor
00098 
00099   delete _xint ;
00100   delete _xIntegrator ;
00101 }
00102 
00103 
00104 
00105 //_____________________________________________________________________________
00106 Bool_t RooSegmentedIntegrator2D::checkLimits() const 
00107 {
00108   // Check that our integration range is finite and otherwise return kFALSE.
00109   // Update the limits from the integrand if requested.
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   // Adjust component integrators, if already created
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 

Generated on Tue Jul 5 15:07:30 2011 for ROOT_528-00b_version by  doxygen 1.5.1