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 ) 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; + }; 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; + + + };