ATLAS Offline Software
Loading...
Searching...
No Matches
TileHitContainerCnv.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
7// Gaudi
8#include "GaudiKernel/MsgStream.h"
9
11 MsgStream mlog(msgSvc(), "TileHitContainerConverter" );
12 TileHitContainerCnv_p1 converter;
13 TileHitContainer_PERS *persObj = converter.createPersistent( transCont, mlog );
14 return persObj;
15}
16
18 MsgStream mlog(msgSvc(), "TileHitContainerConverter" );
19 TileHitContainerCnv_p1 converter_p1;
20
21 TileHitContainer *trans_cont(0);
22
23 static const pool::Guid p1_guid("E347580F-BBF0-441E-A799-9AC0256F69DF");
24 static const pool::Guid p0_guid("704A373C-EA65-4721-A9B8-F577B683699E");
25
26 if( this->compareClassGuid(p1_guid)) {
27 std::unique_ptr< TileHitContainer_p1 > cont( this->poolReadObject< TileHitContainer_p1 >() );
28 trans_cont = converter_p1.createTransient( cont.get(), mlog );
29 }
30 else if( this->compareClassGuid(p0_guid)) {
31 // old version from before TP separation
33
34 if (mlog.level()<=MSG::DEBUG)
35 mlog << MSG::DEBUG << "Read IDC, size " << rdoV->size() << endmsg;
36
37 // TileFragHash::TYPE type = rdoV->m_type;
38
39 // create the Tile IdentifiableContainer to contain the rdo collections
40 trans_cont = new TileHitContainer(false,SG::OWN_ELEMENTS);
41
44
45 for (; it != last; ++it) {
46
47 TileHitCollection* rdoColl = *it;
49
50 // register the rdo collection in StoreGate
51 TileHitCollection::ID id_coll = rdoColl->identify();
52 StatusCode sc = trans_cont->addCollection(rdoColl,trans_cont->hashFunc()(id_coll));
53 if(sc.isFailure()) {
54 mlog << MSG::ERROR << "Can't add collection " << id_coll << " to container " << endmsg;
55 }
56 }
57 delete rdoV;
58 } else {
59 throw std::runtime_error("Unsupported persistent version of Data container");
60 }
61 return trans_cont;
62}
#define endmsg
static Double_t sc
TileHitContainer_p1 TileHitContainer_PERS
T_TilePoolContainerCnv< TileHitContainer, TileHitContainer_p1, TileHitCnv_p1 > TileHitContainerCnv_p1
DataModel_detail::iterator< DataVector > iterator
Definition DataVector.h:842
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
virtual StatusCode addCollection(const T *coll, IdentifierHash hashId) override final
insert collection into container with id hash if IDC should not take ownership of collection,...
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
TileHitContainer * createTransient()
TileHitContainer_PERS * createPersistent(TileHitContainer *transCont)
void setOwnership(SG::OwnershipPolicy ownPolicy)
const TileFragHash & hashFunc() const
@ OWN_ELEMENTS
this data object owns its elements