ATLAS Offline Software
Loading...
Searching...
No Matches
AthIncFirerAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "AthIncFirerAlg.h"
6#include "GaudiKernel/Incident.h"
7
8
9AthIncFirerAlg::AthIncFirerAlg(const std::string& name, ISvcLocator* pSvcLocator) :
10 AthReentrantAlgorithm(name, pSvcLocator),
11 m_incSvc("IncidentSvc", name)
12{}
13
14
16 ATH_CHECK( m_incSvc.retrieve() );
17
18 if (m_incidents.empty()) {
19 ATH_MSG_ERROR("Need to have at least one incident defined!" <<name());
20 return StatusCode::FAILURE;
21 }
22 return StatusCode::SUCCESS;
23}
24
25
26StatusCode AthIncFirerAlg::execute(const EventContext& ctx) const {
27
28 for (const std::string& inc : m_incidents) {
29 ATH_MSG_VERBOSE("Firing incident " << inc);
30 if (m_serial) {
31 m_incSvc->fireIncident(Incident(name(), inc, ctx));
32 }
33 else {
34 m_incSvc->fireIncident(std::make_unique<Incident>(name(), inc, ctx));
35 }
36 }
37 return StatusCode::SUCCESS;
38}
39
40
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
AthIncFirerAlg(const std::string &name, ISvcLocator *pSvcLocator)
Gaudi::Property< bool > m_serial
Gaudi::Property< std::vector< std::string > > m_incidents
ServiceHandle< IIncidentSvc > m_incSvc
virtual StatusCode execute(const EventContext &ctx) const override
virtual StatusCode initialize() override
An algorithm that can be simultaneously executed in multiple threads.