src/modules/VisualizationGeant4/VisualizationGeant4Module.hpp

Definition of Geant4 geometry visualization module. More…

Namespaces

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

Classes

Name
class allpix::VisualizationGeant4Module
Module that shows visualization of constructed Geant4 geometry.

Detailed Description

Definition of Geant4 geometry visualization module.

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_TEST_VISUALIZATION_MODULE_H
#define ALLPIX_TEST_VISUALIZATION_MODULE_H

#include <memory>
#include <string>

#include "core/config/Configuration.hpp"
#include "core/geometry/GeometryManager.hpp"
#include "core/messenger/Messenger.hpp"
#include "core/module/Event.hpp"
#include "core/module/Module.hpp"

class G4UIsession;
class G4VisManager;

namespace allpix {
    class VisualizationGeant4Module : public Module {
        enum class ViewingMode {
            NONE,     
            GUI,      
            TERMINAL, 
        };

        enum class ColorMode {
            GENERIC,  
            CHARGE,   
            PARTICLE, 
        };

    public:
        VisualizationGeant4Module(Configuration& config, Messenger* messenger, GeometryManager* geo_manager);
        ~VisualizationGeant4Module() override;

        void initialize() override;

        void run(Event*) override;

        void finalize() override;

    private:
        GeometryManager* geo_manager_;

        void set_visualization_settings();
        void set_visualization_attributes();
        void add_visualization_volumes();

        // Check if we did run successfully, used to apply workaround in destructor if needed
        bool has_run_{false};

        ViewingMode mode_;

        // Own the Geant4 visualization manager
        std::unique_ptr<G4VisManager> vis_manager_g4_;

        // Hold information about the session
        std::string session_param_;
        char* session_param_ptr_{nullptr};
        std::unique_ptr<G4UIsession> gui_session_;
    };
} // namespace allpix

#endif /* ALLPIX_TEST_VISUALIZATION_MODULE_H */

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