2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5 * @file AthenaPoolCnvSvc/T_AthenaPoolxAODCnv.icc
6 * @author scott snyder <snyder@bnl.gov>
8 * @brief Athena pool converter for xAOD classes.
12#include "AthContainersInterfaces/ToTransient.h"
13#include "AthContainers/tools/copyThinned.h"
14#include "AthenaKernel/getThinningCache.h"
21DMTest::BAuxVec* copyThinned (DMTest::BAuxVec& v,
22 const SG::ThinningInfo* dec);
28 * @param svcLoc Gaudi service locator.
30template <class XAOD, class ... TPCNVS>
31T_AthenaPoolxAODCnv<XAOD, TPCNVS...>::T_AthenaPoolxAODCnv( ISvcLocator* svcLoc )
33 m_guid (AthenaPoolCnvSvc::guidFromTypeinfo (typeid (XAOD)))
39 * @brief Convert a transient object to persistent form.
40 * @param trans The transient object to convert.
41 * @param key The SG key of the object being written.
43 * Returns a newly-allocated persistent object.
45template <class XAOD, class ... TPCNVS>
47T_AthenaPoolxAODCnv<XAOD, TPCNVS...>::createPersistentWithKey( XAOD* trans,
48 const std::string& key)
50 AthenaPoolCnvSvc::debugCreatePersistent (ClassID_traits<XAOD>::ID());
51 const SG::ThinningInfo* info = SG::getThinningInfo (key);
52 return SG::copyThinned (*trans, info).release();
57 * @brief Read the persistent object and convert it to transient.
58 * @param key The SG key of the object being read.
60 * Returns a newly-allocated transient object.
61 * Errors are reported by raising exceptions.
63template <class XAOD, class ... TPCNVS>
65T_AthenaPoolxAODCnv<XAOD, TPCNVS...>::createTransientWithKey (const Token* token, const std::string& key)
67 AthenaPoolCnvSvc::debugCreateTransient (ClassID_traits<XAOD>::ID());
70 if ( this->compareClassGuid(token, m_guid ) ) {
71 // It's the latest version, read it directly:
72 c = this->template poolReadObject< XAOD >(token);
76 c = m_tpcnvs.createTransient (*this, token, key, this->msg()).release();
80 // Call toTransient on the object we just read, if needed.
81 SG::ToTransient<XAOD>::toTransient (*c);
82 if (c->trackIndices()) {
83 DataLink< SG::IConstAuxStore > dl;
84 dl.toTransient (key + "Aux.");
90 // Didn't recognize the GUID.
91 AthenaPoolCnvSvc::throwExcUnsupportedVersion (typeid(XAOD),