ATLAS Offline Software
Loading...
Searching...
No Matches
AthAlgorithm.cxx
Go to the documentation of this file.
1
2
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
15#include "GaudiKernel/ICondSvc.h"
16#include "GaudiKernel/ServiceHandle.h"
17
19// Public methods:
21
22// Constructors
24AthAlgorithm::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>
34 std::move (m_updateDataHandles));
35}
36
37// Destructor
42
43
50const DataObjIDColl& AthAlgorithm::extraOutputDeps() const
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()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
59
61 * @brief Override sysInitialize from the base class
62 *
63 * Scan through all outputHandles, and if they're WriteCondHandles,
64 * register them with the CondSvc
65 */
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}
Update output dependencies to include symlinks.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
static Double_t sc
virtual const DataObjIDColl & extraOutputDeps() const override
Return the list of extra output dependencies.
DataObjIDColl m_extendedExtraObjects
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthAlgorithm()
Default constructor:
virtual ~AthAlgorithm()
Destructor:
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Header file for AthHistogramAlgorithm.