ATLAS Offline Software
Loading...
Searching...
No Matches
MuonContainerCnv.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5*/
6
7// MuonContainerCnv.cxx
8// Implementation file for class MuonContainerCnv
9// Author: Ketevi A. Assamagan <ketevi@bnl.gov>
11
12// STL includes
13
14// Framework includes
15#include "GaudiKernel/MsgStream.h"
16
17// RecAthenaPool includes
18#include "MuonContainerCnv.h"
20
24
28
30// Protected methods:
32
34{
35
36 MsgStream log(msgSvc(), "MuonContainerCnv");
38 if (!sc.isSuccess()) {
39 log << MSG::ERROR << "Can not initialize Converter base class." << endmsg;
40 return(sc);
41 }
42
43 // retrieve the storegate service
44 if ( !m_storeGate.retrieve().isSuccess() ) {
45 log << MSG::ERROR
46 << "Unable to retrieve pointer to StoreGateSvc"
47 << endmsg;
48 return StatusCode::FAILURE;
49 }
50
51 m_cnv_p1.setEventStore( m_storeGate );
53 m_cnv_p2.setEventStore( m_storeGate );
55
56 return StatusCode::SUCCESS;
57}
58
61{
62 MsgStream msg( msgSvc(), "MuonContainerCnv" );
63
65 MuonContainer_PERS *persObj = cnv.createPersistent( transCont, msg );
66
67 msg << MSG::DEBUG << "::createPersistent [Success]" << endmsg;
68 return persObj;
69}
70
72{
73 MsgStream msg( msgSvc(), "MuonContainerConverter" );
74
75 Analysis::MuonContainer *transObj = 0;
76
77 static const pool::Guid tr_guid("E5B86159-2270-4770-A412-078D09F12215");
78 static const pool::Guid p1_guid("2B37C58D-4FBF-46F3-AB5C-B1408DBB99BE");
79 static const pool::Guid p2_guid("AB37C580-4FBF-51F3-F85D-014F8DBBE9BC");
80 static const pool::Guid p3_guid("FB88C580-EFBF-5CDE-EEED-AABF8DBCE9EE");
81 static const pool::Guid p4_guid("01887544-EFBF-E099-1116-0051F2678B09");
82 static const pool::Guid p5_guid("45887564-EABA-EBC9-DE1A-2459F21780CC");
83 static const pool::Guid p6_guid("56E6FC8D-E6B3-4FFB-83A2-A9AEF6E35FF3");
84
85 if ( compareClassGuid(p6_guid) ) {
86
87 std::unique_ptr<MuonContainer_p6> persObj(poolReadObject<MuonContainer_p6>());
88 transObj = m_cnv_p6.createTransient( persObj.get(), msg );
89
90 } else if ( compareClassGuid(p5_guid) ) {
91
92 std::unique_ptr<MuonContainer_p5> persObj(poolReadObject<MuonContainer_p5>());
93 transObj = m_cnv_p5.createTransient( persObj.get(), msg );
94
95 } else if ( compareClassGuid(p4_guid) ) {
96
97 std::unique_ptr<MuonContainer_p4> persObj(poolReadObject<MuonContainer_p4>());
98 transObj = m_cnv_p4.createTransient( persObj.get(), msg );
99
100 } else if ( compareClassGuid(p3_guid) ) {
101
102 std::unique_ptr<MuonContainer_p3> persObj(poolReadObject<MuonContainer_p3>());
103 transObj = m_cnv_p3.createTransient( persObj.get(), msg );
104
105 } else if ( compareClassGuid(p2_guid) ) {
106
109 if ( m_storeGate->record( cont, m_muonCaloEnergyContainerName ).isFailure() ) {
110 msg << MSG::WARNING << "Not able to recod MuonCaloEnergyContainer in StoreGate " << endmsg;
111 }
112 }
113
114 std::unique_ptr<MuonContainer_p2> persObj( poolReadObject<MuonContainer_p2>() );
115 transObj = m_cnv_p2.createTransient( persObj.get(), msg );
116
117 } else if ( compareClassGuid(p1_guid) ) {
118
121 if ( m_storeGate->record( cont, m_muonCaloEnergyContainerName ).isFailure() ) {
122 msg << MSG::WARNING << "Not able to recod MuonCaloEnergyContainer in StoreGate " << endmsg;
123 }
124 }
125
126 // using unique_ptr ensures deletion of the persistent object
127 std::unique_ptr<MuonContainer_p1> persObj( poolReadObject<MuonContainer_p1>() );
128 transObj = m_cnv_p1.createTransient( persObj.get(), msg );
129
130 } else if ( compareClassGuid(tr_guid) ) {
131
132 // regular object from before the T/P separation
134
135 } else {
136 throw std::runtime_error("Unsupported persistent version of MuonContainer");
137 }
138
139 return transObj;
140}
#define endmsg
static Double_t sc
MuonContainer_p6 MuonContainer_PERS
T_AthenaPoolTPCnvVectorConst< Analysis::MuonContainer, MuonContainer_p6, MuonCnv_p6 > MuonContainerCnv_p6
Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Current MuonCaloEnergyContainer
Definition RecTPCnv.cxx:126
definition of StoreGate container holding a vector of Analysis::Muon
virtual StatusCode initialize() override
Gaudi Service Interface method implementations:
Data object for a StoreGate container holding a vector of CaloEnergy, the detailed energy loss descri...
virtual MuonContainer_PERS * createPersistent(Analysis::MuonContainer *transCont)
Build the persistent representation from the transient one.
virtual StatusCode initialize()
initialize() - need to access Storegate
StoreGateSvc_t m_storeGate
MuonContainerCnv_p4 m_cnv_p4
MuonContainerCnv_p2 m_cnv_p2
MuonContainerCnv_p6 m_cnv_p6
MuonContainerCnv_p3 m_cnv_p3
MuonContainerCnv_p1 m_cnv_p1
std::string m_muonCaloEnergyContainerName
MuonContainerCnv_p5 m_cnv_p5
virtual Analysis::MuonContainer * createTransient()
Build the transient representation from a persistent one.
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.