ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetConditions
SCT_ConditionsAlgorithms
src
SCT_SiliconTempCondAlg.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_SiliconTempCondAlg.h
"
6
7
#include "
Identifier/IdentifierHash.h
"
8
#include "
InDetIdentifier/SCT_ID.h
"
9
10
#include <memory>
11
12
SCT_SiliconTempCondAlg::SCT_SiliconTempCondAlg
(
const
std::string& name, ISvcLocator* pSvcLocator)
13
: ::
AthCondAlgorithm
(name, pSvcLocator)
14
{
15
}
16
17
StatusCode
SCT_SiliconTempCondAlg::initialize
() {
18
ATH_MSG_DEBUG
(
"initialize "
<< name());
19
20
// SCT DCS tool
21
ATH_CHECK
(
m_sctDCSTool
.retrieve());
22
// SCT ID helper
23
ATH_CHECK
(
detStore
()->retrieve(
m_pHelper
,
"SCT_ID"
));
24
25
// Read Cond Handle
26
ATH_CHECK
(
m_readKeyState
.initialize(
m_useState
));
27
ATH_CHECK
(
m_readKeyTemp0
.initialize());
28
// Write Cond Handles
29
ATH_CHECK
(
m_writeKey
.initialize());
30
31
return
StatusCode::SUCCESS;
32
}
33
34
StatusCode
SCT_SiliconTempCondAlg::execute
(
const
EventContext& ctx)
const
{
35
ATH_MSG_DEBUG
(
"execute "
<< name());
36
37
// Write Cond Handle
38
SG::WriteCondHandle<SCT_DCSFloatCondData>
writeHandle{
m_writeKey
, ctx};
39
// Do we have a valid Write Cond Handle for current time?
40
if
(writeHandle.
isValid
()) {
41
ATH_MSG_DEBUG
(
"CondHandle "
<< writeHandle.
fullKey
() <<
" is already valid."
42
<<
". In theory this should not be called, but may happen"
43
<<
" if multiple concurrent events are being processed out of order."
);
44
return
StatusCode::SUCCESS;
45
}
46
47
// Read Cond Handle (temperature)
48
SG::ReadCondHandle<SCT_DCSFloatCondData>
readHandleTemp0{
m_readKeyTemp0
, ctx};
49
const
SCT_DCSFloatCondData
* readCdoTemp0{*readHandleTemp0};
50
if
(readCdoTemp0==
nullptr
) {
51
ATH_MSG_FATAL
(
"Null pointer to the read conditions object"
);
52
return
StatusCode::FAILURE;
53
}
54
writeHandle.
addDependency
(readHandleTemp0);
55
ATH_MSG_INFO
(
"Input is "
<< readHandleTemp0.
fullKey
() <<
" with the range of "
<< readHandleTemp0.
getRange
());
56
57
if
(
m_useState
) {
58
// Read Cond Handle (state)
59
SG::ReadCondHandle<SCT_DCSStatCondData>
readHandleState{
m_readKeyState
, ctx};
60
const
SCT_DCSStatCondData
* readCdoState{*readHandleState};
61
if
(readCdoState==
nullptr
) {
62
ATH_MSG_FATAL
(
"Null pointer to the read conditions object"
);
63
return
StatusCode::FAILURE;
64
}
65
writeHandle.
addDependency
(readHandleState);
66
ATH_MSG_INFO
(
"Input is "
<< readHandleState.
fullKey
() <<
" with the range of "
<< readHandleState.
getRange
());
67
}
68
69
// Construct the output Cond Object and fill it in
70
std::unique_ptr<SCT_DCSFloatCondData> writeCdo{std::make_unique<SCT_DCSFloatCondData>()};
71
const
SCT_ID::size_type
wafer_hash_max{
m_pHelper
->wafer_hash_max()};
72
for
(
SCT_ID::size_type
hash{0}; hash<wafer_hash_max; hash++) {
73
writeCdo->setValue(hash,
m_sctDCSTool
->sensorTemperature(
IdentifierHash
(hash), ctx));
74
}
75
76
// Record the output cond object
77
if
(writeHandle.
record
(std::move(writeCdo)).isFailure()) {
78
ATH_MSG_FATAL
(
"Could not record SCT_DCSFloatCondData "
<< writeHandle.
key
()
79
<<
" with EventRange "
<< writeHandle.
getRange
()
80
<<
" into Conditions Store"
);
81
return
StatusCode::FAILURE;
82
}
83
ATH_MSG_INFO
(
"recorded new CDO "
<< writeHandle.
key
() <<
" with range "
<< writeHandle.
getRange
() <<
" into Conditions Store"
);
84
85
return
StatusCode::SUCCESS;
86
}
87
88
StatusCode
SCT_SiliconTempCondAlg::finalize
()
89
{
90
ATH_MSG_DEBUG
(
"finalize "
<< name());
91
return
StatusCode::SUCCESS;
92
}
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
IdentifierHash.h
SCT_ID.h
This is an Identifier helper class for the SCT subdetector.
SCT_SiliconTempCondAlg.h
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthCondAlgorithm
Base class for conditions algorithms.
Definition
AthCondAlgorithm.h:22
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
SCT_DCSFloatCondData
Class for data object used in SCT_DCSConditions{HV,Temp}CondAlg, SCT_DCSConditionsTool,...
Definition
SCT_DCSFloatCondData.h:30
SCT_DCSStatCondData
Classs for data object used in SCT_DCSConditionsStatCondAlg, SCT_DCSConditionsTool,...
Definition
SCT_DCSStatCondData.h:29
SCT_ID::size_type
Identifier::size_type size_type
Definition
SCT_ID.h:72
SCT_SiliconTempCondAlg::m_useState
BooleanProperty m_useState
Definition
SCT_SiliconTempCondAlg.h:28
SCT_SiliconTempCondAlg::m_writeKey
SG::WriteCondHandleKey< SCT_DCSFloatCondData > m_writeKey
Definition
SCT_SiliconTempCondAlg.h:31
SCT_SiliconTempCondAlg::m_sctDCSTool
ToolHandle< ISCT_DCSConditionsTool > m_sctDCSTool
Definition
SCT_SiliconTempCondAlg.h:32
SCT_SiliconTempCondAlg::initialize
virtual StatusCode initialize() override final
Definition
SCT_SiliconTempCondAlg.cxx:17
SCT_SiliconTempCondAlg::m_readKeyTemp0
SG::ReadCondHandleKey< SCT_DCSFloatCondData > m_readKeyTemp0
Definition
SCT_SiliconTempCondAlg.h:30
SCT_SiliconTempCondAlg::m_pHelper
const SCT_ID * m_pHelper
ID helper for SCT.
Definition
SCT_SiliconTempCondAlg.h:33
SCT_SiliconTempCondAlg::finalize
virtual StatusCode finalize() override final
Definition
SCT_SiliconTempCondAlg.cxx:88
SCT_SiliconTempCondAlg::m_readKeyState
SG::ReadCondHandleKey< SCT_DCSStatCondData > m_readKeyState
Definition
SCT_SiliconTempCondAlg.h:29
SCT_SiliconTempCondAlg::SCT_SiliconTempCondAlg
SCT_SiliconTempCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
SCT_SiliconTempCondAlg.cxx:12
SCT_SiliconTempCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition
SCT_SiliconTempCondAlg.cxx:34
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