Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:25:33

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include <boost/test/unit_test.hpp>
0010 
0011 #include "ActsPlugins/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 using namespace Acts;
0022 using namespace ActsPlugins;
0023 
0024 class G4VPhysicalVolume;
0025 
0026 namespace ActsTests {
0027 
0028 BOOST_AUTO_TEST_SUITE(Geant4Suite)
0029 
0030 BOOST_AUTO_TEST_CASE(Geant4PhysicalVolumeSelectors_test) {
0031   G4Box* worldS = new G4Box("world", 100, 100, 100);
0032 
0033   G4LogicalVolume* worldLV = new G4LogicalVolume(worldS, nullptr, "World");
0034 
0035   G4VPhysicalVolume* worldPV = new G4PVPlacement(
0036       nullptr, G4ThreeVector(), worldLV, "World", nullptr, false, 0, true);
0037 
0038   G4Box* boxS = new G4Box("box", 10, 10, 10);
0039   G4LogicalVolume* boxLV = new G4LogicalVolume(boxS, nullptr, "World");
0040   G4VPhysicalVolume* boxPV = new G4PVPlacement(nullptr, G4ThreeVector(), boxLV,
0041                                                "Box", worldLV, false, 0, true);
0042 
0043   auto allSelector = Geant4PhysicalVolumeSelectors::AllSelector();
0044   BOOST_CHECK(allSelector.select(*worldPV));
0045   BOOST_CHECK(allSelector.select(*boxPV));
0046 
0047   auto nameSelector =
0048       Geant4PhysicalVolumeSelectors::NameSelector({"ox"}, false);
0049   BOOST_CHECK(!nameSelector.select(*worldPV));
0050   BOOST_CHECK(nameSelector.select(*boxPV));
0051 
0052   auto nameSelectorE =
0053       Geant4PhysicalVolumeSelectors::NameSelector({"ox"}, true);
0054   BOOST_CHECK(!nameSelectorE.select(*worldPV));
0055   BOOST_CHECK(!nameSelectorE.select(*boxPV));
0056 }
0057 
0058 BOOST_AUTO_TEST_SUITE_END()
0059 
0060 }  // namespace ActsTests