ATLAS Offline Software
MuonSpShowerContainerCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Framework includes
6 #include "GaudiKernel/MsgStream.h"
7 
8 // RecTPCnv includes
10 
11 // RecAthenaPool includes
13 
16 {
17  MsgStream msg( msgSvc(), "MuonSpShowerContainerCnv" );
18  // std::cout<<"Test - MuonSpShowerContainerCnv::createPersistent()"<<std::endl;
19 
21  MuonSpShowerContainer_PERS *persObj = cnv.createPersistent( transCont, msg );
22 
23  msg << MSG::DEBUG << "::createPersistent [Success]" << endmsg;
24  return persObj;
25 }
26 
29 {
30  MsgStream msg( msgSvc(), "MuonSpShowerContainerConverter" );
31  // std::cout<<"Test - MuonSpShowerContainerCnv::createTransient()"<<std::endl;
32  Rec::MuonSpShowerContainer *transObj = 0;
33 
34  static const pool::Guid tr_guid("64AE1E07-67EC-549C-DE00-A953259EBC9E");
35  static const pool::Guid p1_guid("522A7143-856B-41E6-A3FA-AB97693010D8");
36 
37  if ( compareClassGuid(tr_guid) ) {
38 
39  // regular object from before the T/P separation
40  return poolReadObject<Rec::MuonSpShowerContainer>();
41 
42  } else if ( compareClassGuid(p1_guid) ) {
43 
44  // using unique_ptr ensures deletion of the persistent object
45  std::unique_ptr<MuonSpShowerContainer_p1> persObj( poolReadObject<MuonSpShowerContainer_p1>() );
47  transObj = cnv.createTransient( persObj.get(), msg );
48  } else {
49  throw std::runtime_error("Unsupported persistent version of MuonSpShowerContainer");
50  }
51 
52  return transObj;
53 }
MuonSpShowerContainer_p1
Persisent representation of the transient Rec::MuonSpShowerContainer class.
Definition: MuonSpShowerContainer_p1.h:14
Rec::MuonSpShowerContainer
Definition: MuonSpShowerContainer.h:23
TPPolyCnvBase::createTransient
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.
MuonSpShowerContainerCnv.h
MuonSpShowerContainerCnv_p1.h
TPAbstractPolyCnvBase::createPersistent
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
MuonSpShowerContainerCnv::createPersistent
virtual MuonSpShowerContainer_PERS * createPersistent(Rec::MuonSpShowerContainer *transCont)
Build the persistent representation from the transient one.
Definition: MuonSpShowerContainerCnv.cxx:15
DEBUG
#define DEBUG
Definition: page_access.h:11
MuonSpShowerContainerCnv::createTransient
virtual Rec::MuonSpShowerContainer * createTransient()
Build the transient representation from a persistent one.
Definition: MuonSpShowerContainerCnv.cxx:28
T_AthenaPoolCustCnv< Rec::MuonSpShowerContainer, MuonSpShowerContainer_PERS >::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
MuonSpShowerContainerCnv_p1
Definition: MuonSpShowerContainerCnv_p1.h:32