Skip to content
Snippets Groups Projects
Commit f13dc9cc authored by Rosen Matev's avatar Rosen Matev :sunny:
Browse files

ConfigurableDummy can fail in more ways

parent 05c9008f
No related branches found
No related tags found
4 merge requests!4553Fix UT Decoder,!4539Synchronize master branch with 2024-patches,!4525Draft: Synchronize master branch with 2024-patches,!3883Error event handling
......@@ -27,8 +27,10 @@ public:
StatusCode initialize() override;
private:
Gaudi::Property<int> m_CFD{this, "CFD", 1, "ControlFlowDecision is true every Nth events"};
Gaudi::Property<int> m_CFD{this, "CFD", 1, "ControlFlowDecision is true every Nth events"};
Gaudi::Property<std::vector<bool>> m_CFDs{this, "CFDs", {}, "Vector of decisions, overrides CFD"};
Gaudi::Property<bool> m_decisionWarning{this, "DecisionWarning", false, "Emit a warning for false decisions"};
Gaudi::Property<bool> m_decisionException{this, "DecisionException", false, "Throw an exception for false decisions"};
Gaudi::Property<int> m_signal{this, "Signal", 0, "Raise signal"};
Gaudi::Property<std::vector<std::string>> m_inpKeys{this, "inpKeys", {}, ""};
......@@ -95,9 +97,16 @@ StatusCode ConfigurableDummy::execute( EventContext const& context ) const // th
outputHandle->put( std::make_unique<DataObject>() );
}
bool decision = m_CFD > 0 && context.evt() % m_CFD == 0;
bool decision = false;
if ( !m_CFDs.empty() ) {
decision = m_CFDs[context.evt() % m_CFDs.size()];
} else {
decision = m_CFD > 0 && context.evt() % m_CFD == 0;
}
if ( m_decisionWarning && !decision ) { warning() << "Event did not pass" << endmsg; }
if ( m_decisionException && !decision ) {
throw GaudiException( "Event did not pass", __PRETTY_FUNCTION__, StatusCode::FAILURE );
}
if ( m_signal > 0 ) { std::raise( m_signal ); }
return decision ? Gaudi::Functional::FilterDecision::PASSED : Gaudi::Functional::FilterDecision::FAILED;
......
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