Skip to content
Snippets Groups Projects
Commit 06a95a9f authored by Siarhei Harkusha's avatar Siarhei Harkusha Committed by Graeme Stewart
Browse files

moved pool convertor for TileHitVectorCnv to seperate package...

moved pool convertor for TileHitVectorCnv to seperate package TileSimEventAthenaPool (TileSimEventAthenaPool-00-00-01)
parent bf8164a2
No related branches found
No related tags found
No related merge requests found
## automatically generated CMT requirements file
package TileSimEventAthenaPool
author Alexandre Solodkov <Sanya.Solodkov@cern.ch>
## for athena policies: this has to be the first use statement
use AtlasPolicy AtlasPolicy-*
private
use GaudiInterface GaudiInterface-* External
use AthenaPoolCnvSvc AthenaPoolCnvSvc-* Database/AthenaPOOL
use AthenaPoolUtilities AthenaPoolUtilities-* Database/AthenaPOOL
use TileSimEvent TileSimEvent-* TileCalorimeter
use TileSimEventTPCnv TileSimEventTPCnv-* TileCalorimeter/TileSvc
apply_pattern poolcnv files="-s=${TileSimEvent_root}/TileSimEvent TileHitVector.h"
macro_append TileSimEventAthenaPoolPoolCnv_shlibflags "$(TileSimEventAthenaPool_dict_linkopts)"
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
@mainpage TileEventAthenaPool Package
This package handles the conversion of Tile data classes to Pool format.
@author Alexander Solodkov <sanya.solodkov@cern.ch>
In order to write the Tile EDM (Event Data Model) objects, defined in the
TileEvent and TileSimEvent packages, into Pool files (ESD, AOD, ...), pool
converters are needed. In many cases, the persistent version of the object can
be a simple copy of the transient one, so the automatic conversion will be
enough. However, in some cases a custom converter is needed if, for instance,
type casts have to be used.
More details about Pool coversion here:
https://twiki.cern.ch/twiki/bin/view/Atlas/WriteReadDataViaPool
@section Automatic Pool conversion
The AthenaPoolCnvSvc package provides generic converters via a CMT poolcnv
pattern. The Tile classes that use this are:
@section Custom Pool conversion
The other Tile EDM classes have custom converters, defined in this package.
TileSimEvent/TileHitVector
Both TileHit and TileHitVector (and soon, TileDigits), have implemented
Transient/Persistent separation. More details here:
https://twiki.cern.ch/twiki/bin/view/Atlas/TransientPersistentSeparation
*/
/**
@page used_MyPackage Used Packages
@htmlinclude used_packages.html
*/
/**
@page requirements_MyPackage Requirements
@include requirements
*/
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "TileSimEventTPCnv/TileHitVectorCnv_p1.h"
#include "TileHitVectorCnv.h"
#include "TileSimEventTPCnv/TileHit_p1.h"
TileHitVector_PERS* TileHitVectorCnv::createPersistent(TileHitVector* transCont) {
MsgStream mlog(messageService(), "TileHitVectorConverter" );
TileHitVectorCnv_p1 converter;
TileHitVector_PERS *persObj = converter.createPersistent( transCont, mlog );
return persObj;
}
TileHitVector* TileHitVectorCnv::createTransient() {
MsgStream mlog(messageService(), "TileHitVectorConverter" );
TileHitVectorCnv_p1 converter_p1;
TileHitVector* trans_cont(0);
static const pool::Guid p1_guid("65AD597A-BF97-46EE-B9E3-203B35218EA7");
static const pool::Guid p0_guid("EA2209D1-C339-453D-AEAD-21C026F0735E");
if( this->compareClassGuid(p1_guid)) {
std::auto_ptr< TileHitVector_p1 > col_vect( this->poolReadObject< TileHitVector_p1 >() );
trans_cont = converter_p1.createTransient( col_vect.get(), mlog );
} else if( this->compareClassGuid(p0_guid)) {
// old version from before TP separation
TileOldHitVector* oldVec = this->poolReadObject<TileOldHitVector>();
size_t size = oldVec->size();
trans_cont = new TileHitVector();
trans_cont->reserve(size);
// copy all hits to new vector
TileOldHitVector::const_iterator it = oldVec->begin(), itEnd = oldVec->end();
for (;it != itEnd; ++it) {
trans_cont->push_back(**it);
}
delete oldVec;
} else {
throw std::runtime_error("Unsupported persistent version of Data container");
}
return trans_cont;
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TILEHITVECTORCNV
#define TILEHITVECTORCNV
#include "TileSimEvent/TileHitVector.h"
#include "TileSimEventTPCnv/TileHitVector_p1.h"
#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h"
// Gaudi
#include "GaudiKernel/MsgStream.h"
// typedef to the latest persistent version
typedef TileHitVector_p1 TileHitVector_PERS;
class TileHitVectorCnv : public T_AthenaPoolCustomCnv<TileHitVector, TileHitVector_PERS > {
friend class CnvFactory<TileHitVectorCnv>;
protected:
TileHitVectorCnv(ISvcLocator* svcloc): T_AthenaPoolCustomCnv<TileHitVector, TileHitVector_PERS >( svcloc) {}
TileHitVector_PERS* createPersistent(TileHitVector* transCont);
TileHitVector* createTransient ();
};
#endif
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