File indexing completed on 2025-01-30 10:09:32
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include <memory>
0011 #include <unordered_map>
0012 #include <unordered_set>
0013
0014 #include "corecel/Config.hh"
0015
0016 #include "geocel/Types.hh"
0017
0018
0019
0020
0021
0022 class G4LogicalVolume;
0023 class G4VPhysicalVolume;
0024
0025 namespace vecgeom
0026 {
0027 inline namespace cxx
0028 {
0029 class LogicalVolume;
0030 class VPlacedVolume;
0031 }
0032 }
0033
0034
0035 namespace celeritas
0036 {
0037 namespace g4vg
0038 {
0039
0040 class Scaler;
0041 class Transformer;
0042 class SolidConverter;
0043 class LogicalVolumeConverter;
0044
0045
0046
0047
0048
0049
0050
0051
0052 class Converter
0053 {
0054 public:
0055
0056
0057 using arg_type = G4VPhysicalVolume const*;
0058 using MapLvVolId = std::unordered_map<G4LogicalVolume const*, VolumeId>;
0059 using VGPlacedVolume = vecgeom::VPlacedVolume;
0060
0061
0062 struct Options
0063 {
0064 bool verbose{false};
0065 bool compare_volumes{false};
0066 };
0067
0068 struct result_type
0069 {
0070 VGPlacedVolume* world{nullptr};
0071 MapLvVolId volumes;
0072 };
0073
0074 public:
0075
0076 explicit Converter(Options);
0077
0078 Converter() : Converter{Options{}} {}
0079
0080
0081 ~Converter();
0082
0083
0084 result_type operator()(arg_type);
0085
0086 private:
0087 using VGLogicalVolume = vecgeom::LogicalVolume;
0088
0089 #if CELERITAS_USE_GEANT4
0090 Options options_;
0091 int depth_{0};
0092
0093 std::unique_ptr<Scaler> convert_scale_;
0094 std::unique_ptr<Transformer> convert_transform_;
0095 std::unique_ptr<SolidConverter> convert_solid_;
0096 std::unique_ptr<LogicalVolumeConverter> convert_lv_;
0097 std::unordered_set<VGLogicalVolume const*> built_daughters_;
0098
0099 VGLogicalVolume* build_with_daughters(G4LogicalVolume const* mother_g4lv);
0100 #endif
0101 };
0102
0103 #if !CELERITAS_USE_GEANT4
0104 inline Converter::Converter(Options) {}
0105 inline Converter::~Converter() = default;
0106
0107 inline auto Converter::operator()(arg_type) -> result_type
0108 {
0109 CELER_NOT_CONFIGURED("Geant4");
0110 }
0111 #endif
0112
0113
0114 }
0115 }