ATLAS Offline Software
Loading...
Searching...
No Matches
SCT_LinkMaskingTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8// Athena includes
10
11// Constructor
12SCT_LinkMaskingTool::SCT_LinkMaskingTool(const std::string& type, const std::string& name, const IInterface* parent) :
13 base_class(type, name, parent)
14{
15}
16
17// Initialize
19 ATH_MSG_DEBUG("Initializing configuration");
20
21 // Retrieve SCT ID helper
22 if (detStore()->retrieve(m_sctHelper, "SCT_ID").isFailure()) {
23 ATH_MSG_FATAL("Could not get SCT ID helper");
24 return StatusCode::FAILURE;
25 }
26
27 // Read Cond Handle
28 ATH_CHECK(m_condKey.initialize());
29
30 return StatusCode::SUCCESS;
31}
32
33// What level of element can this service report about
37
38// Is an element with this Identifier and hierachy good?
39bool SCT_LinkMaskingTool::isGood(const Identifier& elementId, const EventContext& ctx, InDetConditions::Hierarchy h) const {
40 if (not canReportAbout(h)) return true;
41
42 const SCT_ModuleVetoCondData* condData{getCondData(ctx)};
43 // If database cannot be retrieved, all wafer IDs are good.
44 if (condData==nullptr) return true;
45
46 // Return the result of database
47 return (not condData->isBadWaferId(elementId));
48}
49
50// Is a wafer with this IdentifierHash good?
51bool SCT_LinkMaskingTool::isGood(const IdentifierHash& hashId, const EventContext& ctx) const {
52 Identifier elementId{m_sctHelper->wafer_id(hashId)};
53 return isGood(elementId, ctx, InDetConditions::SCT_SIDE);
54}
55
59 if (not condDataHandle.isValid()) {
60 ATH_MSG_ERROR("Failed to get " << m_condKey.key());
61 return;
62 }
63 const SCT_ModuleVetoCondData* condData{condDataHandle.cptr()};
64 if (whandle) {
65 whandle->addDependency (condDataHandle);
66 }
67 if (condData) {
68 std::vector<bool> &status = element_status.getElementStatus();
69 if (status.empty()) {
70 status.resize(m_sctHelper->wafer_hash_max(),true);
71 }
72 for (const Identifier &wafer_id: condData->badWaferIds()) {
73 status.at( m_sctHelper->wafer_hash(wafer_id) ) = false;
74 }
75 }
76}
77
79SCT_LinkMaskingTool::getCondData(const EventContext& ctx) const {
81 return condData.retrieve();
82}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
This is an Identifier helper class for the SCT subdetector.
Header file for AthHistogramAlgorithm.
This is a "hash" representation of an Identifier.
const std::vector< bool > & getElementStatus() const
virtual void getDetectorElementStatus(const EventContext &ctx, InDet::SiDetectorElementStatus &element_status, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const override
const SCT_ModuleVetoCondData * getCondData(const EventContext &ctx) const
SG::ReadCondHandleKey< SCT_ModuleVetoCondData > m_condKey
virtual bool isGood(const Identifier &elementId, const EventContext &ctx, InDetConditions::Hierarchy h=InDetConditions::DEFAULT) const override
Is the detector element good?
const SCT_ID * m_sctHelper
ID helper for SCT.
virtual bool canReportAbout(InDetConditions::Hierarchy h) const override
Can the service report about the given component?
virtual StatusCode initialize() override
SCT_LinkMaskingTool(const std::string &type, const std::string &name, const IInterface *parent)
Class for data object used in SCT_ModuleVetoCondAlg, SCT_LinkMaskingCondAlg, SCT_ModuleVetoTool,...
const std::set< Identifier > & badWaferIds() const
bool isBadWaferId(const Identifier waferId) const
Check if a wafer ID is bad or not.
const_pointer_type retrieve()
const_pointer_type cptr()
void addDependency(const EventIDRange &range)