ATLAS Offline Software
Loading...
Searching...
No Matches
AthCommonAlgorithm.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5// AthenaBaseComps includes
8#include "GaudiKernel/ICondSvc.h"
9#include "GaudiKernel/ServiceHandle.h"
10
11// Gaudi includes
12#include "Gaudi/Algorithm.h"
13#include "Gaudi/AsynchronousAlgorithm.h"
14
15
16template <class BaseAlg>
18 ISvcLocator* pSvcLocator ) :
19 ::AthCommonDataStore<AthCommonMsg<BaseAlg>> ( name, pSvcLocator )
20{
21
22 // Set up to run AthAlgorithmDHUpdate in sysInitialize before
23 // merging depedency lists. This extends the output dependency
24 // list with any symlinks implied by inheritance relations.
25 m_updateDataHandles =
26 std::make_unique<AthenaBaseComps::AthAlgorithmDHUpdate>
28 std::move (m_updateDataHandles));
29}
30
31
39template <class BaseAlg>
40StatusCode AthCommonAlgorithm<BaseAlg>::sysExecute (const EventContext& ctx)
41{
42 return BaseAlg::sysExecute (ctx);
43}
44
45
49 * This list is extended to include symlinks implied by inheritance
50 * relations.
51 */
52template <class BaseAlg>
54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
60 return BaseAlg::extraOutputDeps();
61}
62
63
70template <class BaseAlg>
73
74 if (sc.isFailure()) {
75 return sc;
76 }
77
78 ServiceHandle<ICondSvc> cs("CondSvc",name());
79 for (auto h : outputHandles()) {
80 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
81 // do this inside the loop so we don't create the CondSvc until needed
82 if ( cs.retrieve().isFailure() ) {
83 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
84 return StatusCode::SUCCESS;
85 }
86 if (cs->regHandle(this,*h).isFailure()) {
87 sc = StatusCode::FAILURE;
88 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
89 << " with CondSvc");
90 }
91 }
92 }
93 return sc;
94}
95
Update output dependencies to include symlinks.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
static Double_t sc
Common base class for algorithms.
AthCommonAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
virtual const DataObjIDColl & extraOutputDeps() const override
Return the list of extra output dependencies.
virtual StatusCode sysExecute(const EventContext &ctx) override
Execute an algorithm.
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Header file for AthHistogramAlgorithm.