File indexing completed on 2026-03-28 08:18:04
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include <memory>
0010 #include <string>
0011
0012 #include "corecel/Config.hh"
0013
0014 #include "corecel/Assert.hh"
0015
0016 #include "GeantPhysicsOptions.hh"
0017
0018
0019 class G4VPhysicalVolume;
0020 class G4RunManager;
0021
0022 namespace celeritas
0023 {
0024 class GeantGeoParams;
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 class GeantSetup
0040 {
0041 public:
0042
0043
0044 using Options = GeantPhysicsOptions;
0045 using SPGeantGeo = std::shared_ptr<GeantGeoParams>;
0046
0047
0048 public:
0049
0050 GeantSetup(std::string const& gdml_filename, Options options);
0051
0052
0053 GeantSetup() = default;
0054
0055
0056 ~GeantSetup();
0057
0058
0059 CELER_DEFAULT_MOVE_DELETE_COPY(GeantSetup);
0060
0061
0062 SPGeantGeo const& geo_params() const { return geo_; }
0063
0064
0065 explicit operator bool() const { return static_cast<bool>(run_manager_); }
0066
0067 private:
0068 struct RMDeleter
0069 {
0070 void operator()(G4RunManager*) const;
0071 };
0072 using RMUniquePtr = std::unique_ptr<G4RunManager, RMDeleter>;
0073
0074 RMUniquePtr run_manager_{nullptr};
0075 SPGeantGeo geo_;
0076 };
0077
0078
0079
0080 #if !CELERITAS_USE_GEANT4
0081 inline GeantSetup::GeantSetup(std::string const&, Options)
0082 {
0083 CELER_NOT_CONFIGURED("Geant4");
0084 }
0085
0086 inline GeantSetup::~GeantSetup() = default;
0087
0088 inline void GeantSetup::RMDeleter::operator()(G4RunManager*) const
0089 {
0090 CELER_ASSERT_UNREACHABLE();
0091 }
0092 #endif
0093
0094
0095 }