Skip to content

Commit

Permalink
refactor: make RNG independent of algorithm order (#1905)
Browse files Browse the repository at this point in the history
after discussion with paul I though it would be beneficial to remove the dependence of the algorithm order of the RNG in the examples framework. changing the order of reader/writer/algorithms used to result in different outputs which might be unexpected and hard to debug

I believe the impact on the randomness in the simulation is negligible and should not result in funny correlations
  • Loading branch information
andiwand committed Mar 2, 2023
1 parent 3847c73 commit 8c93c71
Show file tree
Hide file tree
Showing 22 changed files with 92 additions and 106 deletions.
Binary file modified CI/physmon/reference/performance_ambi_orthogonal.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_ambi_seeded.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_ckf_orthogonal.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_ckf_seeded.root
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified CI/physmon/reference/performance_ckf_truth_estimated.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_ckf_truth_smeared.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_gsf.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_seeding_hists_orthogonal.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_seeding_hists_seeded.root
Binary file not shown.
Binary file not shown.
Binary file modified CI/physmon/reference/performance_truth_tracking.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_vertexing_orthogonal_hist.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_vertexing_seeded_hist.root
Binary file not shown.
Binary file not shown.
Binary file modified CI/physmon/reference/performance_vertexing_truth_smeared_hist.root
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ ActsExamples::ProcessCode ActsExamples::TrackFindingAlgorithm::execute(
Acts::Vector3{0., 0., 0.});

Acts::PropagatorPlainOptions pOptions;
pOptions.maxSteps = 10000;
pOptions.maxSteps = 100000;

MeasurementCalibrator calibrator{measurements};
Acts::GainMatrixUpdater kfUpdater;
Expand Down
8 changes: 1 addition & 7 deletions Examples/Framework/src/Framework/RandomNumbers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,5 @@ ActsExamples::RandomEngine ActsExamples::RandomNumbers::spawnGenerator(

uint64_t ActsExamples::RandomNumbers::generateSeed(
const AlgorithmContext& context) const {
// use Cantor pairing function to generate a unique generator id from
// algorithm and event number to get a consistent seed
// see https://en.wikipedia.org/wiki/Pairing_function#Cantor_pairing_function
const uint64_t k1 = context.algorithmNumber;
const uint64_t k2 = context.eventNumber;
const uint64_t id = (k1 + k2) * (k1 + k2 + 1) / 2 + k2;
return m_cfg.seed + id;
return m_cfg.seed + context.eventNumber;
}
181 changes: 86 additions & 95 deletions Examples/Python/tests/root_file_hashes.txt

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions Examples/Python/tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ def test_seeding_orthogonal(tmp_path, trk_geo, field, assert_root_hash):
(
"estimatedparams.root",
"estimatedparams",
309,
284,
),
(
"performance_seeding_trees.root",
"track_finder_tracks",
309,
284,
),
(
"performance_seeding_hists.root",
Expand Down Expand Up @@ -922,7 +922,8 @@ def test_digitization_example(trk_geo, tmp_path, assert_root_hash):
assert len(list(csv_dir.iterdir())) == 3 * s.config.events
assert all(f.stat().st_size > 50 for f in csv_dir.iterdir())
assert_entries(root_file, "vol9", 0)
for tn in (8, 12, 13, 14, 16, 17, 18):
assert_entries(root_file, "vol14", 0)
for tn in (8, 12, 13, 16, 17, 18):
assert_has_entries(root_file, f"vol{tn}")

assert_root_hash(root_file.name, root_file)
Expand Down

0 comments on commit 8c93c71

Please sign in to comment.