Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooNumIntFactory.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooNumIntFactory.h,v 1.6 2007/05/11 09:11:30 verkerke Exp $
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#ifndef ROO_NUM_INT_FACTORY
17#define ROO_NUM_INT_FACTORY
18
19#include <map>
20#include <string>
21#include "TObject.h"
22#include "RooLinkedList.h"
23#include "RooAbsIntegrator.h"
24
25#include <functional>
26
27class RooNumIntConfig ;
28class RooAbsFunc ;
29
30class RooNumIntFactory ;
32
33class RooNumIntFactory : public TObject {
34public:
35
36 RooNumIntFactory(const RooNumIntFactory& other) = delete;
37
38 using Creator = std::function<std::unique_ptr<RooAbsIntegrator>(RooAbsFunc const& function, const RooNumIntConfig& config)>;
39
40 static RooNumIntFactory& instance() ;
41
42 bool registerPlugin(std::string const &name, Creator const &creator, const RooArgSet &defConfig, bool canIntegrate1D,
43 bool canIntegrate2D, bool canIntegrateND, bool canIntegrateOpenEnded, const char *depName = "");
44
45 std::string getIntegratorName(RooAbsFunc& func, const RooNumIntConfig& config, int ndim=0, bool isBinned=false) const;
46 std::unique_ptr<RooAbsIntegrator> createIntegrator(RooAbsFunc& func, const RooNumIntConfig& config, int ndim=0, bool isBinned=false) const;
47
48
49private:
50
51 friend class RooNumIntConfig ;
52
53 struct PluginInfo {
55 bool canIntegrate1D = false;
56 bool canIntegrate2D = false;
57 bool canIntegrateND = false;
59 std::string depName;
60 };
61
62 PluginInfo const* getPluginInfo(std::string const& name) const
63 {
64 auto item = _map.find(name);
65 return item == _map.end() ? nullptr : &item->second;
66 }
67
68 std::map<std::string,PluginInfo> _map;
69
70 RooNumIntFactory() {} // NOLINT: not allowed to use = default because of TObject::kIsOnHeap detection, see https://sft.its.cern.ch/jira/browse/ROOT-10300
71
72 void init();
73
74
75 ClassDefOverride(RooNumIntFactory, 0) // Numeric Integrator factory
76};
77
78#endif
RooAbsReal & function()
void(* RooNumIntInitializerFunc)(RooNumIntFactory &)
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
char name[80]
Definition TGX11.cxx:110
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Definition RooAbsFunc.h:27
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
Holds the configuration parameters of the various numeric integrators used by RooRealIntegral.
Factory to instantiate numeric integrators from a given function binding and a given configuration.
PluginInfo const * getPluginInfo(std::string const &name) const
std::unique_ptr< RooAbsIntegrator > createIntegrator(RooAbsFunc &func, const RooNumIntConfig &config, int ndim=0, bool isBinned=false) const
Construct a numeric integrator instance that operates on function 'func' and is configured with 'conf...
void init()
Register all known integrators by calling their static registration functions.
std::string getIntegratorName(RooAbsFunc &func, const RooNumIntConfig &config, int ndim=0, bool isBinned=false) const
std::function< std::unique_ptr< RooAbsIntegrator >(RooAbsFunc const &function, const RooNumIntConfig &config)> Creator
std::map< std::string, PluginInfo > _map
RooNumIntFactory(const RooNumIntFactory &other)=delete
static RooNumIntFactory & instance()
Static method returning reference to singleton instance of factory.
bool registerPlugin(std::string const &name, Creator const &creator, const RooArgSet &defConfig, bool canIntegrate1D, bool canIntegrate2D, bool canIntegrateND, bool canIntegrateOpenEnded, const char *depName="")
Method accepting registration of a prototype numeric integrator along with a RooArgSet of its default...
Mother of all ROOT objects.
Definition TObject.h:41