*****************************************************************************/
#include "TClass.h"
#include "RooFit.h"
#include "RooNumIntFactory.h"
#include "RooNumIntFactory.h"
#include "RooArgSet.h"
#include "RooAbsFunc.h"
#include "RooNumIntConfig.h"
#include "RooNumber.h"
#include "RooIntegrator1D.h"
#include "RooIntegrator2D.h"
#include "RooSegmentedIntegrator1D.h"
#include "RooSegmentedIntegrator2D.h"
#include "RooImproperIntegrator1D.h"
#include "RooMCIntegrator.h"
#include "RooGaussKronrodIntegrator1D.h"
#include "RooAdaptiveGaussKronrodIntegrator1D.h"
ClassImp(RooNumIntFactory)
;
RooNumIntFactory::RooNumIntFactory()
{
RooIntegrator1D::registerIntegrator(*this) ;
RooIntegrator2D::registerIntegrator(*this) ;
RooSegmentedIntegrator1D::registerIntegrator(*this) ;
RooSegmentedIntegrator2D::registerIntegrator(*this) ;
RooImproperIntegrator1D::registerIntegrator(*this) ;
RooMCIntegrator::registerIntegrator(*this) ;
RooAdaptiveGaussKronrodIntegrator1D::registerIntegrator(*this) ;
RooGaussKronrodIntegrator1D::registerIntegrator(*this) ;
}
RooNumIntFactory::~RooNumIntFactory()
{
}
RooNumIntFactory::RooNumIntFactory(const RooNumIntFactory& other) : TObject(other)
{
}
RooNumIntFactory& RooNumIntFactory::instance()
{
static RooNumIntFactory* _instance = 0 ;
if (_instance==0) {
_instance = new RooNumIntFactory ;
}
return *_instance ;
}
Bool_t RooNumIntFactory::storeProtoIntegrator(RooAbsIntegrator* proto, const RooArgSet& defConfig, const char* depName)
{
TString name = proto->IsA()->GetName() ;
if (getProtoIntegrator(name)) {
return kTRUE ;
}
_integratorList.Add(proto) ;
_nameList.Add(new TNamed(name,name)) ;
_depList.Add(new TNamed(depName,depName)) ;
RooNumIntConfig::defaultConfig().addConfigSection(proto,defConfig) ;
return kFALSE ;
}
const RooAbsIntegrator* RooNumIntFactory::getProtoIntegrator(const char* name)
{
TObject* theNameObj = _nameList.FindObject(name) ;
if (!theNameObj) return 0 ;
Int_t index = _nameList.IndexOf(theNameObj) ;
if (index<0) return 0 ;
return (RooAbsIntegrator*) _integratorList.At(index) ;
}
const char* RooNumIntFactory::getDepIntegratorName(const char* name)
{
TObject* theNameObj = _nameList.FindObject(name) ;
if (!theNameObj) return 0 ;
Int_t index = _nameList.IndexOf(theNameObj) ;
if (index<0) return 0 ;
return _depList.At(index)->GetName() ;
}
RooAbsIntegrator* RooNumIntFactory::createIntegrator(RooAbsFunc& func, const RooNumIntConfig& config, Int_t ndimPreset)
{
Int_t ndim = ndimPreset>0 ? ndimPreset : func.getDimension() ;
Bool_t openEnded = kFALSE ;
Int_t i ;
for (i=0 ; i<ndim ; i++) {
if(RooNumber::isInfinite(func.getMinLimit(i)) ||
RooNumber::isInfinite(func.getMaxLimit(i))) {
openEnded = kTRUE ;
}
}
TString method ;
switch(ndim) {
case 1:
method = openEnded ? config.method1DOpen().getLabel() : config.method1D().getLabel() ;
break ;
case 2:
method = openEnded ? config.method2DOpen().getLabel() : config.method2D().getLabel() ;
break ;
default:
method = openEnded ? config.methodNDOpen().getLabel() : config.methodND().getLabel() ;
break ;
}
if (!method.CompareTo("N/A")) {
cout << "RooNumIntFactory::createIntegrator: No integration method has been defined for "
<< (openEnded?"an open ended ":"a ") << ndim << "-dimensional integral" << endl ;
return 0 ;
}
const RooAbsIntegrator* proto = getProtoIntegrator(method) ;
RooAbsIntegrator* engine = proto->clone(func,config) ;
if (config.printEvalCounter()) {
engine->setPrintEvalCounter(kTRUE) ;
}
return engine ;
}
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.