ATLAS Offline Software
Loading...
Searching...
No Matches
AthCommonReentrantAlgorithm.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5*/
6
7// AthReentrantAlgorithm.cxx
8// Implementation file for class AthReentrantAlgorithm
9// Author: C. Leggett
11
12// AthenaBaseComps includes
15#include "GaudiKernel/ICondSvc.h"
16#include "GaudiKernel/ServiceHandle.h"
17
18// Gaudi includes
19#include "Gaudi/Algorithm.h"
20#include "Gaudi/AsynchronousAlgorithm.h"
21
22
23template <class BaseAlg>
25 ISvcLocator* pSvcLocator ) :
26 ::AthCommonDataStore<AthCommonMsg<BaseAlg>> ( name, pSvcLocator )
27{
28
29 // Set up to run AthAlgorithmDHUpdate in sysInitialize before
30 // merging depedency lists. This extends the output dependency
31 // list with any symlinks implied by inheritance relations.
32 m_updateDataHandles =
33 std::make_unique<AthenaBaseComps::AthAlgorithmDHUpdate>
35 std::move (m_updateDataHandles));
36}
37
38// Destructor
40template <class BaseAlg>
45
48template <class BaseAlg>
50{
51 // Reentrant algorithms are clonable.
52 return true;
53}
60template <class BaseAlg>
62{
63 return 0;
64}
65
68 *
69 * We override this in order to work around an issue with the Algorithm
70 * base class storing the event context in a member variable that can
71 * cause crashes in MT jobs.
72 */
73template <class BaseAlg>
74StatusCode AthCommonReentrantAlgorithm<BaseAlg>::sysExecute (const EventContext& ctx)
76 return BaseAlg::sysExecute (ctx);
77}
78
79
85 */
86template <class BaseAlg>
88{
89 // If we didn't find any symlinks to add, just return the collection
90 // from the base class. Otherwise, return the extended collection.
91 if (!m_extendedExtraObjects.empty()) {
93 }
94 return BaseAlg::extraOutputDeps();
95}
96
97
104template <class BaseAlg>
107
108 if (sc.isFailure()) {
109 return sc;
110 }
111
112 ServiceHandle<ICondSvc> cs("CondSvc",name());
113 for (auto h : outputHandles()) {
114 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
115 // do this inside the loop so we don't create the CondSvc until needed
116 if ( cs.retrieve().isFailure() ) {
117 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
118 return StatusCode::SUCCESS;
119 }
120 if (cs->regHandle(this,*h).isFailure()) {
121 sc = StatusCode::FAILURE;
122 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
123 << " with CondSvc");
124 }
125 }
126 }
127 return sc;
128}
129
Update output dependencies to include symlinks.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
An algorithm that can be simultaneously executed in multiple threads.
virtual bool isClonable() const override
Specify if the algorithm is clonable.
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonReentrantAlgorithm()
Default constructor:
virtual ~AthCommonReentrantAlgorithm() override
Destructor:
virtual StatusCode sysExecute(const EventContext &ctx) override
Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps() const override
Return the list of extra output dependencies.
virtual unsigned int cardinality() const override
Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentra...
Header file for AthHistogramAlgorithm.