ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloCnv
CaloAthenaPool
src
CaloTopoTowerContainerCnv.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
CaloTopoTowerContainerCnv.h
"
6
7
// LArDetDescr includes
8
#include "
CaloDetDescr/CaloDetDescrManager.h
"
9
10
// Gaudi
11
#include "GaudiKernel/MsgStream.h"
12
#include "GaudiKernel/IToolSvc.h"
13
#include "GaudiKernel/ThreadLocalContext.h"
14
15
// Athena
16
#include "
CaloUtils/CaloTopoTowerBuilderToolBase.h
"
17
18
19
CaloTopoTowerContainerCnv::CaloTopoTowerContainerCnv
(ISvcLocator* svcloc)
20
:
21
// Base class constructor
22
CaloTopoTowerContainerCnvBase
(svcloc)
23
{}
24
25
CaloTopoTowerContainer
*
CaloTopoTowerContainerCnv::createTransient
(
const
Token
* token) {
26
MsgStream log(msgSvc(),
"CaloTopoTowerContainerCnv::createTransient"
);
27
CaloTopoTowerContainer
* Cont = 0;
28
if
(log.level() <= MSG::DEBUG) log << MSG::DEBUG <<
"Starting CaloTopoTowerContainerCnv::PoolToDataObject"
<<
endmsg
;
29
if
(
compareClassGuid
(token,
p0_guid
)) {
30
if
(log.level() <= MSG::DEBUG) log << MSG::DEBUG <<
"Read version p0 of CaloTopoTowerContainer. token="
31
<< token->
toString
() <<
endmsg
;
32
Cont=
poolReadObject<CaloTopoTowerContainer>
(token);
33
}
34
else
if
(
compareClassGuid
(token,
p1_guid
)) {
35
if
(log.level() <= MSG::DEBUG) log << MSG::DEBUG <<
"Read version p1 of CaloTopoTowerContainer. token="
36
<< token->
toString
() <<
endmsg
;
37
CaloTopoTowerContainerPERS
* pers=
poolReadObject<CaloTopoTowerContainer_p1>
(token);
38
Cont=
new
CaloTopoTowerContainer
();
39
m_converter
.persToTrans(pers,Cont,log);
40
delete
pers;
41
}
42
if
(!Cont) {
43
log << MSG::FATAL <<
"Unable to get object from pool"
<<
endmsg
;
44
return
Cont;
45
}
46
47
Cont->
init
();
48
49
// rebuild the CaloTopoTowers in the container.
50
const
EventContext& ctx = Gaudi::Hive::currentContext();
51
52
m_TopoTowerBldr
=
getTool
(
"CaloTopoTowerBuilderTool"
,
"TopoTowerTwrBldr"
);
53
if
(!
m_TopoTowerBldr
){
54
log<<MSG::ERROR<<
" Failed to create CaloTopoTowerContainer "
<<
endmsg
;
55
return
0;
56
}
57
if
(log.level() <= MSG::DEBUG) log << MSG::DEBUG <<
"creating CaloTopoTowerContainerCnv::PoolToDataObject"
<<
endmsg
;
58
StatusCode scfcal =
m_TopoTowerBldr
->execute(ctx, Cont);
59
if
(log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<
" TopoTowers rebuild m_TopoTowerBldr->execute(Cont); Successful "
<<
endmsg
;
60
if
(scfcal.isFailure()) {
61
log<<MSG::ERROR<<
" TopoTowers rebuild failed "
<<
endmsg
;
62
}
63
if
(log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<
" TopoTowers rebuild worked "
<<
endmsg
;
64
65
return
Cont;
66
}
67
68
CaloTopoTowerContainerPERS
*
CaloTopoTowerContainerCnv::createPersistent
(
CaloTopoTowerContainer
* trans) {
69
MsgStream log(msgSvc(),
"CaloTopoTowerContainerCnv::createPersistent"
);
70
if
(log.level() <= MSG::DEBUG) log << MSG::DEBUG <<
"Writing CaloTopoTowerContainer_p1"
<<
endmsg
;
71
CaloTopoTowerContainerPERS
* pers=
new
CaloTopoTowerContainerPERS
();
72
m_converter
.transToPers(trans,pers,log);
73
return
pers;
74
}
75
76
77
CaloTopoTowerBuilderToolBase
*
CaloTopoTowerContainerCnv::getTool
(
78
const
std::string&
type
,
const
std::string& nm)
79
{
80
SmartIF<IToolSvc> myToolSvc{Gaudi::svcLocator()->service(
"ToolSvc"
)};
81
if
(!myToolSvc.isValid()) {
82
ATH_MSG_ERROR
(
"Cannot locate ToolSvc"
);
83
return
0;
84
}
85
87
// Allocate Tools //
89
90
IAlgTool* algToolPtr;
91
StatusCode
sc
= myToolSvc->retrieveTool(
type
,nm,algToolPtr);
92
// tool not found
93
if
(
sc
.isFailure() )
94
{
95
ATH_MSG_INFO
(
"Cannot find tool named <"
96
<<
type
<<
"/"
<< nm
97
<<
">"
);
98
return
0;
99
}
100
return
dynamic_cast<
CaloTopoTowerBuilderToolBase
*
>
(algToolPtr);
101
102
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
CaloDetDescrManager.h
Definition of CaloDetDescrManager.
CaloTopoTowerBuilderToolBase.h
CaloTopoTowerContainerCnv.h
CaloTopoTowerContainerCnvBase
T_AthenaPoolCustomCnv< CaloTopoTowerContainer, CaloTopoTowerContainerPERS > CaloTopoTowerContainerCnvBase
Definition
CaloTopoTowerContainerCnv.h:17
CaloTopoTowerContainerPERS
CaloTopoTowerContainer_p1 CaloTopoTowerContainerPERS
Definition
CaloTopoTowerContainerCnv.h:16
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
CaloTopoTowerBuilderToolBase
CaloTopoTowerBuilderToolBase is abstract base class for tower builders.
Definition
CaloTopoTowerBuilderToolBase.h:20
CaloTopoTowerContainerCnv::createPersistent
virtual CaloTopoTowerContainerPERS * createPersistent(CaloTopoTowerContainer *) override
Definition
CaloTopoTowerContainerCnv.cxx:68
CaloTopoTowerContainerCnv::m_TopoTowerBldr
CaloTopoTowerBuilderToolBase * m_TopoTowerBldr
Definition
CaloTopoTowerContainerCnv.h:39
CaloTopoTowerContainerCnv::createTransient
virtual CaloTopoTowerContainer * createTransient(const Token *token) override
Definition
CaloTopoTowerContainerCnv.cxx:25
CaloTopoTowerContainerCnv::getTool
CaloTopoTowerBuilderToolBase * getTool(const std::string &type, const std::string &nm)
Definition
CaloTopoTowerContainerCnv.cxx:77
CaloTopoTowerContainerCnv::p0_guid
pool::Guid p0_guid
Definition
CaloTopoTowerContainerCnv.h:40
CaloTopoTowerContainerCnv::CaloTopoTowerContainerCnv
CaloTopoTowerContainerCnv(ISvcLocator *svcloc)
Definition
CaloTopoTowerContainerCnv.cxx:19
CaloTopoTowerContainerCnv::m_converter
CaloTopoTowerContainerCnv_p1 m_converter
Definition
CaloTopoTowerContainerCnv.h:42
CaloTopoTowerContainerCnv::p1_guid
pool::Guid p1_guid
Definition
CaloTopoTowerContainerCnv.h:41
CaloTopoTowerContainer
Storable container class for CaloTower.
Definition
CaloTopoTowerContainer.h:51
CaloTowerContainer::init
void init()
Initializes the CaloTowerContainer.
Definition
CaloTowerContainer.cxx:107
T_AthenaPoolCustomCnv< CaloTopoTowerContainer, CaloTopoTowerContainerPERS >::compareClassGuid
virtual bool compareClassGuid(const Token *token, const Guid &clid) const
T_AthenaPoolCustomCnv< CaloTopoTowerContainer, CaloTopoTowerContainerPERS >::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
Token::toString
const std::string toString() const
Retrieve the string representation of the token.
Definition
Token.cxx:135
type
Generated on
for ATLAS Offline Software by
1.17.0