File indexing completed on 2025-09-18 09:16:19
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include <iosfwd>
0010 #include <string>
0011 #include <unordered_set>
0012
0013 #include "corecel/Config.hh"
0014
0015 #include "corecel/Assert.hh"
0016 #include "corecel/cont/Span.hh"
0017 #include "corecel/io/Label.hh"
0018
0019
0020
0021 class G4LogicalVolume;
0022 class G4VPhysicalVolume;
0023 class G4Navigator;
0024 class G4NavigationHistory;
0025
0026 #if CELERITAS_GEANT4_VERSION >= 0x0b0200
0027
0028 class G4TouchableHistory;
0029 #else
0030 class G4VTouchable;
0031 #endif
0032
0033 namespace celeritas
0034 {
0035 struct GeantPhysicalInstance;
0036
0037 #if CELERITAS_GEANT4_VERSION >= 0x0b0200
0038
0039 using GeantTouchableBase = G4TouchableHistory;
0040 #else
0041 using GeantTouchableBase = G4VTouchable;
0042 #endif
0043
0044
0045
0046 struct PrintableNavHistory
0047 {
0048 G4NavigationHistory const* nav{nullptr};
0049 };
0050
0051
0052
0053 struct PrintableLV
0054 {
0055 G4LogicalVolume const* lv{nullptr};
0056 };
0057
0058
0059 std::ostream& operator<<(std::ostream&, PrintableNavHistory const&);
0060
0061
0062 std::ostream& operator<<(std::ostream&, PrintableLV const&);
0063
0064
0065
0066
0067
0068 void save_gdml(G4VPhysicalVolume const* world, std::string const& out_filename);
0069
0070
0071
0072 void reset_geant_geometry();
0073
0074
0075
0076 Span<G4LogicalVolume*> geant_logical_volumes();
0077
0078
0079
0080 G4VPhysicalVolume const* geant_world_volume();
0081
0082
0083
0084 bool is_replica(G4VPhysicalVolume const&);
0085
0086
0087
0088 std::unordered_set<G4LogicalVolume const*>
0089 find_geant_volumes(std::unordered_set<std::string>);
0090
0091
0092 std::vector<Label> make_logical_vol_labels(G4VPhysicalVolume const& world);
0093
0094
0095 std::vector<Label> make_physical_vol_labels(G4VPhysicalVolume const& world);
0096
0097
0098
0099 void set_history(Span<GeantPhysicalInstance const> stack,
0100 G4NavigationHistory* nav);
0101
0102
0103
0104
0105 #if !CELERITAS_USE_GEANT4
0106 inline void reset_geant_geometry()
0107 {
0108 CELER_NOT_CONFIGURED("Geant4");
0109 }
0110
0111 inline Span<G4LogicalVolume*> geant_logical_volumes()
0112 {
0113 CELER_NOT_CONFIGURED("Geant4");
0114 }
0115
0116 inline std::unordered_set<G4LogicalVolume const*>
0117 find_geant_volumes(std::unordered_set<std::string>)
0118 {
0119 CELER_NOT_CONFIGURED("Geant4");
0120 }
0121
0122 inline std::ostream& operator<<(std::ostream&, PrintableNavHistory const&)
0123 {
0124 CELER_NOT_CONFIGURED("Geant4");
0125 }
0126
0127 inline std::ostream& operator<<(std::ostream&, PrintableLV const&)
0128 {
0129 CELER_NOT_CONFIGURED("Geant4");
0130 }
0131
0132 inline bool is_replica(G4VPhysicalVolume const&)
0133 {
0134 CELER_NOT_CONFIGURED("Geant4");
0135 }
0136
0137 #endif
0138
0139
0140 }