ATLAS Offline Software
AthReentrantAlgorithm.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 // 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 // Framework includes
19 #include "GaudiKernel/ThreadLocalContext.h"
20 
22  ISvcLocator* pSvcLocator ) :
23  ::AthCommonDataStore<AthCommonMsg<Gaudi::Algorithm>> ( name, pSvcLocator )
24 {
25 
26  // Set up to run AthAlgorithmDHUpdate in sysInitialize before
27  // merging depedency lists. This extends the output dependency
28  // list with any symlinks implied by inheritance relations.
29  m_updateDataHandles =
30  std::make_unique<AthenaBaseComps::AthAlgorithmDHUpdate>
31  (m_extendedExtraObjects,
32  std::move (m_updateDataHandles));
33 }
34 
35 // Destructor
38 {
39  ATH_MSG_DEBUG ("Calling destructor");
40 }
41 
45 {
46  // Reentrant algorithms are clonable.
47  return true;
48 }
49 
56 {
57  return 0;
58 }
59 
68 {
69  return Gaudi::Algorithm::sysExecute (ctx);
70 }
71 
72 
79 const DataObjIDColl& AthReentrantAlgorithm::extraOutputDeps() const
80 {
81  // If we didn't find any symlinks to add, just return the collection
82  // from the base class. Otherwise, return the extended collection.
83  if (!m_extendedExtraObjects.empty()) {
85  }
86  return Algorithm::extraOutputDeps();
87 }
88 
89 
98 
99  if (sc.isFailure()) {
100  return sc;
101  }
102 
103  ServiceHandle<ICondSvc> cs("CondSvc",name());
104  for (auto h : outputHandles()) {
105  if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
106  // do this inside the loop so we don't create the CondSvc until needed
107  if ( cs.retrieve().isFailure() ) {
108  ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
109  return StatusCode::SUCCESS;
110  }
111  if (cs->regHandle(this,*h).isFailure()) {
112  sc = StatusCode::FAILURE;
113  ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
114  << " with CondSvc");
115  }
116  }
117  }
118  return sc;
119 }
AthReentrantAlgorithm::isClonable
virtual bool isClonable() const override
Specify if the algorithm is clonable.
Definition: AthReentrantAlgorithm.cxx:44
AthAlgorithmDHUpdate.h
Update output dependencies to include symlinks.
beamspotVtxAnalysis.cs
list cs
Definition: beamspotVtxAnalysis.py:391
AthReentrantAlgorithm::cardinality
virtual unsigned int cardinality() const override
Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentra...
Definition: AthReentrantAlgorithm.cxx:55
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
AthReentrantAlgorithm::~AthReentrantAlgorithm
virtual ~AthReentrantAlgorithm() override
Destructor:
Definition: AthReentrantAlgorithm.cxx:37
AthReentrantAlgorithm::extraOutputDeps
virtual const DataObjIDColl & extraOutputDeps() const override
Return the list of extra output dependencies.
Definition: AthReentrantAlgorithm.cxx:79
AthCommonDataStore
Definition: AthCommonDataStore.h:52
AthReentrantAlgorithm::AthReentrantAlgorithm
AthReentrantAlgorithm()
Default constructor:
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
AthCommonDataStore< AthCommonMsg< Gaudi::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
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
python.OldStyleConfig.Algorithm
def Algorithm(name)
Definition: OldStyleConfig.py:39
AthReentrantAlgorithm::sysExecute
virtual StatusCode sysExecute(const EventContext &ctx) override
Execute an algorithm.
Definition: AthReentrantAlgorithm.cxx:67
AthReentrantAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
Definition: AthReentrantAlgorithm.h:153
AthReentrantAlgorithm.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
AthReentrantAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthReentrantAlgorithm.cxx:96
AthCommonMsg
Definition: AthCommonMsg.h:19
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Gaudi
=============================================================================
Definition: CaloGPUClusterAndCellDataMonitorOptions.h:273
ServiceHandle< ICondSvc >