Commit 7c93df8a authored by Denis Oliveira Damazio's avatar Denis Oliveira Damazio Committed by Graeme Stewart
Browse files

Fixes from Attila to read back xAOD (xAODTrigEgammaAthenaPool-00-00-02)

parent 6d9510b1
package xAODTrigEgammaAthenaPool
# Change!
author Gordon Watts <gwatts@uw.edu>
public
# Base package(s):
use AtlasPolicy AtlasPolicy-*
private
# Base package(s):
use GaudiInterface GaudiInterface-* External
# POOL package(s):
use AthenaPoolUtilities AthenaPoolUtilities-* Database/AthenaPOOL
# EDM package(s):
use xAODTrigEgamma xAODTrigEgamma-* Event/xAOD
# Declare the pool converter(s): (add extra ones onto the string with line continuations)
apply_pattern poolcnv typesWithNamespace="xAOD::TrigPhotonContainer xAOD::TrigElectronContainer" \
files="-s=${xAODTrigEgamma_root}/xAODTrigEgamma \
TrigPhotonContainer.h \
TrigPhotonAuxContainer.h \
TrigElectronContainer.h \
TrigElectronAuxContainer.h" \
cnv_pfx="xAOD"
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODTrigElectronAuxContainerCnv.cxx
// System include(s):
#include <exception>
// Local include(s):
#include "xAODTrigElectronAuxContainerCnv.h"
xAODTrigElectronAuxContainerCnv::xAODTrigElectronAuxContainerCnv( ISvcLocator* svcLoc )
: xAODTrigElectronAuxContainerCnvBase( svcLoc ) {
}
xAOD::TrigElectronAuxContainer*
xAODTrigElectronAuxContainerCnv::
createPersistent( xAOD::TrigElectronAuxContainer* trans ) {
// Create a copy of the container:
xAOD::TrigElectronAuxContainer* result =
new xAOD::TrigElectronAuxContainer( *trans );
return result;
}
xAOD::TrigElectronAuxContainer* xAODTrigElectronAuxContainerCnv::createTransient() {
// The known ID(s) for this container:
static const pool::Guid v1_guid( "173425E6-51BB-4015-B960-3F7F83F26B9E" );
// Check which version of the container we're reading:
if( compareClassGuid( v1_guid ) ) {
// It's the latest version, read it directly:
return poolReadObject< xAOD::TrigElectronAuxContainer >();
}
// If we didn't recognise the ID:
throw std::runtime_error( "Unsupported version of "
"xAOD::TrigElectronAuxContainer found" );
return 0;
}
// Dear emacs, this is -*- c++ -*-
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODTrigElectronAuxContainerCnv.h
#ifndef xAODTrigEgammaATHENAPOOL_XAODTrigElectronAUXCONTAINERCNV_H
#define xAODTrigEgammaATHENAPOOL_XAODTrigElectronAUXCONTAINERCNV_H
// Gaudi/Athena include(s):
#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h"
// EDM include(s):
#include "xAODTrigEgamma/TrigElectronAuxContainer.h"
/// Base class for the converter
typedef T_AthenaPoolCustomCnv< xAOD::TrigElectronAuxContainer,
xAOD::TrigElectronAuxContainer >
xAODTrigElectronAuxContainerCnvBase;
/**
* @short POOL converter for the xAOD::TrigElectronAuxContainer class
*
* @author Your name here
*
* $Revision: 572963 $
* $Date: 2013-11-29 01:15:54 -0800 (Fri, 29 Nov 2013) $
*/
class xAODTrigElectronAuxContainerCnv :
public xAODTrigElectronAuxContainerCnvBase {
// Declare the factory as our friend:
friend class CnvFactory< xAODTrigElectronAuxContainerCnv >;
protected:
/// Converter constructor
xAODTrigElectronAuxContainerCnv( ISvcLocator* svcLoc );
/// Function preparing the container to be written out
virtual xAOD::TrigElectronAuxContainer*
createPersistent( xAOD::TrigElectronAuxContainer* trans );
/// Function reading in the object from the input file
virtual xAOD::TrigElectronAuxContainer* createTransient();
}; // class xAODTrigElectronAuxContainerCnv
#endif // xAODTrigEgammaATHENAPOOL_XAODTrigElectronAUXCONTAINERCNV_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODTrigElectronContainerCnv.cxx
// System include(s):
#include <exception>
// Local include(s):
#include "xAODTrigElectronContainerCnv.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
xAODTrigElectronContainerCnv::xAODTrigElectronContainerCnv( ISvcLocator* svcLoc )
: xAODTrigElectronContainerCnvBase( svcLoc ) {
}
StatusCode xAODTrigElectronContainerCnv::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::xAODTrigElectronContainer: " << m_key );
//
// Let the base class do its thing now:
return AthenaPoolConverter::createObj( pAddr, pObj );
}
xAOD::TrigElectronContainer*
xAODTrigElectronContainerCnv::
createPersistent( xAOD::TrigElectronContainer* trans ) {
// Create a view copy of the container:
xAOD::TrigElectronContainer* result =
new xAOD::TrigElectronContainer( trans->begin(), trans->end(),
SG::VIEW_ELEMENTS );
// Prepare the objects to be written out:
xAOD::TrigElectronContainer::iterator itr = result->begin();
xAOD::TrigElectronContainer::iterator end = result->end();
for( ; itr != end; ++itr ) {
toPersistent( *itr );
}
// Return the new container:
return result;
}
xAOD::TrigElectronContainer* xAODTrigElectronContainerCnv::createTransient() {
// The known ID(s) for this container:
static pool::Guid v1_guid( "3492BB27-3ED8-45E3-9A5B-7266949CEDA9" );
// Check if we're reading the most up to date type:
if( compareClassGuid( v1_guid ) ) {
xAOD::TrigElectronContainer* c = poolReadObject< xAOD::TrigElectronContainer >();
setStoreLink(c, m_key );
return c;
}
// If we didn't recognise the ID, let's complain:
throw std::runtime_error( "Unsupported version of "
"xAOD::TrigElectronContainer found" );
return 0;
}
void xAODTrigElectronContainerCnv::
toPersistent( xAOD::TrigElectron* /*cluster*/ ) const {
return;
}
// Dear emacs, this is -*- c++ -*-
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODTrigElectronContainerCnv.h
#ifndef xAODTrigEgammaATHENAPOOL_XAODTrigElectronCONTAINERCNV_H
#define xAODTrigEgammaATHENAPOOL_XAODTrigElectronCONTAINERCNV_H
// Gaudi/Athena include(s):
#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h"
// EDM include(s):
#include "xAODTrigEgamma/TrigElectronContainer.h"
#include "xAODTrigEgamma/TrigElectron.h"
/// Type definition for the converter's base
typedef T_AthenaPoolCustomCnv< xAOD::TrigElectronContainer,
xAOD::TrigElectronContainer >
xAODTrigElectronContainerCnvBase;
/**
* @short POOL converter for the xAOD::TrigElectronContainer class
*
* Simple converter class making the xAOD::TrigElectronContainer
* class known to POOL.
*
* @author Your Name Here
*
* $Revision: 572963 $
* $Date: 2013-11-29 01:15:54 -0800 (Fri, 29 Nov 2013) $
*/
class xAODTrigElectronContainerCnv : public xAODTrigElectronContainerCnvBase {
// Declare the factory as our friend:
friend class CnvFactory< xAODTrigElectronContainerCnv >;
public:
/// Converter constructor
xAODTrigElectronContainerCnv( 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::TrigElectronContainer*
createPersistent( xAOD::TrigElectronContainer* trans );
/// Function reading in the persistent object
virtual xAOD::TrigElectronContainer* createTransient();
private:
/// Function preparing a vertex object for persistence
void toPersistent( xAOD::TrigElectron* cluster ) const;
/// StoreGate key for the container just being created
std::string m_key;
}; // class xAODTrigElectronContainerCnv
#endif // xAODTrigEgammaATHENAPOOL_XAODTrigElectronCONTAINERCNV_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODTrigPhotonAuxContainerCnv.cxx
// System include(s):
#include <exception>
// Local include(s):
#include "xAODTrigPhotonAuxContainerCnv.h"
xAODTrigPhotonAuxContainerCnv::xAODTrigPhotonAuxContainerCnv( ISvcLocator* svcLoc )
: xAODTrigPhotonAuxContainerCnvBase( svcLoc ) {
}
xAOD::TrigPhotonAuxContainer*
xAODTrigPhotonAuxContainerCnv::
createPersistent( xAOD::TrigPhotonAuxContainer* trans ) {
// Create a copy of the container:
xAOD::TrigPhotonAuxContainer* result =
new xAOD::TrigPhotonAuxContainer( *trans );
return result;
}
xAOD::TrigPhotonAuxContainer* xAODTrigPhotonAuxContainerCnv::createTransient() {
// The known ID(s) for this container:
static const pool::Guid v1_guid( "36B8B9E3-8F5E-4356-9315-EF4FA6959624" );
// Check which version of the container we're reading:
if( compareClassGuid( v1_guid ) ) {
// It's the latest version, read it directly:
return poolReadObject< xAOD::TrigPhotonAuxContainer >();
}
// If we didn't recognise the ID:
throw std::runtime_error( "Unsupported version of "
"xAOD::TrigPhotonAuxContainer found" );
return 0;
}
// Dear emacs, this is -*- c++ -*-
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODTrigPhotonAuxContainerCnv.h
#ifndef xAODTrigEgammaATHENAPOOL_XAODTrigPhotonAUXCONTAINERCNV_H
#define xAODTrigEgammaATHENAPOOL_XAODTrigPhotonAUXCONTAINERCNV_H
// Gaudi/Athena include(s):
#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h"
// EDM include(s):
#include "xAODTrigEgamma/TrigPhotonAuxContainer.h"
/// Base class for the converter
typedef T_AthenaPoolCustomCnv< xAOD::TrigPhotonAuxContainer,
xAOD::TrigPhotonAuxContainer >
xAODTrigPhotonAuxContainerCnvBase;
/**
* @short POOL converter for the xAOD::TrigPhotonAuxContainer class
*
* @author Your name here
*
* $Revision: 572963 $
* $Date: 2013-11-29 01:15:54 -0800 (Fri, 29 Nov 2013) $
*/
class xAODTrigPhotonAuxContainerCnv :
public xAODTrigPhotonAuxContainerCnvBase {
// Declare the factory as our friend:
friend class CnvFactory< xAODTrigPhotonAuxContainerCnv >;
protected:
/// Converter constructor
xAODTrigPhotonAuxContainerCnv( ISvcLocator* svcLoc );
/// Function preparing the container to be written out
virtual xAOD::TrigPhotonAuxContainer*
createPersistent( xAOD::TrigPhotonAuxContainer* trans );
/// Function reading in the object from the input file
virtual xAOD::TrigPhotonAuxContainer* createTransient();
}; // class xAODTrigPhotonAuxContainerCnv
#endif // xAODTrigEgammaATHENAPOOL_XAODTrigPhotonAUXCONTAINERCNV_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODTrigPhotonContainerCnv.cxx
// System include(s):
#include <exception>
// Local include(s):
#include "xAODTrigPhotonContainerCnv.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
xAODTrigPhotonContainerCnv::xAODTrigPhotonContainerCnv( ISvcLocator* svcLoc )
: xAODTrigPhotonContainerCnvBase( svcLoc ) {
}
StatusCode xAODTrigPhotonContainerCnv::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::xAODTrigPhotonContainer: " << m_key );
// Let the base class do its thing now:
return AthenaPoolConverter::createObj( pAddr, pObj );
}
xAOD::TrigPhotonContainer*
xAODTrigPhotonContainerCnv::
createPersistent( xAOD::TrigPhotonContainer* trans ) {
// Create a view copy of the container:
xAOD::TrigPhotonContainer* result =
new xAOD::TrigPhotonContainer( trans->begin(), trans->end(),
SG::VIEW_ELEMENTS );
// Prepare the objects to be written out:
xAOD::TrigPhotonContainer::iterator itr = result->begin();
xAOD::TrigPhotonContainer::iterator end = result->end();
for( ; itr != end; ++itr ) {
toPersistent( *itr );
}
// Return the new container:
return result;
}
xAOD::TrigPhotonContainer* xAODTrigPhotonContainerCnv::createTransient() {
// The known ID(s) for this container:
static pool::Guid v1_guid( "DA2CDAF5-B0E8-4502-89A3-E342DFA9C250" );
// Check if we're reading the most up to date type:
if( compareClassGuid( v1_guid ) ) {
xAOD::TrigPhotonContainer* c = poolReadObject< xAOD::TrigPhotonContainer >();
setStoreLink(c, m_key );
return c;
}
// If we didn't recognise the ID, let's complain:
throw std::runtime_error( "Unsupported version of "
"xAOD::TrigPhotonContainer found" );
return 0;
}
void xAODTrigPhotonContainerCnv::
toPersistent( xAOD::TrigPhoton* /*cluster*/ ) const {
return;
}
// Dear emacs, this is -*- c++ -*-
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODTrigPhotonContainerCnv.h
#ifndef xAODTrigEgammaATHENAPOOL_XAODTrigPhotonCONTAINERCNV_H
#define xAODTrigEgammaATHENAPOOL_XAODTrigPhotonCONTAINERCNV_H
// Gaudi/Athena include(s):
#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h"
// EDM include(s):
#include "xAODTrigEgamma/TrigPhotonContainer.h"
#include "xAODTrigEgamma/TrigPhoton.h"
/// Type definition for the converter's base
typedef T_AthenaPoolCustomCnv< xAOD::TrigPhotonContainer,
xAOD::TrigPhotonContainer >
xAODTrigPhotonContainerCnvBase;
/**
* @short POOL converter for the xAOD::TrigPhotonContainer class
*
* Simple converter class making the xAOD::TrigPhotonContainer
* class known to POOL.
*
* @author Your Name Here
*
* $Revision: 572963 $
* $Date: 2013-11-29 01:15:54 -0800 (Fri, 29 Nov 2013) $
*/
class xAODTrigPhotonContainerCnv : public xAODTrigPhotonContainerCnvBase {
// Declare the factory as our friend:
friend class CnvFactory< xAODTrigPhotonContainerCnv >;
public:
/// Converter constructor
xAODTrigPhotonContainerCnv( 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::TrigPhotonContainer*
createPersistent( xAOD::TrigPhotonContainer* trans );
/// Function reading in the persistent object
virtual xAOD::TrigPhotonContainer* createTransient();
private:
/// Function preparing a vertex object for persistence
void toPersistent( xAOD::TrigPhoton* cluster ) const;
/// StoreGate key for the container just being created
std::string m_key;
}; // class xAODTrigPhotonContainerCnv
#endif // xAODTrigEgammaATHENAPOOL_XAODTrigPhotonCONTAINERCNV_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment