Skip to content
Snippets Groups Projects
Commit d3b2b0f8 authored by Joerg Stelzer's avatar Joerg Stelzer
Browse files

Fix HLT prescaling when run on preloaded data with HLTEventLoopMgr forcedSORTime

parent c983c691
6 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!36103Fix HLT prescaling when run on preloaded data
......@@ -6,6 +6,7 @@
#include "GaudiKernel/IToolSvc.h"
#include "CLHEP/Random/RandomEngine.h"
#include "CLHEP/Random/Ranlux64Engine.h"
#include "xAODEventInfo/EventInfo.h"
const std::function< CLHEP::HepRandomEngine*(void) > PSTRanluxFactory = [](void)->CLHEP::HepRandomEngine*{
return new CLHEP::Ranlux64Engine();
......@@ -25,6 +26,8 @@ StatusCode
PrescalingTool::initialize()
{
ATH_CHECK(m_hltPrescaleSetInputKey.initialize( ! m_hltPrescaleSetInputKey.key().empty() ));
ATH_CHECK( m_eventInfoKey.initialize() );
if ( !m_monTool.empty() ) ATH_CHECK(m_monTool.retrieve());
return StatusCode::SUCCESS;
......@@ -68,7 +71,17 @@ StatusCode PrescalingTool::prescaleChains( const EventContext& ctx,
remainActive.reserve( initiallyActive.size() );
// create the seed from the event time
size_t seed = ctx.eventID().time_stamp() ^ ctx.eventID().time_stamp_ns_offset();
/**
Note: the event time needs to be taken from the EventInfo instead EventContext.eventID, which is commonly done!
This is due to the special case when the trigger is run in a partition with preloaded data and the parameter @c
HLTEventLoopMgr.forceStartOfRunTime is set >0. In that case the @c EventContext.EventID is forced to the be the
SOR time for each event. Using the @c EventContext.eventID would lead to a constant seed and a scewed prescaling.
*/
auto eventInfoHandle = SG::makeHandle( m_eventInfoKey, ctx );
CHECK( eventInfoHandle.isValid() );
size_t seed = eventInfoHandle->timeStamp() ^ eventInfoHandle->timeStampNSOffset();
CLHEP::HepRandomEngine* engine = m_RNGEngines.getEngine( ctx );
engine->setSeed( seed, 0 );
......
......@@ -59,6 +59,7 @@ class PrescalingTool : public extends<AthAlgTool, IPrescalingTool> {
// input data
SG::ReadCondHandleKey<TrigConf::HLTPrescalesSet> m_hltPrescaleSetInputKey{ this, "HLTPrescales", "HLTPrescales", "HLT prescales set"};
SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{ this, "EventInfo", "EventInfo", "Event Info Object Key"};
// properties
Gaudi::Property<bool> m_keepUnknownChains{ this, "KeepUnknownChains", true, "If True then chains for which prescaling information is not set are kept" };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment