ATLAS Offline Software
MuonFeatureCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "MuonFeatureCnv.h"
8 
9 MuonFeatureCnv::MuonFeatureCnv(ISvcLocator *svcloc): MuonFeatureCnvBase(svcloc) {}
11 
12 //createPersistent
14  MsgStream mlog(msgSvc(), "MuonFeatureConverter" );
15 
16  mlog << MSG::DEBUG << "MuonFeatureCnv::createPersistent" << endmsg;
17 
18  MuonFeatureCnv_p2 converter;
19  MuonFeature_PERS *persObj = converter.createPersistent( transObj, mlog );
20 
21  return persObj;
22 }
23 
24 //createTransient
26  MsgStream mlog(msgSvc(), "MuonFeatureConverter" );
27 
28  mlog << MSG::DEBUG << "MuonFeatureCnv::createTransient " << endmsg;
29 
30  static const pool::Guid p2_guid("3785A9E4-7845-4B54-B49F-DCC2A24409C0");
31  static const pool::Guid p1_guid("3DFFECBF-3251-4BE7-9D12-B3A9FCAC486E");
32  static const pool::Guid p0_guid("295FBAFB-ED82-43EA-8B63-6E3D3F4D2A9F");
33 
34  if( compareClassGuid(p1_guid) ) {
35 
36  std::unique_ptr< MuonFeature_p1 > col_vect( poolReadObject< MuonFeature_p1 >() );
37  MuonFeatureCnv_p1 converter;
38  return converter.createTransient( col_vect.get(), mlog );
39 
40  }
41  else if( compareClassGuid(p2_guid) ) {
42 
43  std::unique_ptr< MuonFeature_p2 > col_vect( poolReadObject< MuonFeature_p2 >() );
44  MuonFeatureCnv_p2 converter;
45  return converter.createTransient( col_vect.get(), mlog );
46 
47  }
48  else if( compareClassGuid(p0_guid) ) {
49  // old version from before TP separation, just return it
50  return this->poolReadObject<MuonFeature>();
51  }
52  else {
53  throw std::runtime_error("Unsupported persistent version");
54  }
55 
56 }
MuonFeatureCnv_p1
Definition: MuonFeatureCnv_p1.h:32
TPPolyCnvBase::createTransient
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.
TPAbstractPolyCnvBase::createPersistent
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
MuonFeatureCnv::createTransient
virtual MuonFeature * createTransient()
Definition: MuonFeatureCnv.cxx:25
MuonFeatureCnv_p2
Definition: MuonFeatureCnv_p2.h:32
MuonFeatureCnv_p2.h
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
MuonFeature_p2
Definition: MuonFeature_p2.h:26
python.InDetPriVxFinderConfig.mlog
mlog
Definition: InDetPriVxFinderConfig.py:134
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
T_AthenaPoolCustomCnv
Compatibility for old converter classes that don't get passed the key.
Definition: T_AthenaPoolCustomCnv.h:132
MuonFeatureCnv_p1.h
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
MuonFeatureCnv::createPersistent
virtual MuonFeature_PERS * createPersistent(MuonFeature *transObj)
Definition: MuonFeatureCnv.cxx:13
MuonFeature
Definition: MuonFeature.h:21
MuonFeatureCnv.h
MuonFeatureCnv::~MuonFeatureCnv
~MuonFeatureCnv()
Definition: MuonFeatureCnv.cxx:10
MuonFeatureCnv::MuonFeatureCnv
MuonFeatureCnv(ISvcLocator *svcloc)
Definition: MuonFeatureCnv.cxx:9
DEBUG
#define DEBUG
Definition: page_access.h:11
T_AthenaPoolCustCnv::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.