ATLAS Offline Software
Loading...
Searching...
No Matches
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
6
9
10#include <memory>
11
12SCT_SiliconTempCondAlg::SCT_SiliconTempCondAlg(const std::string& name, ISvcLocator* pSvcLocator)
13 : ::AthReentrantAlgorithm(name, pSvcLocator)
14{
15}
16
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
27 ATH_CHECK(m_readKeyTemp0.initialize());
28 // Write Cond Handles
29 ATH_CHECK(m_writeKey.initialize());
30
31 return StatusCode::SUCCESS;
32}
33
34StatusCode SCT_SiliconTempCondAlg::execute(const EventContext& ctx) const {
35 ATH_MSG_DEBUG("execute " << name());
36
37 // Write Cond Handle
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)
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)
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
89{
90 ATH_MSG_DEBUG("finalize " << name());
91 return StatusCode::SUCCESS;
92}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
This is an Identifier helper class for the SCT subdetector.
const ServiceHandle< StoreGateSvc > & detStore() const
An algorithm that can be simultaneously executed in multiple threads.
This is a "hash" representation of an Identifier.
Class for data object used in SCT_DCSConditions{HV,Temp}CondAlg, SCT_DCSConditionsTool,...
Classs for data object used in SCT_DCSConditionsStatCondAlg, SCT_DCSConditionsTool,...
Identifier::size_type size_type
Definition SCT_ID.h:72
SG::WriteCondHandleKey< SCT_DCSFloatCondData > m_writeKey
ToolHandle< ISCT_DCSConditionsTool > m_sctDCSTool
virtual StatusCode initialize() override final
SG::ReadCondHandleKey< SCT_DCSFloatCondData > m_readKeyTemp0
const SCT_ID * m_pHelper
ID helper for SCT.
virtual StatusCode finalize() override final
SG::ReadCondHandleKey< SCT_DCSStatCondData > m_readKeyState
SCT_SiliconTempCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode execute(const EventContext &ctx) const override final
const DataObjID & fullKey() const
const EventIDRange & getRange()
const std::string & key() const
void addDependency(const EventIDRange &range)
const EventIDRange & getRange() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const