src/core/Allpix.hpp

Interface to the core framework. More…

Namespaces

Name
allpix
Helper class to hold support layers for a detector model.

Classes

Name
class allpix::Allpix
Provides the link between the core framework and the executable.

Detailed Description

Interface to the core framework.

Copyright: Copyright (c) 2017-2024 CERN and the Allpix Squared authors. This software is distributed under the terms of the MIT License, copied verbatim in the file “LICENSE.md”. In applying this license, CERN does not waive the privileges and immunities granted to it by virtue of its status as an Intergovernmental Organization or submit itself to any jurisdiction. SPDX-License-Identifier: MIT

Source code


#ifndef ALLPIX_ALLPIX_H
#define ALLPIX_ALLPIX_H

#include <atomic>
#include <fstream>
#include <memory>
#include <string>

#include "config/ConfigManager.hpp"
#include "geometry/GeometryManager.hpp"
#include "messenger/Messenger.hpp"
#include "module/ModuleManager.hpp"

namespace allpix {
    class Allpix {
    public:
        explicit Allpix(std::string config_file_name,
                        const std::vector<std::string>& module_options = std::vector<std::string>(),
                        const std::vector<std::string>& detector_options = std::vector<std::string>());

        void load();

        void initialize();

        void run();

        void finalize();

        void terminate();

    private:
        void set_style();

        // Indicate the framework should terminate
        std::atomic<bool> terminate_;
        std::atomic<bool> has_run_;

        // Log file if specified
        std::ofstream log_file_;

        // All managers in the framework
        std::unique_ptr<Messenger> msg_;
        std::unique_ptr<ModuleManager> mod_mgr_;
        std::unique_ptr<ConfigManager> conf_mgr_;
        std::unique_ptr<GeometryManager> geo_mgr_{};

        // Random generators
        RandomNumberGenerator seeder_modules_;
        RandomNumberGenerator seeder_core_;
    };
} // namespace allpix

#endif /* ALLPIX_ALLPIX_H */

Updated on 2024-12-13 at 08:31:37 +0000