Skip to content
Snippets Groups Projects
Commit 8330bc7c authored by Attila Krasznahorkay's avatar Attila Krasznahorkay
Browse files

Added the necessary converter(s) for xAOD::EventAuxInfo_v2.

The converters are set up to convert _v2 objects into _v1 objects
in memory. To be able to read release 22 files, while still producing
files with the same EDM that release 21 analyses would expect.
parent 9758a0e8
No related branches found
No related tags found
No related merge requests found
################################################################################ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
# Package: xAODEventInfoAthenaPool
################################################################################
# Declare the package name: # Declare the package name:
atlas_subdir( xAODEventInfoAthenaPool ) atlas_subdir( xAODEventInfoAthenaPool )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PRIVATE
Database/AthenaPOOL/AthenaPoolCnvSvc
Database/AthenaPOOL/AthenaPoolUtilities
Event/xAOD/xAODEventInfo )
# Component(s) in the package: # Component(s) in the package:
atlas_add_poolcnv_library( xAODEventInfoAthenaPoolPoolCnv atlas_add_poolcnv_library( xAODEventInfoAthenaPoolPoolCnv
src/*.cxx src/*.h src/*.cxx
FILES xAODEventInfo/EventInfo.h xAODEventInfo/EventAuxInfo.h xAODEventInfo/EventInfoContainer.h xAODEventInfo/EventInfoAuxContainer.h FILES xAODEventInfo/EventInfo.h xAODEventInfo/EventAuxInfo.h
TYPES_WITH_NAMESPACE xAOD::EventInfo xAOD::EventAuxInfo xAOD::EventInfoContainer xAOD::EventInfoAuxContainer xAODEventInfo/EventInfoContainer.h xAODEventInfo/EventInfoAuxContainer.h
CNV_PFX xAOD TYPES_WITH_NAMESPACE xAOD::EventInfo xAOD::EventAuxInfo
LINK_LIBRARIES AthenaPoolCnvSvcLib AthenaPoolUtilities xAODEventInfo ) xAOD::EventInfoContainer xAOD::EventInfoAuxContainer
CNV_PFX xAOD
LINK_LIBRARIES AthenaPoolCnvSvcLib AthenaPoolUtilities AthContainers
xAODEventInfo )
// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
//
// Dummy source file so that cmake will know that this is a custom converter.
//
// Dear emacs, this is -*- c++ -*-
//
// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
//
#ifndef XAODEVENTINFOATHENAPOOL_XAODEVENTAUXINFOCNV_H
#define XAODEVENTINFOATHENAPOOL_XAODEVENTAUXINFOCNV_H
// Local include(s).
#include "xAODEventAuxInfoCnv_v2.h"
// EDM include(s).
#include "xAODEventInfo/EventAuxInfo.h"
// Framework include(s).
#include "AthenaPoolCnvSvc/T_AthenaPoolAuxContainerCnv.h"
// Declare the POOL converter.
typedef T_AthenaPoolAuxContainerCnv< xAOD::EventAuxInfo,
xAODEventAuxInfoCnv_v2 >
xAODEventAuxInfoCnv;
#endif // XAODEVENTINFOATHENAPOOL_XAODEVENTAUXINFOCNV_H
// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
// Local include(s).
#include "xAODEventAuxInfoCnv_v2.h"
// Core EDM include(s):
#include "AthContainers/tools/copyAuxStoreThinned.h"
// System include(s).
#include <stdexcept>
/// Convenience macro for setting the level of output messages
#define MSGLVL MSG::INFO
/// Another convenience macro for printing messages in the converter
#define ATH_MSG( MSG ) \
do { \
if( log.level() <= MSGLVL ) { \
log << MSGLVL << MSG << endmsg; \
} \
} while( 0 )
void xAODEventAuxInfoCnv_v2::persToTrans( const xAOD::EventAuxInfo_v2* oldObj,
xAOD::EventAuxInfo* newObj,
MsgStream& log ) {
// Greet the user.
ATH_MSG( "Converting xAOD::EventAuxInfo_v2 to the current version..." );
// Copy the payload of the v2 object into the latest one by misusing
// the thinning code a bit...
SG::copyAuxStoreThinned( *oldObj, *newObj,
static_cast< IThinningSvc* >( nullptr ) );
// Print what happened:
ATH_MSG( "Converting xAOD::EventAuxInfo_v2 to the current version... "
"[OK]" );
return;
}
void xAODEventAuxInfoCnv_v2::transToPers( const xAOD::EventAuxInfo*,
xAOD::EventAuxInfo_v2*,
MsgStream& log ) {
log << MSG::ERROR
<< "Somebody called xAODEventAuxInfoCnv_v2::transToPers"
<< endmsg;
throw std::runtime_error( "Somebody called xAODEventAuxInfoCnv_v2::"
"transToPers" );
return;
}
// Dear emacs, this is -*- c++ -*-
//
// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
//
#ifndef XAODEVENTINFOATHENAPOOL_XAODEVENAUXINFOCNV_V2_H
#define XAODEVENTINFOATHENAPOOL_XAODEVENAUXINFOCNV_V2_H
// Gaudi/Athena include(s).
#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h"
// EDM include(s).
#include "xAODEventInfo/versions/EventAuxInfo_v2.h"
#include "xAODEventInfo/EventAuxInfo.h"
/// Converter for reading @c xAOD::EventAuxInfo_v2
///
/// This converter takes care of reading @c xAOD::EventAuxInfo_v2 into
/// the "current" version of @c xAOD::EventAuxInfo. (Which is
/// @c xAOD::EventAuxInfo_v1 in this branch.)
///
/// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
///
class xAODEventAuxInfoCnv_v2 :
public T_AthenaPoolTPCnvBase< xAOD::EventAuxInfo,
xAOD::EventAuxInfo_v2 > {
public:
/// Default constructor
xAODEventAuxInfoCnv_v2() = default;
/// Function converting from the old type to the current one
virtual void persToTrans( const xAOD::EventAuxInfo_v2* oldObj,
xAOD::EventAuxInfo* newObj,
MsgStream& log ) override;
/// Dummy function inherited from the base class
virtual void transToPers( const xAOD::EventAuxInfo*,
xAOD::EventAuxInfo_v2*,
MsgStream& log ) override;
}; // class xAODEventAuxInfoCnv_v2
#endif // XAODEVENTINFOATHENAPOOL_XAODEVENAUXINFOCNV_V2_H
// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
// Gaudi/Athena include(s).
#include "AthenaKernel/TPCnvFactory.h"
// EDM include(s).
#include "xAODEventInfo/EventAuxInfo.h"
#include "xAODEventInfo/versions/EventAuxInfo_v2.h"
// Local include(s).
#include "xAODEventAuxInfoCnv_v2.h"
// Declare the T/P converter(s).
DECLARE_TPCNV_FACTORY( xAODEventAuxInfoCnv_v2,
xAOD::EventAuxInfo,
xAOD::EventAuxInfo_v2,
Athena::TPCnvVers::Old )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment