Skip to content

Conversation

@wdconinc
Copy link
Contributor

@wdconinc wdconinc commented Oct 29, 2025

Briefly, what does this PR introduce?

Includes:

This PR adds a truthiness value to each event. More truthiness is more confidently wrong.

See eic/EDM4eic#128 for a related effort (though this can go in without the data type; it will only log stuff though, until we can add the data type and modify the algorithm to provide the output).

What kind of change does this PR introduce?

  • Bug fix (issue #__)
  • New feature (too much truthiness)
  • Documentation update
  • Other: __

Please check if this PR fulfills the following:

  • Tests for the changes have been added
  • Documentation has been added / updated
  • Changes have been communicated to collaborators

Does this PR introduce breaking changes? What changes might users need to make to their code?

No.

Does this PR change default behavior?

No.

wdconinc added a commit that referenced this pull request Oct 29, 2025
…u) (#2164)

This PR applies the include-what-you-use fixes as suggested by
https://github.com/eic/EICrecon/actions/runs/18894504119.
Please merge this PR into the branch `truthiness`
to resolve failures in PR #2163.

Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
wdconinc added a commit that referenced this pull request Oct 29, 2025
…u) (#2165)

This PR applies the include-what-you-use fixes as suggested by
https://github.com/eic/EICrecon/actions/runs/18918945511.
Please merge this PR into the branch `truthiness`
to resolve failures in PR #2163.

Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@wdconinc
Copy link
Contributor Author

wdconinc added a commit that referenced this pull request Nov 1, 2025
…u) (#2164)

This PR applies the include-what-you-use fixes as suggested by
https://github.com/eic/EICrecon/actions/runs/18894504119.
Please merge this PR into the branch `truthiness`
to resolve failures in PR #2163.

Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
wdconinc added a commit that referenced this pull request Nov 1, 2025
…u) (#2165)

This PR applies the include-what-you-use fixes as suggested by
https://github.com/eic/EICrecon/actions/runs/18918945511.
Please merge this PR into the branch `truthiness`
to resolve failures in PR #2163.

Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
wdconinc and others added 9 commits November 7, 2025 14:25
…u) (#2164)

This PR applies the include-what-you-use fixes as suggested by
https://github.com/eic/EICrecon/actions/runs/18894504119.
Please merge this PR into the branch `truthiness`
to resolve failures in PR #2163.

Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…u) (#2165)

This PR applies the include-what-you-use fixes as suggested by
https://github.com/eic/EICrecon/actions/runs/18918945511.
Please merge this PR into the branch `truthiness`
to resolve failures in PR #2163.

Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copilot AI review requested due to automatic review settings November 7, 2025 20:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a Truthiness metric calculation feature that quantifies reconstruction quality by comparing reconstructed particles with Monte Carlo truth. The implementation uses conditional compilation to support both environments with and without the edm4eic::Truthiness output type.

  • Adds a new algorithm (Truthiness) that calculates a metric based on energy, momentum, and PDG code differences
  • Implements both factory and processor patterns depending on whether output persistence is available
  • Integrates the feature into the reconstruction chain and PODIO output

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/services/io/podio/JEventProcessorPODIO.cc Adds "Truthiness" to the output collection list when the header is available
src/global/reco/reco.cc Registers either factory (with output) or processor (without output) based on conditional compilation
src/global/reco/Truthiness_processor.h Defines processor class for running algorithm without persistent output
src/global/reco/Truthiness_processor.cc Implements processor with input collection retrieval and statistics reporting
src/factories/reco/Truthiness_factory.h Defines factory for running algorithm with persistent output collection
src/algorithms/reco/TruthinessConfig.h Defines empty configuration structure for future extensibility
src/algorithms/reco/Truthiness.h Defines algorithm interface with conditional output and statistics accessors
src/algorithms/reco/Truthiness.cc Implements truthiness calculation with penalties for mismatches and missing associations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI commented Nov 7, 2025

@wdconinc I've opened a new pull request, #2179, to work on those changes. Once the pull request is ready, I'll request review from you.

The Truthiness algorithm accumulates statistics in mutable member
variables from a const `process()` method, creating race conditions when
called concurrently from multiple threads.

## Changes

- **`m_event_count`**: Changed from `uint64_t` to
`std::atomic<uint64_t>` for lock-free atomic operations
- **`m_stats_mutex`**: Added mutex to protect `m_average_truthiness`
updates during the online average calculation
- **Accessors**: `getAverageTruthiness()` now locks, `getEventCount()`
uses atomic `.load()`

```cpp
// In process()
{
  std::lock_guard<std::mutex> lock(m_stats_mutex);
  m_event_count++;
  m_average_truthiness += (truthiness - m_average_truthiness) / m_event_count;
}
```

Pattern follows existing thread-safe implementations in the codebase
(e.g., `UniqueIDGenSvc`).

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: wdconinc <[email protected]>
@github-actions github-actions bot added topic: calorimetry relates to calorimetry topic: PID Relates to PID reconstruction labels Nov 8, 2025
@wdconinc
Copy link
Contributor Author

wdconinc commented Nov 8, 2025

truthiness_distribution truthiness_spatial_distribution truthiness_particle_types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: calorimetry relates to calorimetry topic: PID Relates to PID reconstruction

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants