ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetConditions
SCT_ConditionsTools
src
SCT_RODVetoTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
10
11
#include "
SCT_RODVetoTool.h
"
12
#include "
InDetReadoutGeometry/SiDetectorElementCollection.h
"
13
#include "
SCT_ReadoutGeometry/SCT_DetectorElementStatus.h
"
14
15
//Athena includes
16
#include "
Identifier/IdentifierHash.h
"
17
#include "
InDetIdentifier/SCT_ID.h
"
18
#include "
StoreGate/ReadHandle.h
"
19
20
//STL includes
21
#include <algorithm>
22
#include <iterator>
23
#include <list>
24
#include <sstream>
25
#include <vector>
26
27
// Constructor
28
SCT_RODVetoTool::SCT_RODVetoTool
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent) :
29
base_class(
type
, name, parent)
30
{
31
}
32
33
//Initialize
34
StatusCode
35
SCT_RODVetoTool::initialize
() {
36
ATH_CHECK
(detStore()->retrieve(
m_pHelper
,
"SCT_ID"
));
37
ATH_CHECK
(
m_badModuleIds
.initialize());
38
39
return
StatusCode::SUCCESS;
40
}
41
42
//Finalize
43
StatusCode
44
SCT_RODVetoTool::finalize
() {
45
return
StatusCode::SUCCESS;
46
}
47
48
bool
49
SCT_RODVetoTool::canReportAbout
(
InDetConditions::Hierarchy
h
)
const
{
50
return
((
h
==
InDetConditions::DEFAULT
) or
51
(
h
==
InDetConditions::SCT_SIDE
) or
52
(
h
==
InDetConditions::SCT_MODULE
));
53
}
54
55
bool
56
SCT_RODVetoTool::isGood
(
const
Identifier
& elementId,
const
EventContext& ctx,
InDetConditions::Hierarchy
h
)
const
{
57
if
(not
canReportAbout
(
h
))
return
true
;
58
const
IdentifierSet
* badIds{
getCondData
(ctx)};
59
if
(badIds==
nullptr
) {
60
ATH_MSG_ERROR
(
"IdentifierSet cannot be retrieved in isGood. true is returned."
);
61
return
true
;
62
}
63
const
Identifier
waferId{
m_pHelper
->wafer_id(elementId)};
64
const
Identifier
moduleId{
m_pHelper
->module_id(waferId)};
65
bool
result{badIds->find(moduleId) == badIds->end()};
66
return
result;
67
}
68
69
bool
70
SCT_RODVetoTool::isGood
(
const
IdentifierHash
& hashId,
const
EventContext& ctx)
const
{
71
Identifier
elementId{
m_pHelper
->wafer_id(hashId)};
72
Identifier
moduleId{
m_pHelper
->module_id(elementId)};
73
return
isGood
(moduleId, ctx,
InDetConditions::SCT_MODULE
);
74
}
75
76
void
77
SCT_RODVetoTool::getDetectorElementStatus
(
const
EventContext& ctx,
InDet::SiDetectorElementStatus
&element_status,
78
SG::WriteCondHandle<InDet::SiDetectorElementStatus>
* whandle)
const
{
79
SG::ReadCondHandle<IdentifierSet>
condDataHandle{
m_badModuleIds
, ctx};
80
if
(not condDataHandle.
isValid
() || !condDataHandle.
cptr
()) {
81
ATH_MSG_ERROR
(
"Failed to get "
<<
m_badModuleIds
.key());
82
return
;
83
}
84
if
(whandle) {
85
whandle->
addDependency
(condDataHandle);
86
}
87
const
IdentifierSet
* badIds{ condDataHandle.
cptr
() };
88
if
(badIds==
nullptr
) {
89
ATH_MSG_ERROR
(
"IdentifierSet cannot be retrieved in isGood. true is returned."
);
90
return
;
91
}
92
std::vector<bool> &status = element_status.
getElementStatus
();
93
if
(status.empty()) {
94
status.resize(
m_pHelper
->wafer_hash_max(),
true
);
95
}
96
for
(
const
Identifier
&module_id: *badIds) {
97
for
(
int
side_i=0; side_i<2; ++side_i) {
98
Identifier
wafer_id(
m_pHelper
->wafer_id(
m_pHelper
->barrel_ec(module_id),
99
m_pHelper
->layer_disk(module_id),
100
m_pHelper
->phi_module(module_id),
101
m_pHelper
->eta_module(module_id),
102
side_i));
103
status.at(
m_pHelper
->wafer_hash(wafer_id) ) =
false
;
104
}
105
}
106
}
107
108
const
IdentifierSet
*
109
SCT_RODVetoTool::getCondData
(
const
EventContext& ctx)
const
{
110
SG::ReadCondHandle<IdentifierSet>
condData{
m_badModuleIds
, ctx};
111
if
(not condData.
isValid
()) {
112
ATH_MSG_ERROR
(
"Failed to get "
<<
m_badModuleIds
.key());
113
return
nullptr
;
114
}
115
return
condData.
cptr
();
116
}
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:47
IdentifierHash.h
IdentifierSet
std::set< Identifier > IdentifierSet
IdentifierSet is std::set of Identifier and used in SCT_RODVetoCondAlg and SCT_RODVetoTool.
Definition
IdentifierSet.h:18
SCT_DetectorElementStatus.h
SCT_ID.h
This is an Identifier helper class for the SCT subdetector.
SCT_RODVetoTool.h
header file for tool allowing one to declare modules as bad
SiDetectorElementCollection.h
ReadHandle.h
Handle class for reading from StoreGate.
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_RODVetoTool::getCondData
const IdentifierSet * getCondData(const EventContext &ctx) const
Definition
SCT_RODVetoTool.cxx:109
SCT_RODVetoTool::initialize
virtual StatusCode initialize() override
Definition
SCT_RODVetoTool.cxx:35
SCT_RODVetoTool::canReportAbout
virtual bool canReportAbout(InDetConditions::Hierarchy h) const override
Can the service report about the given component? (chip, module...).
Definition
SCT_RODVetoTool.cxx:49
SCT_RODVetoTool::isGood
virtual bool isGood(const Identifier &elementId, const EventContext &ctx, InDetConditions::Hierarchy h=InDetConditions::DEFAULT) const override
Is the detector element good?
Definition
SCT_RODVetoTool.cxx:56
SCT_RODVetoTool::finalize
virtual StatusCode finalize() override
Definition
SCT_RODVetoTool.cxx:44
SCT_RODVetoTool::m_badModuleIds
SG::ReadCondHandleKey< IdentifierSet > m_badModuleIds
Definition
SCT_RODVetoTool.h:67
SCT_RODVetoTool::m_pHelper
const SCT_ID * m_pHelper
Definition
SCT_RODVetoTool.h:69
SCT_RODVetoTool::getDetectorElementStatus
virtual void getDetectorElementStatus(const EventContext &ctx, InDet::SiDetectorElementStatus &element_status, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const override
Definition
SCT_RODVetoTool.cxx:77
SCT_RODVetoTool::SCT_RODVetoTool
SCT_RODVetoTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
SCT_RODVetoTool.cxx:28
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
Identifier
Definition
IdentifierFieldParser.cxx:14
InDetConditions::Hierarchy
Hierarchy
Definition
InDetHierarchy.h:14
InDetConditions::SCT_MODULE
@ SCT_MODULE
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