The Gaudi Framework
master (9f3f8895)
Toggle main menu visibility
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
14
#include <
GaudiKernel/IIncidentSvc.h
>
15
#include <
GaudiKernel/Incident.h
>
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
27
DECLARE_COMPONENT
(
AbortEventAlg
)
28
29
//=============================================================================
30
// Initialization
31
//=============================================================================
32
StatusCode
AbortEventAlg
::
initialize
() {
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
42
return
StatusCode::SUCCESS
;
43
}
44
45
//=============================================================================
46
// Main execution
47
//=============================================================================
48
StatusCode
AbortEventAlg::execute
() {
49
50
debug
() <<
"==> Execute"
<<
endmsg
;
51
52
if
( ++
m_counter
==
m_count
) {
m_incidentSvc
->fireIncident(
Incident
(
name
(), IncidentType::AbortEvent ) ); }
53
54
return
StatusCode::SUCCESS
;
55
}
56
57
//=============================================================================
58
// Finalize
59
//=============================================================================
60
StatusCode
AbortEventAlg::finalize
() {
61
62
debug
() <<
"==> Finalize"
<<
endmsg
;
63
64
return
Algorithm::finalize
();
// must be called after all other actions
65
}
66
67
//=============================================================================
AbortEventAlg.h
IIncidentSvc.h
Incident.h
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition
MsgStream.h:198
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition
PluginServiceV1.h:45
AbortEventAlg
Small algorithm that after a given number of events triggers an AbortEvent.
Definition
AbortEventAlg.h:25
AbortEventAlg::initialize
StatusCode initialize() override
Algorithm initialization.
Definition
AbortEventAlg.cpp:32
AbortEventAlg::m_count
Gaudi::Property< long > m_count
Definition
AbortEventAlg.h:35
AbortEventAlg::execute
StatusCode execute() override
Algorithm execution.
Definition
AbortEventAlg.cpp:48
AbortEventAlg::m_counter
long m_counter
Counter of events.
Definition
AbortEventAlg.h:40
AbortEventAlg::finalize
StatusCode finalize() override
Algorithm finalization.
Definition
AbortEventAlg.cpp:60
AbortEventAlg::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to the incident service.
Definition
AbortEventAlg.h:38
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition
CommonMessaging.h:118
Gaudi::Algorithm::initialize
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
Definition
Algorithm.h:175
Gaudi::Algorithm::finalize
StatusCode finalize() override
the default (empty) implementation of IStateful::finalize() method
Definition
Algorithm.h:181
Gaudi::Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition
Algorithm.cpp:518
Gaudi::Algorithm::service
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").
Definition
Algorithm.cpp:621
Incident
Base class for all Incidents (computing events).
Definition
Incident.h:24
StatusCode
This class is used for returning status codes from appropriate routines.
Definition
StatusCode.h:64
StatusCode::isFailure
bool isFailure() const
Definition
StatusCode.h:118
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition
StatusCode.h:99
GaudiTestSuite
src
AbortEvent
AbortEventAlg.cpp
Generated on
for The Gaudi Framework by
1.17.0