Skip to content

Conversation

Copy link

Copilot AI commented Nov 6, 2025

Implements Point 1 (Unit Tests) from the test suite proposal: establish Google Test infrastructure and validate ActsGaudiLogger, helper functions, and geometry context operations.

Changes

Test Infrastructure

  • Google Test integration with CMake (test/unit/CMakeLists.txt)
  • TestMocks.h: MockMessageSvc for IMessageSvc interface testing
  • Graceful skip when GTest unavailable

Tests Implemented

ActsGaudiLogger (11 tests, ~80% coverage)

  • Acts↔Gaudi log level mapping (VERBOSE→FATAL)
  • Print/filter policy construction, cloning, and lifecycle
  • Logger factory functions and message filtering

Helper Functions (14 tests)

  • Unit conversions: Acts (mm/cm/m, GeV/MeV), DD4hep↔Acts
  • Coordinate transforms: Cartesian↔cylindrical, degrees↔radians
  • Physics: pseudorapidity, impact parameters, χ² calculations
  • Covariance matrix validation (symmetry, positivity)

Geometry Context (10 tests)

  • Acts::GeometryContext lifecycle, copy semantics, const correctness
  • Smart pointer memory management patterns
  • Placeholders for surface maps and tracking geometry (require full DD4hep)

Documentation

  • test/README.md (246 lines): Test structure, coverage summary, running instructions
  • test/unit/TESTING.md (329 lines): Test patterns, mock usage, debugging guide, coverage goals

Example Usage

// Using mock for isolated testing
#include "TestMocks.h"

auto mockMsgSvc = std::make_shared<MockMessageSvc>();
auto logger = makeActsGaudiLogger(mockMsgSvc.get(), "Test", MSG::INFO);

ACTS_INFO(*logger, "Test message");
EXPECT_FALSE(mockMsgSvc->getOutput().empty());

Metrics

  • 35+ test cases across 3 files
  • 1,415 lines added (621 test code, 575 documentation, 122 mocks)
  • Strategic placeholders for components requiring DD4hep fixtures
Original prompt

This section details on the original issue you should resolve

<issue_title>Implementing Test Suite for k4ActsTracking Package</issue_title>
<issue_description>This issue proposes a comprehensive set of tests to be included in the k4ActsTracking package, aiming to improve package robustness and maintainability. These recommendations are based on current repository structure, typical HEP tracking workflows, and standard best practices.

Please discuss or extend as appropriate.

This is an attempt at getting copilot/agents to do as much as possible of the heavy-lifting (the plan below was also written by the AI)


Proposed Test Suite for k4ActsTracking

1. Unit Tests

Geometry Service

  • Initialization of ActsGeoSvc with DD4hep
  • Tracking geometry construction
  • Surface lookup and retrieval
  • Geometry context creation and validation
  • Material decorator application

Helper Functions

  • Track conversions between ACTS and EDM4HEP
  • Coordinate/parameter transformations
  • Covariance/error propagation checks

2. Algorithm Component Tests

ACTSSeededCKFTrackingAlg

  • Valid configuration/init
  • Seed creation from tracker hits
  • CKF track finding with simple mocks
  • Output track collection correctness
  • Empty/noise-only input handling
  • Magnetic field usage tests
  • Performance (timing benchmarks)

ACTSDuplicateRemoval

  • Duplicate identification and removal logic
  • Best track quality preservation
  • Edge cases: single track, no duplicates, all duplicates
  • Output validation

FilterTracksAlg

  • Hit count, chi2, pT, and other filter cut handling
  • Physics cut application correctness
  • Edge cases and misconfigurations

TrackTruthAlg

  • Track/MC particle association logic
  • Simulated hit relation logic
  • Single- and multi-MC scenarios
  • Output mapping quality

3. Integration Tests

Full Tracking Chain

  • Workflow from hits → seeds → tracks
  • Realistic detector (ODD) handling
  • With simulated/known-good particle events
  • Efficiency and correctness checks

Service Integration

  • Various detector/magnetic field configs
  • Calibration and geometry context
  • Concurrent service use

4. Validation Tests

Physics Validation

  • Track parameter and impact parameter resolution
  • Momentum and d0/z0 reconstruction accuracy
  • Track finding efficiency and fake rate

Data Format Tests

  • EDM4HEP I/O and object creation
  • Collection subset persistence

5. Regression Tests

  • Store reference standard outputs for key cases
  • Alert on significant result/performance changes

6. CI/CD Practices

  • Run geometry/service/algorithm tests per PR
  • Full integration/physics validation nightly or weekly
  • Store artifacts and generate metrics/coverage reports

7. Test Data Needs

  • Sample tracker hits, truth, reference geometries
  • Edge case and boundary condition scenarios

Feedback, extensions, and concrete test implementations are encouraged!</issue_description>

<agent_instructions>Can you start working on point 1. Unit tests?</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

samf25 and others added 30 commits September 23, 2025 09:48
It's weird that this didn't pull with the rest of the changes ...
This only makes things build with v32 and v43, there are certainly
versions in between where different changes would be necessary.

(Potentially incomplete) list of related ACTS PRs:
- acts-project/acts#3337
- acts-project/acts#4005
Removed ROOT, EDM4hep, and Gaudi from the list of acts.
- Modified ACTSAlgBase to update geometry configuration
- Added buildsub/, installsub/, and setup.sh to gitignore
Copilot AI and others added 5 commits November 6, 2025 14:09
Co-authored-by: madbaron <7315158+madbaron@users.noreply.github.com>
… documentation

Co-authored-by: madbaron <7315158+madbaron@users.noreply.github.com>
…or Gaudi interface spelling

Co-authored-by: madbaron <7315158+madbaron@users.noreply.github.com>
…e raw pointers with smart pointers

Co-authored-by: madbaron <7315158+madbaron@users.noreply.github.com>
Co-authored-by: madbaron <7315158+madbaron@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement test suite for k4ActsTracking package Add unit test suite for k4ActsTracking core components Nov 6, 2025
Copilot AI requested a review from madbaron November 6, 2025 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implementing Test Suite for k4ActsTracking Package

4 participants