File indexing completed on 2025-01-18 09:12:20
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Plugins/Geant4/Geant4PhysicalVolumeSelectors.hpp"
0010
0011 #include "G4VPhysicalVolume.hh"
0012
0013 namespace Acts::Geant4PhysicalVolumeSelectors {
0014
0015 bool NameSelector::select(const G4VPhysicalVolume& g4PhysVol) const {
0016 std::string volumeName = g4PhysVol.GetName();
0017 bool matched = false;
0018 for (const auto& name : names) {
0019 matched = exact ? (volumeName == name)
0020 : volumeName.find(name) != std::string::npos;
0021 if (matched) {
0022 break;
0023 }
0024 }
0025 return matched;
0026 }
0027
0028 bool PositionSelector::select(const G4VPhysicalVolume& g4PhysVol) const {
0029 bool matched = false;
0030 G4ThreeVector pos = g4PhysVol.GetTranslation();
0031 for (auto range : m_ranges) {
0032 auto& [min, max] = range.second;
0033 EAxis axis = static_cast<EAxis>(range.first);
0034 matched = (pos[axis] >= min) && (pos[axis] <= max);
0035 if (!matched) {
0036 break;
0037 }
0038 }
0039 return matched;
0040 }
0041
0042 }