src/modules/DepositionGeant4/ActionInitializationG4.hpp
Defines the worker initialization class. More…
Namespaces
Name |
---|
allpix Helper class to hold support layers for a detector model. |
Classes
Name | |
---|---|
class | allpix::ActionInitializationG4 Initializer for the tracker and generator actions, required for RunManager. |
Detailed Description
Defines the worker initialization class.
Copyright: Copyright (c) 2019-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_ACTION_INITIALIZATION_H
#define ALLPIX_SIMPLE_DEPOSITION_MODULE_ACTION_INITIALIZATION_H
#include <G4VUserActionInitialization.hh>
#include "core/config/Configuration.hpp"
#include "SetTrackInfoUserHookG4.hpp"
#include "StepInfoUserHookG4.hpp"
namespace allpix {
template <class GEN, class INIT> class ActionInitializationG4 : public G4VUserActionInitialization {
public:
explicit ActionInitializationG4(const Configuration& config) : config_(config){};
void Build() const override {
// primary particles generator
SetUserAction(new GEN(config_));
// tracker hook
SetUserAction(new SetTrackInfoUserHookG4());
// step hook
SetUserAction(new StepInfoUserHookG4());
};
void BuildForMaster() const override {
// UI Commands are applied through the GPS messenger which is a singleton instance
// that modifies shared resources across threads and therefore must only be executed
// on the master thread.
// We force the creation of the messenger early on master and apply UI commands so
// that when workers are ready to use their own instances of GPS class they are
// initialized with common UI commands
static INIT generator(config_);
(void)generator;
}
private:
const Configuration& config_;
};
} // namespace allpix
#endif /* ALLPIX_SIMPLE_DEPOSITION_MODULE_ACTION_INITIALIZATION_H */
Updated on 2025-02-27 at 14:14:46 +0000