ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetConditions
PixelConditionsTools
src
PixelDetectorElementStatusToolBase.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
PixelDetectorElementStatusToolBase.h
"
6
#include "
PixelReadoutGeometry/PixelDetectorElementStatus.h
"
7
8
PixelDetectorElementStatusToolBase::PixelDetectorElementStatusToolBase
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent)
9
:base_class(
type
, name, parent)
10
{
11
}
12
13
PixelDetectorElementStatusToolBase::~PixelDetectorElementStatusToolBase
()=
default
;
14
15
StatusCode
PixelDetectorElementStatusToolBase::initialize
(){
16
ATH_CHECK
(detStore()->retrieve(
m_pixelID
,
"PixelID"
));
17
ATH_CHECK
(
m_pixelDetEleCollKey
.initialize());
18
ATH_CHECK
(
m_pixelDetElStatusCondKey
.initialize( !
m_pixelDetElStatusCondKey
.empty()));
19
20
return
StatusCode::SUCCESS;
21
}
22
23
namespace
{
24
const
InDet::PixelDetectorElementStatus
*castToDerived(
const
InDet::SiDetectorElementStatus
*input) {
25
const
InDet::PixelDetectorElementStatus
*ret =
dynamic_cast<
const
InDet::PixelDetectorElementStatus
*
>
(input);
26
if
(!ret) {
27
throw
std::runtime_error(
"Object is not of expected type InDet::PixelDetectorElementStatus"
);
28
}
29
return
ret;
30
}
31
}
32
33
std::unique_ptr<InDet::SiDetectorElementStatus>
34
PixelDetectorElementStatusToolBase::createDetectorElementStatus
(
const
EventContext& ctx,
35
SG::WriteCondHandle<InDet::SiDetectorElementStatus>
* whandle)
const
{
36
if
(!
m_pixelDetElStatusCondKey
.empty()) {
37
SG::ReadCondHandle<InDet::SiDetectorElementStatus>
input_element_status{
m_pixelDetElStatusCondKey
, ctx};
38
if
(whandle) {
39
whandle->
addDependency
(input_element_status);
40
}
41
42
return
std::make_unique<InDet::PixelDetectorElementStatus>(*castToDerived(input_element_status.
cptr
()));
43
}
44
else
{
45
SG::ReadCondHandle<InDetDD::SiDetectorElementCollection>
pixelDetEleHandle(
m_pixelDetEleCollKey
, ctx);
46
if
(not pixelDetEleHandle.
isValid
() ) {
47
std::stringstream
msg
;
48
msg
<<
m_pixelDetEleCollKey
.fullKey() <<
" is not available."
;
49
throw
std::runtime_error(
msg
.str());
50
}
51
if
(whandle) {
52
whandle->
addDependency
(pixelDetEleHandle);
53
}
54
const
InDetDD::SiDetectorElementCollection
* elements(*pixelDetEleHandle);
55
return
std::make_unique<InDet::PixelDetectorElementStatus>(*elements);
56
}
57
}
58
59
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
PixelDetectorElementStatusToolBase.h
PixelDetectorElementStatus.h
InDetDD::SiDetectorElementCollection
Class to hold the SiDetectorElement objects to be put in the detector store.
Definition
SiDetectorElementCollection.h:27
InDet::PixelDetectorElementStatus
Event data to hold the status information for Pixel modules.
Definition
PixelDetectorElementStatus.h:14
InDet::SiDetectorElementStatus
Definition
SiDetectorElementStatus.h:62
PixelDetectorElementStatusToolBase::m_pixelDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
Definition
PixelDetectorElementStatusToolBase.h:42
PixelDetectorElementStatusToolBase::PixelDetectorElementStatusToolBase
PixelDetectorElementStatusToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Definition
PixelDetectorElementStatusToolBase.cxx:8
PixelDetectorElementStatusToolBase::createDetectorElementStatus
std::unique_ptr< InDet::SiDetectorElementStatus > createDetectorElementStatus(const EventContext &ctx, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const
Create a new detector element status element container.
Definition
PixelDetectorElementStatusToolBase.cxx:34
PixelDetectorElementStatusToolBase::initialize
virtual StatusCode initialize() override
Definition
PixelDetectorElementStatusToolBase.cxx:15
PixelDetectorElementStatusToolBase::~PixelDetectorElementStatusToolBase
virtual ~PixelDetectorElementStatusToolBase()
PixelDetectorElementStatusToolBase::m_pixelID
const PixelID * m_pixelID
Definition
PixelDetectorElementStatusToolBase.h:38
PixelDetectorElementStatusToolBase::m_pixelDetElStatusCondKey
SG::ReadCondHandleKey< InDet::SiDetectorElementStatus > m_pixelDetElStatusCondKey
Definition
PixelDetectorElementStatusToolBase.h:45
SG::ReadCondHandle
Definition
ReadCondHandle.h:39
SG::ReadCondHandle::isValid
bool isValid()
Definition
ReadCondHandle.h:204
SG::ReadCondHandle::cptr
const_pointer_type cptr()
Definition
ReadCondHandle.h:66
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition
WriteCondHandle.h:279
type
msg
MsgStream & msg
Definition
testRead.cxx:32
Generated on
for ATLAS Offline Software by
1.17.0