Skip to content

RNG-seeding bug fix and readability improvements#389

Open
andrsmit wants to merge 3 commits intomasterfrom
gen_primex_eta_he4_rng_fix
Open

RNG-seeding bug fix and readability improvements#389
andrsmit wants to merge 3 commits intomasterfrom
gen_primex_eta_he4_rng_fix

Conversation

@andrsmit
Copy link
Contributor

There were two commits added here:

  1. c323985
    • The inconsistent usage of tabs/spaces for indentation was standardized. Each layer of indentation is now created with 2 space characters (no tabs).
    • I removed indentations from empty lines.
    • A typo in a printout statement was corrected ("Swicth" -> "Switch")
    • Some extra spaces/tabs tacked on to the end of lines were removed.
  2. c0a5bf5
    • Originally this event generator initialized the seed for ROOT's global "gRandom" pointer by doing "gRandom->SetSeed(seed);" at the beginning of the code. That was removed at some point during the recent upgrades made last year, and was replaced with a locally-defined pointer to a TRandom3 (called "fRandom"). However, the "gRandom" pointer is still being used later on in the code to generate (pseudo) random values for the photon beam energy for each event. Without explicitly setting the seed for "gRandom" as well, this led to the same repeated sequence of beam energies on each execution of this code. To correct this, I added a line "gRandom = fRandom;" after the "fRandom" get's initialized.
    • There was previously an option for users to pass in a custom, fixed seed for the RNG using the "-s" flag during run time. This feature also disappeared with the updates that were made last year. The integer "seed" was still being defined and set, but was unused - leading to compiler warning messages. I added this feature back in by defining a new integer, "customSeed", which is 0 by default, but get's set to 1 whenever the user provides the "-s" flag. Otherwise, the same algorithm for determining the seed based on the timestamp is used.

@andrsmit andrsmit requested a review from aaust March 23, 2026 22:47
@gluex
Copy link

gluex commented Mar 24, 2026

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.

2 participants