ATLAS Offline Software
Loading...
Searching...
No Matches
BaseSimulationG4Svc.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ISF_BASESIMULATIONG4SVC_H
6#define ISF_BASESIMULATIONG4SVC_H 1
7
8// STL includes
9#include <memory.h>
10#include <string>
11
12// FrameWork includes
14#include <GaudiKernel/StatusCode.h>
16
17// ISF includes
21
23
24namespace ISF {
25
26class IParticleBroker;
27class ITruthSvc;
28
34 public:
37
39 virtual ~BaseSimulationG4Svc() = default;
40
42 virtual StatusCode simulate(ISFParticle&, McEventCollection*,
43 std::shared_ptr<HitCollectionMap>) = 0;
44
46 virtual StatusCode setupEvent(HitCollectionMap&) = 0;
47
49 virtual StatusCode releaseEvent(HitCollectionMap&) = 0;
50
52 virtual StatusCode simulateVector(const ISFParticleVector& particles,
53 McEventCollection* mcEventCollection,
54 std::shared_ptr<HitCollectionMap> hitCollections,
56 // this implementation is a wrapper in case the simulator does
57 // implement particle-vector input
58 StatusCode sc = StatusCode::SUCCESS;
59 // simulate each particle individually
60 for (ISF::ISFParticle* part : particles) {
62 << "Starting simulation of particle: " << part);
63 if (this->simulate(*part, mcEventCollection, hitCollections).isFailure()) {
64 ATH_MSG_WARNING("Simulation of particle failed!"
65 << endmsg
66 << " -> simulator: " << this->simSvcDescriptor()
67 << " -> particle : " << *part);
68 sc = StatusCode::FAILURE;
69 }
70 }
71 return sc;
72 }
73
75
77 virtual StatusCode simulate(ISFParticle&, McEventCollection*) override {
78 return StatusCode::FAILURE;
79 }
80
82 virtual StatusCode setupEvent() override { return StatusCode::FAILURE; }
83
85 virtual StatusCode releaseEvent() override { return StatusCode::FAILURE; }
86
88 virtual StatusCode simulateVector(const ISFParticleVector&,
90 McEventCollection*) override {
91 return StatusCode::FAILURE;
92 }
93};
94} // namespace ISF
95
96#endif //> !ISF_BASESIMULATIONSVC_H
#define endmsg
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
static Double_t sc
Small wrapper around hit collection map to facilitate accessing the hit collection.
Base class for an ISimulatorSvc which requires a Geant4 UserInfo object.
virtual StatusCode simulateVector(const ISFParticleVector &particles, McEventCollection *mcEventCollection, std::shared_ptr< HitCollectionMap > hitCollections, McEventCollection *)
Simulation call for vectors of particles.
virtual StatusCode simulate(ISFParticle &, McEventCollection *, std::shared_ptr< HitCollectionMap >)=0
Simulation call for individual particles.
virtual StatusCode releaseEvent() override
Release Event chain - in case of an end-of event action is needed.
virtual StatusCode setupEvent(HitCollectionMap &)=0
Setup Event chain - in case of a begin-of event action is needed.
virtual ~BaseSimulationG4Svc()=default
Destructor.
virtual StatusCode simulateVector(const ISFParticleVector &, McEventCollection *, McEventCollection *) override
Simulation call for vectors of particles.
virtual StatusCode simulate(ISFParticle &, McEventCollection *) override
Simulation call for individual particles.
virtual StatusCode setupEvent() override
Setup Event chain - in case of a begin-of event action is needed.
virtual StatusCode releaseEvent(HitCollectionMap &)=0
Release Event chain - in case of an end-of event action is needed.
Concrete base class for all simulation services.
Gaudi::Property< std::string > m_screenOutputPrefix
Screen output refinement.
BaseSimulationSvc(const std::string &name, ISvcLocator *pSvcLocator)
const std::string & simSvcDescriptor() override
Return the simulation service descriptor.
@ class IParticleBroker
The generic ISF particle definition,.
Definition ISFParticle.h:42
@ class ITruthSvc
Definition ITruthSvc.h:29
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
ISFParticleOrderedQueue.
std::vector< ISF::ISFParticle * > ISFParticleVector
ISFParticle vector.