ATLAS Offline Software
AthAlgorithmDHUpdate.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration.
3  */
4 // $Id$
13 #include "AthAlgorithmDHUpdate.h"
14 #include "AthenaKernel/BaseInfo.h"
15 
16 
17 namespace AthenaBaseComps {
18 
19 
25 AthAlgorithmDHUpdate::AthAlgorithmDHUpdate (DataObjIDColl& linkedObjs,
26  std::unique_ptr<IDataHandleVisitor> chain)
27  : m_linkedObjs (linkedObjs),
28  m_chain (std::move (chain))
29 {
30 }
31 
32 
40 void AthAlgorithmDHUpdate::visit (const IDataHandleHolder* dhh)
41 {
42  // Make a copy, as usually linkedObjs will be extraOutputDeps().
43  DataObjIDColl ex = dhh->extraOutputDeps();
44 
45  // Process all output dependencies.
46  for (const Gaudi::DataHandle* h : dhh->outputHandles()) {
47  if (!h->objKey().empty())
48  handle (h->fullKey().clid(), h->objKey());
49  }
50 
51  for (const DataObjID& dobj : ex) {
52  if (!dobj.key().empty())
53  handle (dobj.clid(), dobj.key());
54  }
55 
56  for (const DataObjID& dobj : dhh->outputDataObjs()) {
57  if (!dobj.key().empty())
58  handle (dobj.clid(), dobj.key());
59  }
60 
61  // If we put anything in linkedObjs, also add the contents
62  // of extraOutputDeps.
63  if (!m_linkedObjs.empty()) {
64  m_linkedObjs.insert (ex.begin(), ex.end());
65  }
66 
67  // Call the next hook function, if any.
68  if (m_chain) {
69  m_chain->visit (dhh);
70  }
71 }
72 
73 
81 void AthAlgorithmDHUpdate::handle (CLID clid, const std::string& key)
82 {
83  const SG::BaseInfoBase* bib = SG::BaseInfoBase::find (clid);
84  if (!bib) return;
85  for (CLID clid2 : bib->get_bases()) {
86  if (clid2 != clid) {
87  m_linkedObjs.emplace (clid2, key);
88  }
89  }
90 }
91 
92 
93 } // namespace AthenaBaseComps
AthenaBaseComps::AthAlgorithmDHUpdate::handle
void handle(CLID clid, const std::string &key)
Handle one output dependency.
Definition: AthAlgorithmDHUpdate.cxx:81
AthenaBaseComps::AthAlgorithmDHUpdate::AthAlgorithmDHUpdate
AthAlgorithmDHUpdate(DataObjIDColl &linkedObjs, std::unique_ptr< IDataHandleVisitor > chain)
Constructor.
Definition: AthAlgorithmDHUpdate.cxx:25
AthAlgorithmDHUpdate.h
Update output dependencies to include symlinks.
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
AthenaBaseComps
Definition: AthAlgorithmDHUpdate.cxx:17
AthenaBaseComps::AthAlgorithmDHUpdate::m_linkedObjs
DataObjIDColl & m_linkedObjs
Set of additional output dependencies represented by links.
Definition: AthAlgorithmDHUpdate.h:75
SG::BaseInfoBase::get_bases
const std::vector< CLID > & get_bases() const
Return the class IDs of all known bases of T (that have class IDs).
Definition: BaseInfo.cxx:304
BaseInfo.h
Provide an interface for finding inheritance information at run time.
AthenaBaseComps::AthAlgorithmDHUpdate::visit
virtual void visit(const IDataHandleHolder *dhh) override
Walk over the dependencies of an algorithm.
Definition: AthAlgorithmDHUpdate.cxx:40
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
AthenaBaseComps::AthAlgorithmDHUpdate::m_chain
std::unique_ptr< IDataHandleVisitor > m_chain
Hook to call after this one.
Definition: AthAlgorithmDHUpdate.h:78
SG::BaseInfoBase::find
static const BaseInfoBase * find(CLID clid)
Find the BaseInfoBase instance for clid.
Definition: BaseInfo.cxx:569
h
SG::BaseInfoBase
The non-template portion of the BaseInfo implementation.
Definition: Control/AthenaKernel/AthenaKernel/BaseInfo.h:451
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37