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