ATLAS Offline Software
TileDigitsContainerCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 // Gaudi
10 #include "GaudiKernel/MsgStream.h"
11 
14 {
15  ServiceHandle<IService> cablingSvc ("TileCablingSvc", "TileDigitsContainerCnv");
16  if (cablingSvc.retrieve().isFailure()) {
17  std::abort();
18  }
19 }
20 
22  MsgStream mlog(msgSvc(), "TileDigitsContainerConverter" );
23  TileDigitsContainerCnv_p3 converter;
24  TileDigitsContainer_PERS *persObj = converter.createPersistent( transCont, mlog );
25  return persObj;
26 }
27 
29  MsgStream mlog(msgSvc(), "TileDigitsContainerConverter" );
30  TileDigitsContainerCnv_p1 converter_p1;
31  TileDigitsContainerCnv_p2 converter_p2;
32  TileDigitsContainerCnv_p3 converter_p3;
33 
34  TileDigitsContainer *trans_cont(0);
35 
36  static const pool::Guid p3_guid("8CC01C7A-B330-413E-BEF9-DFA18F15B1FA");
37  static const pool::Guid p2_guid("2F82DE4C-65FA-4F01-BCB5-15330224E357");
38  static const pool::Guid p1_guid("F9386A42-43A7-4482-8A5B-F33EDE586FB2");
39  static const pool::Guid p0_guid("EB51ED70-5EC0-4F31-97D3-14453F77C88B");
40 
41  if( this->compareClassGuid(p3_guid)) {
42  std::unique_ptr< TileDigitsContainer_p3 > cont( this->poolReadObject< TileDigitsContainer_p3 >() );
43  trans_cont = converter_p3.createTransient( cont.get(), mlog );
44  }
45  else if( this->compareClassGuid(p2_guid)) {
46  std::unique_ptr< TileDigitsContainer_p2 > cont( this->poolReadObject< TileDigitsContainer_p2 >() );
47  trans_cont = converter_p2.createTransient( cont.get(), mlog );
48  }
49  else if( this->compareClassGuid(p1_guid)) {
50  std::unique_ptr< TileDigitsContainer_p1 > cont( this->poolReadObject< TileDigitsContainer_p1 >() );
51  trans_cont = converter_p1.createTransient( cont.get(), mlog );
52  }
53  else if( this->compareClassGuid(p0_guid)) {
54  // old version from before TP separation
55  TileDigitsCollectionVec* rdoV = this->poolReadObject<TileDigitsCollectionVec>();
56 
57  if (mlog.level()<=MSG::DEBUG)
58  mlog << MSG::DEBUG << "Read IDC, size " << rdoV->size() << endmsg;
59 
60  // TileFragHash::TYPE type = rdoV->m_type;
61 
62  // create the Tile IdentifiableContainer to contain the rdo collections
63  trans_cont = new TileDigitsContainer(false,SG::OWN_ELEMENTS);
64 
67 
68  for (; it != last; ++it) {
69 
70  TileDigitsCollection* rdoColl = *it;
72 
73  // register the rdo collection in StoreGate
74  TileDigitsCollection::ID id_coll = rdoColl->identify();
75  StatusCode sc = trans_cont->addCollection(rdoColl,trans_cont->hashFunc()(id_coll));
76  if(sc.isFailure()) {
77  mlog << MSG::ERROR << "Can't add collection " << id_coll << " to container " << endmsg;
78  }
79  }
80  delete rdoV;
81  } else {
82  throw std::runtime_error("Unsupported persistent version of Data container");
83  }
84  return trans_cont;
85 }
TileDigitsCollection::ID
MyBase::ID ID
Definition: TileDigitsCollection.h:23
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:297
TPPolyCnvBase::createTransient
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.
skel.it
it
Definition: skel.GENtoEVGEN.py:396
TileDigitsContainerCnv.h
TileDigitsCollectionVec
Definition: TileDigitsContainer.h:34
TileDigitsContainer
Definition: TileDigitsContainer.h:13
TPAbstractPolyCnvBase::createPersistent
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
TileDigitsContainerCnv::TileDigitsContainerCnv
TileDigitsContainerCnv(ISvcLocator *svcloc)
Definition: TileDigitsContainerCnv.cxx:12
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
TileDigitsContainerCnv_p3.h
python.InDetPriVxFinderConfig.mlog
mlog
Definition: InDetPriVxFinderConfig.py:139
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
T_AthenaPoolCustomCnv
Compatibility for old converter classes that don't get passed the key.
Definition: T_AthenaPoolCustomCnv.h:132
SG::OWN_ELEMENTS
@ OWN_ELEMENTS
this data object owns its elements
Definition: OwnershipPolicy.h:17
TileDigitsContainerCnv_p1.h
TileDigitsContainer
Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Current TileDigitsContainer
Definition: TileTPCnv.cxx:103
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
TileDigitsContainerCnv::createPersistent
TileDigitsContainer_PERS * createPersistent(TileDigitsContainer *transCont)
Definition: TileDigitsContainerCnv.cxx:21
TileDigitsContainerCnv::createTransient
TileDigitsContainer * createTransient()
Definition: TileDigitsContainerCnv.cxx:28
TileRawDataCollection::setOwnership
void setOwnership(SG::OwnershipPolicy ownPolicy)
Definition: TileRawDataCollection.h:110
TileDigitsContainerCnv_p2.h
TileRawDataCollection::identify
ID identify() const
Definition: TileRawDataCollection.h:71
TileDigitsContainer_p3
Definition: TileDigitsContainer_p3.h:19
TileDigitsCollection
Definition: TileDigitsCollection.h:18
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.
DEBUG
#define DEBUG
Definition: page_access.h:11
T_TilePoolContainerCnv
Definition: T_TilePoolContainerCnv.h:24
T_AthenaPoolCustCnv< TileDigitsContainer, TileDigitsContainer_PERS >::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
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.
ServiceHandle
Definition: ClusterMakerTool.h:37