ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetConditions
SCT_ConditionsAlgorithms
src
SCT_DCSConditionsHVCondAlg.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_DCSConditionsHVCondAlg.h
"
6
7
#include "
Identifier/IdentifierHash.h
"
8
#include "
AthenaKernel/IOVInfiniteRange.h
"
9
10
#include <memory>
11
12
SCT_DCSConditionsHVCondAlg::SCT_DCSConditionsHVCondAlg
(
const
std::string& name, ISvcLocator* pSvcLocator)
13
: ::
AthCondAlgorithm
(name, pSvcLocator)
14
{
15
}
16
17
StatusCode
SCT_DCSConditionsHVCondAlg::initialize
() {
18
ATH_MSG_DEBUG
(
"initialize "
<< name());
19
20
// Read Cond Handle
21
ATH_CHECK
(
m_readKey
.initialize(
m_returnHVTemp
));
22
// Write Cond Handle
23
ATH_CHECK
(
m_writeKey
.initialize(
m_returnHVTemp
));
24
25
return
StatusCode::SUCCESS;
26
}
27
28
StatusCode
SCT_DCSConditionsHVCondAlg::execute
(
const
EventContext& ctx)
const
{
29
ATH_MSG_DEBUG
(
"execute "
<< name());
30
31
if
(not
m_returnHVTemp
) {
32
return
StatusCode::SUCCESS;
33
}
34
35
// Write Cond Handle
36
SG::WriteCondHandle<SCT_DCSFloatCondData>
writeHandle{
m_writeKey
, ctx};
37
// Do we have a valid Write Cond Handle for current time?
38
if
(writeHandle.
isValid
()) {
39
ATH_MSG_DEBUG
(
"CondHandle "
<< writeHandle.
fullKey
() <<
" is already valid."
40
<<
". In theory this should not be called, but may happen"
41
<<
" if multiple concurrent events are being processed out of order."
);
42
return
StatusCode::SUCCESS;
43
}
44
45
writeHandle.
addDependency
(
IOVInfiniteRange::infiniteMixed
());
46
47
// Read Cond Handle
48
SG::ReadCondHandle<CondAttrListCollection>
readHandle{
m_readKey
, ctx};
49
const
CondAttrListCollection
* readCdo{*readHandle};
50
if
(readCdo==
nullptr
) {
51
ATH_MSG_FATAL
(
"Null pointer to the read conditions object"
);
52
return
StatusCode::FAILURE;
53
}
54
// Add dependency
55
writeHandle.
addDependency
(readHandle);
56
ATH_MSG_INFO
(
"Size of CondAttrListCollection "
<< readHandle.
fullKey
() <<
" readCdo->size()= "
<< readCdo->
size
());
57
ATH_MSG_INFO
(
"Range of input is "
<< readHandle.
getRange
());
58
59
// Construct the output Cond Object and fill it in
60
std::unique_ptr<SCT_DCSFloatCondData> writeCdo{std::make_unique<SCT_DCSFloatCondData>()};
61
62
// Read temperature info
63
std::string param{
"HVCHVOLT_RECV"
};
64
CondAttrListCollection::const_iterator
attrList{readCdo->
begin
()};
65
CondAttrListCollection::const_iterator
end{readCdo->
end
()};
66
// CondAttrListCollection doesn't support C++11 type loops, no generic 'begin'
67
for
(; attrList!=end; ++attrList) {
68
// A CondAttrListCollection is a map of ChanNum and AttributeList
69
CondAttrListCollection::ChanNum
channelNumber{attrList->first};
70
const
CondAttrListCollection::AttributeList
&payload{attrList->second};
71
if
(payload.exists(param) and not payload[param].isNull()) {
72
float
val{payload[param].data<
float
>()};
73
writeCdo->setValue(channelNumber, val);
74
}
else
{
75
ATH_MSG_WARNING
(param <<
" does not exist for ChanNum "
<< channelNumber);
76
}
77
}
78
79
// Record the output cond object
80
if
(writeHandle.
record
(std::move(writeCdo)).isFailure()) {
81
ATH_MSG_FATAL
(
"Could not record SCT_DCSFloatCondData "
<< writeHandle.
key
()
82
<<
" with EventRange "
<< writeHandle.
getRange
()
83
<<
" into Conditions Store"
);
84
return
StatusCode::FAILURE;
85
}
86
ATH_MSG_INFO
(
"recorded new CDO "
<< writeHandle.
key
() <<
" with range "
<< writeHandle.
getRange
() <<
" into Conditions Store"
);
87
88
return
StatusCode::SUCCESS;
89
}
90
91
StatusCode
SCT_DCSConditionsHVCondAlg::finalize
()
92
{
93
ATH_MSG_DEBUG
(
"finalize "
<< name());
94
return
StatusCode::SUCCESS;
95
}
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:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:30
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:28
IOVInfiniteRange.h
IdentifierHash.h
SCT_DCSConditionsHVCondAlg.h
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
CondAttrListCollection::ChanNum
unsigned int ChanNum
Definition
CondAttrListCollection.h:54
CondAttrListCollection::AttributeList
coral::AttributeList AttributeList
Definition
CondAttrListCollection.h:55
IOVInfiniteRange::infiniteMixed
static EventIDRange infiniteMixed()
Produces an mixed EventIDRange that is infinite in Time and RunLumi.
Definition
IOVInfiniteRange.h:55
SCT_DCSConditionsHVCondAlg::m_readKey
SG::ReadCondHandleKey< CondAttrListCollection > m_readKey
Definition
SCT_DCSConditionsHVCondAlg.h:29
SCT_DCSConditionsHVCondAlg::initialize
virtual StatusCode initialize() override final
Definition
SCT_DCSConditionsHVCondAlg.cxx:17
SCT_DCSConditionsHVCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition
SCT_DCSConditionsHVCondAlg.cxx:28
SCT_DCSConditionsHVCondAlg::m_returnHVTemp
BooleanProperty m_returnHVTemp
Definition
SCT_DCSConditionsHVCondAlg.h:32
SCT_DCSConditionsHVCondAlg::finalize
virtual StatusCode finalize() override final
Definition
SCT_DCSConditionsHVCondAlg.cxx:91
SCT_DCSConditionsHVCondAlg::SCT_DCSConditionsHVCondAlg
SCT_DCSConditionsHVCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
SCT_DCSConditionsHVCondAlg.cxx:12
SCT_DCSConditionsHVCondAlg::m_writeKey
SG::WriteCondHandleKey< SCT_DCSFloatCondData > m_writeKey
Definition
SCT_DCSConditionsHVCondAlg.h:30
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::fullKey
const DataObjID & fullKey() const
Definition
ReadCondHandle.h:60
SG::ReadCondHandle::getRange
const EventIDRange & getRange()
Definition
ReadCondHandle.h:241
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
Generated on
for ATLAS Offline Software by
1.17.0