Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
AthCommonReentrantAlgorithm.cxx
Go to the documentation of this file.
1 
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
14 #include "AthAlgorithmDHUpdate.h"
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 // Framework includes
23 #include "GaudiKernel/ThreadLocalContext.h"
24 
25 template <class BaseAlg>
27  ISvcLocator* pSvcLocator ) :
28  ::AthCommonDataStore<AthCommonMsg<BaseAlg>> ( name, pSvcLocator )
29 {
30 
31  // Set up to run AthAlgorithmDHUpdate in sysInitialize before
32  // merging depedency lists. This extends the output dependency
33  // list with any symlinks implied by inheritance relations.
34  m_updateDataHandles =
35  std::make_unique<AthenaBaseComps::AthAlgorithmDHUpdate>
37  std::move (m_updateDataHandles));
38 }
39 
40 // Destructor
42 template <class BaseAlg>
44 {
45  ATH_MSG_DEBUG ("Calling destructor");
46 }
47 
50 template <class BaseAlg>
52 {
53  // Reentrant algorithms are clonable.
54  return true;
55 }
56 
62 template <class BaseAlg>
64 {
65  return 0;
66 }
67 
75 template <class BaseAlg>
77 {
78  return BaseAlg::sysExecute (ctx);
79 }
80 
81 
88 template <class BaseAlg>
90 {
91  // If we didn't find any symlinks to add, just return the collection
92  // from the base class. Otherwise, return the extended collection.
93  if (!m_extendedExtraObjects.empty()) {
94  return m_extendedExtraObjects;
95  }
96  return BaseAlg::extraOutputDeps();
97 }
98 
99 
106 template <class BaseAlg>
109 
110  if (sc.isFailure()) {
111  return sc;
112  }
113 
114  ServiceHandle<ICondSvc> cs("CondSvc",name());
115  for (auto h : outputHandles()) {
116  if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
117  // do this inside the loop so we don't create the CondSvc until needed
118  if ( cs.retrieve().isFailure() ) {
119  ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
120  return StatusCode::SUCCESS;
121  }
122  if (cs->regHandle(this,*h).isFailure()) {
123  sc = StatusCode::FAILURE;
124  ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
125  << " with CondSvc");
126  }
127  }
128  }
129  return sc;
130 }
131 
AthCommonReentrantAlgorithm::cardinality
virtual unsigned int cardinality() const override
Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentra...
Definition: AthCommonReentrantAlgorithm.cxx:63
AthAlgorithmDHUpdate.h
Update output dependencies to include symlinks.
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
AthCommonReentrantAlgorithm::extraOutputDeps
virtual const DataObjIDColl & extraOutputDeps() const override
Return the list of extra output dependencies.
Definition: AthCommonReentrantAlgorithm.cxx:89
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthCommonReentrantAlgorithm::sysExecute
virtual StatusCode sysExecute(const EventContext &ctx) override
Execute an algorithm.
Definition: AthCommonReentrantAlgorithm.cxx:76
AthCommonReentrantAlgorithm::AthCommonReentrantAlgorithm
AthCommonReentrantAlgorithm()
Default constructor:
AthCommonReentrantAlgorithm::~AthCommonReentrantAlgorithm
virtual ~AthCommonReentrantAlgorithm() override
Destructor:
Definition: AthCommonReentrantAlgorithm.cxx:43
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
AthCommonReentrantAlgorithm.h
AthCommonReentrantAlgorithm< Gaudi::Algorithm >
AthCommonMsg
Definition: AthCommonMsg.h:19
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AthCommonReentrantAlgorithm::isClonable
virtual bool isClonable() const override
Specify if the algorithm is clonable.
Definition: AthCommonReentrantAlgorithm.cxx:51
AthCommonReentrantAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthCommonReentrantAlgorithm.cxx:107
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
AthCommonReentrantAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
Definition: AthCommonReentrantAlgorithm.h:114
ServiceHandle< ICondSvc >