Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/RooNumIntFactory.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*****************************************************************************
0002  * Project: RooFit                                                           *
0003  * Package: RooFitCore                                                       *
0004  *    File: $Id: RooNumIntFactory.h,v 1.6 2007/05/11 09:11:30 verkerke Exp $
0005  * Authors:                                                                  *
0006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
0007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
0008  *                                                                           *
0009  * Copyright (c) 2000-2005, Regents of the University of California          *
0010  *                          and Stanford University. All rights reserved.    *
0011  *                                                                           *
0012  * Redistribution and use in source and binary forms,                        *
0013  * with or without modification, are permitted according to the terms        *
0014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
0015  *****************************************************************************/
0016 #ifndef ROO_NUM_INT_FACTORY
0017 #define ROO_NUM_INT_FACTORY
0018 
0019 #include <map>
0020 #include <string>
0021 #include "TObject.h"
0022 #include "RooLinkedList.h"
0023 #include "RooAbsIntegrator.h"
0024 
0025 #include <functional>
0026 
0027 class RooNumIntConfig ;
0028 class RooAbsFunc ;
0029 
0030 class RooNumIntFactory ;
0031 typedef void (*RooNumIntInitializerFunc)(RooNumIntFactory&) ;
0032 
0033 class RooNumIntFactory : public TObject {
0034 public:
0035 
0036   RooNumIntFactory(const RooNumIntFactory& other) = delete;
0037 
0038   using Creator = std::function<std::unique_ptr<RooAbsIntegrator>(RooAbsFunc const& function, const RooNumIntConfig& config)>;
0039 
0040   static RooNumIntFactory& instance() ;
0041 
0042   bool registerPlugin(std::string const &name, Creator const &creator, const RooArgSet &defConfig, bool canIntegrate1D,
0043                     bool canIntegrate2D, bool canIntegrateND, bool canIntegrateOpenEnded, const char *depName = "");
0044 
0045   std::string getIntegratorName(RooAbsFunc& func, const RooNumIntConfig& config, int ndim=0, bool isBinned=false) const;
0046   std::unique_ptr<RooAbsIntegrator> createIntegrator(RooAbsFunc& func, const RooNumIntConfig& config, int ndim=0, bool isBinned=false) const;
0047 
0048 
0049 private:
0050 
0051   friend class RooNumIntConfig ;
0052 
0053   struct PluginInfo {
0054     Creator creator;
0055     bool canIntegrate1D = false;
0056     bool canIntegrate2D = false;
0057     bool canIntegrateND = false;
0058     bool canIntegrateOpenEnded = false;
0059     std::string depName;
0060   };
0061 
0062   PluginInfo const* getPluginInfo(std::string const& name) const
0063   {
0064     auto item = _map.find(name);
0065     return item == _map.end() ? nullptr : &item->second;
0066   }
0067 
0068   std::map<std::string,PluginInfo> _map;
0069 
0070   RooNumIntFactory() {} // NOLINT: not allowed to use = default because of TObject::kIsOnHeap detection, see https://sft.its.cern.ch/jira/browse/ROOT-10300
0071 
0072   void init();
0073 
0074 
0075   ClassDefOverride(RooNumIntFactory, 0) // Numeric Integrator factory
0076 };
0077 
0078 #endif