ATLAS Offline Software
TileBeamElemContainerCnv.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(), "TileBeamElemContainerConverter" );
13  TileBeamElemContainer_PERS *persObj = converter.createPersistent( transCont, mlog );
14  return persObj;
15 }
16 
18  MsgStream mlog(msgSvc(), "TileBeamElemContainerConverter" );
19  TileBeamElemContainerCnv_p1 converter_p1;
20 
21  TileBeamElemContainer *trans_cont(0);
22 
23  static const pool::Guid p1_guid("CF8DE6AB-8E15-4B5F-881B-39B736EAB4E0");
24  static const pool::Guid p0_guid("7FCE8F30-B59E-41E6-9A66-0DCD6134552E");
25 
26  if( this->compareClassGuid(p1_guid)) {
27  std::unique_ptr< TileBeamElemContainer_p1 > cont( this->poolReadObject< TileBeamElemContainer_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  TileBeamElemCollectionVec* rdoV = this->poolReadObject<TileBeamElemCollectionVec>();
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 TileBeamElemContainer(false,SG::OWN_ELEMENTS);
41 
44 
45  for (; it != last; ++it) {
46 
47  TileBeamElemCollection* rdoColl = *it;
49 
50  // register the rdo collection in StoreGate
51  TileBeamElemCollection::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 }
63 
TileBeamElemCollection
Definition: TileBeamElemCollection.h:12
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
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
TPAbstractPolyCnvBase::createPersistent
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
TileBeamElemCollection::ID
MyBase::ID ID
Definition: TileBeamElemCollection.h:17
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
TileBeamElemContainer_p1
Definition: TileBeamElemContainer_p1.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
TileBeamElemContainerCnv_p1.h
TileBeamElemContainer
Definition: TileBeamElemContainer.h:13
TileRawDataCollection::setOwnership
void setOwnership(SG::OwnershipPolicy ownPolicy)
Definition: TileRawDataCollection.h:110
TileBeamElemCollectionVec
Definition: TileBeamElemContainer.h:34
TileRawDataCollection::identify
ID identify() const
Definition: TileRawDataCollection.h:71
TileBeamElemContainerCnv::createPersistent
TileBeamElemContainer_PERS * createPersistent(TileBeamElemContainer *transCont)
Definition: TileBeamElemContainerCnv.cxx:10
TileRawDataContainer::hashFunc
const TileFragHash & hashFunc() const
Definition: TileRawDataContainer.h:66
TileBeamElemContainerCnv::createTransient
TileBeamElemContainer * createTransient()
Definition: TileBeamElemContainerCnv.cxx:17
TileBeamElemContainerCnv.h
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DEBUG
#define DEBUG
Definition: page_access.h:11
T_TilePoolContainerCnv
Definition: T_TilePoolContainerCnv.h:24
T_AthenaPoolCustCnv< TileBeamElemContainer, TileBeamElemContainer_PERS >::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
RunTileMonitoring.TileBeamElemContainer
TileBeamElemContainer
Definition: RunTileMonitoring.py:441
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.