ATLAS Offline Software
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 
6 #include "TileHitContainerCnv.h"
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
32  TileHitCollectionVec* rdoV = this->poolReadObject<TileHitCollectionVec>();
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 
43  TileHitCollectionVec::iterator last = rdoV->end();
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 }
IdentifiableContainerMT::addCollection
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,...
Definition: IdentifiableContainerMT.h:300
TileHitCollectionVec
Definition: TileHitContainer.h:33
TPPolyCnvBase::createTransient
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.
skel.it
it
Definition: skel.GENtoEVGEN.py:423
TileHitContainer_p1
Definition: TileHitContainer_p1.h:18
TileHitCollection
Definition: TileHitCollection.h:12
TPAbstractPolyCnvBase::createPersistent
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
TileHitContainerCnv.h
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
python.InDetPriVxFinderConfig.mlog
mlog
Definition: InDetPriVxFinderConfig.py:134
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
SG::OWN_ELEMENTS
@ OWN_ELEMENTS
this data object owns its elements
Definition: OwnershipPolicy.h:17
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TileRawDataCollection::setOwnership
void setOwnership(SG::OwnershipPolicy ownPolicy)
Definition: TileRawDataCollection.h:110
TileHitContainer
Definition: TileHitContainer.h:13
TileRawDataCollection::identify
ID identify() const
Definition: TileRawDataCollection.h:71
TileRawDataContainer::hashFunc
const TileFragHash & hashFunc() const
Definition: TileRawDataContainer.h:66
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
TileHitCollection::ID
MyBase::ID ID
Definition: TileHitCollection.h:17
TileHitContainerCnv::createTransient
TileHitContainer * createTransient()
Definition: TileHitContainerCnv.cxx:17
DEBUG
#define DEBUG
Definition: page_access.h:11
T_TilePoolContainerCnv
Definition: T_TilePoolContainerCnv.h:24
TileHitContainerCnv_p1.h
T_AthenaPoolCustCnv< TileHitContainer, TileHitContainer_PERS >::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
TileHitContainerCnv::createPersistent
TileHitContainer_PERS * createPersistent(TileHitContainer *transCont)
Definition: TileHitContainerCnv.cxx:10
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.