ATLAS Offline Software
Loading...
Searching...
No Matches
AthAlgorithm.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2026 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#include "GaudiKernel/ThreadLocalContext.h"
18
19// Constructors
21AthAlgorithm::AthAlgorithm( const std::string& name,
22 ISvcLocator* pSvcLocator ) :
23 ::AthCommonDataStore<AthCommonMsg<Algorithm>> ( name, pSvcLocator )
24{
25 // default cardinality for non-reentrant algorithms
26 setProperty( "Cardinality", 1 ).orThrow("Unable to set property 'Cardinality'", name);
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
51{
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
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}
89
90const EventContext& AthAlgorithm::getContext() const {
91 return Gaudi::Hive::currentContext();
92}
93
95 return execState( Gaudi::Hive::currentContext() ).filterPassed();
96}
97
98void AthAlgorithm::setFilterPassed( bool state ) const {
99 execState( Gaudi::Hive::currentContext() ).setFilterPassed(state);
100}
Update output dependencies to include symlinks.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
static Double_t sc
void setProperty(columnar::PythonToolHandle &self, const std::string &key, nb::object value)
const EventContext & getContext() const
Deprecated methods (use the ones with EventContext).
virtual const DataObjIDColl & extraOutputDeps() const override
Return the list of extra output dependencies.
DataObjIDColl m_extendedExtraObjects
void setFilterPassed(bool state) const
virtual StatusCode sysInitialize() override
Override sysInitialize.
bool filterPassed() const
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
virtual ~AthAlgorithm()
Destructor:
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Header file for AthHistogramAlgorithm.