ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetConditions
SCT_ConditionsTools
src
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
5
#include "
SCT_LinkMaskingTool.h
"
6
#include "
SCT_ReadoutGeometry/SCT_DetectorElementStatus.h
"
7
8
// Athena includes
9
#include "
InDetIdentifier/SCT_ID.h
"
10
11
// Constructor
12
SCT_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
18
StatusCode
SCT_LinkMaskingTool::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
34
bool
SCT_LinkMaskingTool::canReportAbout
(
InDetConditions::Hierarchy
h
)
const
{
35
return
(
h
==
InDetConditions::SCT_SIDE
or
h
==
InDetConditions::DEFAULT
);
36
}
37
38
// Is an element with this Identifier and hierachy good?
39
bool
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?
51
bool
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
56
void
SCT_LinkMaskingTool::getDetectorElementStatus
(
const
EventContext& ctx,
InDet::SiDetectorElementStatus
&element_status,
57
SG::WriteCondHandle<InDet::SiDetectorElementStatus>
* whandle)
const
{
58
SG::ReadCondHandle<SCT_ModuleVetoCondData>
condDataHandle{
m_condKey
, ctx};
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
78
const
SCT_ModuleVetoCondData
*
79
SCT_LinkMaskingTool::getCondData
(
const
EventContext& ctx)
const
{
80
SG::ReadCondHandle<SCT_ModuleVetoCondData>
condData{
m_condKey
, ctx};
81
return
condData.
retrieve
();
82
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
SCT_DetectorElementStatus.h
SCT_ID.h
This is an Identifier helper class for the SCT subdetector.
SCT_LinkMaskingTool.h
h
Header file for AthHistogramAlgorithm.
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
InDet::SiDetectorElementStatus
Definition
SiDetectorElementStatus.h:62
InDet::SiDetectorElementStatus::getElementStatus
const std::vector< bool > & getElementStatus() const
Definition
SiDetectorElementStatus.h:116
SCT_LinkMaskingTool::getDetectorElementStatus
virtual void getDetectorElementStatus(const EventContext &ctx, InDet::SiDetectorElementStatus &element_status, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const override
Definition
SCT_LinkMaskingTool.cxx:56
SCT_LinkMaskingTool::getCondData
const SCT_ModuleVetoCondData * getCondData(const EventContext &ctx) const
Definition
SCT_LinkMaskingTool.cxx:79
SCT_LinkMaskingTool::m_condKey
SG::ReadCondHandleKey< SCT_ModuleVetoCondData > m_condKey
Definition
SCT_LinkMaskingTool.h:58
SCT_LinkMaskingTool::isGood
virtual bool isGood(const Identifier &elementId, const EventContext &ctx, InDetConditions::Hierarchy h=InDetConditions::DEFAULT) const override
Is the detector element good?
Definition
SCT_LinkMaskingTool.cxx:39
SCT_LinkMaskingTool::m_sctHelper
const SCT_ID * m_sctHelper
ID helper for SCT.
Definition
SCT_LinkMaskingTool.h:55
SCT_LinkMaskingTool::canReportAbout
virtual bool canReportAbout(InDetConditions::Hierarchy h) const override
Can the service report about the given component?
Definition
SCT_LinkMaskingTool.cxx:34
SCT_LinkMaskingTool::initialize
virtual StatusCode initialize() override
Definition
SCT_LinkMaskingTool.cxx:18
SCT_LinkMaskingTool::SCT_LinkMaskingTool
SCT_LinkMaskingTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
SCT_LinkMaskingTool.cxx:12
SCT_ModuleVetoCondData
Class for data object used in SCT_ModuleVetoCondAlg, SCT_LinkMaskingCondAlg, SCT_ModuleVetoTool,...
Definition
SCT_ModuleVetoCondData.h:27
SCT_ModuleVetoCondData::badWaferIds
const std::set< Identifier > & badWaferIds() const
Definition
SCT_ModuleVetoCondData.h:46
SCT_ModuleVetoCondData::isBadWaferId
bool isBadWaferId(const Identifier waferId) const
Check if a wafer ID is bad or not.
Definition
SCT_ModuleVetoCondData.cxx:23
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::retrieve
const_pointer_type retrieve()
Definition
ReadCondHandle.h:161
SG::ReadCondHandle::isValid
bool isValid()
Definition
ReadCondHandle.h:205
SG::ReadCondHandle::cptr
const_pointer_type cptr()
Definition
ReadCondHandle.h:67
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition
WriteCondHandle.h:279
Identifier
Definition
IdentifierFieldParser.cxx:14
InDetConditions::Hierarchy
Hierarchy
Definition
InDetHierarchy.h:14
InDetConditions::DEFAULT
@ DEFAULT
Definition
InDetHierarchy.h:14
InDetConditions::SCT_SIDE
@ SCT_SIDE
Definition
InDetHierarchy.h:14
type
Generated on
for ATLAS Offline Software by
1.17.0