Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
9 AthIncFirerAlg::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 
26 StatusCode 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 
AthIncFirerAlg::AthIncFirerAlg
AthIncFirerAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: AthIncFirerAlg.cxx:9
AthIncFirerAlg::m_incidents
Gaudi::Property< std::vector< std::string > > m_incidents
Definition: AthIncFirerAlg.h:30
AthIncFirerAlg.h
AthIncFirerAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: AthIncFirerAlg.cxx:26
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
AthIncFirerAlg::m_incSvc
ServiceHandle< IIncidentSvc > m_incSvc
Definition: AthIncFirerAlg.h:33
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
AthIncFirerAlg::initialize
virtual StatusCode initialize() override
Definition: AthIncFirerAlg.cxx:15
AthIncFirerAlg::m_serial
Gaudi::Property< bool > m_serial
Definition: AthIncFirerAlg.h:31