Skip to content

feat: ingest EventHeader into digi, generate UID to reseed RNG #1934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

wdconinc
Copy link
Contributor

Briefly, what does this PR introduce?

One challenge of multi-threaded/concurrent running is that the random number generators are called in no predictable order; this affects both events which can come out of order, or algorithms within the same event which can be called in different orders for different branches. That results in non-reproducibility.

This PR ingests the event header into digitization algorithms (which is our main use for random sampling). The event header is combined with the algorithm name into a random seed for that event/algorithm combination. With this seed, the random number generator is reseeded.

Outside the scope of this PR is reverting back to a single random service instead of the various algorithm specific approaches.

Still TODO in this algorithm:

  • expose the top-level seed used to generate event-level seeds as a property for setting through JANA.

What kind of change does this PR introduce?

  • Bug fix (issue: lack of reproducibility for multi-threaded running)
  • New feature (issue #__)
  • 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?

Yes. It results in a different random number sequence, so all distributions will be shuffled.

@github-actions github-actions bot added topic: calorimetry relates to calorimetry topic: PID Relates to PID reconstruction topic: far-forward Far forward reconstruction topic: far-backward Reconstruction related to far backward detectors topic: barrel topic: forward topic: backward topic: digitization labels Jun 27, 2025
Comment on lines +43 to +44
size_t getUniqueID(const event_num_t evt_num, const run_num_t run_num,
const std::string_view& name) const {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not strictly necessary to ingest name here, since can pass that on init, not process, but this is an attempt at sticking close to the k4FWCore approach. Only difference is that we take a string_view instead of a string (arguably they will want to move to string_view anyway).

@github-actions github-actions bot added the topic: tracking Relates to tracking reconstruction label Jun 27, 2025
Copy link
Contributor

github-actions bot commented Jun 27, 2025

@wdconinc
Copy link
Contributor Author

@wdconinc
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: backward topic: barrel topic: calorimetry relates to calorimetry topic: digitization topic: far-backward Reconstruction related to far backward detectors topic: far-forward Far forward reconstruction topic: forward topic: PID Relates to PID reconstruction topic: tracking Relates to tracking reconstruction
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant