ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
HighGranularityTimingDetector
HGTD_DetDescrCnv
HGTD_IdCnv
src
HGTD_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
#include "
HGTD_IDDetDescrCnv.h
"
7
8
#include "
DetDescrCnvSvc/DetDescrConverter.h
"
9
#include "
DetDescrCnvSvc/DetDescrAddress.h
"
10
#include "
StoreGate/StoreGateSvc.h
"
11
12
#include "
AthenaBaseComps/AthCheckMacros.h
"
13
14
#include "
IdDictDetDescr/IdDictManager.h
"
15
#include "
IdDict/IdDictDictionary.h
"
16
#include "
IdDict/IdDictMgr.h
"
17
18
//--------------------------------------------------------------------
19
20
long
int
21
HGTD_IDDetDescrCnv::repSvcType
()
const
22
{
23
return
(
storageType
());
24
}
25
26
//--------------------------------------------------------------------
27
28
StatusCode
29
HGTD_IDDetDescrCnv::initialize
()
30
{
31
// First call parent init
32
ATH_CHECK
(DetDescrConverter::initialize());
33
34
return
StatusCode::SUCCESS;
35
}
36
37
//--------------------------------------------------------------------
38
39
StatusCode
40
HGTD_IDDetDescrCnv::createObj
(IOpaqueAddress*
/*pAddr*/
, DataObject*& pObj)
41
{
42
ATH_MSG_INFO
(
"in createObj: creating a HGTD_ID helper object in the detector store"
);
43
44
// Get the dictionary manager from the detector store
45
const
IdDictManager
* idDictMgr;
46
ATH_CHECK
(
detStore
()->retrieve(idDictMgr,
"IdDict"
) );
47
48
// Only initialize helper if it is the first pass or if there is a
49
// change in the the file or tag
50
bool
initHelper =
false
;
51
52
const
IdDictMgr
* mgr = idDictMgr->
manager
();
53
54
// Internal InDet id tag
55
std::string inDetIDTag = mgr->tag();
56
57
// DoChecks flag
58
bool
doChecks = mgr->do_checks();
59
60
const
IdDictDictionary
* dict = mgr->find_dictionary(
"InnerDetector"
);
61
if
(!dict) {
62
ATH_MSG_ERROR
(
"unable to find idDict for InnerDetector"
);
63
return
StatusCode::FAILURE;
64
}
65
66
// File to be read for InDet ids
67
std::string inDetIDFileName = dict->file_name();
68
// Tag of RDB record for InDet ids
69
std::string inDetIdDictTag = dict->dict_tag();
70
71
if
(
m_hgtdId
) {
72
// HGTD id helper already exists - second pass. Check for a
73
// change
74
if
(inDetIDTag !=
m_inDetIDTag
) {
75
// Internal InDet id tag
76
initHelper =
true
;
77
ATH_MSG_DEBUG
(
" Changed internal InDet id tag: "
<< inDetIDTag );
78
}
79
if
(inDetIDFileName !=
m_inDetIDFileName
) {
80
// File to be read for InDet ids
81
initHelper =
true
;
82
ATH_MSG_DEBUG
(
" Changed InDetFileName:"
<< inDetIDFileName );
83
}
84
if
(inDetIdDictTag !=
m_inDetIdDictTag
) {
85
// Tag of RDB record for InDet ids
86
initHelper =
true
;
87
ATH_MSG_DEBUG
(
" Changed InDetIdDictTag: "
<< inDetIdDictTag );
88
}
89
if
(doChecks !=
m_doChecks
) {
90
// DoChecks flag
91
initHelper =
true
;
92
ATH_MSG_DEBUG
(
" Changed doChecks flag: "
<< doChecks );
93
}
94
}
95
else
{
96
// create the helper
97
m_hgtdId
= std::make_unique<HGTD_ID>();
98
initHelper =
true
;
99
if
(dict->version() ==
"P2-RUN4"
){
100
m_hgtdId
->set_useNewIdentifierScheme(
true
);
101
}
102
}
103
104
if
(initHelper) {
105
if
(idDictMgr->
initializeHelper
(*
m_hgtdId
)) {
106
ATH_MSG_ERROR
(
"Unable to initialize HGTD_ID"
);
107
return
StatusCode::FAILURE;
108
}
109
// Save state:
110
m_inDetIDTag
= std::move(inDetIDTag);
111
m_inDetIDFileName
= std::move(inDetIDFileName);
112
m_inDetIdDictTag
= std::move(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_hgtdId
.release());
118
119
return
StatusCode::SUCCESS;
120
121
}
122
123
//--------------------------------------------------------------------
124
125
long
126
HGTD_IDDetDescrCnv::storageType
()
127
{
128
return
DetDescr_StorageType
;
129
}
130
131
//--------------------------------------------------------------------
132
CLID
133
HGTD_IDDetDescrCnv::classID
() {
134
return
ClassID_traits<HGTD_ID>::ID
();
135
}
136
137
//--------------------------------------------------------------------
138
HGTD_IDDetDescrCnv::HGTD_IDDetDescrCnv
(ISvcLocator* svcloc)
139
:
140
DetDescrConverter
(
ClassID_traits
<
HGTD_ID
>::ID(), svcloc,
"HGTD_IDDetDescrCnv"
),
141
m_hgtdId
(),
142
m_doChecks
(false)
143
144
{}
AthCheckMacros.h
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
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
HGTD_IDDetDescrCnv.h
IdDictDictionary.h
IdDictManager.h
IdDictMgr.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
HGTD_IDDetDescrCnv::m_inDetIDFileName
std::string m_inDetIDFileName
File to be read for InDet ids.
Definition
HGTD_IDDetDescrCnv.h:45
HGTD_IDDetDescrCnv::classID
static CLID classID()
Definition
HGTD_IDDetDescrCnv.cxx:133
HGTD_IDDetDescrCnv::storageType
static long storageType()
Definition
HGTD_IDDetDescrCnv.cxx:126
HGTD_IDDetDescrCnv::repSvcType
virtual long int repSvcType() const override final
Definition
HGTD_IDDetDescrCnv.cxx:21
HGTD_IDDetDescrCnv::m_inDetIdDictTag
std::string m_inDetIdDictTag
Tag of RDB record for InDet ids.
Definition
HGTD_IDDetDescrCnv.h:48
HGTD_IDDetDescrCnv::initialize
virtual StatusCode initialize() override final
Definition
HGTD_IDDetDescrCnv.cxx:29
HGTD_IDDetDescrCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj) override final
Definition
HGTD_IDDetDescrCnv.cxx:40
HGTD_IDDetDescrCnv::m_inDetIDTag
std::string m_inDetIDTag
Internal InDet id tag.
Definition
HGTD_IDDetDescrCnv.h:51
HGTD_IDDetDescrCnv::HGTD_IDDetDescrCnv
HGTD_IDDetDescrCnv(ISvcLocator *svcloc)
Definition
HGTD_IDDetDescrCnv.cxx:138
HGTD_IDDetDescrCnv::m_doChecks
bool m_doChecks
Whether or not.
Definition
HGTD_IDDetDescrCnv.h:54
HGTD_IDDetDescrCnv::m_hgtdId
std::unique_ptr< HGTD_ID > m_hgtdId
The helper - only will create it once.
Definition
HGTD_IDDetDescrCnv.h:42
HGTD_ID
This is an Identifier helper class for the HGTD subdetector.
Definition
HGTD_ID.h:47
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
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