ATLAS Offline Software
Loading...
Searching...
No Matches
G4AtlasAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef G4ATLASALG_G4AtlasAlg_H
6#define G4ATLASALG_G4AtlasAlg_H
7
8// Base class header
10
11// STL headers
12#include <map>
13#include <string>
14
15// Gaudi headers
16#include "GaudiKernel/ServiceHandle.h"
17#include "GaudiKernel/ToolHandle.h"
18
19// Athena headers
35
36// ISF includes
40
53{
54
55public:
56
58 G4AtlasAlg(const std::string& name, ISvcLocator* pSvcLocator);
59
61 virtual ~G4AtlasAlg() { };
62
64 bool isClonable() const override { return true; }
65
72 StatusCode initialize ATLAS_NOT_THREAD_SAFE () override;
73
75 StatusCode finalize() override;
76
78 StatusCode execute(const EventContext& ctx) override;
79
81 void initializeG4();
82
85 void initializeOnce();
86
89 void finalizeOnce();
90
91private:
92
94 void commandLog(int returnCode, const std::string& commandString) const;
95
98 void releaseGeoModel();
99
102 Gaudi::Property<bool> m_killAbortedEvents{this, "KillAbortedEvents", false, ""};
103 Gaudi::Property<bool> m_flagAbortedEvents{this, "FlagAbortedEvents", false, ""};
104 SG::ReadHandleKey<McEventCollection> m_inputTruthCollectionKey{this, "InputTruthCollection", "BeamTruthEvent", "Input hard scatter collection"};
105 SG::WriteHandleKey<McEventCollection> m_outputTruthCollectionKey{this, "OutputTruthCollection", "TruthEvent", "Output hard scatter truth collection"};
106 SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this, "EventInfo", "EventInfo", "EventInfo key"};
107
109 ServiceHandle<ISF::ITruthSvc> m_truthRecordSvc{this, "TruthRecordService", "ISF_TruthRecordSvc", ""};
110
112 std::map<std::string,std::string> m_verbosities;
114
117 Gaudi::Property<std::string> m_libList{this, "Dll", "", ""};
118 Gaudi::Property<std::string> m_physList{this, "Physics", "", ""};
119 Gaudi::Property<std::string> m_fieldMap{this, "FieldMap", "", ""};
120 Gaudi::Property<std::string> m_rndmGen{this, "RandomGenerator", "athena", ""};
121 Gaudi::Property<bool> m_releaseGeoModel{this, "ReleaseGeoModel", true, ""};
122 Gaudi::Property<bool> m_recordFlux{this, "RecordFlux", false, ""};
123 Gaudi::Property<bool> m_quietMode{this, "QuietMode", false, ""};
125 Gaudi::Property<std::vector<std::string> > m_g4commands{this, "G4Commands", {}, "Commands to send to the G4UI"};
127 Gaudi::Property<bool> m_useMT{this,"MultiThreading", false, "Multi-threading specific settings"};
128 Gaudi::Property<bool> m_activateParallelGeometries{this, "ActivateParallelWorlds", false, "Toggle on/off the G4 parallel geometry system"};
129 BooleanProperty m_useShadowEvent{this, "UseShadowEvent", false, "New approach to selecting particles for simulation" };
131 ServiceHandle<IAthRNGSvc> m_rndmGenSvc{this, "AtRndmGenSvc", "AthRNGSvc", ""}; // TODO rename property
133 Gaudi::Property<std::string> m_randomStreamName{this, "RandomStreamName", "Geant4", ""};
135 ServiceHandle<IUserLimitsSvc> m_userLimitsSvc{this, "UserLimitsSvc", "UserLimitsSvc", ""};
137 ServiceHandle<G4UA::IUserActionSvc> m_userActionSvc{this, "UserActionSvc", "G4UA::UserActionSvc", ""};
138
139 PublicToolHandle<IDetectorConstructionTool> m_detConstruction{this, "DetectorConstruction", "", "Tool handle of the DetectorConstruction"};
140 PublicToolHandleArray<IPhysicsInitializationTool> m_physicsInitializationTools{this, "PhysicsInitializationTools", {}, "Physics initialization happening after Geant4 initialization"};
141
143 ServiceHandle<Simulation::IZeroLifetimePatcher> m_qspatcher{this, "QuasiStablePatcher", "", "Quasi-Stable Particle Simulation Patcher"};
144
145 ToolHandle<ISF::IGenEventFilter> m_truthPreselectionTool{this, "TruthPreselectionTool", "", "Tool for filtering out quasi-stable particle daughters"};
146
148 ServiceHandle<ISF::IInputConverter> m_inputConverter{this, "InputConverter", "ISF_InputConverter", ""};
150 ServiceHandle<IPhysicsListSvc> m_physListSvc{this, "PhysicsListSvc", "PhysicsListSvc", ""};
152 PublicToolHandle<ISensitiveDetectorMasterTool> m_senDetTool{this, "SenDetMasterTool", "SensitiveDetectorMasterTool", ""};
154 PublicToolHandle<IFastSimulationMasterTool> m_fastSimTool{this, "FastSimMasterTool", "FastSimulationMasterTool", ""};
156 PublicToolHandleArray<G4UA::IUserActionTool> m_actionTools{this, "UserActionTools", {}, "User action tools to be added to the G4 Action service."};
157 // FastCaloSim in Geant4 configuration
158 Gaudi::Property<std::string> m_simplifiedGeoPath{this, "SimplifiedGeoPath", "", "Path to the simplified geometry file used to transport particles"};
159
160};
161
162#endif// G4ATLASALG_G4AtlasAlg_H
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
Define macros for attributes used to control the static checker.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
ServiceHandle< ISF::IInputConverter > m_inputConverter
Service to convert ISF_Particles into a G4Event.
Definition G4AtlasAlg.h:148
Gaudi::Property< std::string > m_fieldMap
Definition G4AtlasAlg.h:119
ServiceHandle< ISF::ITruthSvc > m_truthRecordSvc
Central Truth Service.
Definition G4AtlasAlg.h:109
ServiceHandle< Simulation::IZeroLifetimePatcher > m_qspatcher
Quasi-Stable Particle Simulation Patcher.
Definition G4AtlasAlg.h:143
void commandLog(int returnCode, const std::string &commandString) const
This command prints a message about a G4Command depending on its returnCode.
std::map< std::string, std::string > m_verbosities
Verbosity settings for Geant4.
Definition G4AtlasAlg.h:112
Gaudi::Property< std::string > m_physList
Definition G4AtlasAlg.h:118
Gaudi::Property< bool > m_quietMode
Definition G4AtlasAlg.h:123
PublicToolHandle< ISensitiveDetectorMasterTool > m_senDetTool
Sensitive Detector Master Tool.
Definition G4AtlasAlg.h:152
Gaudi::Property< bool > m_useMT
Activate multi-threading configuration.
Definition G4AtlasAlg.h:127
G4AtlasAlg(const std::string &name, ISvcLocator *pSvcLocator)
Standard algorithm constructor.
virtual ~G4AtlasAlg()
Virtual destructor.
Definition G4AtlasAlg.h:61
ServiceHandle< IAthRNGSvc > m_rndmGenSvc
Random number service.
Definition G4AtlasAlg.h:131
StatusCode execute(const EventContext &ctx) override
Simulate one Athena event.
StatusCode finalize() override
Finalize the algorithm and invoke G4 run termination.
bool isClonable() const override
this Alg is Clonable (for AthenaMT)
Definition G4AtlasAlg.h:64
BooleanProperty m_useShadowEvent
Definition G4AtlasAlg.h:129
ToolHandle< ISF::IGenEventFilter > m_truthPreselectionTool
Definition G4AtlasAlg.h:145
PublicToolHandleArray< IPhysicsInitializationTool > m_physicsInitializationTools
Definition G4AtlasAlg.h:140
Gaudi::Property< std::vector< std::string > > m_g4commands
Commands to send to the G4 UI.
Definition G4AtlasAlg.h:125
Gaudi::Property< std::string > m_randomStreamName
Random Stream Name.
Definition G4AtlasAlg.h:133
PublicToolHandle< IFastSimulationMasterTool > m_fastSimTool
Fast Simulation Master Tool.
Definition G4AtlasAlg.h:154
Gaudi::Property< bool > m_killAbortedEvents
Definition G4AtlasAlg.h:102
PublicToolHandleArray< G4UA::IUserActionTool > m_actionTools
Definition G4AtlasAlg.h:156
SG::ReadHandleKey< McEventCollection > m_inputTruthCollectionKey
input hard scatter collection
Definition G4AtlasAlg.h:104
PublicToolHandle< IDetectorConstructionTool > m_detConstruction
Definition G4AtlasAlg.h:139
Gaudi::Property< bool > m_activateParallelGeometries
Definition G4AtlasAlg.h:128
ServiceHandle< G4UA::IUserActionSvc > m_userActionSvc
User Action Service.
Definition G4AtlasAlg.h:137
ServiceHandle< IUserLimitsSvc > m_userLimitsSvc
Definition G4AtlasAlg.h:135
Gaudi::Property< std::string > m_libList
Definition G4AtlasAlg.h:117
Gaudi::Property< std::string > m_simplifiedGeoPath
Definition G4AtlasAlg.h:158
void initializeG4()
Poorly named possibly unused method which sets some verbosities.
Gaudi::Property< bool > m_recordFlux
Definition G4AtlasAlg.h:122
SG::WriteHandleKey< McEventCollection > m_outputTruthCollectionKey
output hard scatter truth collection
Definition G4AtlasAlg.h:105
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition G4AtlasAlg.h:106
ServiceHandle< IPhysicsListSvc > m_physListSvc
Physics List Tool.
Definition G4AtlasAlg.h:150
Gaudi::Property< bool > m_releaseGeoModel
Definition G4AtlasAlg.h:121
StatusCode initialize ATLAS_NOT_THREAD_SAFE() override
Initialize the algorithm.
Gaudi::Property< std::string > m_rndmGen
Definition G4AtlasAlg.h:120
Gaudi::Property< bool > m_flagAbortedEvents
Definition G4AtlasAlg.h:103
void initializeOnce()
G4 initialization called only by the first alg instance.
void finalizeOnce()
G4 finalization called only by the first alg instance.
void releaseGeoModel()
Releases the GeoModel geometry from memory once it has been used to build the G4 geometry and is no-l...
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
void initialize()