ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
RecAthenaPool
src
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
"
19
#include "
muonEvent/MuonCaloEnergyContainer.h
"
20
24
28
30
// Protected methods:
32
33
StatusCode
MuonContainerCnv::initialize
()
34
{
35
36
MsgStream log(msgSvc(),
"MuonContainerCnv"
);
37
StatusCode
sc
=
T_AthenaPoolCustomCnv<Analysis::MuonContainer,MuonContainer_PERS>::initialize
();
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
);
52
m_cnv_p1
.setKey(
m_muonCaloEnergyContainerName
);
53
m_cnv_p2
.setEventStore(
m_storeGate
);
54
m_cnv_p2
.setKey(
m_muonCaloEnergyContainerName
);
55
56
return
StatusCode::SUCCESS;
57
}
58
59
MuonContainer_PERS
*
60
MuonContainerCnv::createPersistent
(
Analysis::MuonContainer
* transCont )
61
{
62
MsgStream
msg
( msgSvc(),
"MuonContainerCnv"
);
63
64
MuonContainerCnv_p6
cnv;
65
MuonContainer_PERS
*persObj = cnv.
createPersistent
( transCont,
msg
);
66
67
msg
<< MSG::DEBUG <<
"::createPersistent [Success]"
<<
endmsg
;
68
return
persObj;
69
}
70
71
Analysis::MuonContainer
*
MuonContainerCnv::createTransient
(
const
Token
* token)
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
(token, p6_guid) ) {
86
87
std::unique_ptr<MuonContainer_p6> persObj(
poolReadObject<MuonContainer_p6>
(token));
88
transObj =
m_cnv_p6
.createTransient( persObj.get(),
msg
);
89
90
}
else
if
(
compareClassGuid
(token, p5_guid) ) {
91
92
std::unique_ptr<MuonContainer_p5> persObj(
poolReadObject<MuonContainer_p5>
(token));
93
transObj =
m_cnv_p5
.createTransient( persObj.get(),
msg
);
94
95
}
else
if
(
compareClassGuid
(token, p4_guid) ) {
96
97
std::unique_ptr<MuonContainer_p4> persObj(
poolReadObject<MuonContainer_p4>
(token));
98
transObj =
m_cnv_p4
.createTransient( persObj.get(),
msg
);
99
100
}
else
if
(
compareClassGuid
(token, p3_guid) ) {
101
102
std::unique_ptr<MuonContainer_p3> persObj(
poolReadObject<MuonContainer_p3>
(token));
103
transObj =
m_cnv_p3
.createTransient( persObj.get(),
msg
);
104
105
}
else
if
(
compareClassGuid
(token, p2_guid) ) {
106
107
if
( !
m_storeGate
->contains<
MuonCaloEnergyContainer
>(
m_muonCaloEnergyContainerName
) ) {
108
MuonCaloEnergyContainer
* cont =
new
MuonCaloEnergyContainer
();
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>
(token) );
115
transObj =
m_cnv_p2
.createTransient( persObj.get(),
msg
);
116
117
}
else
if
(
compareClassGuid
(token, p1_guid) ) {
118
119
if
( !
m_storeGate
->contains<
MuonCaloEnergyContainer
>(
m_muonCaloEnergyContainerName
) ) {
120
MuonCaloEnergyContainer
* cont =
new
MuonCaloEnergyContainer
();
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>
(token) );
128
transObj =
m_cnv_p1
.createTransient( persObj.get(),
msg
);
129
130
}
else
if
(
compareClassGuid
(token, tr_guid) ) {
131
132
// regular object from before the T/P separation
133
return
poolReadObject<Analysis::MuonContainer>
(token);
134
135
}
else
{
136
throw
std::runtime_error(
"Unsupported persistent version of MuonContainer"
);
137
}
138
139
return
transObj;
140
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
MuonCaloEnergyContainer.h
MuonContainerCnv.h
MuonContainer_PERS
MuonContainer_p6 MuonContainer_PERS
Definition
MuonContainerCnv.h:39
MuonContainerCnv_p6
T_AthenaPoolTPCnvVectorConst< Analysis::MuonContainer, MuonContainer_p6, MuonCnv_p6 > MuonContainerCnv_p6
Definition
MuonContainerCnv_p6.h:32
MuonCaloEnergyContainer
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
Analysis::MuonContainer
definition of StoreGate container holding a vector of Analysis::Muon
Definition
Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonContainer.h:38
T_AthenaPoolCustomCnv< Analysis::MuonContainer, MuonContainer_PERS >::msg
MsgStream & msg() const
Definition
AthMessaging.h:167
AthenaPoolConverter::initialize
virtual StatusCode initialize() override
Gaudi Service Interface method implementations:
Definition
AthenaPoolConverter.cxx:29
MuonCaloEnergyContainer
Data object for a StoreGate container holding a vector of CaloEnergy, the detailed energy loss descri...
Definition
MuonCaloEnergyContainer.h:19
MuonContainerCnv::createPersistent
virtual MuonContainer_PERS * createPersistent(Analysis::MuonContainer *transCont)
Build the persistent representation from the transient one.
Definition
MuonContainerCnv.cxx:60
MuonContainerCnv::initialize
virtual StatusCode initialize()
initialize() - need to access Storegate
Definition
MuonContainerCnv.cxx:33
MuonContainerCnv::createTransient
virtual Analysis::MuonContainer * createTransient(const Token *token)
Build the transient representation from a persistent one.
Definition
MuonContainerCnv.cxx:71
MuonContainerCnv::m_storeGate
StoreGateSvc_t m_storeGate
Definition
MuonContainerCnv.h:77
MuonContainerCnv::m_cnv_p4
MuonContainerCnv_p4 m_cnv_p4
Definition
MuonContainerCnv.h:83
MuonContainerCnv::m_cnv_p2
MuonContainerCnv_p2 m_cnv_p2
Definition
MuonContainerCnv.h:81
MuonContainerCnv::m_cnv_p6
MuonContainerCnv_p6 m_cnv_p6
Definition
MuonContainerCnv.h:85
MuonContainerCnv::m_cnv_p3
MuonContainerCnv_p3 m_cnv_p3
Definition
MuonContainerCnv.h:82
MuonContainerCnv::m_cnv_p1
MuonContainerCnv_p1 m_cnv_p1
Definition
MuonContainerCnv.h:80
MuonContainerCnv::m_muonCaloEnergyContainerName
std::string m_muonCaloEnergyContainerName
Definition
MuonContainerCnv.h:78
MuonContainerCnv::m_cnv_p5
MuonContainerCnv_p5 m_cnv_p5
Definition
MuonContainerCnv.h:84
TPAbstractPolyCnvBase::createPersistent
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
T_AthenaPoolCustomCnv< Analysis::MuonContainer, MuonContainer_PERS >::compareClassGuid
virtual bool compareClassGuid(const Token *token, const Guid &clid) const
T_AthenaPoolCustomCnv< Analysis::MuonContainer, MuonContainer_PERS >::poolReadObject
P * poolReadObject(const Token *token)
Token
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition
Token.h:22
pool::Guid
::Guid Guid
Definition
T_AthenaPoolCustCnv.h:19
Generated on
for ATLAS Offline Software by
1.17.0