From 0882682018cd84c326be172705c779dab90b6071 Mon Sep 17 00:00:00 2001 From: Penny Slocum Date: Wed, 3 Apr 2024 20:50:01 -0400 Subject: [PATCH] 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; + };