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
41
54{
55
56public:
57
59 G4AtlasAlg(const std::string& name, ISvcLocator* pSvcLocator);
60
62 virtual ~G4AtlasAlg() { };
63
65 bool isClonable() const override { return true; }
66
73 StatusCode initialize ATLAS_NOT_THREAD_SAFE () override;
74
76 StatusCode finalize() override;
77
79 StatusCode execute() override;
80
82 void initializeG4();
83
86 void initializeOnce();
87
90 void finalizeOnce();
91
92private:
93
95 void commandLog(int returnCode, const std::string& commandString) const;
96
99 void releaseGeoModel();
100
103 Gaudi::Property<bool> m_killAbortedEvents{this, "KillAbortedEvents", false, ""};
104 Gaudi::Property<bool> m_flagAbortedEvents{this, "FlagAbortedEvents", false, ""};
105 SG::ReadHandleKey<McEventCollection> m_inputTruthCollectionKey{this, "InputTruthCollection", "BeamTruthEvent", "Input hard scatter collection"};
106 SG::WriteHandleKey<McEventCollection> m_outputTruthCollectionKey{this, "OutputTruthCollection", "TruthEvent", "Output hard scatter truth collection"};
107 SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this, "EventInfo", "EventInfo", "EventInfo key"};
108
110 ServiceHandle<ISF::ITruthSvc> m_truthRecordSvc{this, "TruthRecordService", "ISF_TruthRecordSvc", ""};
112 ServiceHandle<ISF::IGeoIDSvc> m_geoIDSvc{this, "GeoIDSvc", "ISF_GeoIDSvc", ""};
113
115 std::map<std::string,std::string> m_verbosities;
117
120 Gaudi::Property<std::string> m_libList{this, "Dll", "", ""};
121 Gaudi::Property<std::string> m_physList{this, "Physics", "", ""};
122 Gaudi::Property<std::string> m_fieldMap{this, "FieldMap", "", ""};
123 Gaudi::Property<std::string> m_rndmGen{this, "RandomGenerator", "athena", ""};
124 Gaudi::Property<bool> m_releaseGeoModel{this, "ReleaseGeoModel", true, ""};
125 Gaudi::Property<bool> m_recordFlux{this, "RecordFlux", false, ""};
126 Gaudi::Property<bool> m_quietMode{this, "QuietMode", false, ""};
128 Gaudi::Property<std::vector<std::string> > m_g4commands{this, "G4Commands", {}, "Commands to send to the G4UI"};
130 Gaudi::Property<bool> m_useMT{this,"MultiThreading", false, "Multi-threading specific settings"};
131 Gaudi::Property<bool> m_activateParallelGeometries{this, "ActivateParallelWorlds", false, "Toggle on/off the G4 parallel geometry system"};
132 BooleanProperty m_useShadowEvent{this, "UseShadowEvent", false, "New approach to selecting particles for simulation" };
134 ServiceHandle<IAthRNGSvc> m_rndmGenSvc{this, "AtRndmGenSvc", "AthRNGSvc", ""}; // TODO rename property
136 Gaudi::Property<std::string> m_randomStreamName{this, "RandomStreamName", "Geant4", ""};
138 ServiceHandle<IUserLimitsSvc> m_userLimitsSvc{this, "UserLimitsSvc", "UserLimitsSvc", ""};
140 ServiceHandle<G4UA::IUserActionSvc> m_userActionSvc{this, "UserActionSvc", "G4UA::UserActionSvc", ""};
141
142 PublicToolHandle<IDetectorConstructionTool> m_detConstruction{this, "DetectorConstruction", "", "Tool handle of the DetectorConstruction"};
143 PublicToolHandleArray<IPhysicsInitializationTool> m_physicsInitializationTools{this, "PhysicsInitializationTools", {}, "Physics initialization happening after Geant4 initialization"};
144
146 ServiceHandle<Simulation::IZeroLifetimePatcher> m_qspatcher{this, "QuasiStablePatcher", "", "Quasi-Stable Particle Simulation Patcher"};
147
148 ToolHandle<ISF::IGenEventFilter> m_truthPreselectionTool{this, "TruthPreselectionTool", "", "Tool for filtering out quasi-stable particle daughters"};
149
151 ServiceHandle<ISF::IInputConverter> m_inputConverter{this, "InputConverter", "ISF_InputConverter", ""};
153 ServiceHandle<IPhysicsListSvc> m_physListSvc{this, "PhysicsListSvc", "PhysicsListSvc", ""};
155 PublicToolHandle<ISensitiveDetectorMasterTool> m_senDetTool{this, "SenDetMasterTool", "SensitiveDetectorMasterTool", ""};
157 PublicToolHandle<IFastSimulationMasterTool> m_fastSimTool{this, "FastSimMasterTool", "FastSimulationMasterTool", ""};
159 PublicToolHandleArray<G4UA::IUserActionTool> m_actionTools{this, "UserActionTools", {}, "User action tools to be added to the G4 Action service."};
160 // FastCaloSim in Geant4 configuration
161 Gaudi::Property<std::string> m_simplifiedGeoPath{this, "SimplifiedGeoPath", "", "Path to the simplified geometry file used to transport particles"};
162
163};
164
165#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 with parameters:
ServiceHandle< ISF::IInputConverter > m_inputConverter
Service to convert ISF_Particles into a G4Event.
Definition G4AtlasAlg.h:151
Gaudi::Property< std::string > m_fieldMap
Definition G4AtlasAlg.h:122
ServiceHandle< ISF::ITruthSvc > m_truthRecordSvc
Central Truth Service.
Definition G4AtlasAlg.h:110
ServiceHandle< Simulation::IZeroLifetimePatcher > m_qspatcher
Quasi-Stable Particle Simulation Patcher.
Definition G4AtlasAlg.h:146
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:115
Gaudi::Property< std::string > m_physList
Definition G4AtlasAlg.h:121
Gaudi::Property< bool > m_quietMode
Definition G4AtlasAlg.h:126
PublicToolHandle< ISensitiveDetectorMasterTool > m_senDetTool
Sensitive Detector Master Tool.
Definition G4AtlasAlg.h:155
Gaudi::Property< bool > m_useMT
Activate multi-threading configuration.
Definition G4AtlasAlg.h:130
G4AtlasAlg(const std::string &name, ISvcLocator *pSvcLocator)
Standard algorithm constructor.
StatusCode execute() override
Simulate one Athena event.
virtual ~G4AtlasAlg()
Virtual destructor.
Definition G4AtlasAlg.h:62
ServiceHandle< IAthRNGSvc > m_rndmGenSvc
Random number service.
Definition G4AtlasAlg.h:134
StatusCode finalize() override
Finalize the algorithm and invoke G4 run termination.
bool isClonable() const override
this Alg is Clonable (for AthenaMT)
Definition G4AtlasAlg.h:65
BooleanProperty m_useShadowEvent
Definition G4AtlasAlg.h:132
ToolHandle< ISF::IGenEventFilter > m_truthPreselectionTool
Definition G4AtlasAlg.h:148
PublicToolHandleArray< IPhysicsInitializationTool > m_physicsInitializationTools
Definition G4AtlasAlg.h:143
Gaudi::Property< std::vector< std::string > > m_g4commands
Commands to send to the G4 UI.
Definition G4AtlasAlg.h:128
Gaudi::Property< std::string > m_randomStreamName
Random Stream Name.
Definition G4AtlasAlg.h:136
PublicToolHandle< IFastSimulationMasterTool > m_fastSimTool
Fast Simulation Master Tool.
Definition G4AtlasAlg.h:157
Gaudi::Property< bool > m_killAbortedEvents
Definition G4AtlasAlg.h:103
PublicToolHandleArray< G4UA::IUserActionTool > m_actionTools
Definition G4AtlasAlg.h:159
SG::ReadHandleKey< McEventCollection > m_inputTruthCollectionKey
input hard scatter collection
Definition G4AtlasAlg.h:105
PublicToolHandle< IDetectorConstructionTool > m_detConstruction
Definition G4AtlasAlg.h:142
Gaudi::Property< bool > m_activateParallelGeometries
Definition G4AtlasAlg.h:131
ServiceHandle< G4UA::IUserActionSvc > m_userActionSvc
User Action Service.
Definition G4AtlasAlg.h:140
ServiceHandle< IUserLimitsSvc > m_userLimitsSvc
Definition G4AtlasAlg.h:138
Gaudi::Property< std::string > m_libList
Definition G4AtlasAlg.h:120
Gaudi::Property< std::string > m_simplifiedGeoPath
Definition G4AtlasAlg.h:161
ServiceHandle< ISF::IGeoIDSvc > m_geoIDSvc
Geo ID Service.
Definition G4AtlasAlg.h:112
void initializeG4()
Poorly named possibly unused method which sets some verbosities.
Gaudi::Property< bool > m_recordFlux
Definition G4AtlasAlg.h:125
SG::WriteHandleKey< McEventCollection > m_outputTruthCollectionKey
output hard scatter truth collection
Definition G4AtlasAlg.h:106
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition G4AtlasAlg.h:107
ServiceHandle< IPhysicsListSvc > m_physListSvc
Physics List Tool.
Definition G4AtlasAlg.h:153
Gaudi::Property< bool > m_releaseGeoModel
Definition G4AtlasAlg.h:124
StatusCode initialize ATLAS_NOT_THREAD_SAFE() override
Initialize the algorithm.
Gaudi::Property< std::string > m_rndmGen
Definition G4AtlasAlg.h:123
Gaudi::Property< bool > m_flagAbortedEvents
Definition G4AtlasAlg.h:104
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()