ATLAS Offline Software
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 
12 SCT_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
28  // Write Cond Handles
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
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 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
SCT_DCSFloatCondData
Class for data object used in SCT_DCSConditions{HV,Temp}CondAlg, SCT_DCSConditionsTool,...
Definition: SCT_DCSFloatCondData.h:30
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SCT_SiliconTempCondAlg.h
SCT_SiliconTempCondAlg::m_readKeyTemp0
SG::ReadCondHandleKey< SCT_DCSFloatCondData > m_readKeyTemp0
Definition: SCT_SiliconTempCondAlg.h:31
SCT_SiliconTempCondAlg::finalize
virtual StatusCode finalize() override final
Definition: SCT_SiliconTempCondAlg.cxx:88
SCT_SiliconTempCondAlg::m_writeKey
SG::WriteCondHandleKey< SCT_DCSFloatCondData > m_writeKey
Definition: SCT_SiliconTempCondAlg.h:32
SCT_DCSStatCondData
Classs for data object used in SCT_DCSConditionsStatCondAlg, SCT_DCSConditionsTool,...
Definition: SCT_DCSStatCondData.h:29
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
SCT_SiliconTempCondAlg::m_pHelper
const SCT_ID * m_pHelper
ID helper for SCT.
Definition: SCT_SiliconTempCondAlg.h:34
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
SCT_SiliconTempCondAlg::SCT_SiliconTempCondAlg
SCT_SiliconTempCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: SCT_SiliconTempCondAlg.cxx:12
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
SCT_ID::size_type
Identifier::size_type size_type
Definition: SCT_ID.h:72
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SCT_SiliconTempCondAlg::m_sctDCSTool
ToolHandle< ISCT_DCSConditionsTool > m_sctDCSTool
Definition: SCT_SiliconTempCondAlg.h:33
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
SCT_ID::wafer_hash_max
size_type wafer_hash_max(void) const
Definition: SCT_ID.cxx:636
IdentifierHash.h
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
SCT_SiliconTempCondAlg::m_readKeyState
SG::ReadCondHandleKey< SCT_DCSStatCondData > m_readKeyState
Definition: SCT_SiliconTempCondAlg.h:30
SCT_SiliconTempCondAlg::m_useState
BooleanProperty m_useState
Definition: SCT_SiliconTempCondAlg.h:29
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
SG::WriteCondHandle
Definition: WriteCondHandle.h:26
SCT_SiliconTempCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition: SCT_SiliconTempCondAlg.cxx:34
SCT_SiliconTempCondAlg::initialize
virtual StatusCode initialize() override final
Definition: SCT_SiliconTempCondAlg.cxx:17