ATLAS Offline Software
TileHitVectorCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "TileHitVectorCnv.h"
8 
9 
11  MsgStream mlog(msgSvc(), "TileHitVectorConverter" );
12  TileHitVectorCnv_p1 converter;
13  TileHitVector_PERS *persObj = converter.createPersistent( transCont, mlog );
14  return persObj;
15 }
16 
17 
19 
20  MsgStream mlog(msgSvc(), "TileHitVectorConverter" );
21  TileHitVectorCnv_p1 converter_p1;
22 
23  TileHitVector* trans_cont(0);
24 
25  static const pool::Guid p1_guid("65AD597A-BF97-46EE-B9E3-203B35218EA7");
26  static const pool::Guid p0_guid("EA2209D1-C339-453D-AEAD-21C026F0735E");
27 
28  if( this->compareClassGuid(p1_guid)) {
29 
30  std::unique_ptr< TileHitVector_p1 > col_vect( this->poolReadObject< TileHitVector_p1 >() );
31  trans_cont = converter_p1.createTransient( col_vect.get(), mlog );
32 
33  } else if( this->compareClassGuid(p0_guid)) {
34 
35  // old version from before TP separation
36  TileOldHitVector* oldVec = this->poolReadObject<TileOldHitVector>();
37  size_t size = oldVec->size();
38  trans_cont = new TileHitVector();
39  trans_cont->reserve(size);
40  // copy all hits to new vector
41 
42  for (TileHit* hit : *oldVec) {
43  trans_cont->push_back(*hit);
44  }
45 
46  delete oldVec;
47 
48  } else {
49  throw std::runtime_error("Unsupported persistent version of Data container");
50  }
51 
52  return trans_cont;
53 }
TileHitVector
AtlasHitsVector< TileHit > TileHitVector
Definition: TileHitVector.h:28
AtlasHitsVector
Definition: AtlasHitsVector.h:33
TileHitVectorCnv_p1
Definition: TileHitVectorCnv_p1.h:13
AtlasHitsVector::reserve
void reserve(size_type n)
Definition: AtlasHitsVector.h:158
TileHitVectorCnv_p1.h
TPAbstractPolyCnvBase::createPersistent
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
TileHitVectorCnv::createPersistent
TileHitVector_PERS * createPersistent(TileHitVector *transCont)
Definition: TileHitVectorCnv.cxx:10
python.InDetPriVxFinderConfig.mlog
mlog
Definition: InDetPriVxFinderConfig.py:134
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
TileHitVectorCnv.h
TileHitVector_p1
Definition: TileHitVector_p1.h:20
TileHitVectorCnv_p1::createTransient
virtual TileHitVector * createTransient(const TileHitVector_p1 *persObj, MsgStream &log)
Create transient representation of a persistent object.
Definition: TileHitVectorCnv_p1.cxx:15
TileHitVectorCnv::createTransient
TileHitVector * createTransient()
Definition: TileHitVectorCnv.cxx:18
TileHit_p1.h
TileHit
Definition: TileSimEvent/TileSimEvent/TileHit.h:30
AthenaHitsVector::size
size_type size() const
Definition: AthenaHitsVector.h:151
T_AthenaPoolCustCnv< TileHitVector, TileHitVector_PERS >::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
AthenaHitsVector
Definition: AthenaHitsVector.h:39
AtlasHitsVector::push_back
void push_back(const T &t)
Definition: AtlasHitsVector.h:145