Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Geant4PhysicalVolumeSelectorsTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Geant4PhysicalVolumeSelectorsTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2022 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #include <boost/test/unit_test.hpp>
10 
12 
13 #include <string>
14 
15 #include "G4Box.hh"
16 #include "G4LogicalVolume.hh"
17 #include "G4PVPlacement.hh"
18 #include "G4RotationMatrix.hh"
19 #include "G4ThreeVector.hh"
20 
21 class G4VPhysicalVolume;
22 
23 BOOST_AUTO_TEST_SUITE(Geant4Plugin)
24 
25 BOOST_AUTO_TEST_CASE(Geant4PhysicalVolumeSelectors_test) {
26  G4Box* worldS = new G4Box("world", 100, 100, 100);
27 
28  G4LogicalVolume* worldLV = new G4LogicalVolume(worldS, nullptr, "World");
29 
30  G4VPhysicalVolume* worldPV = new G4PVPlacement(
31  nullptr, G4ThreeVector(), worldLV, "World", nullptr, false, 0, true);
32 
33  G4Box* boxS = new G4Box("box", 10, 10, 10);
34  G4LogicalVolume* boxLV = new G4LogicalVolume(boxS, nullptr, "World");
35  G4VPhysicalVolume* boxPV = new G4PVPlacement(nullptr, G4ThreeVector(), boxLV,
36  "Box", worldLV, false, 0, true);
37 
39  BOOST_CHECK(allSelector.select(*worldPV));
40  BOOST_CHECK(allSelector.select(*boxPV));
41 
42  auto nameSelector =
44  BOOST_CHECK(!nameSelector.select(*worldPV));
45  BOOST_CHECK(nameSelector.select(*boxPV));
46 
47  auto nameSelectorE =
49  BOOST_CHECK(!nameSelectorE.select(*worldPV));
50  BOOST_CHECK(!nameSelectorE.select(*boxPV));
51 }
52 
53 BOOST_AUTO_TEST_SUITE_END()