File indexing completed on 2025-03-13 09:12:20
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include <string>
0011 #include <unordered_map>
0012
0013 #include "corecel/Types.hh"
0014 #include "corecel/cont/LabelIdMultiMap.hh"
0015 #include "corecel/data/ParamsDataInterface.hh"
0016 #include "geocel/BoundingBox.hh"
0017 #include "geocel/GeoParamsInterface.hh"
0018 #include "geocel/Types.hh"
0019
0020 #include "VecgeomData.hh"
0021
0022 class G4VPhysicalVolume;
0023
0024 namespace celeritas
0025 {
0026
0027
0028
0029
0030
0031
0032 class VecgeomParams final : public GeoParamsInterface,
0033 public ParamsDataInterface<VecgeomParamsData>
0034 {
0035 public:
0036
0037 static bool use_surface_tracking();
0038
0039
0040 static bool use_vgdml();
0041
0042
0043 explicit VecgeomParams(std::string const& gdml_filename);
0044
0045
0046 explicit VecgeomParams(G4VPhysicalVolume const* world);
0047
0048
0049 ~VecgeomParams();
0050
0051
0052 bool supports_safety() const final { return true; }
0053
0054
0055 BBox const& bbox() const final { return bbox_; }
0056
0057
0058 int max_depth() const { return host_ref_.max_depth; }
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
0089
0090 HostRef const& host_ref() const final { return host_ref_; }
0091
0092
0093 DeviceRef const& device_ref() const final { return device_ref_; }
0094
0095 private:
0096
0097
0098
0099 LabelIdMultiMap<VolumeId> vol_labels_;
0100 std::unordered_map<G4LogicalVolume const*, VolumeId> g4log_volid_map_;
0101
0102 BBox bbox_;
0103
0104
0105 HostRef host_ref_;
0106 DeviceRef device_ref_;
0107
0108
0109 bool loaded_geant4_gdml_{false};
0110
0111
0112
0113
0114 void build_volumes_vgdml(std::string const& filename);
0115 void build_volumes_geant4(G4VPhysicalVolume const* world);
0116 void build_tracking();
0117 void build_surface_tracking();
0118 void build_volume_tracking();
0119
0120
0121 void build_data();
0122
0123 void build_metadata();
0124 };
0125
0126
0127 }