diff --git a/Event/xAOD/xAODEventInfoAthenaPool/src/xAODEventInfoCnv.cxx b/Event/xAOD/xAODEventInfoAthenaPool/src/xAODEventInfoCnv.cxx index 51e4d7b44d1bf98d17692da83f3ce6c62338a81a..1f80c2794e36ec2327992513dc92b30b68c19441 100644 --- a/Event/xAOD/xAODEventInfoAthenaPool/src/xAODEventInfoCnv.cxx +++ b/Event/xAOD/xAODEventInfoAthenaPool/src/xAODEventInfoCnv.cxx @@ -1,76 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -// $Id: xAODEventInfoCnv.cxx 594317 2014-04-25 17:36:58Z krasznaa $ - -// System include(s): -#include <exception> - -// Local include(s): -#include "xAODEventInfoCnv.h" - -namespace { - - /// Helper function to set up the object's link to its auxiliary store - void setStoreLink( SG::AuxElement* el, const std::string& key ) { - - // The link to set up: - DataLink< SG::IConstAuxStore > link( key + "Aux." ); - - // Give it to the object: - el->setStore( link ); - - return; - } - -} // private namespace - -xAODEventInfoCnv::xAODEventInfoCnv( ISvcLocator* svcLoc ) - : xAODEventInfoCnvBase( svcLoc ), m_key() { - -} - -StatusCode xAODEventInfoCnv::createObj( IOpaqueAddress* pAddr, - DataObject*& pObj ) { - - // Get the key of the object that we'll be creating: - m_key = *( pAddr->par() + 1 ); - ATH_MSG_VERBOSE( "Key of xAOD::EventInfo: " << m_key ); - - // Let the base class do its thing now: - return AthenaPoolConverter::createObj( pAddr, pObj ); -} - -xAOD::EventInfo* xAODEventInfoCnv::createPersistent( xAOD::EventInfo* trans ) { - - // Prepare the original object for persistification: - trans->toPersistent(); - - // Create a new object: - xAOD::EventInfo* result = new xAOD::EventInfo(); - - // Make it see the auxiliary store of the parent object. But not be able - // to modify it: - result->setStore( trans->getConstStore() ); - - // Return the new object: - return result; -} - -xAOD::EventInfo* xAODEventInfoCnv::createTransient() { - - // The known ID(s) for the object: - static const pool::Guid v1_guid( "AE8BED6D-1D41-4CAF-994B-42613FC91A0A" ); - - // Check if we're reading the most up to date type: - if( compareClassGuid( v1_guid ) ) { - xAOD::EventInfo* ei = poolReadObject< xAOD::EventInfo >(); - setStoreLink( ei, m_key ); - return ei; - } - - // If we didn't recognise the ID, let's complain: - throw std::runtime_error( "Unsupported version of xAOD::EventInfo found" ); - return 0; -} +// Dummy source file so that cmake will know this is a custom converter. diff --git a/Event/xAOD/xAODEventInfoAthenaPool/src/xAODEventInfoCnv.h b/Event/xAOD/xAODEventInfoAthenaPool/src/xAODEventInfoCnv.h index 0150eda6b778992c563306c1247af563067cff16..c938c5e06a6c57dddd5e6d6119afe99513c34eeb 100644 --- a/Event/xAOD/xAODEventInfoAthenaPool/src/xAODEventInfoCnv.h +++ b/Event/xAOD/xAODEventInfoAthenaPool/src/xAODEventInfoCnv.h @@ -1,59 +1,17 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -// $Id: xAODEventInfoCnv.h 592114 2014-04-09 12:00:50Z krasznaa $ #ifndef XAODEVENTINFOATHENAPOOL_XAODEVENTINFOCNV_H #define XAODEVENTINFOATHENAPOOL_XAODEVENTINFOCNV_H -// System include(s): -#include <string> - -// Gaudi/Athena include(s): -#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" - -// EDM include(s): #include "xAODEventInfo/EventInfo.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolxAODCnv.h" -/// Type definition for the converter's base -typedef T_AthenaPoolCustomCnv< xAOD::EventInfo, xAOD::EventInfo > - xAODEventInfoCnvBase; - -/** - * @short POOL converter for the xAOD::EventInfo class - * - * A custom POOL converter is only needed to make sure that the - * EventInfo object gets connected to its auxiliary store correctly - * in case it is read in using a DataLink from an input file. - * - * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - * - * $Revision: 592114 $ - * $Date: 2014-04-09 14:00:50 +0200 (Wed, 09 Apr 2014) $ - */ -class xAODEventInfoCnv : public xAODEventInfoCnvBase { - - // Declare the factory as a friend of this class: - friend class CnvFactory< xAODEventInfoCnv >; - -public: - /// Converter constructor - xAODEventInfoCnv( ISvcLocator* svcLoc ); - - /// Re-implemented function in order to get access to the SG key - virtual StatusCode createObj( IOpaqueAddress* pAddr, DataObject*& pObj ); - - /// Function preparing the object to be written out - virtual xAOD::EventInfo* createPersistent( xAOD::EventInfo* trans ); - /// Function reading in the persistent object - virtual xAOD::EventInfo* createTransient(); -private: - /// StoreGate key of the object being read - std::string m_key; +typedef T_AthenaPoolxAODCnv<xAOD::EventInfo> xAODEventInfoCnv; -}; // class xAODEventInfoCnv #endif // XAODEVENTINFOATHENAPOOL_XAODEVENTINFOCNV_H diff --git a/Event/xAOD/xAODEventInfoAthenaPool/src/xAODEventInfoContainerCnv.cxx b/Event/xAOD/xAODEventInfoAthenaPool/src/xAODEventInfoContainerCnv.cxx index b54ba21abbabb59204c5e726676af77358b74710..1f80c2794e36ec2327992513dc92b30b68c19441 100644 --- a/Event/xAOD/xAODEventInfoAthenaPool/src/xAODEventInfoContainerCnv.cxx +++ b/Event/xAOD/xAODEventInfoAthenaPool/src/xAODEventInfoContainerCnv.cxx @@ -1,81 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -// $Id: xAODEventInfoContainerCnv.cxx 682544 2015-07-13 13:53:25Z krasznaa $ - -// System include(s): -#include <exception> - -// Local include(s): -#include "xAODEventInfoContainerCnv.h" - -namespace { - - /// Helper function to set up the object's link to its auxiliary store - void setStoreLink( SG::AuxVectorBase* vec, const std::string& key ) { - - // The link to set up: - DataLink< SG::IConstAuxStore > link( key + "Aux." ); - - // Give it to the object: - vec->setStore( link ); - - return; - } - -} // private namespace - -xAODEventInfoContainerCnv::xAODEventInfoContainerCnv( ISvcLocator* svcLoc ) - : xAODEventInfoContainerCnvBase( svcLoc ), m_key() { - -} - -StatusCode xAODEventInfoContainerCnv::createObj( IOpaqueAddress* pAddr, - DataObject*& pObj ) { - - // Get the key of the object that we'll be creating: - m_key = *( pAddr->par() + 1 ); - ATH_MSG_VERBOSE( "Key of xAOD::EventInfo: " << m_key ); - - // Let the base class do its thing now: - return AthenaPoolConverter::createObj( pAddr, pObj ); -} - -xAOD::EventInfoContainer* -xAODEventInfoContainerCnv::createPersistent( xAOD::EventInfoContainer* trans ) { - - // Create a view copy of the container: - xAOD::EventInfoContainer* result = - new xAOD::EventInfoContainer( trans->begin(), trans->end(), - SG::VIEW_ELEMENTS ); - - // Prepare all objects to be written out: - xAOD::EventInfoContainer::iterator itr = result->begin(); - xAOD::EventInfoContainer::iterator end = result->end(); - for( ; itr != end; ++itr ) { - ( *itr )->toPersistent(); - } - - // Return the new container: - return result; -} - -xAOD::EventInfoContainer* xAODEventInfoContainerCnv::createTransient() { - - // The known ID(s) for the object: - static const pool::Guid v1_guid( "8F061263-D744-4D72-9377-1573FE21CDCE" ); - - // Check if we're reading the most up to date type: - if( compareClassGuid( v1_guid ) ) { - xAOD::EventInfoContainer* ei = - poolReadObject< xAOD::EventInfoContainer >(); - setStoreLink( ei, m_key ); - return ei; - } - - // If we didn't recognise the ID, let's complain: - throw std::runtime_error( "Unsupported version of xAOD::EventInfoContainer" - " found" ); - return 0; -} +// Dummy source file so that cmake will know this is a custom converter. diff --git a/Event/xAOD/xAODEventInfoAthenaPool/src/xAODEventInfoContainerCnv.h b/Event/xAOD/xAODEventInfoAthenaPool/src/xAODEventInfoContainerCnv.h index 7992ed9c6b64238f602e56aeafb5023f8f0f5281..195d5a675bd4b2a987d1aef4f9cee5fa73549d94 100644 --- a/Event/xAOD/xAODEventInfoAthenaPool/src/xAODEventInfoContainerCnv.h +++ b/Event/xAOD/xAODEventInfoAthenaPool/src/xAODEventInfoContainerCnv.h @@ -1,62 +1,18 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -// $Id: xAODEventInfoContainerCnv.h 594317 2014-04-25 17:36:58Z krasznaa $ #ifndef XAODEVENTINFOATHENAPOOL_XAODEVENTINFOCONTAINERCNV_H #define XAODEVENTINFOATHENAPOOL_XAODEVENTINFOCONTAINERCNV_H -// System include(s): -#include <string> -// Gaudi/Athena include(s): -#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" - -// EDM include(s): #include "xAODEventInfo/EventInfoContainer.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolxAODCnv.h" + + +typedef T_AthenaPoolxAODCnv<xAOD::EventInfoContainer> xAODEventInfoContainerCnv; -/// Type definition for the converter's base -typedef T_AthenaPoolCustomCnv< xAOD::EventInfoContainer, - xAOD::EventInfoContainer > - xAODEventInfoContainerCnvBase; - -/** - * @short POOL converter for the xAOD::EventInfoContainer class - * - * A custom POOL converter is only needed to make sure that the - * EventInfoContainer gets connected to its auxiliary store correctly - * in case it is read in using a DataLink/ElementLink from an input - * file. - * - * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - * - * $Revision: 594317 $ - * $Date: 2014-04-25 19:36:58 +0200 (Fri, 25 Apr 2014) $ - */ -class xAODEventInfoContainerCnv : public xAODEventInfoContainerCnvBase { - - // Declare the factory as a friend of this class: - friend class CnvFactory< xAODEventInfoContainerCnv >; - -public: - /// Converter constructor - xAODEventInfoContainerCnv( ISvcLocator* svcLoc ); - - /// Re-implemented function in order to get access to the SG key - virtual StatusCode createObj( IOpaqueAddress* pAddr, DataObject*& pObj ); - - /// Function preparing the object to be written out - virtual xAOD::EventInfoContainer* - createPersistent( xAOD::EventInfoContainer* trans ); - /// Function reading in the persistent object - virtual xAOD::EventInfoContainer* createTransient(); - -private: - /// StoreGate key of the container being read - std::string m_key; - -}; // class xAODEventInfoContainerCnv #endif // XAODEVENTINFOATHENAPOOL_XAODEVENTINFOCONTAINERCNV_H