From 216c679ebc2cf58a311bb953270d4a221c758d78 Mon Sep 17 00:00:00 2001 From: Penny Slocum Date: Wed, 3 Apr 2024 20:49:41 -0400 Subject: [PATCH 1/5] Use LMCUniformDistribution for track length randomization. --- Source/Kassiopeia/LMCRunPause.cc | 7 +++++-- Source/Kassiopeia/LMCRunPause.hh | 6 ++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/Kassiopeia/LMCRunPause.cc b/Source/Kassiopeia/LMCRunPause.cc index 44e29aba..5ce29c20 100644 --- a/Source/Kassiopeia/LMCRunPause.cc +++ b/Source/Kassiopeia/LMCRunPause.cc @@ -296,9 +296,12 @@ namespace locust { if ( aParam["random-track-length"]().as_bool() == true) { - srand ( GetSeed( aParam )); + scarab::param_node default_setting; + default_setting.add("name","uniform"); + fTrackLengthDistribution = fDistributionInterface.get_dist(default_setting); + fDistributionInterface.SetSeed( GetSeed(aParam) ); double tMinTrackLength = tMaxTrackLength * tMinTrackLengthFraction; - double tRandomTime = tMinTrackLength + (tMaxTrackLength - tMinTrackLength) * (rand() % 10) / 9.; + double tRandomTime = tMinTrackLength + (tMaxTrackLength - tMinTrackLength) * fTrackLengthDistribution->Generate(); fLocustMaxTimeTerminator->SetTime( tRandomTime ); LPROG(lmclog,"Randomizing the track length to " << tRandomTime); } diff --git a/Source/Kassiopeia/LMCRunPause.hh b/Source/Kassiopeia/LMCRunPause.hh index 83e7338f..366e30b1 100644 --- a/Source/Kassiopeia/LMCRunPause.hh +++ b/Source/Kassiopeia/LMCRunPause.hh @@ -28,6 +28,7 @@ #include "KSGenTimeComposite.h" #include "LMCKassLocustInterface.hh" #include "KRandom.h" +#include "LMCDistributionInterface.hh" #include #include @@ -79,6 +80,11 @@ namespace locust Kassiopeia::KSGeoSpace* fKSSpace; Kassiopeia::KSGenGeneratorComposite* fGenerator; + std::shared_ptr< BaseDistribution> fTrackLengthDistribution; + DistributionInterface fDistributionInterface; + + + }; From 0882682018cd84c326be172705c779dab90b6071 Mon Sep 17 00:00:00 2001 From: Penny Slocum Date: Wed, 3 Apr 2024 20:50:01 -0400 Subject: [PATCH 2/5] Use LMCUniformDistribution for track start delay randomization. --- Source/Generators/LMCCavitySignalGenerator.cc | 7 +++++-- Source/Generators/LMCCavitySignalGenerator.hh | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Source/Generators/LMCCavitySignalGenerator.cc b/Source/Generators/LMCCavitySignalGenerator.cc index a8ea83d3..7ff2c4ea 100644 --- a/Source/Generators/LMCCavitySignalGenerator.cc +++ b/Source/Generators/LMCCavitySignalGenerator.cc @@ -322,8 +322,11 @@ namespace locust bool CavitySignalGenerator::RandomizeStartDelay() { - srand ( fTrackDelaySeed ); - int tNPreEventSamples = fNPreEventSamples/10 * ( rand() % 10 ); + scarab::param_node default_setting; + default_setting.add("name","uniform"); + fStartDelayDistribution = fDistributionInterface.get_dist(default_setting); + fDistributionInterface.SetSeed( fTrackDelaySeed ); + int tNPreEventSamples = fNPreEventSamples * fStartDelayDistribution->Generate(); LPROG(lmclog,"Randomizing the start delay to " << tNPreEventSamples << " fast samples."); fNPreEventSamples = tNPreEventSamples; diff --git a/Source/Generators/LMCCavitySignalGenerator.hh b/Source/Generators/LMCCavitySignalGenerator.hh index cb8efd13..1190d435 100644 --- a/Source/Generators/LMCCavitySignalGenerator.hh +++ b/Source/Generators/LMCCavitySignalGenerator.hh @@ -25,6 +25,7 @@ #include "LMCTFFileHandler.hh" #include "LMCCavityUtility.hh" #include "LMCAliasingUtility.hh" +#include "LMCDistributionInterface.hh" #include #include #include @@ -134,6 +135,9 @@ namespace locust const scarab::param_node* fParam; + std::shared_ptr< BaseDistribution> fStartDelayDistribution; + DistributionInterface fDistributionInterface; + }; From 960f655fb5d6533d58e19bc6d4ee955dc207e513 Mon Sep 17 00:00:00 2001 From: Penny Slocum Date: Wed, 3 Apr 2024 20:50:45 -0400 Subject: [PATCH 3/5] Build on push to feature branch. --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 592aedda..1b97349a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,7 +3,7 @@ name: Build and Test Locust on: pull_request: push: - branches: [master, develop] + branches: [master, develop, feature/useFTGdistributions] tags: ['*'] workflow_dispatch: From 069b97eea173538e913a90c4866606bbca1c25a8 Mon Sep 17 00:00:00 2001 From: Penny Slocum Date: Thu, 18 Apr 2024 15:27:52 -0400 Subject: [PATCH 4/5] Remove build on push to feature branch. --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1b97349a..592aedda 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,7 +3,7 @@ name: Build and Test Locust on: pull_request: push: - branches: [master, develop, feature/useFTGdistributions] + branches: [master, develop] tags: ['*'] workflow_dispatch: From b14b3a633dda2881d211dfac9aaa38172b7a7a63 Mon Sep 17 00:00:00 2001 From: Penny Slocum Date: Sat, 20 Apr 2024 09:40:31 -0400 Subject: [PATCH 5/5] Bump version to v2.9.1 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a78db879..8289672f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required( VERSION 3.1 ) # Define the project cmake_policy( SET CMP0048 NEW ) # version in project() -project( locust_mc VERSION 2.8.0) +project( locust_mc VERSION 2.8.1) list( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/Scarab/cmake )