src/modules/DepositionGeant4/GeneratorActionG4.hpp

Defines the particle generator. More…

Namespaces

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

Classes

Name
class allpix::GeneratorActionG4
Generates the particles in every event.
class allpix::GeneratorActionInitializationMaster
Creates and initialize the GPS messenger on master before workers use it.

Detailed Description

Defines the particle generator.

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_SIMPLE_DEPOSITION_MODULE_GENERATOR_ACTION_H
#define ALLPIX_SIMPLE_DEPOSITION_MODULE_GENERATOR_ACTION_H

#include <memory>

#include <G4GeneralParticleSource.hh>
#include <G4ParticleDefinition.hh>
#include <G4SDManager.hh>
#include <G4ThreeVector.hh>
#include <G4TwoVector.hh>
#include <G4VUserPrimaryGeneratorAction.hh>

#include "core/config/Configuration.hpp"

namespace allpix {
    class GeneratorActionG4 : public G4VUserPrimaryGeneratorAction {
    public:
        enum class SourceType {
            MACRO,  
            BEAM,   
            SPHERE, 
            SQUARE, 
            POINT,  
        };

        enum class BeamShape {
            CIRCLE,    
            ELLIPSE,   
            RECTANGLE, 
        };

        explicit GeneratorActionG4(const Configuration& config);

        void GeneratePrimaries(G4Event*) override;

    private:
        std::unique_ptr<G4GeneralParticleSource> particle_source_;

        static std::map<std::string, std::tuple<int, int, int, double>> isotopes_;

        const Configuration& config_;

        std::string particle_type_;

        bool initialize_ion_as_particle_{false};
    };

    class GeneratorActionInitializationMaster {
    public:
        explicit GeneratorActionInitializationMaster(const Configuration& config);

    private:
        std::unique_ptr<G4GeneralParticleSource> particle_source_;
    };
} // namespace allpix

#endif /* ALLPIX_SIMPLE_DEPOSITION_MODULE_GENERATOR_ACTION_H */

Updated on 2025-02-27 at 14:14:46 +0000