ATLAS Offline Software
ElectronContainerCnv.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 // ElectronContainerCnv.cxx
8 // Implementation file for class ElectronContainerCnv
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 "ElectronContainerCnv.h"
27 #include "egammaMsgUtil.h"
28 
32 
36 
38 // Protected methods:
40 
41 
44 {
45  MsgStream msg( msgSvc(), "ElectronContainerCnv" );
46 
48  ElectronContainer_PERS *persObj = cnv.createPersistent( transCont, msg );
49 
50  MSG_DEBUG(msg, "::createPersistent [Success]");
51  return persObj;
52 }
53 
55 {
56  MsgStream msg( msgSvc(), "ElectronContainerCnv" );
57 
58  ElectronContainer *transObj = nullptr;
59 
60  static const pool::Guid tr_guid("417E86E5-CA20-4F50-A7A2-C91BF44C9125");
61  static const pool::Guid p1_guid("48355DA8-3BCE-43E0-B29B-51525BCEEDDD");
62  static const pool::Guid p2_guid("A4377CE2-C0DC-4F80-8CFD-3BBE9A8EFD52");
63  static const pool::Guid p3_guid("51C149D6-2FBA-4ADD-B6AA-8AE39E07D202");
64  static const pool::Guid p4_guid("1A7C1F66-D9D2-49E9-80A8-592A0CEE3FDF");
65  static const pool::Guid p5_guid("A7C69641-E985-4D31-92D4-D33206C197F1");
66 
67  if ( compareClassGuid(p5_guid) ) {
68 
69  // using unique_ptr ensures deletion of the persistent object
70  std::unique_ptr<ElectronContainer_p5> persObj( poolReadObject<ElectronContainer_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<ElectronContainer_p4> persObj( poolReadObject<ElectronContainer_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<ElectronContainer_p3> persObj( poolReadObject<ElectronContainer_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<ElectronContainer_p2> persObj( poolReadObject<ElectronContainer_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<ElectronContainer_p1> persObj( poolReadObject<ElectronContainer_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<ElectronContainer>();
106 
107  } else {
108  throw std::runtime_error("Unsupported persistent version of ElectronContainer");
109  }
110 
111  return transObj;
112 }
ElectronContainerCnv.h
TPPolyCnvBase::createTransient
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.
ElectronContainerCnv_p2.h
ElectronContainerCnv_p4.h
TPAbstractPolyCnvBase::createPersistent
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
ElectronContainerCnv_p1.h
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
ElectronContainerCnv::createTransient
virtual ElectronContainer * createTransient()
Build the transient representation from a persistent one.
Definition: ElectronContainerCnv.cxx:54
ElectronContainerCnv_p3.h
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
ElectronContainerCnv::createPersistent
virtual ElectronContainer_PERS * createPersistent(ElectronContainer *transCont)
Build the persistent representation from the transient one.
Definition: ElectronContainerCnv.cxx:43
ElectronContainerCnv_p5.h
egammaMsgUtil.h
ElectronContainer_p5
Definition: ElectronContainer_p5.h:19
MSG_DEBUG
#define MSG_DEBUG(log, x)
Definition: MsgUtil.h:15
ElectronContainer
Definition: Reconstruction/egamma/egammaEvent/egammaEvent/ElectronContainer.h:32
TPCnvVector
Definition: TPConverter.h:1256
T_AthenaPoolCustCnv< ElectronContainer, ElectronContainer_PERS >::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.