ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetDetDescrCnv
InDetIdCnv
src
PixelIDDetDescrCnv.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 "
PixelIDDetDescrCnv.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/PixelID.h
"
16
17
18
//--------------------------------------------------------------------
19
20
long
int
21
PixelIDDetDescrCnv::repSvcType
()
const
22
{
23
return
(
storageType
());
24
}
25
26
//--------------------------------------------------------------------
27
28
StatusCode
29
PixelIDDetDescrCnv::initialize
()
30
{
31
ATH_CHECK
( DetDescrConverter::initialize() );
32
return
StatusCode::SUCCESS;
33
}
34
35
//--------------------------------------------------------------------
36
37
StatusCode
38
PixelIDDetDescrCnv::createObj
(IOpaqueAddress*
/*pAddr*/
, DataObject*& pObj)
39
{
40
// Get the dictionary manager from the detector store
41
const
IdDictManager
* idDictMgr;
42
ATH_CHECK
(
detStore
()->retrieve(idDictMgr,
"IdDict"
) );
43
44
// Only initialize helper if it is the first pass or if there is a
45
// change in the the file or tag
46
bool
initHelper =
false
;
47
48
const
IdDictMgr
* mgr = idDictMgr->
manager
();
49
50
// Internal InDet id tag
51
const
std::string & inDetIDTag = mgr->tag();
52
53
// DoChecks flag
54
bool
doChecks = mgr->do_checks();
55
56
const
IdDictDictionary
* dict = mgr->find_dictionary(
"InnerDetector"
);
57
if
(!dict) {
58
ATH_MSG_ERROR
(
"unable to find idDict for InnerDetector"
);
59
return
StatusCode::FAILURE;
60
}
61
62
// File to be read for InDet ids
63
const
std::string & inDetIDFileName = dict->file_name();
64
65
// Tag of RDB record for InDet ids
66
const
std::string & inDetIdDictTag = dict->dict_tag();
67
68
69
if
(
m_pixelId
) {
70
71
// Pixel id helper already exists - second pass. Check for a
72
// change
73
if
(inDetIDTag !=
m_inDetIDTag
) {
74
// Internal InDet id tag
75
initHelper =
true
;
76
ATH_MSG_DEBUG
(
" Changed internal InDet id tag: "
<< inDetIDTag);
77
}
78
if
(inDetIDFileName !=
m_inDetIDFileName
) {
79
// File to be read for InDet ids
80
initHelper =
true
;
81
ATH_MSG_DEBUG
(
" Changed InDetFileName:"
<< inDetIDFileName);
82
}
83
if
(inDetIdDictTag !=
m_inDetIdDictTag
) {
84
// Tag of RDB record for InDet ids
85
initHelper =
true
;
86
ATH_MSG_DEBUG
(
" Changed InDetIdDictTag: "
<< inDetIdDictTag);
87
}
88
if
(doChecks !=
m_doChecks
) {
89
// DoChecks flag
90
initHelper =
true
;
91
ATH_MSG_DEBUG
(
" Changed doChecks flag: "
<< doChecks);
92
}
93
}
94
else
{
95
// create the helper
96
m_pixelId
=
new
PixelID
;
97
initHelper =
true
;
98
}
99
100
if
(initHelper) {
101
ATH_CHECK
( idDictMgr->
initializeHelper
(*
m_pixelId
) == 0 );
102
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_pixelId
);
112
113
return
StatusCode::SUCCESS;
114
115
}
116
117
//--------------------------------------------------------------------
118
119
long
120
PixelIDDetDescrCnv::storageType
()
121
{
122
return
DetDescr_StorageType
;
123
}
124
125
//--------------------------------------------------------------------
126
CLID
127
PixelIDDetDescrCnv::classID
() {
128
return
ClassID_traits<PixelID>::ID
();
129
}
130
131
//--------------------------------------------------------------------
132
PixelIDDetDescrCnv::PixelIDDetDescrCnv
(ISvcLocator* svcloc)
133
:
134
DetDescrConverter
(
ClassID_traits
<
PixelID
>::ID(), svcloc,
"PixelIDDetDescrCnv"
),
135
m_pixelId
(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
PixelIDDetDescrCnv.h
PixelID.h
This is an Identifier helper class for the Pixel 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
PixelIDDetDescrCnv::storageType
static long storageType()
Definition
PixelIDDetDescrCnv.cxx:120
PixelIDDetDescrCnv::PixelIDDetDescrCnv
PixelIDDetDescrCnv(ISvcLocator *svcloc)
Definition
PixelIDDetDescrCnv.cxx:132
PixelIDDetDescrCnv::m_doChecks
bool m_doChecks
Whether or not.
Definition
PixelIDDetDescrCnv.h:48
PixelIDDetDescrCnv::initialize
virtual StatusCode initialize() override
Definition
PixelIDDetDescrCnv.cxx:29
PixelIDDetDescrCnv::repSvcType
virtual long int repSvcType() const override
Definition
PixelIDDetDescrCnv.cxx:21
PixelIDDetDescrCnv::m_inDetIdDictTag
std::string m_inDetIdDictTag
Tag of RDB record for InDet ids.
Definition
PixelIDDetDescrCnv.h:42
PixelIDDetDescrCnv::m_pixelId
PixelID * m_pixelId
The helper - only will create it once.
Definition
PixelIDDetDescrCnv.h:36
PixelIDDetDescrCnv::m_inDetIDFileName
std::string m_inDetIDFileName
File to be read for InDet ids.
Definition
PixelIDDetDescrCnv.h:39
PixelIDDetDescrCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj) override
Definition
PixelIDDetDescrCnv.cxx:38
PixelIDDetDescrCnv::m_inDetIDTag
std::string m_inDetIDTag
Internal InDet id tag.
Definition
PixelIDDetDescrCnv.h:45
PixelIDDetDescrCnv::classID
static CLID classID()
Definition
PixelIDDetDescrCnv.cxx:127
PixelID
This is an Identifier helper class for the Pixel subdetector.
Definition
PixelID.h:69
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