4#ifndef XAODMUONVIEWS_FILLCONTAINER_H
5#define XAODMUONVIEWS_FILLCONTAINER_H
10#include "GaudiKernel/MsgStream.h"
12#include "GeoModelKernel/throwExcept.h"
24 template <
typename AuxCont_t>
concept AuxContainerConcept = std::is_base_of_v<xAOD::AuxContainerBase, AuxCont_t>
25 || std::is_same_v<AuxCont_t, void*>;
28 std::is_same_v<Cont_t, DataVector<typename Cont_t::base_value_type>>;
31 &&
requires(
const Cont_t& container) {
32 requires std::is_base_of_v<SG::AuxElement, typename Cont_t::base_value_type>;
47 if constexpr(!std::is_same_v<AuxCont_t, void*>) {
73 const EventContext& ctx) {
75 return StatusCode::SUCCESS;
79 msg<<MSG::ERROR<<__func__<<
"() - "<<__LINE__<<
": Write handle under key "
81 return StatusCode::FAILURE;
84 if constexpr(!std::is_same_v<AuxCont_t, void*>) {
95 const EventContext& ctx) {
97 return StatusCode::SUCCESS;
101 msg<<MSG::ERROR<<__func__<<
"() - "<<__LINE__<<
": Write handle under key "
103 return StatusCode::FAILURE;
106 if constexpr(!std::is_same_v<AuxCont_t, void*>) {
116 THROW_EXCEPTION(
"The write handle has not been initialized. Please call record or"
117 <<
" recordNonConst before calling getHandle()");
125 std::unique_ptr<Cont_t>
m_cont{std::make_unique<Cont_t>()};
127 std::unique_ptr<AuxCont_t>
m_auxCont{std::make_unique<AuxCont_t>()};
Base class for elements of a container that can have aux data.
An STL vector of pointers that by default owns its pointed-to elements.
Handle class for recording to StoreGate.
#define ATLAS_THREAD_SAFE
Property holding a SG store/key/clid from which a WriteHandle is made.
bool hasHandle() const
Returns whether the record function has been called.
std::unique_ptr< AuxCont_t > m_auxCont
StatusCode recordNonConst(const SG::WriteHandleKey< Cont_t > &key, const EventContext &ctx)
Record the container to store gate using the passed write handle key.
SG::WriteHandle< Cont_t > WriteHandle_t
Abrivation of the write handle type.
FillContainer(FillContainer &&other)=default
Move constructor.
StatusCode record(const SG::WriteHandleKey< Cont_t > &key, const EventContext &ctx)
Record the container to store gate using the passed write handle key.
FillContainer()
default constructor
std::unique_ptr< Cont_t > m_cont
FillContainer & operator=(FillContainer &&other)=default
Default move operator.
std::unique_ptr< WriteHandle_t > m_writeHandle
WriteHandle_t & getHandle()
Returns the reference to the active write handle.
Cont_t * operator->() const
Define the arrow operator.
Cont_t * get() const
get operator
Cont_t & operator*() const
Define the dereference operator.
Define that the templated class needs to inherit from the AuxContainerBase class.
Define the primary container.
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)
Auxiliary class to create a xAOD container together with its associated AuxContainer without manually...
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
#define THROW_EXCEPTION(MESSAGE)