Skip to content
Snippets Groups Projects
Commit 825accaf authored by Emmanuel Le Guirriec's avatar Emmanuel Le Guirriec Committed by Graeme Stewart
Browse files

All taggers in (xAODBTaggingAthenaPool-00-00-06)

parent abe2fcee
No related branches found
No related tags found
No related merge requests found
Showing with 580 additions and 0 deletions
package xAODBTaggingAthenaPool
# $Id: requirements 602344 2014-06-18 10:14:07Z rticseto $
author Magdalena Slawinska <Magdalena.Slawinska@cern.ch>
author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
public
# Base package(s):
use AtlasPolicy AtlasPolicy-*
private
# Base package(s):
use GaudiInterface GaudiInterface-* External
# POOL package(s):
use AthenaPoolUtilities AthenaPoolUtilities-* Database/AthenaPOOL
use AtlasROOT AtlasROOT-* External
use xAODTracking xAODTracking-* Event/xAOD
# EDM package(s):
use xAODBTagging xAODBTagging-* Event/xAOD
# Declare the pool converter(s):
apply_pattern poolcnv typesWithNamespace="xAOD::BTaggingContainer \
xAOD::BTaggingAuxContainer \
xAOD::BTagVertexContainer \
xAOD::BTagVertexAuxContainer" \
files="-s=${xAODBTagging_root}/xAODBTagging \
BTaggingContainer.h \
BTaggingAuxContainer.h \
BTagVertexContainer.h \
BTagVertexAuxContainer.h" \
cnv_pfx="xAOD"
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODBTaggingAuxContainerCnv.cxx 566967 2013-10-24 13:24:31Z krasznaa $
// System include(s):
#include <exception>
// ROOT include(s):
#include <TClass.h>
// Local include(s):
#include "xAODBTagVertexAuxContainerCnv.h"
#include "xAODTracking/TrackParticleContainer.h"
xAODBTagVertexAuxContainerCnv::xAODBTagVertexAuxContainerCnv( ISvcLocator* svcLoc )
: xAODBTagVertexAuxContainerCnvBase( svcLoc ) {
}
xAOD::BTagVertexAuxContainer*
xAODBTagVertexAuxContainerCnv::
createPersistent( xAOD::BTagVertexAuxContainer* trans ) {
static const char* trackParticleType =
"std::vector<std::vector<ElementLink<DataVector<xAOD::TrackParticle_v1> > > >";
static bool dictLoaded = false;
if( ! dictLoaded ) {
TClass* cl = TClass::GetClass( trackParticleType );
if( ( ! cl ) || ( ! cl->IsLoaded() ) ) {
ATH_MSG_ERROR( "Couldn't load the dictionary for \""
<< trackParticleType << "\"" );
} else {
dictLoaded = true;
}
}
// Create a copy of the container:
xAOD::BTagVertexAuxContainer* result =
new xAOD::BTagVertexAuxContainer( *trans );
return result;
}
xAOD::BTagVertexAuxContainer* xAODBTagVertexAuxContainerCnv::createTransient() {
// The known ID(s) for this container:
const pool::Guid v1_guid( "09CD44BA-0F40-4FDB-BB30-2F4226FF3E18" );
// Check which version of the container we're reading:
if( compareClassGuid( v1_guid ) ) {
// It's the latest version, read it directly:
return poolReadObject< xAOD::BTagVertexAuxContainer >();
}
// If we didn't recognise the ID:
throw std::runtime_error( "Unsupported version of "
"xAOD::BTagVertexAuxContainer found" );
return 0;
}
// Dear emacs, this is -*- c++ -*-
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODBTaggingAuxContainerCnv.h 566967 2013-10-24 13:24:31Z krasznaa $
#ifndef XAODBTAGGINGATHENAPOOL_XAODBTAGVERTEXAUXCONTAINERCNV_H
#define XAODBTAGGINGATHENAPOOL_XAODBTAGVERTEXAUXCONTAINERCNV_H
// Gaudi/Athena include(s):
#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h"
// EDM include(s):
#include "xAODBTagging/BTagVertexAuxContainer.h"
/// Base class for the converter
typedef T_AthenaPoolCustomCnv< xAOD::BTagVertexAuxContainer,
xAOD::BTagVertexAuxContainer >
xAODBTagVertexAuxContainerCnvBase;
/**
* @short POOL converter for the xAOD::BTaggingAuxContainer class
*
* This is the converter doing the actual schema evolution
* of the package... The converter for xAOD::BTaggingContainer
* 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 Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
*
* $Revision: 566967 $
* $Date: 2013-10-24 15:24:31 +0200 (Thu, 24 Oct 2013) $
*/
class xAODBTagVertexAuxContainerCnv :
public xAODBTagVertexAuxContainerCnvBase {
// Declare the factory as our friend:
friend class CnvFactory< xAODBTagVertexAuxContainerCnv >;
protected:
/// Converter constructor
xAODBTagVertexAuxContainerCnv( ISvcLocator* svcLoc );
/// Function preparing the container to be written out
virtual xAOD::BTagVertexAuxContainer*
createPersistent( xAOD::BTagVertexAuxContainer* trans );
/// Function reading in the object from the input file
virtual xAOD::BTagVertexAuxContainer* createTransient();
}; // class xAODBTaggingAuxContainerCnv
#endif // XAODBTAGGINGATHENAPOOL_XAODBTAGGINGAUXCONTAINERCNV_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODBTagVertexContainerCnv.cxx 581167 2014-02-03 10:45:56Z $
// System include(s):
#include <exception>
// Local include(s):
#include "xAODBTagVertexContainerCnv.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
xAODBTagVertexContainerCnv::xAODBTagVertexContainerCnv( ISvcLocator* svcLoc )
: xAODBTagVertexContainerCnvBase( svcLoc ) {
}
/**
* 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 xAODBTagVertexContainerCnv::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::BTagVertexContainer: " << m_key );
// Let the base class do its thing now:
return AthenaPoolConverter::createObj( pAddr, pObj );
}
xAOD::BTagVertexContainer*
xAODBTagVertexContainerCnv::createPersistent( xAOD::BTagVertexContainer* trans ) {
// Create a view copy of the container:
xAOD::BTagVertexContainer* result =
new xAOD::BTagVertexContainer( trans->begin(), trans->end(),
SG::VIEW_ELEMENTS );
// Prepare the objects to be written out:
xAOD::BTagVertexContainer::iterator itr = result->begin();
xAOD::BTagVertexContainer::iterator end = result->end();
for( ; itr != end; ++itr ) {
toPersistent( *itr );
}
// Return the new container:
return result;
}
xAOD::BTagVertexContainer* xAODBTagVertexContainerCnv::createTransient() {
// The known ID(s) for this container:
const pool::Guid v1_guid( "E225A9EC-9782-43F7-B7BF-1B215187C11C" );
// Check if we're reading the most up to date type:
if( compareClassGuid( v1_guid ) ) {
xAOD::BTagVertexContainer* c = poolReadObject< xAOD::BTagVertexContainer >();
setStoreLink( c, m_key );
return c;
}
// If we didn't recognise the ID, let's complain:
throw std::runtime_error( "Unsupported version of "
"xAOD::BTagVertexContainer found" );
return 0;
}
void xAODBTagVertexContainerCnv::toPersistent( xAOD::BTagVertex* BTagVertex ) const {
// Tell the object to prepare all its smart pointers for persistification:
BTagVertex->toPersistent();
return;
}
// Dear emacs, this is -*- c++ -*-
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODJetContainerCnv.h 581167 2014-02-03 10:45:56Z krasznaa $
#ifndef XAODBTAGGINGATHENAPOOL_XAODBTAGVERTEXCONTAINERCNV_H
#define XAODBTAGGINGATHENAPOOL_XAODBTAGVERTEXCONTAINERCNV_H
// System include(s):
#include <string>
// Gaudi/Athena include(s):
#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h"
// EDM include(s):
#include "xAODBTagging/BTagVertexContainer.h"
/// Type definition for the converter's base
typedef T_AthenaPoolCustomCnv< xAOD::BTagVertexContainer,
xAOD::BTagVertexContainer >
xAODBTagVertexContainerCnvBase;
/**
* @short POOL converter for the xAOD::BTaggingContainer class
*
* Simple converter class making the xAOD::BTaggingContainer
* class known to POOL.
*
* @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
*
* $Revision: 581167 $
* $Date: 2014-02-03 11:45:56 +0100 (Mon, 03 Feb 2014) $
*/
class xAODBTagVertexContainerCnv : public xAODBTagVertexContainerCnvBase {
// Declare the factory as our friend:
friend class CnvFactory< xAODBTagVertexContainerCnv >;
public:
/// Converter constructor
xAODBTagVertexContainerCnv( 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::BTagVertexContainer* createPersistent( xAOD::BTagVertexContainer* trans );
/// Function reading in the persistent object
virtual xAOD::BTagVertexContainer* createTransient();
private:
/// Function preparing a vertex object for persistence
void toPersistent( xAOD::BTagVertex* BTagVertex ) const;
/// StoreGate key of the container just being created
std::string m_key;
}; // class xAODBTaggingContainerCnv
#endif // XAODBTAGGINGATHENAPOOL_XAODBTAGGINGCONTAINERCNV_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODBTaggingAuxContainerCnv.cxx 566967 2013-10-24 13:24:31Z krasznaa $
// System include(s):
#include <exception>
// ROOT include(s):
#include <TClass.h>
// Local include(s):
#include "xAODBTaggingAuxContainerCnv.h"
#include "xAODTracking/TrackParticleContainer.h"
xAODBTaggingAuxContainerCnv::xAODBTaggingAuxContainerCnv( ISvcLocator* svcLoc )
: xAODBTaggingAuxContainerCnvBase( svcLoc ) {
}
xAOD::BTaggingAuxContainer*
xAODBTaggingAuxContainerCnv::
createPersistent( xAOD::BTaggingAuxContainer* trans ) {
// Make sure that the dictionary for the Athena-only dynamic variable
// is loaded:
static const char* trackParticleType =
"std::vector<std::vector<ElementLink<DataVector<xAOD::TrackParticle_v1> > > >";
static bool dictLoaded = false;
if( ! dictLoaded ) {
TClass* cl = TClass::GetClass( trackParticleType );
if( ( ! cl ) || ( ! cl->IsLoaded() ) ) {
ATH_MSG_ERROR( "Couldn't load the dictionary for \""
<< trackParticleType << "\"" );
} else {
dictLoaded = true;
}
}
// Create a copy of the container:
xAOD::BTaggingAuxContainer* result =
new xAOD::BTaggingAuxContainer( *trans );
return result;
}
xAOD::BTaggingAuxContainer* xAODBTaggingAuxContainerCnv::createTransient() {
// The known ID(s) for this container:
const pool::Guid v1_guid( "5E1973D2-D860-4BB1-B8EF-C9AD8E6C66A2" );
// Check which version of the container we're reading:
if( compareClassGuid( v1_guid ) ) {
// It's the latest version, read it directly:
return poolReadObject< xAOD::BTaggingAuxContainer >();
}
// If we didn't recognise the ID:
throw std::runtime_error( "Unsupported version of "
"xAOD::BTaggingAuxContainer found" );
return 0;
}
// Dear emacs, this is -*- c++ -*-
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODBTaggingAuxContainerCnv.h 566967 2013-10-24 13:24:31Z krasznaa $
#ifndef XAODBTAGGINGATHENAPOOL_XAODBTAGGINGAUXCONTAINERCNV_H
#define XAODBTAGGINGATHENAPOOL_XAODBTAGGINGAUXCONTAINERCNV_H
// Gaudi/Athena include(s):
#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h"
// EDM include(s):
#include "xAODBTagging/BTaggingAuxContainer.h"
/// Base class for the converter
typedef T_AthenaPoolCustomCnv< xAOD::BTaggingAuxContainer,
xAOD::BTaggingAuxContainer >
xAODBTaggingAuxContainerCnvBase;
/**
* @short POOL converter for the xAOD::BTaggingAuxContainer class
*
* This is the converter doing the actual schema evolution
* of the package... The converter for xAOD::BTaggingContainer
* 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 Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
*
* $Revision: 566967 $
* $Date: 2013-10-24 15:24:31 +0200 (Thu, 24 Oct 2013) $
*/
class xAODBTaggingAuxContainerCnv :
public xAODBTaggingAuxContainerCnvBase {
// Declare the factory as our friend:
friend class CnvFactory< xAODBTaggingAuxContainerCnv >;
protected:
/// Converter constructor
xAODBTaggingAuxContainerCnv( ISvcLocator* svcLoc );
/// Function preparing the container to be written out
virtual xAOD::BTaggingAuxContainer*
createPersistent( xAOD::BTaggingAuxContainer* trans );
/// Function reading in the object from the input file
virtual xAOD::BTaggingAuxContainer* createTransient();
}; // class xAODBTaggingAuxContainerCnv
#endif // XAODBTAGGINGATHENAPOOL_XAODBTAGGINGAUXCONTAINERCNV_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODBTaggingContainerCnv.cxx 581167 2014-02-03 10:45:56Z krasznaa $
// System include(s):
#include <exception>
// Local include(s):
#include "xAODBTaggingContainerCnv.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
xAODBTaggingContainerCnv::xAODBTaggingContainerCnv( ISvcLocator* svcLoc )
: xAODBTaggingContainerCnvBase( svcLoc ) {
}
/**
* 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 xAODBTaggingContainerCnv::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::BTaggingContainer: " << m_key );
// Let the base class do its thing now:
return AthenaPoolConverter::createObj( pAddr, pObj );
}
xAOD::BTaggingContainer*
xAODBTaggingContainerCnv::createPersistent( xAOD::BTaggingContainer* trans ) {
// Create a view copy of the container:
xAOD::BTaggingContainer* result =
new xAOD::BTaggingContainer( trans->begin(), trans->end(),
SG::VIEW_ELEMENTS );
// Prepare the objects to be written out:
xAOD::BTaggingContainer::iterator itr = result->begin();
xAOD::BTaggingContainer::iterator end = result->end();
for( ; itr != end; ++itr ) {
toPersistent( *itr );
}
// Return the new container:
return result;
}
xAOD::BTaggingContainer* xAODBTaggingContainerCnv::createTransient() {
// The known ID(s) for this container:
const pool::Guid v1_guid( "5D19F171-E07E-4F65-BC1F-FC4F4099E9F1" );
// Check if we're reading the most up to date type:
if( compareClassGuid( v1_guid ) ) {
xAOD::BTaggingContainer* c = poolReadObject< xAOD::BTaggingContainer >();
setStoreLink( c, m_key );
return c;
}
// If we didn't recognise the ID, let's complain:
throw std::runtime_error( "Unsupported version of "
"xAOD::BTaggingContainer found" );
return 0;
}
void xAODBTaggingContainerCnv::toPersistent( xAOD::BTagging* BTagging ) const {
// Tell the object to prepare all its smart pointers for persistification:
BTagging->toPersistent();
return;
}
// Dear emacs, this is -*- c++ -*-
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODJetContainerCnv.h 581167 2014-02-03 10:45:56Z krasznaa $
#ifndef XAODBTAGGINGATHENAPOOL_XAODBTAGGINGCONTAINERCNV_H
#define XAODBTAGGINGATHENAPOOL_XAODBTAGGINGCONTAINERCNV_H
// System include(s):
#include <string>
// Gaudi/Athena include(s):
#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h"
// EDM include(s):
#include "xAODBTagging/BTaggingContainer.h"
/// Type definition for the converter's base
typedef T_AthenaPoolCustomCnv< xAOD::BTaggingContainer,
xAOD::BTaggingContainer >
xAODBTaggingContainerCnvBase;
/**
* @short POOL converter for the xAOD::BTaggingContainer class
*
* Simple converter class making the xAOD::BTaggingContainer
* class known to POOL.
*
* @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
*
* $Revision: 581167 $
* $Date: 2014-02-03 11:45:56 +0100 (Mon, 03 Feb 2014) $
*/
class xAODBTaggingContainerCnv : public xAODBTaggingContainerCnvBase {
// Declare the factory as our friend:
friend class CnvFactory< xAODBTaggingContainerCnv >;
public:
/// Converter constructor
xAODBTaggingContainerCnv( 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::BTaggingContainer* createPersistent( xAOD::BTaggingContainer* trans );
/// Function reading in the persistent object
virtual xAOD::BTaggingContainer* createTransient();
private:
/// Function preparing a vertex object for persistence
void toPersistent( xAOD::BTagging* BTagging ) const;
/// StoreGate key of the container just being created
std::string m_key;
}; // class xAODBTaggingContainerCnv
#endif // XAODBTAGGINGATHENAPOOL_XAODBTAGGINGCONTAINERCNV_H
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