ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
DetectorDescription
DetDescrCnvSvc
src
DetDescrCnvSvc.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 files
6
#include "
DetDescrCnvSvc/DetDescrCnvSvc.h
"
7
8
#include "
AthenaBaseComps/AthCheckMacros.h
"
9
#include "
AthenaBaseComps/AthMsgStreamMacros.h
"
10
#include "
DetDescrCnvSvc/DetDescrAddress.h
"
11
#include "
DetDescrCnvSvc/IDetDescrCnvSvc.h
"
12
#include "GaudiKernel/IConversionSvc.h"
13
#include "GaudiKernel/IConverter.h"
14
#include "GaudiKernel/IDataSelector.h"
15
#include "GaudiKernel/IOpaqueAddress.h"
16
#include "GaudiKernel/ISvcLocator.h"
17
#include "
StoreGate/StoreGateSvc.h
"
18
19
// External definitions
20
constexpr
long
DetDescr_StorageType
= 0x44;
21
22
//-------------------------------------------------------------------------
23
25
DetDescrCnvSvc::DetDescrCnvSvc
(
const
std::string &name, ISvcLocator *svc)
26
: ConversionSvc(name, svc,
DetDescr_StorageType
),
27
m_detStore
(
"DetectorStore"
, name)
28
{}
29
30
//-------------------------------------------------------------------------
31
33
DetDescrCnvSvc::~DetDescrCnvSvc
() =
default
;
34
35
//-------------------------------------------------------------------------
36
38
StatusCode
DetDescrCnvSvc::initialize
() {
39
ATH_CHECK
(ConversionSvc::initialize());
40
ATH_MSG_INFO
(
" initializing "
);
41
42
// get DetectorStore service
43
ATH_CHECK
(
m_detStore
.retrieve() );
44
ATH_MSG_INFO
(
"Found DetectorStore service"
);
45
46
// fill in the Addresses for Transient Detector Store objects
47
ATH_MSG_INFO
(
" filling proxies for detector managers "
);
48
49
ATH_CHECK
(
addToDetStore
(117659265,
"CaloTTMgr"
));
50
ATH_CHECK
(
addToDetStore
(4548337,
"CaloMgr"
));
51
ATH_CHECK
(
addToDetStore
(241807251,
"CaloSuperCellMgr"
));
52
ATH_CHECK
(
addToDetStore
(125856940,
"CaloIdManager"
));
53
// IdDict:
54
ATH_CHECK
(
addToDetStore
(2411,
"IdDict"
));
55
56
// IdHelpers
57
ATH_CHECK
(
addToDetStore
(164875623,
"AtlasID"
));
58
ATH_CHECK
(
addToDetStore
(2516,
"PixelID"
));
59
ATH_CHECK
(
addToDetStore
(2517,
"SCT_ID"
));
60
61
if
(
m_hasTRT
)
62
ATH_CHECK
(
addToDetStore
(2518,
"TRT_ID"
));
63
64
ATH_CHECK
(
addToDetStore
(131939624,
"PLR_ID"
));
65
ATH_CHECK
(
addToDetStore
(79264207,
"HGTD_ID"
));
66
ATH_CHECK
(
addToDetStore
(129452393,
"SiliconID"
));
67
ATH_CHECK
(
addToDetStore
(163583365,
"LArEM_ID"
));
68
ATH_CHECK
(
addToDetStore
(99488227,
"LArEM_SuperCell_ID"
));
69
ATH_CHECK
(
addToDetStore
(3870484,
"LArHEC_ID"
));
70
ATH_CHECK
(
addToDetStore
(254277678,
"LArHEC_SuperCell_ID"
));
71
ATH_CHECK
(
addToDetStore
(45738051,
"LArFCAL_ID"
));
72
ATH_CHECK
(
addToDetStore
(12829437,
"LArFCAL_SuperCell_ID"
));
73
ATH_CHECK
(
addToDetStore
(79264204,
"LArMiniFCAL_ID"
));
74
ATH_CHECK
(
addToDetStore
(158698068,
"LArOnlineID"
));
75
ATH_CHECK
(
addToDetStore
(38321944,
"TTOnlineID"
));
76
ATH_CHECK
(
addToDetStore
(115600394,
"LArOnline_SuperCellID"
));
77
ATH_CHECK
(
addToDetStore
(27863673,
"LArHVLineID"
));
78
ATH_CHECK
(
addToDetStore
(80757351,
"LArElectrodeID"
));
79
ATH_CHECK
(
addToDetStore
(2901,
"TileID"
));
80
ATH_CHECK
(
addToDetStore
(49557789,
"Tile_SuperCell_ID"
));
81
ATH_CHECK
(
addToDetStore
(2902,
"TileHWID"
));
82
ATH_CHECK
(
addToDetStore
(2903,
"TileTBID"
));
83
84
if
(
m_hasMDT
)
85
ATH_CHECK
(
addToDetStore
(4170,
"MDTIDHELPER"
));
86
if
(
m_hasCSC
)
87
ATH_CHECK
(
addToDetStore
(4171,
"CSCIDHELPER"
));
88
89
if
(
m_hasRPC
)
90
ATH_CHECK
(
addToDetStore
(4172,
"RPCIDHELPER"
));
91
if
(
m_hasTGC
)
92
ATH_CHECK
(
addToDetStore
(4173,
"TGCIDHELPER"
));
93
if
(
m_hasSTGC
)
94
ATH_CHECK
(
addToDetStore
(4174,
"STGCIDHELPER"
));
95
if
(
m_hasMM
)
96
ATH_CHECK
(
addToDetStore
(4175,
"MMIDHELPER"
));
97
98
ATH_CHECK
(
addToDetStore
(108133391,
"CaloLVL1_ID"
));
99
ATH_CHECK
(
addToDetStore
(123500438,
"CaloCell_ID"
));
100
ATH_CHECK
(
addToDetStore
(128365736,
"CaloCell_SuperCell_ID"
));
101
ATH_CHECK
(
addToDetStore
(167756483,
"CaloDM_ID"
));
102
ATH_CHECK
(
addToDetStore
(190591643,
"ZdcID"
));
103
104
// for J/GTower
105
ATH_CHECK
(
addToDetStore
(218674799,
"JTower_ID"
));
106
ATH_CHECK
(
addToDetStore
(49678914,
"GTower_ID"
));
107
108
return
StatusCode::SUCCESS;
109
}
110
111
//-------------------------------------------------------------------------
112
115
StatusCode
DetDescrCnvSvc::createAddress
(
long
/* svc_type */
,
116
const
CLID
&
/* clid */
,
117
const
std::string *
/* par */
,
118
const
unsigned
long
*
/* ip */
,
119
IOpaqueAddress *&refpAddress) {
120
refpAddress =
nullptr
;
121
return
StatusCode::FAILURE;
122
}
123
124
//-------------------------------------------------------------------------
125
126
StatusCode
DetDescrCnvSvc::createAddress
(
long
/* svc_type */
,
const
CLID
&clid,
127
const
std::string &refAddress,
128
IOpaqueAddress *&refpAddress) {
129
try
{
130
refpAddress =
new
DetDescrAddress
(clid);
131
DetDescrAddress
*ddAddr;
132
ddAddr =
dynamic_cast<
DetDescrAddress
*
>
(refpAddress);
133
if
(!ddAddr) {
134
MsgStream log(msgSvc(), name());
135
log << MSG::FATAL <<
"Could not cast to DetDescrAddress."
<<
endmsg
;
136
return
StatusCode::FAILURE;
137
}
138
if
(ddAddr->
fromString
(refAddress).isFailure()) {
139
MsgStream log(msgSvc(), name());
140
log << MSG::FATAL <<
"Could not assign address "
<< refAddress
141
<<
endmsg
;
142
return
StatusCode::FAILURE;
143
}
144
}
catch
(...) {
145
refpAddress = 0;
146
}
147
return
(refpAddress != 0) ? StatusCode::SUCCESS : StatusCode::FAILURE;
148
}
149
150
//-------------------------------------------------------------------------
151
152
StatusCode
DetDescrCnvSvc::convertAddress
(
const
IOpaqueAddress *pAddress,
153
std::string &refAddress) {
154
const
DetDescrAddress
*addr =
155
dynamic_cast<
const
DetDescrAddress
*
>
(pAddress);
156
if
(!addr)
157
return
StatusCode::FAILURE;
158
return
addr->
toString
(refAddress);
159
}
160
161
//-------------------------------------------------------------------------
162
163
StatusCode
DetDescrCnvSvc::addToDetStore
(
const
CLID
&clid,
164
const
std::string &name)
const
{
165
// Based on input parameters, create StoreGate proxies with
166
// DetDescrAddresses in the detector store for the different
167
// detectors.
168
169
// fill in the Addresses for Transient Detector Store objects
170
171
CxxUtils::RefCountedPtr<DetDescrAddress>
addr
172
(
new
DetDescrAddress
(clid, name, name));
173
ATH_MSG_INFO
(
" filling address for "
<< (*addr->par()) <<
" with CLID "
174
<< addr->clID() <<
" and storage type "
175
<< addr->svcType()
176
<<
" to detector store "
);
177
ATH_CHECK
(
m_detStore
->recordAddress(std::move(addr)));
178
return
StatusCode::SUCCESS;
179
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:61
AthCheckMacros.h
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
AthMsgStreamMacros.h
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
DetDescrAddress.h
DetDescr_StorageType
const long DetDescr_StorageType
Definition
DetDescrCnvSvc.cxx:20
DetDescrCnvSvc.h
CLID
uint32_t CLID
The Class ID type.
Definition
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
IDetDescrCnvSvc.h
StoreGateSvc.h
CxxUtils::RefCountedPtr
Simple smart pointer for Gaudi-style refcounted objects.
Definition
RefCountedPtr.h:39
DetDescrAddress
Definition
DetDescrAddress.h:32
DetDescrAddress::fromString
StatusCode fromString(const std::string &stringifiedIOA)
initialize technology-specific part of IOA from stringifiedIOA
Definition
DetDescrAddress.cxx:55
DetDescrAddress::toString
StatusCode toString(std::string &refString) const
write technology-specific part of address to string
Definition
DetDescrAddress.cxx:46
DetDescrCnvSvc::m_hasTGC
BooleanProperty m_hasTGC
Definition
DetDescrCnvSvc.h:96
DetDescrCnvSvc::addToDetStore
virtual StatusCode addToDetStore(const CLID &clid, const std::string &name) const
Add new address to the Detector Store.
Definition
DetDescrCnvSvc.cxx:163
DetDescrCnvSvc::m_hasMM
BooleanProperty m_hasMM
Definition
DetDescrCnvSvc.h:93
DetDescrCnvSvc::m_hasRPC
BooleanProperty m_hasRPC
Definition
DetDescrCnvSvc.h:95
DetDescrCnvSvc::m_detStore
ServiceHandle< StoreGateSvc > m_detStore
Definition
DetDescrCnvSvc.h:52
DetDescrCnvSvc::m_hasMDT
BooleanProperty m_hasMDT
Definition
DetDescrCnvSvc.h:94
DetDescrCnvSvc::m_hasCSC
BooleanProperty m_hasCSC
Switch on/off the muon detectors.
Definition
DetDescrCnvSvc.h:91
DetDescrCnvSvc::initialize
virtual StatusCode initialize()
Initialize the service.
Definition
DetDescrCnvSvc.cxx:38
DetDescrCnvSvc::createAddress
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
Basic create address.
Definition
DetDescrCnvSvc.cxx:115
DetDescrCnvSvc::DetDescrCnvSvc
DetDescrCnvSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition
DetDescrCnvSvc.cxx:25
DetDescrCnvSvc::m_hasSTGC
BooleanProperty m_hasSTGC
Definition
DetDescrCnvSvc.h:92
DetDescrCnvSvc::~DetDescrCnvSvc
virtual ~DetDescrCnvSvc()
Standard Destructor.
DetDescrCnvSvc::m_hasTRT
BooleanProperty m_hasTRT
Switch on/off the TRT.
Definition
DetDescrCnvSvc.h:87
DetDescrCnvSvc::convertAddress
virtual StatusCode convertAddress(const IOpaqueAddress *pAddress, std::string &refAddress)
Convert address to string form.
Definition
DetDescrCnvSvc.cxx:152
Generated on
for ATLAS Offline Software by
1.17.0