8#ifndef XAODCORE_SHALLOWCOPY_H
9#define XAODCORE_SHALLOWCOPY_H
16#include "AthLinks/DataLink.h"
23#ifndef XAOD_STANDALONE
24#include <GaudiKernel/ThreadLocalContext.h>
44 return std::make_unique<T>();
53 std::pair<std::unique_ptr<T>, std::unique_ptr<ShallowAuxContainer>>
61 std::cout <<
"xAOD::shallowCopyContainer ERROR Couldn't set up "
62 <<
"DataLink to the original container's auxiliary store"
64 std::cout <<
"xAOD::shallowCopyContainer ERROR Are you using the "
65 <<
"xAOD::TEvent::kBranchAccess access mode?" << std::endl;
70 auto newCont = std::make_unique<T>();
73 newCont->reserve(cont.size());
74 for (
size_t i = 0; i < cont.size(); ++i) {
79 auto aux = std::make_unique<ShallowAuxContainer>(link);
82 newCont->setStore(
aux.get());
85 return std::make_pair(std::move(newCont), std::move(
aux));
109 std::pair<std::unique_ptr<T>, std::unique_ptr<ShallowAuxContainer>>
111 [[maybe_unused]]
const EventContext& ctx
113#ifndef XAOD_STANDALONE
144 return std::make_pair(tmp.first.release(), tmp.second.release());
167 if( ! link.
cptr() ) {
171 std::cout <<
"xAOD::shallowCopyObject ERROR Couldn't set up "
172 <<
"DataLink to the original object's auxiliary store"
174 std::cout <<
"xAOD::shallowCopyObject ERROR Are you using the "
175 <<
"xAOD::TEvent::kBranchAccess access mode?"
177 std::pair< T*, ShallowAuxInfo* > dummy;
188 newObj->setStore(
aux );
191 return std::make_pair( newObj,
aux );
Interface for const operations on an auxiliary store.
Object reference supporting deferred reading from StoreGate.
const_pointer cptr() const
Dereference the link.
Shallow copy for the auxiliary store of standalone objects.
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainerImpl(const T &cont, DataLink< SG::IConstAuxStore > &link)
Impl function for shallow copy container.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
std::unique_ptr< CaloCluster > prepareElementForShallowCopy(const CaloCluster *orgCluster)
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainer(const T &cont, const EventContext &ctx)
Function making a shallow copy of a constant container.
std::pair< T *, ShallowAuxInfo * > shallowCopyObject(const T &obj)
Function making a shallow copy of a constant standalone object.