ATLAS Offline Software
Loading...
Searching...
No Matches
SCT_LinkMaskingTool.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
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
51 const EventContext& ctx{Gaudi::Hive::currentContext()};
52
53 return isGood(elementId, ctx, h);
54}
55
56// Is a wafer with this IdentifierHash good?
57bool SCT_LinkMaskingTool::isGood(const IdentifierHash& hashId, const EventContext& ctx) const {
58 Identifier elementId{m_sctHelper->wafer_id(hashId)};
59 return isGood(elementId, ctx, InDetConditions::SCT_SIDE);
60}
61
63 const EventContext& ctx{Gaudi::Hive::currentContext()};
64
65 return isGood(hashId, ctx);
66}
67
71 if (not condDataHandle.isValid()) {
72 ATH_MSG_ERROR("Failed to get " << m_condKey.key());
73 return;
74 }
75 const SCT_ModuleVetoCondData* condData{condDataHandle.cptr()};
76 if (whandle) {
77 whandle->addDependency (condDataHandle);
78 }
79 if (condData) {
80 std::vector<bool> &status = element_status.getElementStatus();
81 if (status.empty()) {
82 status.resize(m_sctHelper->wafer_hash_max(),true);
83 }
84 for (const Identifier &wafer_id: condData->badWaferIds()) {
85 status.at( m_sctHelper->wafer_hash(wafer_id) ) = false;
86 }
87 }
88}
89
91SCT_LinkMaskingTool::getCondData(const EventContext& ctx) const {
93 return condData.retrieve();
94}
#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, 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)