src/modules/DepositionGenerator/ActionInitializationPrimaries.hpp

Defines the worker initialization class. More…

Namespaces

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

Classes

Name
class allpix::ActionInitializationPrimaries
Initializer for the generator actions, required for RunManager.

Detailed Description

Defines the worker initialization class.

Copyright: Copyright (c) 2022-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_PRIMARIES_DEPOSITION_MODULE_ACTION_INITIALIZATION_H
#define ALLPIX_PRIMARIES_DEPOSITION_MODULE_ACTION_INITIALIZATION_H

#include <G4VUserActionInitialization.hh>

#include "core/config/Configuration.hpp"

#include "../DepositionGeant4/SetTrackInfoUserHookG4.hpp"

namespace allpix {
    class PrimariesReader;

    template <class GEN> class ActionInitializationPrimaries : public G4VUserActionInitialization {
    public:
        explicit ActionInitializationPrimaries(const Configuration& config, std::shared_ptr<PrimariesReader>& reader)
            : config_(config), reader_(reader){};

        void Build() const override {
            // primary particles generator
            SetUserAction(new GEN(config_, reader_));

            // tracker hook
            SetUserAction(new SetTrackInfoUserHookG4());
        };

    private:
        const Configuration& config_;
        std::shared_ptr<PrimariesReader> reader_;
    };
} // namespace allpix

#endif /* ALLPIX_PRIMARIES_DEPOSITION_MODULE_ACTION_INITIALIZATION_H */

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