ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloCnv
CaloIdCnv
src
CaloIDHelper_IDDetDescrCnv.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
10
11
12
#include "
CaloIdCnv/CaloIDHelper_IDDetDescrCnv.h
"
13
#include "
IdDictDetDescr/IdDictManager.h
"
14
#include "
DetDescrCnvSvc/DetDescrAddress.h
"
15
#include "
StoreGate/StoreGateSvc.h
"
16
#include "
AthenaKernel/ClassID_traits.h
"
17
#include "
Identifier/IdHelper.h
"
18
#include "
AthenaKernel/errorcheck.h
"
19
#include "GaudiKernel/IClassIDSvc.h"
20
#include "GaudiKernel/MsgStream.h"
21
22
23
namespace
CaloIdCnv
{
24
25
31
StatusCode
CaloIDHelper_IDDetDescrCnv::createObj
(IOpaqueAddress* pAddr,
32
DataObject*& pObj)
33
{
34
// Get the a name of the class we're converting.
35
std::string type_name;
36
SmartIF<IClassIDSvc> clidsvc{ service (
"ClassIDSvc"
) };
37
CHECK
( clidsvc.isValid() );
38
CHECK
( clidsvc->getTypeNameOfID (objType(), type_name) );
39
40
// Get the SG key.
41
DetDescrAddress
* ddAddr =
dynamic_cast<
DetDescrAddress
*
>
(pAddr);
42
if
(!ddAddr) {
43
ATH_MSG_ERROR
(
"Dynamic cast to DetDescrAddress fails!"
);
44
return
StatusCode::FAILURE;
45
}
46
std::string helperKey = *( ddAddr->par() );
47
if
(helperKey.empty()) {
48
ATH_MSG_DEBUG
(
"No Helper key "
);
49
}
50
else
{
51
ATH_MSG_DEBUG
(
"Helper key is "
<< helperKey);
52
}
53
54
// Get the dictionary manager from the detector store
55
const
IdDictManager
* idDictMgr = 0;
56
CHECK
(
detStore
()->retrieve(idDictMgr,
"IdDict"
) );
57
58
// Create the helper.
59
IdHelper
* idhelper = 0;
60
CHECK
(
createHelper
(helperKey, idhelper, pObj) );
61
62
// Initialize the helper.
63
if
(idDictMgr->
initializeHelper
(*idhelper)) {
64
ATH_MSG_ERROR
(
"Unable to initialize "
<< type_name);
65
return
StatusCode::FAILURE;
66
}
67
else
{
68
ATH_MSG_DEBUG
(
"Initialized "
<< type_name);
69
}
70
71
return
StatusCode::SUCCESS;
72
}
73
74
78
long
int
CaloIDHelper_IDDetDescrCnv::repSvcType
()
const
79
{
80
return
storageType
();
81
}
82
83
89
CaloIDHelper_IDDetDescrCnv::CaloIDHelper_IDDetDescrCnv
(
const
CLID
& clid,
90
ISvcLocator* svcloc)
91
:
DetDescrConverter
(clid, svcloc,
"CaloIDHelper_IDDetDescrCnv"
)
92
{
93
}
94
95
96
}
// namespace CaloIdCnv
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloIDHelper_IDDetDescrCnv.h
Common code for creating calo ID helpers in the detector store.
ClassID_traits.h
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
DetDescrAddress.h
CLID
uint32_t CLID
The Class ID type.
Definition
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
IdDictManager.h
IdHelper.h
StoreGateSvc.h
CaloIdCnv::CaloIDHelper_IDDetDescrCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Called by the converter infrastructure to create an object.
Definition
CaloIDHelper_IDDetDescrCnv.cxx:31
CaloIdCnv::CaloIDHelper_IDDetDescrCnv::createHelper
virtual StatusCode createHelper(const std::string &helperKey, IdHelper *&idhelper, DataObject *&pObj)=0
Create the helper object.
CaloIdCnv::CaloIDHelper_IDDetDescrCnv::repSvcType
virtual long int repSvcType() const
Return the service type.
Definition
CaloIDHelper_IDDetDescrCnv.cxx:78
CaloIdCnv::CaloIDHelper_IDDetDescrCnv::CaloIDHelper_IDDetDescrCnv
CaloIDHelper_IDDetDescrCnv(const CLID &clid, ISvcLocator *svcloc)
Constructor.
Definition
CaloIDHelper_IDDetDescrCnv.cxx:89
DetDescrAddress
Definition
DetDescrAddress.h:32
DetDescrConverter::storageType
static long storageType()
Storage type for all DetDescrConverters.
Definition
DetDescrConverter.cxx:30
DetDescrConverter::DetDescrConverter
DetDescrConverter(const CLID &myCLID, ISvcLocator *svcloc, const char *name=nullptr)
Definition
DetDescrConverter.cxx:34
DetDescrConverter::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Handle to DetectorStore.
Definition
DetDescrConverter.h:33
IdDictManager
IdDictManager is the interface to identifier dictionaries.
Definition
IdDictManager.h:26
IdDictManager::initializeHelper
int initializeHelper(IdHelper &helper) const
Return value: 0 OK, >0 error.
Definition
IdDictManager.cxx:37
IdHelper
This is an abstract base class for helper classes that know how to convert Identifier <-> IdentifierH...
Definition
IdHelper.h:24
CaloIdCnv
Definition
CaloIDHelper_IDDetDescrCnv.h:40
Generated on
for ATLAS Offline Software by
1.17.0