Commit 41c0bccf authored by Edward Moyse's avatar Edward Moyse Committed by Graeme Stewart
Browse files

'PRD/MOT changes from Anthony' (xAODTrackingAthenaPool-00-02-00)

parent c4f10f97
package xAODTrackingAthenaPool
author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
author Edward Moyse <Edward.Moyse@cern.ch>
public
# Base package(s):
use AtlasPolicy AtlasPolicy-*
private
# Base package(s):
use AtlasROOT AtlasROOT-* External
use AthenaKernel AthenaKernel-* Control
use AthContainers AthContainers-* Control
# POOL package(s):
use AthenaPoolCnvSvc AthenaPoolCnvSvc-* Database/AthenaPOOL
use AthenaPoolUtilities AthenaPoolUtilities-* Database/AthenaPOOL
# EDM package(s):
use xAODTracking xAODTracking-* Event/xAOD
use xAODTruth xAODTruth-* Event/xAOD
# Declare the pool converter(s):
apply_pattern poolcnv typesWithNamespace="xAOD::TrackParticleContainer xAOD::TrackParticleAuxContainer \
xAOD::NeutralParticleContainer xAOD::NeutralParticleAuxContainer \
xAOD::VertexContainer xAOD::VertexAuxContainer \
xAOD::PrepRawDataContainer xAOD::PrepRawDataAuxContainer \
xAOD::MeasurementStateOnSurfaceContainer xAOD::MeasurementStateOnSurfaceAuxContainer "\
files="-s=${xAODTracking_root}/xAODTracking \
TrackParticleContainer.h TrackParticleAuxContainer.h \
NeutralParticleContainer.h NeutralParticleAuxContainer.h \
VertexContainer.h VertexAuxContainer.h \
PrepRawDataContainer.h PrepRawDataAuxContainer.h \
MeasurementStateOnSurfaceContainer.h MeasurementStateOnSurfaceAuxContainer.h" \
cnv_pfx="xAOD"
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODMeasurementStateOnSurfaceAuxContainerCnv.cxx $
// System include(s):
#include <exception>
// Local include(s):
#include "xAODMeasurementStateOnSurfaceAuxContainerCnv.h"
xAODMeasurementStateOnSurfaceAuxContainerCnv::
xAODMeasurementStateOnSurfaceAuxContainerCnv( ISvcLocator* svcLoc )
: xAODMeasurementStateOnSurfaceAuxContainerCnvBase( svcLoc ) {
}
xAOD::MeasurementStateOnSurfaceAuxContainer*
xAODMeasurementStateOnSurfaceAuxContainerCnv::
createPersistent( xAOD::MeasurementStateOnSurfaceAuxContainer* trans ) {
// Create a copy of the container:
xAOD::MeasurementStateOnSurfaceAuxContainer* result =
new xAOD::MeasurementStateOnSurfaceAuxContainer( *trans );
return result;
}
xAOD::MeasurementStateOnSurfaceAuxContainer*
xAODMeasurementStateOnSurfaceAuxContainerCnv::createTransient() {
// The known ID(s) for this container:
static const pool::Guid v1_guid( "3D48E694-334F-11E4-AA51-02163E00A738" );
// Check which version of the container we're reading:
if( compareClassGuid( v1_guid ) ) {
// It's the latest version, read it directly:
return poolReadObject< xAOD::MeasurementStateOnSurfaceAuxContainer >();
}
// If we didn't recognise the ID:
throw std::runtime_error( "Unsupported version of "
"xAOD::MeasurementStateOnSurfaceAuxContainer found" );
return 0;
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef XAODTRACKINGATHENAPOOL_XAODMeasurementStateOnSurfaceAUXCONTAINERCNV_H
#define XAODTRACKINGATHENAPOOL_XAODMeasurementStateOnSurfaceAUXCONTAINERCNV_H
// Gaudi/Athena include(s):
#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h"
// EDM include(s):
#include "xAODTracking/MeasurementStateOnSurfaceAuxContainer.h"
/// Base class for the converter
typedef T_AthenaPoolCustomCnv< xAOD::MeasurementStateOnSurfaceAuxContainer,
xAOD::MeasurementStateOnSurfaceAuxContainer >
xAODMeasurementStateOnSurfaceAuxContainerCnvBase;
/**
* @short POOL converter for the xAOD::MeasurementStateOnSurfaceAuxContainer class
*
* This is the converter doing the actual schema evolution
* of the package... The converter for xAOD::TrackParticleContainer
* doesn't do much, as the "interface classes" don't contain
* too much/any payload. Most of the payload is in the auxiliary
* containers like this one.
*
*/
class xAODMeasurementStateOnSurfaceAuxContainerCnv :
public xAODMeasurementStateOnSurfaceAuxContainerCnvBase {
// Declare the factory as our friend:
friend class CnvFactory< xAODMeasurementStateOnSurfaceAuxContainerCnv >;
protected:
/// Converter constructor
xAODMeasurementStateOnSurfaceAuxContainerCnv( ISvcLocator* svcLoc );
/// Function preparing the container to be written out
virtual xAOD::MeasurementStateOnSurfaceAuxContainer*
createPersistent( xAOD::MeasurementStateOnSurfaceAuxContainer* trans );
/// Function reading in the object from the input file
virtual xAOD::MeasurementStateOnSurfaceAuxContainer* createTransient();
}; // class xAODMeasurementStateOnSurfaceAuxContainerCnv
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// System include(s):
#include <exception>
// Local include(s):
#include "xAODMeasurementStateOnSurfaceContainerCnv.h"
namespace {
/// Helper function setting up the container's link to its auxiliary store
void setStoreLink( SG::AuxVectorBase* cont, const std::string& key ) {
// The link to set up:
DataLink< SG::IConstAuxStore > link( key + "Aux." );
// Give it to the container:
cont->setStore( link );
return;
}
} // private namespace
xAODMeasurementStateOnSurfaceContainerCnv::xAODMeasurementStateOnSurfaceContainerCnv( ISvcLocator* svcLoc )
: xAODMeasurementStateOnSurfaceContainerCnvBase( svcLoc ) {
}
xAOD::MeasurementStateOnSurfaceContainer*
xAODMeasurementStateOnSurfaceContainerCnv::
createPersistent( xAOD::MeasurementStateOnSurfaceContainer* trans ) {
// Create a view copy of the container:
xAOD::MeasurementStateOnSurfaceContainer* result =
new xAOD::MeasurementStateOnSurfaceContainer( trans->begin(), trans->end(),
SG::VIEW_ELEMENTS );
// Prepare the objects to be written out:
xAOD::MeasurementStateOnSurfaceContainer::iterator itr = result->begin();
xAOD::MeasurementStateOnSurfaceContainer::iterator end = result->end();
for( ; itr != end; ++itr ) {
toPersistent( *itr );
}
// Return the new container:
return result;
}
/**
* This function needs to be re-implemented in order to figure out the StoreGate
* key of the container that's being created. After that's done, it lets the
* base class do its normal task.
*/
StatusCode xAODMeasurementStateOnSurfaceContainerCnv::createObj( IOpaqueAddress* pAddr,
DataObject*& pObj ) {
// Get the key of the container that we'll be creating:
m_key = *( pAddr->par() + 1 );
ATH_MSG_VERBOSE( "Key of xAOD::MeasurementStateOnSurfaceContainer: " << m_key );
// Let the base class do its thing now:
return AthenaPoolConverter::createObj( pAddr, pObj );
}
xAOD::MeasurementStateOnSurfaceContainer* xAODMeasurementStateOnSurfaceContainerCnv::createTransient() {
// The known ID(s) for this container:
static pool::Guid v1_guid( "DBAAD4D2-334F-11E4-8DF6-02163E00A738" );
// Check if we're reading the most up to date type:
if( compareClassGuid( v1_guid ) ) {
xAOD::MeasurementStateOnSurfaceContainer* c = poolReadObject< xAOD::MeasurementStateOnSurfaceContainer >();
setStoreLink( c, m_key );
return c;
}
// If we didn't recognise the ID, let's complain:
throw std::runtime_error( "Unsupported version of "
"xAOD::MeasurementStateOnSurfaceContainer found" );
return 0;
}
void xAODMeasurementStateOnSurfaceContainerCnv::
toPersistent( xAOD::MeasurementStateOnSurface* /*np*/ ) const {
return;
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef XAODTRACKINGATHENAPOOL_XAODMSOSCONTAINERCNV_H
#define XAODTRACKINGATHENAPOOL_XAODMSOSCONTAINERCNV_H
// Gaudi/Athena include(s):
#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h"
// EDM include(s):
#include "xAODTracking/MeasurementStateOnSurfaceContainer.h"
/// Type definition for the converter's base
typedef T_AthenaPoolCustomCnv< xAOD::MeasurementStateOnSurfaceContainer,
xAOD::MeasurementStateOnSurfaceContainer >
xAODMeasurementStateOnSurfaceContainerCnvBase;
/**
* @short POOL converter for the xAOD::MeasurementStateOnSurfaceContainer class
*
* Simple converter class making the xAOD::MeasurementStateOnSurfaceContainer
* class known to POOL.
*
*
*/
class xAODMeasurementStateOnSurfaceContainerCnv : public xAODMeasurementStateOnSurfaceContainerCnvBase {
// Declare the factory as our friend:
friend class CnvFactory< xAODMeasurementStateOnSurfaceContainerCnv >;
public:
/// Converter constructor
xAODMeasurementStateOnSurfaceContainerCnv( ISvcLocator* svcLoc );
/// Re-implemented function in order to get access to the SG key
virtual StatusCode createObj( IOpaqueAddress* pAddr, DataObject*& pObj );
/// Function preparing the container to be written out
virtual xAOD::MeasurementStateOnSurfaceContainer* createPersistent( xAOD::MeasurementStateOnSurfaceContainer* trans );
/// Function reading in the persistent object
virtual xAOD::MeasurementStateOnSurfaceContainer* createTransient();
private:
/// Function preparing a vertex object for persistence
void toPersistent( xAOD::MeasurementStateOnSurface* np ) const;
/// StoreGate key of the container just being created
std::string m_key;
}; // class xAODMSOSContainerCnv
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODNeutralParticleAuxContainerCnv.cxx 581533 2014-02-05 09:28:36Z krasznaa $
// System include(s):
#include <exception>
// Local include(s):
#include "xAODNeutralParticleAuxContainerCnv.h"
xAODNeutralParticleAuxContainerCnv::
xAODNeutralParticleAuxContainerCnv( ISvcLocator* svcLoc )
: xAODNeutralParticleAuxContainerCnvBase( svcLoc ) {
}
xAOD::NeutralParticleAuxContainer*
xAODNeutralParticleAuxContainerCnv::
createPersistent( xAOD::NeutralParticleAuxContainer* trans ) {
// Create a copy of the container:
xAOD::NeutralParticleAuxContainer* result =
new xAOD::NeutralParticleAuxContainer( *trans );
return result;
}
xAOD::NeutralParticleAuxContainer*
xAODNeutralParticleAuxContainerCnv::createTransient() {
// The known ID(s) for this container:
static const pool::Guid v1_guid( "006862BC-5CEB-11E3-9FB4-02163E00A92F" );
// Check which version of the container we're reading:
if( compareClassGuid( v1_guid ) ) {
// It's the latest version, read it directly:
return poolReadObject< xAOD::NeutralParticleAuxContainer >();
}
// If we didn't recognise the ID:
throw std::runtime_error( "Unsupported version of "
"xAOD::NeutralParticleAuxContainer found" );
return 0;
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef XAODTRACKINGATHENAPOOL_XAODNEUTRALPARTICLEAUXCONTAINERCNV_H
#define XAODTRACKINGATHENAPOOL_XAODNEUTRALPARTICLEAUXCONTAINERCNV_H
// Gaudi/Athena include(s):
#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h"
// EDM include(s):
#include "xAODTracking/NeutralParticleAuxContainer.h"
/// Base class for the converter
typedef T_AthenaPoolCustomCnv< xAOD::NeutralParticleAuxContainer,
xAOD::NeutralParticleAuxContainer >
xAODNeutralParticleAuxContainerCnvBase;
/**
* @short POOL converter for the xAOD::NeutralParticleAuxContainer class
*
* This is the converter doing the actual schema evolution
* of the package... The converter for xAOD::TrackParticleContainer
* doesn't do much, as the "interface classes" don't contain
* too much/any payload. Most of the payload is in the auxiliary
* containers like this one.
*
* @author Edward Moyse <Edward.Moyse@cern.ch>
*/
class xAODNeutralParticleAuxContainerCnv :
public xAODNeutralParticleAuxContainerCnvBase {
// Declare the factory as our friend:
friend class CnvFactory< xAODNeutralParticleAuxContainerCnv >;
protected:
/// Converter constructor
xAODNeutralParticleAuxContainerCnv( ISvcLocator* svcLoc );
/// Function preparing the container to be written out
virtual xAOD::NeutralParticleAuxContainer*
createPersistent( xAOD::NeutralParticleAuxContainer* trans );
/// Function reading in the object from the input file
virtual xAOD::NeutralParticleAuxContainer* createTransient();
}; // class xAODNeutralParticleAuxContainerCnv
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// System include(s):
#include <exception>
// Local include(s):
#include "xAODNeutralParticleContainerCnv.h"
namespace {
/// Helper function setting up the container's link to its auxiliary store
void setStoreLink( SG::AuxVectorBase* cont, const std::string& key ) {
// The link to set up:
DataLink< SG::IConstAuxStore > link( key + "Aux." );
// Give it to the container:
cont->setStore( link );
return;
}
} // private namespace
xAODNeutralParticleContainerCnv::xAODNeutralParticleContainerCnv( ISvcLocator* svcLoc )
: xAODNeutralParticleContainerCnvBase( svcLoc ) {
}
xAOD::NeutralParticleContainer*
xAODNeutralParticleContainerCnv::
createPersistent( xAOD::NeutralParticleContainer* trans ) {
// Create a view copy of the container:
xAOD::NeutralParticleContainer* result =
new xAOD::NeutralParticleContainer( trans->begin(), trans->end(),
SG::VIEW_ELEMENTS );
// Prepare the objects to be written out:
xAOD::NeutralParticleContainer::iterator itr = result->begin();
xAOD::NeutralParticleContainer::iterator end = result->end();
for( ; itr != end; ++itr ) {
toPersistent( *itr );
}
// Return the new container:
return result;
}
/**
* This function needs to be re-implemented in order to figure out the StoreGate
* key of the container that's being created. After that's done, it lets the
* base class do its normal task.
*/
StatusCode xAODNeutralParticleContainerCnv::createObj( IOpaqueAddress* pAddr,
DataObject*& pObj ) {
// Get the key of the container that we'll be creating:
m_key = *( pAddr->par() + 1 );
ATH_MSG_VERBOSE( "Key of xAOD::NeutralParticleContainer: " << m_key );
// Let the base class do its thing now:
return AthenaPoolConverter::createObj( pAddr, pObj );
}
xAOD::NeutralParticleContainer* xAODNeutralParticleContainerCnv::createTransient() {
// The known ID(s) for this container:
static pool::Guid v1_guid( "12869D6A-5CEB-11E3-B64A-02163E00A92F" );
// Check if we're reading the most up to date type:
if( compareClassGuid( v1_guid ) ) {
xAOD::NeutralParticleContainer* c = poolReadObject< xAOD::NeutralParticleContainer >();
setStoreLink( c, m_key );
return c;
}
// If we didn't recognise the ID, let's complain:
throw std::runtime_error( "Unsupported version of "
"xAOD::NeutralParticleContainer found" );
return 0;
}
void xAODNeutralParticleContainerCnv::
toPersistent( xAOD::NeutralParticle* /*np*/ ) const {
return;
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef XAODTRACKINGATHENAPOOL_XAODNEUTRALPARTICLECONTAINERCNV_H
#define XAODTRACKINGATHENAPOOL_XAODNEUTRALPARTICLECONTAINERCNV_H
// Gaudi/Athena include(s):
#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h"
// EDM include(s):
#include "xAODTracking/NeutralParticleContainer.h"
/// Type definition for the converter's base
typedef T_AthenaPoolCustomCnv< xAOD::NeutralParticleContainer,
xAOD::NeutralParticleContainer >
xAODNeutralParticleContainerCnvBase;
/**
* @short POOL converter for the xAOD::NeutralParticleContainer class
*
* Simple converter class making the xAOD::NeutralParticleContainer
* class known to POOL.
*
* @author Edward Moyse <Edward.Moyse@cern.ch>
* @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
*
*/
class xAODNeutralParticleContainerCnv : public xAODNeutralParticleContainerCnvBase {
// Declare the factory as our friend:
friend class CnvFactory< xAODNeutralParticleContainerCnv >;
public:
/// Converter constructor
xAODNeutralParticleContainerCnv( ISvcLocator* svcLoc );
/// Re-implemented function in order to get access to the SG key
virtual StatusCode createObj( IOpaqueAddress* pAddr, DataObject*& pObj );
/// Function preparing the container to be written out
virtual xAOD::NeutralParticleContainer* createPersistent( xAOD::NeutralParticleContainer* trans );
/// Function reading in the persistent object
virtual xAOD::NeutralParticleContainer* createTransient();
private:
/// Function preparing a vertex object for persistence
void toPersistent( xAOD::NeutralParticle* np ) const;
/// StoreGate key of the container just being created
std::string m_key;
}; // class xAODNeutralParticleContainerCnv
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODPrepRawDataAuxContainerCnv.cxx 581533 2014-02-05 09:28:36Z krasznaa $
// System include(s):
#include <exception>
// Local include(s):
#include "xAODPrepRawDataAuxContainerCnv.h"
xAODPrepRawDataAuxContainerCnv::
xAODPrepRawDataAuxContainerCnv( ISvcLocator* svcLoc )
: xAODPrepRawDataAuxContainerCnvBase( svcLoc ) {
}
xAOD::PrepRawDataAuxContainer*
xAODPrepRawDataAuxContainerCnv::
createPersistent( xAOD::PrepRawDataAuxContainer* trans ) {
// Create a copy of the container:
xAOD::PrepRawDataAuxContainer* result =
new xAOD::PrepRawDataAuxContainer( *trans );
return result;
}
xAOD::PrepRawDataAuxContainer*
xAODPrepRawDataAuxContainerCnv::createTransient() {
// The known ID(s) for this container:
static const pool::Guid v1_guid( "11B4BF93-0074-4BF5-AD64-216762A58E5C" );
// Check which version of the container we're reading:
if( compareClassGuid( v1_guid ) ) {
// It's the latest version, read it directly:
return poolReadObject< xAOD::PrepRawDataAuxContainer >();
}
// If we didn't recognise the ID:
throw std::runtime_error( "Unsupported version of "
"xAOD::PrepRawDataAuxContainer found" );
return 0;
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef XAODTRACKINGATHENAPOOL_XAODPREPRAWDATAAUXCONTAINERCNV_H
#define XAODTRACKINGATHENAPOOL_XAODPREPRAWDATAAUXCONTAINERCNV_H
// Gaudi/Athena include(s):
#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h"
// EDM include(s):
#include "xAODTracking/PrepRawDataAuxContainer.h"
/// Base class for the converter
typedef T_AthenaPoolCustomCnv< xAOD::PrepRawDataAuxContainer,
xAOD::PrepRawDataAuxContainer >