diff --git a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/python/MTCalibPebConfig.py b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/python/MTCalibPebConfig.py index 0505712f88c8633e847618922a32fb0ac55ef0fc..e7d41a6c2208a763c258a4beb0dc51e66fe15595 100644 --- a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/python/MTCalibPebConfig.py +++ b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/python/MTCalibPebConfig.py @@ -85,6 +85,7 @@ rob_access_dict = { class MTCalibPebHypoOptions: def __init__(self): + self.UseRandomSeed = False self.RandomAcceptRate = -1.0 self.BurnTimePerCycleMillisec = 0 self.NumBurnCycles = 0 @@ -161,6 +162,7 @@ def make_hypo_alg(name): def make_hypo_tool(name, options=default_options): from TrigExPartialEB.TrigExPartialEBConf import MTCalibPebHypoTool hypo_tool = MTCalibPebHypoTool(name) + hypo_tool.UseRandomSeed = options.UseRandomSeed hypo_tool.RandomAcceptRate = options.RandomAcceptRate hypo_tool.BurnTimePerCycleMillisec = options.BurnTimePerCycleMillisec hypo_tool.NumBurnCycles = options.NumBurnCycles diff --git a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/share/MTCalibPeb.py b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/share/MTCalibPeb.py index def03037a9bf4a809d9b4c5e69f4c5d23e52701a..caddc643a3195c0d1eb61e30db64de61c02790dd 100644 --- a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/share/MTCalibPeb.py +++ b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/share/MTCalibPeb.py @@ -15,6 +15,7 @@ concurrent = get_opt('concurrent', False) # Number of chains num_chains = get_opt('num_chains', 3) # Configure hypo tool options +MTCalibPebConfig.default_options.UseRandomSeed = get_opt('UseRandomSeed', False) MTCalibPebConfig.default_options.RandomAcceptRate = get_opt('RandomAcceptRate', 0.01) MTCalibPebConfig.default_options.BurnTimePerCycleMillisec = get_opt('BurnTimePerCycleMillisec', 20) MTCalibPebConfig.default_options.NumBurnCycles = get_opt('NumBurnCycles', 10) diff --git a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/src/MTCalibPebHypoTool.cxx b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/src/MTCalibPebHypoTool.cxx index 83c6a217465ae114f30247bb0c15ccd9de585282..082c838133d6d86e44cc542c7aa7aa9a1eedbdd0 100644 --- a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/src/MTCalibPebHypoTool.cxx +++ b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/src/MTCalibPebHypoTool.cxx @@ -18,10 +18,20 @@ // Local implementation-specific helper methods namespace { + using rng_t = std::mt19937_64; + using seed_t = rng_t::result_type; + /// Calculate seed from EventID and tool name + seed_t eventSeed(const EventIDBase& eventID, const std::string& name) { + uint64_t evtNum = eventID.event_number(); + uint64_t runNum = eventID.run_number(); + uint64_t nameHash = std::hash<std::string>{}(name); + uint64_t seed = evtNum ^ (runNum << 10) ^ nameHash; + return static_cast<seed_t>(seed); + } /// Returns a reference to static thread-local random number generator - std::mt19937& threadLocalGenerator() { + rng_t& threadLocalGenerator() { static thread_local std::random_device rd; // used only to ensure different seeds for mt19937 - static thread_local std::mt19937 generator(rd()); + static thread_local rng_t generator(rd()); return generator; } /// Basic random real number generation @@ -161,6 +171,12 @@ StatusCode MTCalibPebHypoTool::finalize() { // ============================================================================= StatusCode MTCalibPebHypoTool::decide(const MTCalibPebHypoTool::Input& input) const { + // Re-seed the static thread-local RNG + if (not m_useRandomSeed.value()) { + const seed_t seed = eventSeed(input.eventContext.eventID(), name()); + ATH_MSG_DEBUG("Using seed " << seed << " for event " << input.eventContext.eventID()); + threadLocalGenerator().seed(seed); + } // --------------------------------------------------------------------------- // Burn CPU time diff --git a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/src/MTCalibPebHypoTool.h b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/src/MTCalibPebHypoTool.h index 58bad04d0e515216b0948781258b1c58a1fa6d75..9852ace6ad51eaf9f7af93a1e9926814a6faa784 100644 --- a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/src/MTCalibPebHypoTool.h +++ b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/src/MTCalibPebHypoTool.h @@ -60,6 +60,10 @@ private: }; // ------------------------- Properties -------------------------------------- + Gaudi::Property<bool> m_useRandomSeed { + this, "UseRandomSeed", false, + "If true, use random seed for the internal RNG. If false, use a seed based on run/event number and tool name." + }; Gaudi::Property<double> m_acceptRate { this, "RandomAcceptRate", -1, "Rate of random accepts, <=0 is never, >=1 is always" diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_build.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_build.py index 5de739c82b59a8d2726d9e4e8bbe05659b709e05..36508b956e0d4b51fb74224ba0e427c77b6e1a4d 100755 --- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_build.py +++ b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_build.py @@ -18,5 +18,8 @@ test.art_type = 'build' test.exec_steps = [ex] test.check_steps = CheckSteps.default_check_steps(test) +# Make RootComp step required +test.get_step('RootComp').required = True + import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_build.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_build.py index ab02ca5b8487d897d6af31f854e35f6ba69b8b8b..2e842357485b6420fa432b60674fb94c11358185 100755 --- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_build.py +++ b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_build.py @@ -22,5 +22,8 @@ test.art_type = 'build' test.exec_steps = [ex] test.check_steps = CheckSteps.default_check_steps(test) +# Make RootComp step required +test.get_step('RootComp').required = True + import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_grid.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_grid.py index c707e93f549a5f299298b83a8131f44d61c7068a..6b42cdbc2d9787dc37aa3914f9fe927e4f8d7654 100755 --- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_grid.py +++ b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_grid.py @@ -34,5 +34,8 @@ test.art_type = 'grid' test.exec_steps = [ex] test.check_steps = CheckSteps.default_check_steps(test) +# Make RootComp step required +test.get_step('RootComp').required = True + import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_forkAndMT_build.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_forkAndMT_build.py deleted file mode 100755 index ba97113d99ee0a46a56e8f687f38b24a8ac64a25..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_forkAndMT_build.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env python - -# art-description: CalibPeb test with forks=2, threads=2, concurrent_events=2 -# art-type: build -# art-include: master/Athena -# Skipping art-output which has no effect for build tests. -# If you create a grid version, check art-output in existing grid tests. - -from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps - -ex = ExecStep.ExecStep() -ex.type = 'athenaHLT' -ex.job_options = 'TrigExPartialEB/MTCalibPeb.py' -ex.input = 'data' -ex.forks = 2 -ex.threads = 2 -ex.concurrent_events = 2 - -test = Test.Test() -test.art_type = 'build' -test.exec_steps = [ex] -test.check_steps = CheckSteps.default_check_steps(test) - -import sys -sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_highForkAndMT_build.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_highForkAndMT_build.py index 7f7f51359d6d5fa429003de30510f4b056e5e0dc..dbb65dda3667a3ef9d1315e2ef8bc07b65417721 100755 --- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_highForkAndMT_build.py +++ b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_highForkAndMT_build.py @@ -21,5 +21,8 @@ test.art_type = 'build' test.exec_steps = [ex] test.check_steps = CheckSteps.default_check_steps(test) +# Make RootComp step required +test.get_step('RootComp').required = True + import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigValTools/bin/rootcomp.py b/Trigger/TrigValidation/TrigValTools/bin/rootcomp.py index 8bd362668c10bbf319a4f44e50483b744808c63f..ad13c7842a8f22fb6110e90bf55625455dbf0248 100755 --- a/Trigger/TrigValidation/TrigValTools/bin/rootcomp.py +++ b/Trigger/TrigValidation/TrigValTools/bin/rootcomp.py @@ -158,6 +158,7 @@ def main(): opts.skip += ["Average Hlt Result size for physics streams"] # ATR-14330 opts.skip += ["HltEDMSizes:Events_Without_Truncation"] # ATR-14330 opts.skip += ["Trig.*CaloCellMaker.*/TCRec_"] # timing histograms in TrigCaloCellMaker + opts.skip += ["HLTFramework/ROBDataProviderSvc"] # RDP histograms differ in MT due to caching # Default thresholds if not opts.threshold: