ATLAS Offline Software
Loading...
Searching...
No Matches
CP::detail Namespace Reference

Classes

struct  ContainerType
 check what kind of object/container the argument is More...
struct  ShallowCopy
 a helper class to create shallow copies and register them in the event store More...
struct  ShallowCopy< T, 1 >
struct  ShallowCopy< T, 2 >
struct  ShallowCopy< T, 3 >
struct  ShallowCopy< xAOD::EgammaContainer >
struct  ShallowCopy< xAOD::IParticleContainer >

Functions

template<typename ContainerType, unsigned mode, typename AlgorithmType>
requires (mode <= 2 && !std::is_const_v<ContainerType>)
StatusCode addDependency (AlgorithmType &owner, const std::string &name, const std::string &decoName, bool decoWrite)

Function Documentation

◆ addDependency()

template<typename ContainerType, unsigned mode, typename AlgorithmType>
requires (mode <= 2 && !std::is_const_v<ContainerType>)
StatusCode CP::detail::addDependency ( AlgorithmType & owner,
const std::string & name,
const std::string & decoName,
bool decoWrite )

Definition at line 38 of file AthenaDependencyHelpers.h.

39 {
40 // I'm creating a `****HandleKey` for the given name and then take
41 // the proper dependency information from that, as that reuses as
42 // much as possible from the official AthenaMT dependency
43 // machinery.
44 std::conditional_t<mode == 0,SG::ReadHandleKey<ContainerType>,
45 std::conditional_t<mode == 1,SG::WriteHandleKey<ContainerType>,
47 if (!key.initialize().isSuccess())
48 return StatusCode::FAILURE;
49
50 if (decoName.empty())
51 {
52 owner.addDependency (key.fullKey(), key.mode());
53 return StatusCode::SUCCESS;
54 }
55
56 // This `if` exempts the MissingETContainer, which doesn't seem to
57 // like decoration handles. once this is fixed, this `if` should
58 // be removed, as well as the link dependency to xAODMissingET in
59 // the CMakeLists.txt of this package.
60 if constexpr (std::same_as<ContainerType, xAOD::MissingETContainer>)
61 {
62 owner.msg() << MSG::WARNING << "Can not add decoration dependency " << name << "." << decoName << " as MissingET doesn't support decoration dependencies. This is only problematic if you are running in AthenaMT and rely on this dependency to exist." << endmsg;
63 return StatusCode::SUCCESS;
64 } else
65 {
66 if (decoWrite)
67 {
68 SG::WriteDecorHandleKey<ContainerType> decoKey {key, decoName};
69 if (!decoKey.initialize().isSuccess())
70 return StatusCode::FAILURE;
71 owner.addDependency (decoKey.fullKey(), decoKey.mode());
72 } else
73 {
74 SG::ReadDecorHandleKey<ContainerType> decoKey {key, decoName};
75 if (!decoKey.initialize().isSuccess())
76 return StatusCode::FAILURE;
77 owner.addDependency (decoKey.fullKey(), decoKey.mode());
78 }
79 return StatusCode::SUCCESS;
80 }
81 }
#define endmsg
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Property holding a SG store/key/clid from which an UpdateHandle is made.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.