ATLAS Offline Software
TrackTruthCollectionCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
15 
16 #include "GaudiKernel/StatusCode.h"
17 #include "GaudiKernel/MsgStream.h"
18 #include "GaudiKernel/ISvcLocator.h"
19 
20 // Athena
21 #include "StoreGate/StoreGateSvc.h"
22 
23 // This is release 12 guid for TrackTruthVector.
24 const pool::Guid TrackTruthCollectionCnv::s_p0_guid("8BC86D69-DBC4-4B34-8273-513D9BE771D5");
25 const pool::Guid TrackTruthCollectionCnv::s_p1_guid("ED2B4B64-7CF6-48B3-8C40-29F8501A6090");
26 const pool::Guid TrackTruthCollectionCnv::s_p2_guid("44F35B21-838A-4C4E-B09B-971CEA0EB70A");
27 const pool::Guid TrackTruthCollectionCnv::s_p3_guid("018E41F8-0857-7D8C-A062-A3947683EB99");
28 
29 
30 //================================================================
33 {}
34 
35 //================================================================
37  MsgStream log(msgSvc(), "TrackTruthCollectionCnv");
38  log<<MSG::DEBUG<<"Writing TrackTruthCollection_p2"<<endmsg;
40  m_converter_p2.transToPers(trans,pers,log);
41  return pers;
42 }
43 
44 //================================================================
46  MsgStream log(msgSvc(), "TrackTruthCollectionCnv" );
47  std::unique_ptr<TrackTruthCollection> trans(new TrackTruthCollection());
48 
50  log<<MSG::DEBUG<<"Read TrackTruthCollection_p3. GUID="<<m_classID.toString()<<endmsg;
51  Trk::TrackTruthCollection_p3* pers=poolReadObject<Trk::TrackTruthCollection_p3>();
52  m_converter_p3.persToTrans(pers, trans.get(), log);
53  delete pers;
54  }
55  else if (compareClassGuid(s_p2_guid)) {
56  log<<MSG::DEBUG<<"Read TrackTruthCollection_p2. GUID="<<m_classID.toString()<<endmsg;
57  Trk::TrackTruthCollection_p2* pers=poolReadObject<Trk::TrackTruthCollection_p2>();
58  m_converter_p2.persToTrans(pers, trans.get(), log);
59  delete pers;
60  }
61  else if (compareClassGuid(s_p1_guid)) {
62  log<<MSG::DEBUG<<"Read TrackTruthCollection_p1. GUID="<<m_classID.toString()<<endmsg;
63  Trk::TrackTruthCollection_p1* pers=poolReadObject<Trk::TrackTruthCollection_p1>();
64  m_converter_p1.persToTrans(pers, trans.get(), log);
65  delete pers;
66  }
67  else if (compareClassGuid(s_p0_guid)) {
68  log<<MSG::DEBUG<<"Read version p0 of TrackTruthCollection. GUID="<<m_classID.toString()<<endmsg;
69  TrackTruthVector *pers = poolReadObject<TrackTruthVector>();
70  m_converter_p0.persToTrans(pers, trans.get(), log);
71  delete pers;
72  }
73  else {
74  log<<MSG::ERROR<<"Unsupported persistent version of TrackTruthCollection. GUID="
76  throw std::runtime_error("Unsupported persistent version of Data Collection");
77  }
78 
79  return trans.release();
80 }
81 
82 //================================================================
TrackTruthCollectionCnv_p2::persToTrans
virtual void persToTrans(const Trk::TrackTruthCollection_p2 *persObj, TrackTruthCollection *transObj, MsgStream &msg)
Method creating the transient representation of Analysis::TrackTruthCollection from its persistent re...
Definition: TrackTruthCollectionCnv_p2.cxx:26
TrackTruthCollectionCnv::m_converter_p1
TrackTruthCollectionCnv_p1 m_converter_p1
Definition: TrackTruthCollectionCnv.h:37
T_AthenaPoolCustCnv::m_classID
Guid m_classID
Definition: T_AthenaPoolCustCnv.h:96
TrackTruthCollectionCnv::m_converter_p2
TrackTruthCollectionCnv_p2 m_converter_p2
Definition: TrackTruthCollectionCnv.h:38
TrackTruthCollectionCnv::m_converter_p0
TrackTruthCollectionCnv_p0 m_converter_p0
Definition: TrackTruthCollectionCnv.h:36
TrackTruthCollectionCnv::s_p1_guid
static const pool::Guid s_p1_guid
Definition: TrackTruthCollectionCnv.h:42
TrackTruthCollection_p3.h
TrackTruthVector
Definition: TrackTruthCollection_p0.h:24
TrackTruthCollectionPERS
Trk::TrackTruthCollection_p2 TrackTruthCollectionPERS
Definition: TrackTruthCollectionCnv.h:22
Guid::toString
const std::string toString() const
Automatic conversion to string representation.
Definition: Guid.cxx:58
TrackTruthCollectionCnv_p1::persToTrans
virtual void persToTrans(const Trk::TrackTruthCollection_p1 *persObj, TrackTruthCollection *transObj, MsgStream &msg)
Method creating the transient representation of Analysis::TrackTruthCollection from its persistent re...
Definition: TrackTruthCollectionCnv_p1.cxx:25
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
TrackTruthCollectionCnv::s_p0_guid
static const pool::Guid s_p0_guid
Definition: TrackTruthCollectionCnv.h:41
TrackTruthCollection
Definition: TrackTruthCollection.h:21
Trk::TrackTruthCollection_p1
Definition: TrackTruthCollection_p1.h:21
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
TrackTruthCollection.h
T_AthenaPoolCustomCnv
Compatibility for old converter classes that don't get passed the key.
Definition: T_AthenaPoolCustomCnv.h:132
TrackTruthCollectionCnv::m_converter_p3
TrackTruthCollectionCnv_p3 m_converter_p3
Definition: TrackTruthCollectionCnv.h:39
TrackTruthCollectionCnv::s_p2_guid
static const pool::Guid s_p2_guid
Definition: TrackTruthCollectionCnv.h:43
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
TrackTruthCollectionCnv_p2.h
TrackTruthCollectionCnv_p3.h
TrackTruthCollection_p1.h
TrackTruthCollection_p0.h
Trk::TrackTruthCollection_p3
Definition: TrackTruthCollection_p3.h:21
TrackTruthCollection_p2.h
Trk::TrackTruthCollection_p2
Definition: TrackTruthCollection_p2.h:21
TrackTruthCollectionCnv::createPersistent
virtual TrackTruthCollectionPERS * createPersistent(TrackTruthCollection *)
Definition: TrackTruthCollectionCnv.cxx:36
TrackTruthCollectionCnv_p0::persToTrans
virtual void persToTrans(const Trk::TrackTruthCollection_p0 *persObj, TrackTruthCollection *transObj, MsgStream &msg)
Method creating the transient representation of Analysis::TrackTruthCollection from its persistent re...
Definition: TrackTruthCollectionCnv_p0.cxx:25
TrackTruthCollectionCnv_p2::transToPers
virtual void transToPers(const TrackTruthCollection *transObj, Trk::TrackTruthCollection_p2 *persObj, MsgStream &msg)
Method creating the persistent representation TrackTruthCollection_p2 from its transient representati...
Definition: TrackTruthCollectionCnv_p2.cxx:43
TrackTruthCollectionCnv_p1.h
TrackTruthCollectionCnv::TrackTruthCollectionCnv
TrackTruthCollectionCnv(ISvcLocator *svcloc)
Definition: TrackTruthCollectionCnv.cxx:31
DEBUG
#define DEBUG
Definition: page_access.h:11
TrackTruthCollectionCnv_p3::persToTrans
virtual void persToTrans(const Trk::TrackTruthCollection_p3 *persObj, TrackTruthCollection *transObj, MsgStream &msg)
Method creating the transient representation of Analysis::TrackTruthCollection from its persistent re...
Definition: TrackTruthCollectionCnv_p3.cxx:26
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
TrackTruthCollectionCnv::s_p3_guid
static const pool::Guid s_p3_guid
Definition: TrackTruthCollectionCnv.h:44
T_AthenaPoolCustCnv::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
StoreGateSvc.h
TrackTruthCollectionCnv::createTransient
virtual TrackTruthCollection * createTransient()
Definition: TrackTruthCollectionCnv.cxx:45
TrackTruthCollectionCnv.h