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 using Creator = std::function<std::unique_ptr<RooAbsIntegrator>(RooAbsFunc const& function, const RooNumIntConfig& config)>;
37
38 static RooNumIntFactory& instance() ;
39
40 bool registerPlugin(std::string const &name, Creator const &creator, const RooArgSet &defConfig, bool canIntegrate1D,
41 bool canIntegrate2D, bool canIntegrateND, bool canIntegrateOpenEnded, const char *depName = "");
42
43 std::unique_ptr<RooAbsIntegrator> createIntegrator(RooAbsFunc& func, const RooNumIntConfig& config, Int_t ndim=0, bool isBinned=false) const;
44
45
46private:
47
48 friend class RooNumIntConfig ;
49
50 struct PluginInfo {
52 bool canIntegrate1D = false;
53 bool canIntegrate2D = false;
54 bool canIntegrateND = false;
56 std::string depName;
57 };
58
59 PluginInfo const* getPluginInfo(const char* name) const
60 {
61 auto item = _map.find(name);
62 return item == _map.end() ? nullptr : &item->second;
63 }
64
65 std::map<std::string,PluginInfo> _map;
66
67 RooNumIntFactory() {} // NOLINT: not allowed to use = default because of TObject::kIsOnHeap detection, see ROOT-10300
68 RooNumIntFactory(const RooNumIntFactory& other) = delete;
69
70 void init();
71
72
73 ClassDefOverride(RooNumIntFactory, 0) // Numeric Integrator factory
74};
75
76#endif
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
RooNumIntConfig holds the configuration parameters of the various numeric integrators used by RooReal...
RooNumIntFactory is a factory to instantiate numeric integrators from a given function binding and a ...
void init()
Register all known integrators by calling their static registration functions.
PluginInfo const * getPluginInfo(const char *name) const
std::function< std::unique_ptr< RooAbsIntegrator >(RooAbsFunc const &function, const RooNumIntConfig &config)> Creator
std::unique_ptr< RooAbsIntegrator > createIntegrator(RooAbsFunc &func, const RooNumIntConfig &config, Int_t ndim=0, bool isBinned=false) const
Construct a numeric integrator instance that operates on function 'func' and is configured with 'conf...
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