ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetDetDescrCnv
InDetIdCnv
src
PLR_IDDetDescrCnv.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
/***************************************************************************
6
InDet DetDescrCnv package
7
-----------------------------------------
8
***************************************************************************/
9
10
#include "
PLR_IDDetDescrCnv.h
"
11
12
#include "
DetDescrCnvSvc/DetDescrConverter.h
"
13
#include "
DetDescrCnvSvc/DetDescrAddress.h
"
14
#include "GaudiKernel/MsgStream.h"
15
#include "
StoreGate/StoreGateSvc.h
"
16
17
#include "
IdDictDetDescr/IdDictManager.h
"
18
#include "
IdDict/IdDictDictionary.h
"
19
#include "
IdDict/IdDictMgr.h
"
20
#include "
InDetIdentifier/PLR_ID.h
"
21
22
//--------------------------------------------------------------------
23
24
PLR_IDDetDescrCnv::PLR_IDDetDescrCnv
(ISvcLocator* svcloc)
25
:
DetDescrConverter
(
ClassID_traits
<
PLR_ID
>::ID(), svcloc,
"PLR_IDDetDescrCnv"
)
26
{}
27
28
//--------------------------------------------------------------------
29
30
long
int
31
PLR_IDDetDescrCnv::repSvcType
()
const
32
{
33
return
storageType
();
34
}
35
36
//--------------------------------------------------------------------
37
38
StatusCode
39
PLR_IDDetDescrCnv::initialize
()
40
{
41
ATH_CHECK
( DetDescrConverter::initialize() );
42
return
StatusCode::SUCCESS;
43
}
44
45
//--------------------------------------------------------------------
46
47
StatusCode
48
PLR_IDDetDescrCnv::createObj
(IOpaqueAddress*
/*pAddr*/
, DataObject*& pObj)
49
{
50
// Get the dictionary manager from the detector store
51
const
IdDictManager
* idDictMgr;
52
ATH_CHECK
(
detStore
()->retrieve(idDictMgr,
"IdDict"
) );
53
54
// Only initialize helper if it is the first pass or if there is a
55
// change in the the file or tag
56
bool
initHelper{};
57
58
const
IdDictMgr
* mgr = idDictMgr->
manager
();
59
60
// Internal InDet id tag
61
const
std::string & inDetIDTag = mgr->tag();
62
63
// DoChecks flag
64
bool
doChecks = mgr->do_checks();
65
66
const
IdDictDictionary
* dict = mgr->find_dictionary(
"InnerDetector"
);
67
if
(!dict) {
68
ATH_MSG_ERROR
(
"unable to find idDict for InnerDetector"
);
69
return
StatusCode::FAILURE;
70
}
71
72
// File to be read for InDet ids
73
const
std::string & inDetIDFileName = dict->file_name();
74
75
// Tag of RDB record for InDet ids
76
const
std::string & inDetIdDictTag = dict->dict_tag();
77
78
// PLR id helper already exists - second pass. Check for a change
79
if
(
m_plrId
) {
80
if
(inDetIDTag !=
m_inDetIDTag
) {
81
// Internal InDet id tag
82
initHelper =
true
;
83
ATH_MSG_DEBUG
(
" Changed internal InDet id tag: "
<< inDetIDTag);
84
}
85
if
(inDetIDFileName !=
m_inDetIDFileName
) {
86
// File to be read for InDet ids
87
initHelper =
true
;
88
ATH_MSG_DEBUG
(
" Changed InDetFileName: "
<< inDetIDFileName);
89
}
90
if
(inDetIdDictTag !=
m_inDetIdDictTag
) {
91
// Tag of RDB record for InDet ids
92
initHelper =
true
;
93
ATH_MSG_DEBUG
(
" Changed InDetIdDictTag: "
<< inDetIdDictTag);
94
}
95
if
(doChecks !=
m_doChecks
) {
96
// DoChecks flag
97
initHelper =
true
;
98
ATH_MSG_DEBUG
(
" Changed doChecks flag: "
<< doChecks);
99
}
100
}
else
{
101
// create the helper
102
m_plrId
=
new
PLR_ID
;
103
initHelper =
true
;
104
}
105
106
if
(initHelper) {
107
ATH_CHECK
( idDictMgr->
initializeHelper
(*
m_plrId
) == 0 );
108
109
// Save state:
110
m_inDetIDTag
= inDetIDTag;
111
m_inDetIDFileName
= inDetIDFileName;
112
m_inDetIdDictTag
= inDetIdDictTag;
113
m_doChecks
= doChecks;
114
}
115
116
// Pass a pointer to the container to the Persistency service by reference.
117
pObj =
SG::asStorable
(
m_plrId
);
118
119
return
StatusCode::SUCCESS;
120
}
121
122
//--------------------------------------------------------------------
123
124
long
125
PLR_IDDetDescrCnv::storageType
()
126
{
127
return
DetDescr_StorageType
;
128
}
129
130
//--------------------------------------------------------------------
131
CLID
132
PLR_IDDetDescrCnv::classID
()
133
{
134
return
ClassID_traits<PLR_ID>::ID
();
135
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
DetDescrAddress.h
DetDescr_StorageType
const long DetDescr_StorageType
Definition
DetDescrCnvSvc.cxx:20
DetDescrConverter.h
CLID
uint32_t CLID
The Class ID type.
Definition
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
IdDictDictionary.h
IdDictManager.h
IdDictMgr.h
PLR_IDDetDescrCnv.h
PLR_ID.h
StoreGateSvc.h
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
IdDictDictionary
Definition
IdDictDictionary.h:33
IdDictManager
IdDictManager is the interface to identifier dictionaries.
Definition
IdDictManager.h:26
IdDictManager::manager
const IdDictMgr * manager(void) const
Definition
IdDictManager.cxx:30
IdDictManager::initializeHelper
int initializeHelper(IdHelper &helper) const
Return value: 0 OK, >0 error.
Definition
IdDictManager.cxx:37
IdDictMgr
Definition
IdDictMgr.h:17
PLR_IDDetDescrCnv::m_plrId
PLR_ID * m_plrId
The helper - only will create it once.
Definition
PLR_IDDetDescrCnv.h:41
PLR_IDDetDescrCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj) override
Definition
PLR_IDDetDescrCnv.cxx:48
PLR_IDDetDescrCnv::classID
static CLID classID()
Definition
PLR_IDDetDescrCnv.cxx:132
PLR_IDDetDescrCnv::repSvcType
virtual long int repSvcType() const override
Definition
PLR_IDDetDescrCnv.cxx:31
PLR_IDDetDescrCnv::m_inDetIDTag
std::string m_inDetIDTag
Internal InDet id tag.
Definition
PLR_IDDetDescrCnv.h:50
PLR_IDDetDescrCnv::storageType
static long storageType()
Definition
PLR_IDDetDescrCnv.cxx:125
PLR_IDDetDescrCnv::m_inDetIdDictTag
std::string m_inDetIdDictTag
Tag of RDB record for InDet ids.
Definition
PLR_IDDetDescrCnv.h:47
PLR_IDDetDescrCnv::PLR_IDDetDescrCnv
PLR_IDDetDescrCnv(ISvcLocator *svcloc)
Definition
PLR_IDDetDescrCnv.cxx:24
PLR_IDDetDescrCnv::m_doChecks
bool m_doChecks
Whether or not.
Definition
PLR_IDDetDescrCnv.h:53
PLR_IDDetDescrCnv::m_inDetIDFileName
std::string m_inDetIDFileName
File to be read for InDet ids.
Definition
PLR_IDDetDescrCnv.h:44
PLR_IDDetDescrCnv::initialize
virtual StatusCode initialize() override
Definition
PLR_IDDetDescrCnv.cxx:39
PLR_ID
This is a Identifier helper class for the PLR subdetector.
Definition
PLR_ID.h:22
SG::asStorable
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
Definition
DataObjectSharedPtr.h:31
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition
Control/AthenaKernel/AthenaKernel/ClassID_traits.h:37
ClassID_traits::ID
static constexpr CLID ID()
Definition
Control/AthenaKernel/AthenaKernel/ClassID_traits.h:44
Generated on
for ATLAS Offline Software by
1.17.0