File indexing completed on 2025-02-22 09:54:43
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include <map>
0011 #include <unordered_set>
0012 #include <vector>
0013
0014 #include "corecel/Assert.hh"
0015 #include "geocel/GeoParamsInterface.hh"
0016 #include "celeritas/ext/GeantVolumeMapper.hh"
0017
0018 class G4LogicalVolume;
0019 class G4VSensitiveDetector;
0020
0021 namespace celeritas
0022 {
0023 namespace detail
0024 {
0025
0026
0027
0028
0029
0030
0031 class SensDetInserter
0032 {
0033 public:
0034
0035
0036 using SetLV = std::unordered_set<G4LogicalVolume const*>;
0037 using VecLV = std::vector<G4LogicalVolume const*>;
0038 using MapIdLv = std::map<VolumeId, G4LogicalVolume const*>;
0039
0040
0041 public:
0042
0043 inline SensDetInserter(GeoParamsInterface const& geo,
0044 SetLV const& skip_volumes,
0045 MapIdLv* found,
0046 VecLV* missing);
0047
0048
0049 void operator()(G4LogicalVolume const* lv, G4VSensitiveDetector const* sd);
0050
0051
0052 void operator()(G4LogicalVolume const* lv);
0053
0054 private:
0055 GeoParamsInterface const& geo_;
0056 GeantVolumeMapper g4_to_celer_;
0057 SetLV const& skip_volumes_;
0058 MapIdLv* found_;
0059 VecLV* missing_;
0060
0061 VolumeId insert_impl(G4LogicalVolume const* lv);
0062 };
0063
0064
0065
0066
0067
0068
0069
0070 SensDetInserter::SensDetInserter(GeoParamsInterface const& geo,
0071 SetLV const& skip_volumes,
0072 MapIdLv* found,
0073 VecLV* missing)
0074 : geo_(geo)
0075 , g4_to_celer_{geo}
0076 , skip_volumes_{skip_volumes}
0077 , found_{found}
0078 , missing_{missing}
0079 {
0080 CELER_EXPECT(found_);
0081 CELER_EXPECT(missing_);
0082 }
0083
0084
0085 }
0086 }