ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetConditions
SCT_ConditionsTools
src
SCT_TdaqEnabledTool.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_TdaqEnabledTool.h
"
12
#include "
InDetReadoutGeometry/SiDetectorElementCollection.h
"
13
#include "
SCT_ReadoutGeometry/SCT_DetectorElementStatus.h
"
14
15
#include "
InDetIdentifier/SCT_ID.h
"
16
#include "
StoreGate/ReadCondHandle.h
"
17
#include "
StoreGate/ReadHandle.h
"
18
19
// Constructor
20
SCT_TdaqEnabledTool::SCT_TdaqEnabledTool
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent):
21
base_class(
type
, name, parent)
22
{
23
}
24
25
//Initialize
26
StatusCode
27
SCT_TdaqEnabledTool::initialize
() {
28
const
std::string databaseUseString{
m_useDatabase
?
""
:
"not "
};
29
ATH_MSG_INFO
(
" Database will "
<<databaseUseString<<
"be used."
);
30
31
ATH_CHECK
(detStore()->retrieve(
m_pHelper
,
"SCT_ID"
));
32
// Read Cond Handle Key
33
ATH_CHECK
(
m_condKey
.initialize(
m_useDatabase
));
34
35
return
StatusCode::SUCCESS;
36
}
37
38
//Finalize
39
StatusCode
40
SCT_TdaqEnabledTool::finalize
() {
41
return
StatusCode::SUCCESS;
42
}
43
44
bool
45
SCT_TdaqEnabledTool::canReportAbout
(
InDetConditions::Hierarchy
h
)
const
{
46
return
(
h
==
InDetConditions::DEFAULT
or
h
==
InDetConditions::SCT_SIDE
or
h
==
InDetConditions::SCT_MODULE
);
47
}
48
49
bool
50
SCT_TdaqEnabledTool::isGood
(
const
Identifier
& elementId,
const
EventContext& ctx,
InDetConditions::Hierarchy
h
)
const
{
51
if
(not
canReportAbout
(
h
))
return
true
;
52
//turn to hash, given the identifier
53
const
IdentifierHash
hashId{
m_pHelper
->wafer_hash(elementId)};
54
return
isGood
(hashId, ctx);
55
}
56
57
bool
58
SCT_TdaqEnabledTool::isGood
(
const
IdentifierHash
& hashId,
const
EventContext& ctx)
const
{
59
const
SCT_TdaqEnabledCondData
* condData{
getCondData
(ctx)};
60
if
(condData==
nullptr
)
return
false
;
61
return
condData->
isGood
(hashId);
62
}
63
64
void
65
SCT_TdaqEnabledTool::getDetectorElementStatus
(
const
EventContext& ctx,
InDet::SiDetectorElementStatus
&element_status,
66
SG::WriteCondHandle<InDet::SiDetectorElementStatus>
* whandle)
const
{
67
SG::ReadCondHandle<SCT_TdaqEnabledCondData>
condDataHandle{
m_condKey
, ctx};
68
if
(not condDataHandle.
isValid
()) {
69
ATH_MSG_ERROR
(
"Invalid cond data handle "
<<
m_condKey
.key() );
70
return
;
71
}
72
if
(whandle) {
73
whandle->
addDependency
(condDataHandle);
74
}
75
const
SCT_TdaqEnabledCondData
* condData{condDataHandle.
cptr
()};
76
if
(condData==
nullptr
) {
77
ATH_MSG_ERROR
(
"Invalid TdaqEnabledCondData. Return true."
);
78
return ;
79
}
80
std::vector<bool> &status = element_status.
getElementStatus
();
81
if
(status.empty()) {
82
status.resize(
m_pHelper
->wafer_hash_max(),
true
);
83
}
84
if
(not condData->
isNoneBad
()) {
85
std::vector<bool> tdaq_enabled;
86
tdaq_enabled.resize(
m_pHelper
->wafer_hash_max(),
false
);
87
for
(
const
IdentifierHash
&id_hash : condData->
goodIdHashes
() ) {
88
tdaq_enabled.at(id_hash.value())=
true
;
89
}
90
for
(
unsigned
int
status_i=0; status_i<status.size(); ++status_i) {
91
status[status_i] = status[status_i] && tdaq_enabled.at(status_i);
92
}
93
}
94
95
}
96
97
const
SCT_TdaqEnabledCondData
*
98
SCT_TdaqEnabledTool::getCondData
(
const
EventContext& ctx)
const
{
99
SG::ReadCondHandle<SCT_TdaqEnabledCondData>
condData{
m_condKey
, ctx};
100
return
condData.
retrieve
();
101
}
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_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ReadCondHandle.h
SCT_DetectorElementStatus.h
SCT_ID.h
This is an Identifier helper class for the SCT subdetector.
SCT_TdaqEnabledTool.h
interface file for tool that keeps track of Tdaq enabling/disabling of SCT Rods.
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_TdaqEnabledCondData
Class for data object used in SCT_TdaqEnabledCondAlg and SCT_TdaqEnabledTool.
Definition
SCT_TdaqEnabledCondData.h:27
SCT_TdaqEnabledCondData::isGood
bool isGood(const IdentifierHash &hashId) const
Check if a module is good.
Definition
SCT_TdaqEnabledCondData.cxx:74
SCT_TdaqEnabledCondData::isNoneBad
bool isNoneBad() const
Get noneBad value.
Definition
SCT_TdaqEnabledCondData.cxx:67
SCT_TdaqEnabledCondData::goodIdHashes
const std::set< IdentifierHash > & goodIdHashes() const
Definition
SCT_TdaqEnabledCondData.h:63
SCT_TdaqEnabledTool::SCT_TdaqEnabledTool
SCT_TdaqEnabledTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
SCT_TdaqEnabledTool.cxx:20
SCT_TdaqEnabledTool::m_useDatabase
bool m_useDatabase
Definition
SCT_TdaqEnabledTool.h:56
SCT_TdaqEnabledTool::canReportAbout
virtual bool canReportAbout(InDetConditions::Hierarchy h) const override
Can the service report about the given component? (TdaqEnabledSvc can answer questions about a module...
Definition
SCT_TdaqEnabledTool.cxx:45
SCT_TdaqEnabledTool::getDetectorElementStatus
virtual void getDetectorElementStatus(const EventContext &ctx, InDet::SiDetectorElementStatus &element_status, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const override
Definition
SCT_TdaqEnabledTool.cxx:65
SCT_TdaqEnabledTool::m_condKey
SG::ReadCondHandleKey< SCT_TdaqEnabledCondData > m_condKey
Definition
SCT_TdaqEnabledTool.h:58
SCT_TdaqEnabledTool::isGood
virtual bool isGood(const Identifier &elementId, const EventContext &ctx, InDetConditions::Hierarchy h=InDetConditions::DEFAULT) const override
Is the detector element good?
Definition
SCT_TdaqEnabledTool.cxx:50
SCT_TdaqEnabledTool::getCondData
const SCT_TdaqEnabledCondData * getCondData(const EventContext &ctx) const
Definition
SCT_TdaqEnabledTool.cxx:98
SCT_TdaqEnabledTool::initialize
virtual StatusCode initialize() override
Definition
SCT_TdaqEnabledTool.cxx:27
SCT_TdaqEnabledTool::m_pHelper
const SCT_ID * m_pHelper
Definition
SCT_TdaqEnabledTool.h:55
SCT_TdaqEnabledTool::finalize
virtual StatusCode finalize() override
Definition
SCT_TdaqEnabledTool.cxx:40
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::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