ATLAS Offline Software
Loading...
Searching...
No Matches
Geant4SimSvc.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5// class header
6#include "Geant4SimSvc.h"
7
9
11iGeant4::Geant4SimSvc::Geant4SimSvc(const std::string& name, ISvcLocator* svc)
12 : BaseSimulationG4Svc(name, svc) {}
13
16
19{
20 ATH_CHECK (m_simulatorTool.retrieve());
22 dynamic_cast<ISF::BaseSimulatorG4Tool*>(m_simulatorTool.get());
23 if (!m_simulatorG4Tool) {
24 ATH_MSG_FATAL("SimulatorTool is not of type ISF::BaseSimulatorG4Tool");
25 return StatusCode::FAILURE;
26 }
27 return StatusCode::SUCCESS;
28}
29
32{
33 return StatusCode::SUCCESS;
34}
35
37 return m_simulatorG4Tool->setupEventST(hitCollections);
38}
39
41 HitCollectionMap& hitCollections) {
42 return m_simulatorG4Tool->releaseEventST(hitCollections);
43}
44
47 McEventCollection* mcEventCollection,
48 std::shared_ptr<HitCollectionMap> hitCollections) {
49 const EventContext& ctx = Gaudi::Hive::currentContext();
50 ISF::ISFParticleContainer secondaries; // filled, but not used
51 ATH_CHECK(m_simulatorG4Tool->simulate(ctx, isp, secondaries,
52 mcEventCollection, hitCollections));
53 return StatusCode::SUCCESS;
54}
55
58 const ISF::ISFParticleVector& particles,
59 McEventCollection* mcEventCollection, std::shared_ptr<HitCollectionMap> hitCollections,
60 McEventCollection* shadowTruth) {
61 const EventContext& ctx = Gaudi::Hive::currentContext();
62 ISF::ISFParticleContainer secondaries; // filled, but not used
63 ATH_CHECK(m_simulatorG4Tool->simulateVector(
64 ctx, particles, secondaries, mcEventCollection, hitCollections, shadowTruth));
65 return StatusCode::SUCCESS;
66}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
Small wrapper around hit collection map to facilitate accessing the hit collection.
The generic ISF particle definition,.
Definition ISFParticle.h:42
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
virtual StatusCode simulate(ISF::ISFParticle &isp, McEventCollection *mcEventCollection, std::shared_ptr< HitCollectionMap >) override
Simulation Call.
Geant4SimSvc()
Default constructor.
virtual StatusCode initialize() override
Athena algorithm's interface methods.
virtual ~Geant4SimSvc()
Destructor.
virtual StatusCode releaseEvent() override
Release Event chain - in case of an end-of event action is needed.
PublicToolHandle< ISF::ISimulatorTool > m_simulatorTool
virtual StatusCode finalize() override
framework methods
virtual StatusCode simulateVector(const ISF::ISFParticleVector &particles, McEventCollection *mcEventCollection, std::shared_ptr< HitCollectionMap > hitCollections, McEventCollection *shadowTruth=nullptr) override
Simulation Call for vector of ISF particles.
virtual StatusCode setupEvent() override
Setup Event chain - in case of a begin-of event action is needed.
ISF::BaseSimulatorG4Tool * m_simulatorG4Tool
pointer to the downcasted G4 simulator tool
std::list< ISF::ISFParticle * > ISFParticleContainer
generic ISFParticle container (not necessarily a std::list!)
std::vector< ISF::ISFParticle * > ISFParticleVector
ISFParticle vector.