2 Copyright (C) 2002-2020 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 "AthContainers/tools/copyThinned.h"
13 #include "AthenaKernel/getThinningCache.h"
20 DMTest::BAuxVec* copyThinned (DMTest::BAuxVec& v,
21 const SG::ThinningInfo* dec);
27 * @param svcLoc Gaudi service locator.
29 template <class XAOD, class ... TPCNVS>
30 T_AthenaPoolxAODCnv<XAOD, TPCNVS...>::T_AthenaPoolxAODCnv( ISvcLocator* svcLoc )
32 m_guid (AthenaPoolCnvSvc::guidFromTypeinfo (typeid (XAOD)))
38 * @brief Convert a transient object to persistent form.
39 * @param trans The transient object to convert.
40 * @param key The SG key of the object being written.
42 * Returns a newly-allocated persistent object.
44 template <class XAOD, class ... TPCNVS>
46 T_AthenaPoolxAODCnv<XAOD, TPCNVS...>::createPersistentWithKey( XAOD* trans,
47 const std::string& key)
49 AthenaPoolCnvSvc::debugCreatePersistent (ClassID_traits<XAOD>::ID());
50 const SG::ThinningInfo* info = SG::getThinningInfo (key);
51 return SG::copyThinned (*trans, info).release();
56 * @brief Read the persistent object and convert it to transient.
57 * @param key The SG key of the object being read.
59 * Returns a newly-allocated transient object.
60 * Errors are reported by raising exceptions.
62 template <class XAOD, class ... TPCNVS>
64 T_AthenaPoolxAODCnv<XAOD, TPCNVS...>::createTransientWithKey (const std::string& key)
66 AthenaPoolCnvSvc::debugCreateTransient (ClassID_traits<XAOD>::ID());
69 if ( this->compareClassGuid( m_guid ) ) {
70 // It's the latest version, read it directly:
71 c = this->template poolReadObject< XAOD >();
75 c = m_tpcnvs.createTransient (*this, key, this->msg()).release();
79 if (c->trackIndices()) {
80 DataLink< SG::IConstAuxStore > dl;
81 dl.toTransient (key + "Aux.");
87 // Didn't recognize the GUID.
88 AthenaPoolCnvSvc::throwExcUnsupportedVersion (typeid(XAOD),
89 this->m_i_poolToken->classID());