ATLAS Offline Software
Loading...
Searching...
No Matches
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
7
8PixelDetectorElementStatusToolBase::PixelDetectorElementStatusToolBase(const std::string& type, const std::string& name, const IInterface* parent)
9 :base_class(type, name, parent)
10{
11}
12
14
16 ATH_CHECK(detStore()->retrieve(m_pixelID,"PixelID"));
17 ATH_CHECK(m_pixelDetEleCollKey.initialize());
19
20 return StatusCode::SUCCESS;
21}
22
23namespace {
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
33std::unique_ptr<InDet::SiDetectorElementStatus>
36 if (!m_pixelDetElStatusCondKey.empty()) {
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 {
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
#define ATH_CHECK
Evaluate an expression and check for errors.
Class to hold the SiDetectorElement objects to be put in the detector store.
Event data to hold the status information for Pixel modules.
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
PixelDetectorElementStatusToolBase(const std::string &type, const std::string &name, const IInterface *parent)
std::unique_ptr< InDet::SiDetectorElementStatus > createDetectorElementStatus(const EventContext &ctx, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const
Create a new detector element status element container.
SG::ReadCondHandleKey< InDet::SiDetectorElementStatus > m_pixelDetElStatusCondKey
const_pointer_type cptr()
void addDependency(const EventIDRange &range)
MsgStream & msg
Definition testRead.cxx:32