Skip to content
Snippets Groups Projects
Commit ca2bc4b8 authored by James Catmore's avatar James Catmore
Browse files

Improvement to DerivationFramework::PrescaleTool to give reproducible results when running in MP/MT

ATLASG-1450

It was noted that the derivation framework PrescaleTool is not safe in a multi-process/thread environment due to its use of an event counter, such that the order of execution needs to be the same to get reproducible results. This MR changes the tool to use the event number rather than a counter, and since the event number is independent of the the order of processing, the outcome of the prescaler is now exactly reproducible and predictable.


Former-commit-id: 34bb2bdbc7f28e74a954c5952ce0a7efb2fafc9b
parent dc92798f
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@ atlas_depends_on_subdirs(
PhysicsAnalysis/AnalysisCommon/PATCore
PhysicsAnalysis/DerivationFramework/DerivationFrameworkInterfaces
Trigger/TrigAnalysis/TrigDecisionTool
Event/xAOD/xAODEventInfo
PRIVATE
Control/AthenaKernel
PhysicsAnalysis/CommonTools/ExpressionEvaluation )
......@@ -26,7 +27,7 @@ atlas_add_library( DerivationFrameworkToolsLib
DerivationFrameworkTools/*.h src/*.cxx
PUBLIC_HEADERS DerivationFrameworkTools
PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
LINK_LIBRARIES AthenaBaseComps xAODBase GaudiKernel PATCoreLib
LINK_LIBRARIES AthenaBaseComps xAODBase GaudiKernel PATCoreLib xAODEventInfo
TrigDecisionToolLib ExpressionEvaluationLib DerivationFrameworkInterfacesLib
PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaKernel )
......
......@@ -25,7 +25,7 @@ namespace DerivationFramework {
virtual bool eventPassesFilter() const;
private:
mutable int m_prescale, m_eventCounter;
unsigned int m_prescale;
};
}
......
......@@ -11,6 +11,7 @@
// Use of ExpressionParsing to analyse a more complex string
#include "DerivationFrameworkTools/PrescaleTool.h"
#include "xAODEventInfo/EventInfo.h"
namespace DerivationFramework {
......@@ -30,7 +31,6 @@ namespace DerivationFramework {
ATH_MSG_FATAL("Prescale of less than 1 makes no sense");
return StatusCode::FAILURE;
}
m_eventCounter = 0;
return StatusCode::SUCCESS;
}
......@@ -41,9 +41,11 @@ namespace DerivationFramework {
bool PrescaleTool::eventPassesFilter() const
{
const xAOD::EventInfo* ei = 0;
CHECK( evtStore()->retrieve( ei , "EventInfo" ) );
uint32_t eventNumber ei->eventNumber();
bool accept(false);
if (m_eventCounter % m_prescale == 0) accept = true;
++m_eventCounter;
if (eventNumber % m_prescale == 0) accept = true;
return accept;
}
......
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