ATLAS Offline Software
AthIncFirerAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 #include "AthIncFirerAlg.h"
5 #include "GaudiKernel/IIncidentSvc.h"
6 #include "GaudiKernel/Incident.h"
8 
9 AthIncFirerAlg::AthIncFirerAlg( const std::string& name, ISvcLocator* pSvcLocator ):AthReentrantAlgorithm(name,pSvcLocator),m_Serial(false){
10  declareProperty("Incidents",m_incLists,"Incidents to fire");
11  declareProperty("FireSerial",m_Serial,"Whether to fire serial incidents");
12 }
13 
15  m_incSvc = service("IncidentSvc",true);
16  //Copied from CPUCruncher.cpp
17  if (m_incLists.value().size()==0){
18  ATH_MSG_ERROR("Need to have at least one incident defined!" <<name());
19  return StatusCode::FAILURE;
20  }
21  return StatusCode::SUCCESS;
22 }
23 
24 StatusCode AthIncFirerAlg::execute(const EventContext& ctx)const {
25  auto ctxcp=ctx;
26  for(auto & i:m_incLists.value()){
27  ATH_MSG_VERBOSE("Firing incident "<<i);
28  m_incSvc->fireIncident(std::make_unique<Incident>(name(),i,ctxcp));
29  if (m_Serial.value()) m_incSvc->fireIncident(Incident(name(),i,ctxcp));
30  }
31  return StatusCode::SUCCESS;
32 }
33 
34 
36  return StatusCode::SUCCESS;
37 }
AthIncFirerAlg::AthIncFirerAlg
AthIncFirerAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: AthIncFirerAlg.cxx:9
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
AthIncFirerAlg.h
AthIncFirerAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: AthIncFirerAlg.cxx:24
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AthIncFirerAlg::m_incSvc
SmartIF< IIncidentSvc > m_incSvc
Definition: AthIncFirerAlg.h:27
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthIncFirerAlg::finalize
virtual StatusCode finalize() override
Definition: AthIncFirerAlg.cxx:35
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
errorcheck.h
Helpers for checking error return status codes and reporting errors.
AthIncFirerAlg::initialize
virtual StatusCode initialize() override
Definition: AthIncFirerAlg.cxx:14
AthIncFirerAlg::m_incLists
StringArrayProperty m_incLists
Definition: AthIncFirerAlg.h:25
AthIncFirerAlg::m_Serial
BooleanProperty m_Serial
Definition: AthIncFirerAlg.h:26