ATLAS Offline Software
PhotonContainerCnv.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // PhotonContainerCnv.cxx
8 // Implementation file for class PhotonContainerCnv
9 // Author: K.Cranmer<cranmer@cern.ch>
10 // Author: S.Binet<binet@cern.ch>
12 
13 // STL includes
14 
15 // Framework includes
16 #include "GaudiKernel/MsgStream.h"
17 
18 // egammaEventTPCnv includes
24 
25 // RecAthenaPool includes
26 #include "PhotonContainerCnv.h"
27 #include "egammaMsgUtil.h"
28 
32 
36 
38 // Protected methods:
40 
41 
44 {
45  MsgStream msg( msgSvc(), "PhotonContainerCnv" );
46 
48  PhotonContainer_PERS *persObj = cnv.createPersistent( transCont, msg );
49 
50  MSG_DEBUG(msg, "::createPersistent [Success]");
51  return persObj;
52 }
53 
55 {
56  MsgStream msg( msgSvc(), "PhotonContainerCnv" );
57 
58  PhotonContainer *transObj = nullptr;
59 
60  static const pool::Guid tr_guid("B0DC1628-F17C-4951-BC85-55BBECF4D4D1");
61  static const pool::Guid p1_guid("7D40A2D2-C03C-470C-8F0C-937592D34B5B");
62  static const pool::Guid p2_guid("E807B07C-8B27-4FF1-A638-05FBCA034C0B");
63  static const pool::Guid p3_guid("BC1DF3E5-98F5-444D-826A-DFBB85E1C870");
64  static const pool::Guid p4_guid("554B12C0-AB10-451D-963C-F9714FB29695");
65  static const pool::Guid p5_guid("64942DEF-C0FE-4CA7-A735-70187092DC27");
66 
67  if ( compareClassGuid(p5_guid) ) {
68 
69  // using unique_ptr ensures deletion of the persistent object
70  std::unique_ptr<PhotonContainer_p5> persObj( poolReadObject<PhotonContainer_p5>() );
72  transObj = cnv.createTransient( persObj.get(), msg );
73 
74  } else if ( compareClassGuid(p4_guid) ) {
75 
76  // using unique_ptr ensures deletion of the persistent object
77  std::unique_ptr<PhotonContainer_p4> persObj( poolReadObject<PhotonContainer_p4>() );
79  transObj = cnv.createTransient( persObj.get(), msg );
80 
81  } else if ( compareClassGuid(p3_guid) ) {
82 
83  // using unique_ptr ensures deletion of the persistent object
84  std::unique_ptr<PhotonContainer_p3> persObj( poolReadObject<PhotonContainer_p3>() );
86  transObj = cnv.createTransient( persObj.get(), msg );
87 
88  } else if ( compareClassGuid(p2_guid) ) {
89 
90  // using unique_ptr ensures deletion of the persistent object
91  std::unique_ptr<PhotonContainer_p2> persObj( poolReadObject<PhotonContainer_p2>() );
93  transObj = cnv.createTransient( persObj.get(), msg );
94 
95  } else if ( compareClassGuid(p1_guid) ) {
96 
97  // using unique_ptr ensures deletion of the persistent object
98  std::unique_ptr<PhotonContainer_p1> persObj( poolReadObject<PhotonContainer_p1>() );
100  transObj = cnv.createTransient( persObj.get(), msg );
101 
102  } else if ( compareClassGuid(tr_guid) ) {
103 
104  // regular object from before the T/P separation
105  return poolReadObject<PhotonContainer>();
106 
107  } else {
108  throw std::runtime_error("Unsupported persistent version of PhotonContainer");
109  }
110 
111  return transObj;
112 }
TPPolyCnvBase::createTransient
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.
PhotonContainerCnv_p1.h
TPAbstractPolyCnvBase::createPersistent
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
PhotonContainer
Definition: Reconstruction/egamma/egammaEvent/egammaEvent/PhotonContainer.h:30
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
PhotonContainerCnv::createPersistent
virtual PhotonContainer_PERS * createPersistent(PhotonContainer *transCont)
Build the persistent representation from the transient one.
Definition: PhotonContainerCnv.cxx:43
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
PhotonContainerCnv_p2.h
PhotonContainerCnv::createTransient
virtual PhotonContainer * createTransient()
Build the transient representation from a persistent one.
Definition: PhotonContainerCnv.cxx:54
PhotonContainerCnv_p3.h
PhotonContainerCnv.h
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
PhotonContainerCnv_p4.h
egammaMsgUtil.h
PhotonContainerCnv_p5.h
MSG_DEBUG
#define MSG_DEBUG(log, x)
Definition: MsgUtil.h:15
PhotonContainer_p5
Definition: PhotonContainer_p5.h:19
TPCnvVector
Definition: TPConverter.h:1256
T_AthenaPoolCustCnv< PhotonContainer, PhotonContainer_PERS >::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.