The Gaudi Framework  master (181af51f)
Loading...
Searching...
No Matches
AbortEventAlg.cpp
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11// Include files
12
13// from Gaudi
16
17// local
18#include "AbortEventAlg.h"
19
20//-----------------------------------------------------------------------------
21// Implementation file for class : AbortEventAlg
22//
23// Nov 16, 2007 : Marco Clemencic
24//-----------------------------------------------------------------------------
25
26// Declaration of the Algorithm Factory
28
29//=============================================================================
30// Initialization
31//=============================================================================
33 StatusCode sc = Algorithm::initialize(); // must be executed first
34 if ( sc.isFailure() ) return sc; // error printed already by Algorithm
35
36 debug() << "==> Initialize" << endmsg;
37
38 m_incidentSvc = service( "IncidentSvc", true );
39
40 m_counter = 0;
41
43}
44
45//=============================================================================
46// Main execution
47//=============================================================================
49
50 debug() << "==> Execute" << endmsg;
51
52 if ( ++m_counter == m_count ) { m_incidentSvc->fireIncident( Incident( name(), IncidentType::AbortEvent ) ); }
53
55}
56
57//=============================================================================
58// Finalize
59//=============================================================================
61
62 debug() << "==> Finalize" << endmsg;
63
64 return Algorithm::finalize(); // must be called after all other actions
65}
66
67//=============================================================================
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
#define DECLARE_COMPONENT(type)
Small algorithm that after a given number of events triggers an AbortEvent.
StatusCode initialize() override
Algorithm initialization.
Gaudi::Property< long > m_count
StatusCode execute() override
Algorithm execution.
long m_counter
Counter of events.
StatusCode finalize() override
Algorithm finalization.
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to the incident service.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
Definition Algorithm.h:175
StatusCode finalize() override
the default (empty) implementation of IStateful::finalize() method
Definition Algorithm.h:181
const std::string & name() const override
The identifying name of the algorithm object.
SmartIF< IService > service(std::string_view name, const bool createIf=true, const bool quiet=false) const
Return a pointer to the service identified by name (or "type/name")
Base class for all Incidents (computing events).
Definition Incident.h:24
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
bool isFailure() const
Definition StatusCode.h:129
constexpr static const auto SUCCESS
Definition StatusCode.h:99