ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetConditions
SCT_ConditionsAlgorithms
src
SCT_MonitorCondAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
SCT_MonitorCondAlg.h
"
6
7
#include "
InDetIdentifier/SCT_ID.h
"
8
9
#include <memory>
10
11
SCT_MonitorCondAlg::SCT_MonitorCondAlg
(
const
std::string& name, ISvcLocator* pSvcLocator)
12
: ::
AthCondAlgorithm
(name, pSvcLocator)
13
{
14
}
15
16
StatusCode
SCT_MonitorCondAlg::initialize
()
17
{
18
ATH_MSG_DEBUG
(
"initialize "
<< name());
19
20
ATH_CHECK
(
detStore
()->retrieve(
m_helper
,
"SCT_ID"
));
21
22
// Read Cond Handle
23
ATH_CHECK
(
m_readKey
.initialize());
24
25
// Write Cond Handle
26
ATH_CHECK
(
m_writeKey
.initialize());
27
28
return
StatusCode::SUCCESS;
29
}
30
31
StatusCode
SCT_MonitorCondAlg::execute
(
const
EventContext& ctx)
const
32
{
33
ATH_MSG_DEBUG
(
"execute "
<< name());
34
35
// Write Cond Handle
36
SG::WriteCondHandle<SCT_MonitorCondData>
writeHandle{
m_writeKey
, ctx};
37
38
// Do we have a valid Write Cond Handle for current time?
39
if
(writeHandle.
isValid
()) {
40
ATH_MSG_DEBUG
(
"CondHandle "
<< writeHandle.
fullKey
() <<
" is already valid."
41
<<
". In theory this should not be called, but may happen"
42
<<
" if multiple concurrent events are being processed out of order."
);
43
return
StatusCode::SUCCESS;
44
}
45
46
// Read Cond Handle
47
SG::ReadCondHandle<CondAttrListCollection>
readHandle{
m_readKey
, ctx};
48
const
CondAttrListCollection
* readCdo{*readHandle};
49
if
(readCdo==
nullptr
) {
50
ATH_MSG_FATAL
(
"Null pointer to the read conditions object"
);
51
return
StatusCode::FAILURE;
52
}
53
ATH_MSG_INFO
(
"Size of CondAttrListCollection readCdo->size()= "
<< readCdo->
size
());
54
55
// Add dependency
56
writeHandle.
addDependency
(readHandle);
57
58
// Construct the output Cond Object and fill it in
59
std::unique_ptr<SCT_MonitorCondData> writeCdo{std::make_unique<SCT_MonitorCondData>()};
60
61
// Fill Write Cond Handle
62
static
const
unsigned
int
defectListIndex{7};
63
CondAttrListCollection::const_iterator
iter{readCdo->
begin
()};
64
CondAttrListCollection::const_iterator
last{readCdo->
end
()};
65
for
(; iter!=last; ++iter) {
66
const
coral::AttributeList& list{iter->second};
67
if
(list.size()>defectListIndex) {
68
const
Identifier
moduleId{
m_helper
->module_id(
Identifier
{iter->first})};
69
const
IdentifierHash
moduleHash{
m_helper
->wafer_hash(moduleId)};
70
writeCdo->insert(moduleHash, list[defectListIndex].data<std::string>());
71
}
72
}
73
74
// Record validity of the output cond obbject
75
if
(writeHandle.
record
(std::move(writeCdo)).isFailure()) {
76
ATH_MSG_FATAL
(
"Could not record SCT_MonitorCondData "
<< writeHandle.
key
()
77
<<
" with EventRange "
<< writeHandle.
getRange
()
78
<<
" into Conditions Store"
);
79
return
StatusCode::FAILURE;
80
}
81
ATH_MSG_INFO
(
"recorded new CDO "
<< writeHandle.
key
() <<
" with range "
<< writeHandle.
getRange
() <<
" into Conditions Store"
);
82
83
return
StatusCode::SUCCESS;
84
}
85
86
StatusCode
SCT_MonitorCondAlg::finalize
()
87
{
88
ATH_MSG_DEBUG
(
"finalize "
<< name());
89
return
StatusCode::SUCCESS;
90
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
SCT_ID.h
This is an Identifier helper class for the SCT subdetector.
SCT_MonitorCondAlg.h
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthCondAlgorithm
Base class for conditions algorithms.
Definition
AthCondAlgorithm.h:22
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number.
Definition
CondAttrListCollection.h:51
CondAttrListCollection::end
const_iterator end() const
Definition
CondAttrListCollection.h:314
CondAttrListCollection::begin
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
Definition
CondAttrListCollection.h:308
CondAttrListCollection::size
size_type size() const
number of Chan/AttributeList pairs
Definition
CondAttrListCollection.h:321
CondAttrListCollection::const_iterator
ChanAttrListMap::const_iterator const_iterator
Definition
CondAttrListCollection.h:62
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
SCT_MonitorCondAlg::initialize
virtual StatusCode initialize() override final
Definition
SCT_MonitorCondAlg.cxx:16
SCT_MonitorCondAlg::finalize
virtual StatusCode finalize() override final
Definition
SCT_MonitorCondAlg.cxx:86
SCT_MonitorCondAlg::m_readKey
SG::ReadCondHandleKey< CondAttrListCollection > m_readKey
Definition
SCT_MonitorCondAlg.h:27
SCT_MonitorCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition
SCT_MonitorCondAlg.cxx:31
SCT_MonitorCondAlg::m_writeKey
SG::WriteCondHandleKey< SCT_MonitorCondData > m_writeKey
Definition
SCT_MonitorCondAlg.h:28
SCT_MonitorCondAlg::SCT_MonitorCondAlg
SCT_MonitorCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
SCT_MonitorCondAlg.cxx:11
SCT_MonitorCondAlg::m_helper
const SCT_ID * m_helper
Definition
SCT_MonitorCondAlg.h:29
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
SG::WriteCondHandle::key
const std::string & key() const
Definition
WriteCondHandle.h:44
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition
WriteCondHandle.h:279
SG::WriteCondHandle::getRange
const EventIDRange & getRange() const
Definition
WriteCondHandle.h:93
SG::WriteCondHandle::record
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
Definition
WriteCondHandle.h:161
SG::WriteCondHandle::isValid
bool isValid() const
Definition
WriteCondHandle.h:252
SG::WriteCondHandle::fullKey
const DataObjID & fullKey() const
Definition
WriteCondHandle.h:45
Identifier
Definition
IdentifierFieldParser.cxx:14
Generated on
for ATLAS Offline Software by
1.17.0