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 );
196 #endif // XAODCORE_SHALLOWCOPY_H