File indexing completed on 2025-01-18 09:13:10
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Plugins/Geant4/Geant4PhysicalVolumeSelectors.hpp"
0012
0013 #include <string>
0014
0015 #include "G4Box.hh"
0016 #include "G4LogicalVolume.hh"
0017 #include "G4PVPlacement.hh"
0018 #include "G4RotationMatrix.hh"
0019 #include "G4ThreeVector.hh"
0020
0021 class G4VPhysicalVolume;
0022
0023 BOOST_AUTO_TEST_SUITE(Geant4Plugin)
0024
0025 BOOST_AUTO_TEST_CASE(Geant4PhysicalVolumeSelectors_test) {
0026 G4Box* worldS = new G4Box("world", 100, 100, 100);
0027
0028 G4LogicalVolume* worldLV = new G4LogicalVolume(worldS, nullptr, "World");
0029
0030 G4VPhysicalVolume* worldPV = new G4PVPlacement(
0031 nullptr, G4ThreeVector(), worldLV, "World", nullptr, false, 0, true);
0032
0033 G4Box* boxS = new G4Box("box", 10, 10, 10);
0034 G4LogicalVolume* boxLV = new G4LogicalVolume(boxS, nullptr, "World");
0035 G4VPhysicalVolume* boxPV = new G4PVPlacement(nullptr, G4ThreeVector(), boxLV,
0036 "Box", worldLV, false, 0, true);
0037
0038 auto allSelector = Acts::Geant4PhysicalVolumeSelectors::AllSelector();
0039 BOOST_CHECK(allSelector.select(*worldPV));
0040 BOOST_CHECK(allSelector.select(*boxPV));
0041
0042 auto nameSelector =
0043 Acts::Geant4PhysicalVolumeSelectors::NameSelector({"ox"}, false);
0044 BOOST_CHECK(!nameSelector.select(*worldPV));
0045 BOOST_CHECK(nameSelector.select(*boxPV));
0046
0047 auto nameSelectorE =
0048 Acts::Geant4PhysicalVolumeSelectors::NameSelector({"ox"}, true);
0049 BOOST_CHECK(!nameSelectorE.select(*worldPV));
0050 BOOST_CHECK(!nameSelectorE.select(*boxPV));
0051 }
0052
0053 BOOST_AUTO_TEST_SUITE_END()