ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetDetDescrCnv
InDetIdCnv
src
SCT_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
#include "
SCT_IDDetDescrCnv.h
"
6
7
#include "
DetDescrCnvSvc/DetDescrConverter.h
"
8
#include "
DetDescrCnvSvc/DetDescrAddress.h
"
9
#include "GaudiKernel/MsgStream.h"
10
#include "
StoreGate/StoreGateSvc.h
"
11
12
#include "
IdDictDetDescr/IdDictManager.h
"
13
#include "
IdDict/IdDictDictionary.h
"
14
#include "
IdDict/IdDictMgr.h
"
15
#include "
InDetIdentifier/SCT_ID.h
"
16
17
18
//--------------------------------------------------------------------
19
20
long
int
21
SCT_IDDetDescrCnv::repSvcType
()
const
22
{
23
return
(
storageType
());
24
}
25
26
//--------------------------------------------------------------------
27
28
StatusCode
29
SCT_IDDetDescrCnv::initialize
()
30
{
31
// First call parent init
32
ATH_CHECK
( DetDescrConverter::initialize() );
33
return
StatusCode::SUCCESS;
34
}
35
36
//--------------------------------------------------------------------
37
38
StatusCode
39
SCT_IDDetDescrCnv::createObj
(IOpaqueAddress*
/*pAddr*/
, DataObject*& pObj)
40
{
41
// Get the dictionary manager from the detector store
42
const
IdDictManager
* idDictMgr;
43
ATH_CHECK
(
detStore
()->retrieve(idDictMgr,
"IdDict"
) );
44
45
// Only create new helper if it is the first pass or if there is a
46
// change in the the file or tag
47
bool
initHelper =
false
;
48
49
const
IdDictMgr
* mgr = idDictMgr->
manager
();
50
51
// Internal InDet id tag
52
const
std::string & inDetIDTag = mgr->tag();
53
54
// DoChecks flag
55
bool
doChecks = mgr->do_checks();
56
57
const
IdDictDictionary
* dict = mgr->find_dictionary(
"InnerDetector"
);
58
if
(!dict) {
59
ATH_MSG_ERROR
(
"unable to find idDict for InnerDetector"
);
60
return
StatusCode::FAILURE;
61
}
62
63
// File to be read for InDet ids
64
const
std::string & inDetIDFileName = dict->file_name();
65
66
// Tag of RDB record for InDet ids
67
const
std::string & inDetIdDictTag = dict->dict_tag();
68
69
70
if
(
m_sctId
) {
71
72
// SCT 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_sctId
=
new
SCT_ID
;
98
initHelper =
true
;
99
}
100
101
if
(initHelper) {
102
ATH_CHECK
( idDictMgr->
initializeHelper
(*
m_sctId
) == 0 );
103
// Save state:
104
m_inDetIDTag
= inDetIDTag;
105
m_inDetIDFileName
= inDetIDFileName;
106
m_inDetIdDictTag
= inDetIdDictTag;
107
m_doChecks
= doChecks;
108
}
109
110
// Pass a pointer to the container to the Persistency service by reference.
111
pObj =
SG::asStorable
(
m_sctId
);
112
113
return
StatusCode::SUCCESS;
114
115
}
116
117
//--------------------------------------------------------------------
118
119
long
120
SCT_IDDetDescrCnv::storageType
()
121
{
122
return
DetDescr_StorageType
;
123
}
124
125
//--------------------------------------------------------------------
126
CLID
127
SCT_IDDetDescrCnv::classID
() {
128
return
ClassID_traits<SCT_ID>::ID
();
129
}
130
131
//--------------------------------------------------------------------
132
SCT_IDDetDescrCnv::SCT_IDDetDescrCnv
(ISvcLocator* svcloc)
133
:
134
DetDescrConverter
(
ClassID_traits
<
SCT_ID
>::ID(), svcloc,
"SCT_IDDetDescrCnv"
),
135
m_sctId
(nullptr),
136
m_doChecks
(false)
137
138
{}
139
140
141
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
SCT_IDDetDescrCnv.h
SCT_ID.h
This is an Identifier helper class for the SCT subdetector.
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
SCT_IDDetDescrCnv::m_inDetIdDictTag
std::string m_inDetIdDictTag
Tag of RDB record for InDet ids.
Definition
SCT_IDDetDescrCnv.h:40
SCT_IDDetDescrCnv::m_inDetIDTag
std::string m_inDetIDTag
Internal InDet id tag.
Definition
SCT_IDDetDescrCnv.h:43
SCT_IDDetDescrCnv::m_inDetIDFileName
std::string m_inDetIDFileName
File to be read for InDet ids.
Definition
SCT_IDDetDescrCnv.h:37
SCT_IDDetDescrCnv::m_doChecks
bool m_doChecks
Whether or not.
Definition
SCT_IDDetDescrCnv.h:46
SCT_IDDetDescrCnv::repSvcType
virtual long int repSvcType() const override
Definition
SCT_IDDetDescrCnv.cxx:21
SCT_IDDetDescrCnv::m_sctId
SCT_ID * m_sctId
The helper - only will create it once.
Definition
SCT_IDDetDescrCnv.h:34
SCT_IDDetDescrCnv::SCT_IDDetDescrCnv
SCT_IDDetDescrCnv(ISvcLocator *svcloc)
Definition
SCT_IDDetDescrCnv.cxx:132
SCT_IDDetDescrCnv::storageType
static long storageType()
Definition
SCT_IDDetDescrCnv.cxx:120
SCT_IDDetDescrCnv::classID
static CLID classID()
Definition
SCT_IDDetDescrCnv.cxx:127
SCT_IDDetDescrCnv::initialize
virtual StatusCode initialize() override
Definition
SCT_IDDetDescrCnv.cxx:29
SCT_IDDetDescrCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj) override
Definition
SCT_IDDetDescrCnv.cxx:39
SCT_ID
This is an Identifier helper class for the SCT subdetector.
Definition
SCT_ID.h:68
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