ATLAS Offline Software
Control
AthenaBaseComps
src
AthAlgorithm.cxx
Go to the documentation of this file.
1
3
/*
4
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
// AthAlgorithm.cxx
8
// Implementation file for class AthAlgorithm
9
// Author: S.Binet<binet@cern.ch>
11
12
// AthenaBaseComps includes
13
#include "
AthenaBaseComps/AthAlgorithm.h
"
14
#include "
AthAlgorithmDHUpdate.h
"
15
#include "GaudiKernel/ICondSvc.h"
16
#include "GaudiKernel/ServiceHandle.h"
17
19
// Public methods:
21
22
// Constructors
24
AthAlgorithm::AthAlgorithm
(
const
std::string&
name
,
25
ISvcLocator* pSvcLocator ) :
26
::
AthCommonDataStore
<
AthCommonMsg
<Algorithm>> (
name
, pSvcLocator )
27
{
28
// Set up to run AthAlgorithmDHUpdate in sysInitialize before
29
// merging dependency lists. This extends the output dependency
30
// list with any symlinks implied by inheritance relations.
31
m_updateDataHandles =
32
std::make_unique<AthenaBaseComps::AthAlgorithmDHUpdate>
33
(
m_extendedExtraObjects
,
34
std::move (m_updateDataHandles));
35
}
36
37
// Destructor
39
AthAlgorithm::~AthAlgorithm
()
40
{
41
}
42
43
50
const
DataObjIDColl&
AthAlgorithm::extraOutputDeps
()
const
51
{
52
// If we didn't find any symlinks to add, just return the collection
53
// from the base class. Otherwise, return the extended collection.
54
if
(!
m_extendedExtraObjects
.empty()) {
55
return
m_extendedExtraObjects
;
56
}
57
return
Algorithm::extraOutputDeps();
58
}
59
66
StatusCode
AthAlgorithm::sysInitialize
() {
67
StatusCode
sc
=
AthCommonDataStore<AthCommonMsg<Algorithm>
>
::sysInitialize
();
68
69
if
(
sc
.isFailure()) {
70
return
sc
;
71
}
72
ServiceHandle<ICondSvc>
cs(
"CondSvc"
,
name
());
73
for
(
auto
h
:
outputHandles
()) {
74
if
(
h
->isCondition() &&
h
->mode() ==
Gaudi::DataHandle::Writer
) {
75
// do this inside the loop so we don't create the CondSvc until needed
76
if
( cs.retrieve().isFailure() ) {
77
ATH_MSG_WARNING
(
"no CondSvc found: won't autoreg WriteCondHandles"
);
78
return
StatusCode::SUCCESS;
79
}
80
if
(cs->regHandle(
this
,*
h
).isFailure()) {
81
sc
= StatusCode::FAILURE;
82
ATH_MSG_ERROR
(
"unable to register WriteCondHandle "
<<
h
->fullKey()
83
<<
" with CondSvc"
);
84
}
85
}
86
}
87
return
sc
;
88
}
AthAlgorithmDHUpdate.h
Update output dependencies to include symlinks.
AthenaPoolTestRead.sc
sc
Definition:
AthenaPoolTestRead.py:27
AthAlgorithm.h
AthCommonDataStore
Definition:
AthCommonDataStore.h:52
AthAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition:
AthAlgorithm.cxx:66
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition:
AthMsgStreamMacros.h:33
AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgorithm::~AthAlgorithm
virtual ~AthAlgorithm()
Destructor:
Definition:
AthAlgorithm.cxx:39
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:228
AthAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Definition:
AthAlgorithm.h:79
AthCommonMsg
Definition:
AthCommonMsg.h:19
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition:
AthMsgStreamMacros.h:32
AthAlgorithm::extraOutputDeps
virtual const DataObjIDColl & extraOutputDeps() const override
Return the list of extra output dependencies.
Definition:
AthAlgorithm.cxx:50
AthAlgorithm::AthAlgorithm
AthAlgorithm()
Default constructor:
LHEF::Writer
Pythia8::Writer Writer
Definition:
Prophecy4fMerger.cxx:12
ServiceHandle< ICondSvc >
Generated on Sun Dec 22 2024 21:07:08 for ATLAS Offline Software by
1.8.18