File indexing completed on 2025-01-18 09:59:33
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include <string>
0011
0012 #include "corecel/Types.hh"
0013 #include "corecel/cont/LabelIdMultiMap.hh"
0014 #include "corecel/data/ParamsDataInterface.hh"
0015 #include "geocel/BoundingBox.hh"
0016 #include "geocel/GeoParamsInterface.hh"
0017 #include "geocel/Types.hh"
0018
0019 #include "GeantGeoData.hh"
0020
0021 class G4VPhysicalVolume;
0022
0023 namespace celeritas
0024 {
0025
0026 class ScopedGeantLogger;
0027 class ScopedGeantExceptionHandler;
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 class GeantGeoParams final : public GeoParamsInterface,
0039 public ParamsDataInterface<GeantGeoParamsData>
0040 {
0041 public:
0042
0043 explicit GeantGeoParams(std::string const& gdml_filename);
0044
0045
0046 explicit GeantGeoParams(G4VPhysicalVolume const* world);
0047
0048
0049 ~GeantGeoParams();
0050
0051
0052 G4VPhysicalVolume const* world() const { return host_ref_.world; }
0053
0054
0055 bool supports_safety() const final { return true; }
0056
0057
0058 BBox const& bbox() const final { return bbox_; }
0059
0060
0061
0062
0063 VolumeId::size_type num_volumes() const final
0064 {
0065 return vol_labels_.size();
0066 }
0067
0068
0069 Label const& id_to_label(VolumeId vol_id) const final;
0070
0071
0072 using GeoParamsInterface::find_volume;
0073
0074
0075
0076 VolumeId find_volume(std::string const& name) const final;
0077
0078
0079 VolumeId find_volume(Label const& label) const final;
0080
0081
0082 VolumeId find_volume(G4LogicalVolume const* volume) const final;
0083
0084
0085 SpanConstVolumeId find_volumes(std::string const& name) const final;
0086
0087
0088 G4LogicalVolume const* id_to_lv(VolumeId vol_id) const;
0089
0090
0091
0092
0093 HostRef const& host_ref() const final { return host_ref_; }
0094
0095
0096 DeviceRef const& device_ref() const final
0097 {
0098 CELER_NOT_IMPLEMENTED("Geant4 on GPU");
0099 }
0100
0101 private:
0102
0103
0104 bool loaded_gdml_{false};
0105 bool closed_geometry_{false};
0106 std::unique_ptr<ScopedGeantLogger> scoped_logger_;
0107 std::unique_ptr<ScopedGeantExceptionHandler> scoped_exceptions_;
0108
0109
0110 LabelIdMultiMap<VolumeId> vol_labels_;
0111 BBox bbox_;
0112
0113
0114 HostRef host_ref_;
0115
0116
0117
0118
0119 void build_tracking();
0120
0121
0122 void build_metadata();
0123 };
0124
0125
0126 }