ATLAS Offline Software
Loading...
Searching...
No Matches
LockDecorations.cxx
Go to the documentation of this file.
1// This file's extension implies that it's C, but it's really -*- C++ -*-.
8
9
10#include "LockDecorations.h"
15#include "GaudiKernel/ConcurrencyFlags.h"
16
17
18namespace DerivationFramework {
19
20
25{
26 if (Gaudi::Concurrency::ConcurrencyFlags::numThreads() > 1) {
27 ATH_MSG_WARNING( "LockDecoration used in MT job. This configuration is likely not thread-safe." );
28 }
29 ATH_CHECK( m_decorations.initialize() );
30 return StatusCode::SUCCESS;
31}
32
33
38StatusCode LockDecorations::execute (const EventContext& ctx) const
39{
40 const auto& r = SG::AuxTypeRegistry::instance();
42 SG::ReadHandle<SG::AuxVectorBase> h (k.contHandleKey(), ctx);
43 if (h->size_v() > 0) {
44 SG::auxid_t auxid = r.findAuxID (SG::decorKeyFromKey (k.key()));
45 if (auxid == SG::null_auxid) {
46 ATH_MSG_ERROR( "Cannot find decoration " << k.key() );
47 return StatusCode::FAILURE;
48 }
50 avd.lockDecoration (auxid);
51 }
52 }
53 return StatusCode::SUCCESS;
54}
55
56
57} // namespace DerivationFramework
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
Handle mappings between names and auxid_t.
Manage index tracking and synchronization of auxiliary data.
Algorithm to explicitly lock a set of decorations.
Some common helper functions used by decoration handles.
Define macros for attributes used to control the static checker.
#define ATLAS_THREAD_SAFE
Header file for AthHistogramAlgorithm.
virtual StatusCode initialize() override
Standard Gaudi initialize method.
SG::WriteDecorHandleKeyArray< SG::AuxVectorBase > m_decorations
The decoration to lock.
virtual StatusCode execute(const EventContext &ctx) const override
Execute algorithm.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Manage index tracking and synchronization of auxiliary data.
void lockDecoration(SG::auxid_t auxid)
Explicitly lock a decoration.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
int r
Definition globals.cxx:22
THE reconstruction tool.
std::string decorKeyFromKey(const std::string &key, const std::string &deflt)
Extract the decoration part of key.
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27