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