ATLAS Offline Software
egammaContainerCnv.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 // egammaContainerCnv.cxx
8 // Implementation file for class egammaContainerCnv
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 "egammaContainerCnv.h"
27 #include "egammaMsgUtil.h"
28 
29 
33 
37 
39 // Protected methods:
41 
42 
45 {
46  MsgStream msg( msgSvc(), "egammaContainerCnv" );
47 
49  egammaContainer_PERS *persObj = cnv.createPersistent( transCont, msg );
50 
51  MSG_DEBUG(msg, "::createPersistent [Success]");
52  return persObj;
53 }
54 
56 {
57  MsgStream msg( msgSvc(), "egammaContainerCnv" );
58 
59  egammaContainer *transObj = nullptr;
60 
61  static const pool::Guid tr_guid("7CAB4F67-1765-4CDC-9614-60EB93E5551B");
62  static const pool::Guid p1_guid("DBA382E5-52F7-4B40-8623-E807E134412E");
63  static const pool::Guid p2_guid("5576188C-ECA9-4BD1-B1F1-563C728FE51F");
64  static const pool::Guid p3_guid("95BD7D50-F070-4245-91DE-ECAB4A8D722D");
65  static const pool::Guid p4_guid("451AACD2-5B23-4557-8A3F-6CD1AB36BF9F");
66  static const pool::Guid p5_guid("1AA8DE2E-D1CC-4076-B74A-82BBCC551798");
67 
68  if ( compareClassGuid(p5_guid) ) {
69 
70  // using unique_ptr ensures deletion of the persistent object
71  std::unique_ptr<egammaContainer_p5> persObj( poolReadObject<egammaContainer_p5>() );
73  transObj = cnv.createTransient( persObj.get(), msg );
74 
75  } else if ( compareClassGuid(p4_guid) ) {
76 
77  // using unique_ptr ensures deletion of the persistent object
78  std::unique_ptr<egammaContainer_p4> persObj( poolReadObject<egammaContainer_p4>() );
80  transObj = cnv.createTransient( persObj.get(), msg );
81 
82  } else if ( compareClassGuid(p3_guid) ) {
83 
84  // using unique_ptr ensures deletion of the persistent object
85  std::unique_ptr<egammaContainer_p3> persObj( poolReadObject<egammaContainer_p3>() );
87  transObj = cnv.createTransient( persObj.get(), msg );
88 
89  } else if ( compareClassGuid(p2_guid) ) {
90 
91  // using unique_ptr ensures deletion of the persistent object
92  std::unique_ptr<egammaContainer_p2> persObj( poolReadObject<egammaContainer_p2>() );
94  transObj = cnv.createTransient( persObj.get(), msg );
95 
96  } else if ( compareClassGuid(p1_guid) ) {
97 
98  // using unique_ptr ensures deletion of the persistent object
99  std::unique_ptr<egammaContainer_p1> persObj( poolReadObject<egammaContainer_p1>() );
101  transObj = cnv.createTransient( persObj.get(), msg );
102 
103  } else if ( compareClassGuid(tr_guid) ) {
104 
105  // regular object from before the T/P separation
106  return poolReadObject<egammaContainer>();
107 
108  } else {
109  throw std::runtime_error("Unsupported persistent version of egammaContainer");
110  }
111 
112  return transObj;
113 }
TPPolyCnvBase::createTransient
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.
egammaContainerCnv_p2.h
egammaContainerCnv.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
egammaContainerCnv::createTransient
virtual egammaContainer * createTransient()
Build the transient representation from a persistent one.
Definition: egammaContainerCnv.cxx:55
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
egammaContainerCnv::createPersistent
virtual egammaContainer_PERS * createPersistent(egammaContainer *transCont)
Build the persistent representation from the transient one.
Definition: egammaContainerCnv.cxx:44
egammaContainer
Definition: egammaContainer.h:41
egammaContainerCnv_p1.h
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
egammaContainerCnv_p4.h
egammaContainerCnv_p5.h
egammaContainer_p5
Definition: egammaContainer_p5.h:21
egammaMsgUtil.h
egammaContainerCnv_p3.h
MSG_DEBUG
#define MSG_DEBUG(log, x)
Definition: MsgUtil.h:15
TPCnvVector
Definition: TPConverter.h:1256
T_AthenaPoolCustCnv< egammaContainer, egammaContainer_PERS >::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.