Loading [MathJax]/extensions/tex2jax.js

Search Results

 /*
  *  MoMEMta: a modular implementation of the Matrix Element Method
  *  Copyright (C) 2016  Universite catholique de Louvain (UCL), Belgium
  *
  *  This program is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation, either version 3 of the License, or
  *  (at your option) any later version.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 
 #pragma once
 
 #include <momemta/impl/Pool.h>
 #include <momemta/InputTag.h>
 #include <momemta/ModuleRegistry.h>
 
 class Module {
     public:
         // FIXME: Naming
         enum class Status: std::int8_t {
             OK,
             NEXT,
             ABORT
         };
 
         class invalid_configuration: public std::runtime_error {
             using std::runtime_error::runtime_error;
         };
 
         static std::string statusToString(const Status& status);
 
         Module(PoolPtr pool, const std::string& name):
             m_name(name), m_pool(pool) {
             // Empty
         }
 
         virtual void configure() { };
 
         virtual void beginIntegration() {};
 
         virtual void beginPoint() {};
 
         virtual void beginLoop() {};
 
         virtual Status work() { return Status::OK; };
 
         virtual void endLoop() {};
 
         virtual void endPoint() {};
 
         virtual void endIntegration() {};
 
         virtual void finish() { };
 
         virtual std::string name() const final {
             return m_name;
         }
 
         inline static bool is_virtual_module(const std::string& name) {
             return (name == "momemta") || (name == "input") || (name == "cuba");
         }
 
     protected:
         template<typename T, typename... Args> std::shared_ptr<T> produce(const std::string& name, Args... args) {
             return m_pool->put<T>({m_name, name}, std::forward<Args>(args)...);
         }
 
         template<typename T> Value<T> get(const std::string& module, const std::string& name) {
             return m_pool->get<T>({module, name});
         }
 
         template<typename T> Value<T> get(const InputTag& tag) {
             return m_pool->get<T>(tag);
         }
 
     private:
 
         const std::string m_name;
 
     protected:
 
         PoolPtr m_pool;
 };
 
 using ModulePtr = std::shared_ptr<Module>;
All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Modules Pages