File indexing completed on 2026-07-26 08:22:24
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "traccc/clusterization/clusterization_algorithm.hpp"
0010 #include "traccc/geometry/detector.hpp"
0011 #include "traccc/geometry/detector_design_description.hpp"
0012 #include "traccc/io/read_cells.hpp"
0013 #include "traccc/io/read_detector.hpp"
0014 #include "traccc/io/read_detector_description.hpp"
0015 #include "traccc/io/read_spacepoints.hpp"
0016 #include "traccc/performance/details/is_same_object.hpp"
0017 #include "traccc/seeding/silicon_pixel_spacepoint_formation_algorithm.hpp"
0018
0019
0020 #include <vecmem/memory/host_memory_resource.hpp>
0021
0022
0023 #include <gtest/gtest.h>
0024
0025 class SurfaceBinningTests
0026 : public ::testing::TestWithParam<
0027 std::tuple<std::string, std::string, std::string, unsigned int>> {};
0028
0029
0030 TEST_P(SurfaceBinningTests, Run) {
0031 std::string detector_file = std::get<0>(GetParam());
0032 std::string digi_config_file = std::get<1>(GetParam());
0033 std::string det_cond_file = std::get<1>(GetParam());
0034 std::string data_dir = std::get<2>(GetParam());
0035 unsigned int event = std::get<3>(GetParam());
0036
0037
0038 vecmem::host_memory_resource host_mr;
0039
0040
0041 traccc::detector_design_description::host det_desc{host_mr};
0042 traccc::detector_conditions_description::host det_cond{host_mr};
0043 traccc::io::read_detector_description(det_desc, det_cond, detector_file,
0044 digi_config_file, det_cond_file,
0045 traccc::json);
0046 const traccc::detector_design_description::data det_desc_data =
0047 vecmem::get_data(det_desc);
0048 const traccc::detector_conditions_description::data det_cond_data =
0049 vecmem::get_data(det_cond);
0050
0051
0052 traccc::host_detector detector;
0053 traccc::io::read_detector(detector, host_mr, detector_file);
0054
0055
0056 traccc::host::clusterization_algorithm ca(host_mr);
0057 traccc::host::silicon_pixel_spacepoint_formation_algorithm sf(host_mr);
0058
0059
0060 traccc::edm::silicon_cell_collection::host cells_truth{host_mr};
0061 traccc::io::read_cells(cells_truth, event, data_dir,
0062 traccc::getDummyLogger().clone(), &det_cond);
0063
0064
0065 auto measurements_recon =
0066 ca(vecmem::get_data(cells_truth), det_desc_data, det_cond_data);
0067 auto spacepoints_recon = sf(detector, vecmem::get_data(measurements_recon));
0068
0069
0070 traccc::edm::spacepoint_collection::host spacepoints_truth{host_mr};
0071 traccc::edm::measurement_collection::host measurements_truth{host_mr};
0072 traccc::io::read_spacepoints(spacepoints_truth, measurements_truth, event,
0073 data_dir, &detector);
0074
0075
0076 EXPECT_TRUE(spacepoints_recon.size() > 0);
0077
0078 for (traccc::edm::spacepoint_collection::host::size_type i = 0u;
0079 i < spacepoints_recon.size(); ++i) {
0080 const auto sp_recon = spacepoints_recon.at(i);
0081
0082 bool found_match = false;
0083
0084
0085 auto iso = traccc::details::is_same_object(sp_recon, 0.2f);
0086
0087 for (traccc::edm::spacepoint_collection::host::size_type j = 0u;
0088 j < spacepoints_truth.size(); ++j) {
0089 const auto sp_truth = spacepoints_truth.at(j);
0090
0091
0092 found_match = iso(sp_truth);
0093
0094 if (found_match) {
0095 break;
0096 }
0097 }
0098
0099 EXPECT_EQ(found_match, true);
0100 }
0101 }
0102
0103 INSTANTIATE_TEST_SUITE_P(
0104 SurfaceBinningValidation, SurfaceBinningTests,
0105 ::testing::Values(
0106 std::make_tuple("geometries/odd/odd-detray_geometry_detray.json",
0107 "geometries/odd/odd-digi-geometric-config.json",
0108 "odd/geant4_1muon_100GeV", 0),
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119 std::make_tuple("geometries/odd/odd-detray_geometry_detray.json",
0120 "geometries/odd/odd-digi-geometric-config.json",
0121 "odd/geant4_1muon_100GeV", 3),
0122 std::make_tuple("geometries/odd/odd-detray_geometry_detray.json",
0123 "geometries/odd/odd-digi-geometric-config.json",
0124 "odd/geant4_1muon_100GeV", 4)));