File indexing completed on 2026-09-09 08:21:44
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #if defined(__GNUC__) && !defined(__clang__)
0014 #pragma GCC diagnostic push
0015 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
0016 #endif
0017
0018 #include <boost/test/unit_test.hpp>
0019
0020 #include "Acts/Definitions/TrackParametrization.hpp"
0021 #include "Acts/Definitions/Units.hpp"
0022 #include "Acts/EventData/BoundTrackParameters.hpp"
0023 #include "Acts/Surfaces/PerigeeSurface.hpp"
0024 #include "ActsExamples/Validation/ResPlotTool.hpp"
0025
0026 #include <memory>
0027 #include <numbers>
0028
0029 #if defined(__GNUC__) && !defined(__clang__)
0030 #pragma GCC diagnostic pop
0031 #endif
0032
0033 using namespace Acts;
0034 using namespace ActsExamples;
0035
0036 namespace {
0037
0038
0039
0040 double inRangeEntries(const ResPlotTool::Histogram1& histogram) {
0041 double sum = 0;
0042 for (int i = 0; i < histogram.histogram().axis(0).size(); ++i) {
0043 sum += histogram.binContent({i});
0044 }
0045 return sum;
0046 }
0047
0048
0049
0050 ResPlotTool::Config makeConfig() {
0051 ResPlotTool::Config cfg;
0052 cfg.paramNames = {"d0", "z0", "phi", "theta", "qop", "t"};
0053 return cfg;
0054 }
0055
0056 BoundTrackParameters makeParameters(
0057 const std::shared_ptr<const Surface>& surface, double phi) {
0058 BoundVector parameters = BoundVector::Zero();
0059 parameters[eBoundPhi] = phi;
0060 parameters[eBoundTheta] = std::numbers::pi / 2;
0061 parameters[eBoundQOverP] = 1. / (1. * UnitConstants::GeV);
0062
0063 return BoundTrackParameters(surface, parameters,
0064 BoundMatrix::Identity() * 1e-4,
0065 ParticleHypothesis::pion());
0066 }
0067
0068 }
0069
0070 BOOST_AUTO_TEST_SUITE(ValidationResPlotTool)
0071
0072
0073
0074 BOOST_AUTO_TEST_CASE(PhiResidualWrapsAround) {
0075 ResPlotTool tool(makeConfig(), Acts::Logging::INFO);
0076
0077 const auto surface = Surface::makeShared<PerigeeSurface>(Vector3::Zero());
0078 const double delta = 0.00105;
0079 tool.fill(makeParameters(surface, std::numbers::pi - delta),
0080 makeParameters(surface, -std::numbers::pi + delta));
0081
0082
0083 const ResPlotTool::Histogram1& residual = tool.res().at("phi");
0084 BOOST_CHECK_EQUAL(inRangeEntries(residual), 1.);
0085
0086 const int bin = residual.histogram().axis(0).index(2 * delta);
0087 BOOST_CHECK_EQUAL(residual.binContent({bin}), 1.);
0088 }
0089
0090
0091 BOOST_AUTO_TEST_CASE(PhiResidualAwayFromTheWrap) {
0092 ResPlotTool tool(makeConfig(), Acts::Logging::INFO);
0093
0094 const auto surface = Surface::makeShared<PerigeeSurface>(Vector3::Zero());
0095 const double delta = 0.00105;
0096 tool.fill(makeParameters(surface, 0.), makeParameters(surface, delta));
0097
0098 const ResPlotTool::Histogram1& residual = tool.res().at("phi");
0099 const int bin = residual.histogram().axis(0).index(delta);
0100 BOOST_CHECK_EQUAL(residual.binContent({bin}), 1.);
0101 }
0102
0103 BOOST_AUTO_TEST_SUITE_END()