ATLAS Offline Software
SiElementPropertiesTableCondAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
9 
10 #include <memory>
11 
12 namespace InDet {
13 
14  SiElementPropertiesTableCondAlg::SiElementPropertiesTableCondAlg(const std::string& name, ISvcLocator* pSvcLocator)
15  : ::AthReentrantAlgorithm(name, pSvcLocator)
16 {
17 }
18 
20  {
21  // Read Handle
23 
24  // Write Handle
26 
27  ATH_CHECK(detStore()->retrieve(m_idHelper, "SCT_ID"));
28 
29  return StatusCode::SUCCESS;
30  }
31 
33  {
34  ATH_MSG_DEBUG("execute " << name());
35 
36  // ____________ Construct Write Cond Handle and check its validity ____________
38 
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  // ____________ Get Read Cond Object ____________
49  const InDetDD::SiDetectorElementCollection* readCdo{*readHandle};
50  if (readCdo==nullptr) {
51  ATH_MSG_FATAL("Null pointer to the read conditions object of " << m_readKey.key());
52  return StatusCode::FAILURE;
53  }
54 
55  // Add dependency
56  writeHandle.addDependency(readHandle);
57 
58  // ____________ Construct new Write Cond Object ____________
59  std::unique_ptr<InDet::SiElementPropertiesTable> writeCdo{std::make_unique<InDet::SiElementPropertiesTable>(*m_idHelper, *readCdo, m_epsWidth)};
60 
61  // ____________ Fill writeCdo using readCdo ____________
62 
63  // Record WriteCondHandle
64  if (writeHandle.record(std::move(writeCdo)).isFailure()) {
65  ATH_MSG_FATAL("Could not record " << writeHandle.key()
66  << " with EventRange " << writeHandle.getRange()
67  << " into Conditions Store");
68  return StatusCode::FAILURE;
69  }
70  ATH_MSG_DEBUG("recorded new CDO " << writeHandle.key() << " with range " << writeHandle.getRange() << " into ConditionStore");
71 
72  return StatusCode::SUCCESS;
73  }
74 
76  {
77  return StatusCode::SUCCESS;
78  }
79 
80 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
InDet::SiElementPropertiesTableCondAlg::m_writeKey
SG::WriteCondHandleKey< InDet::SiElementPropertiesTable > m_writeKey
Definition: SiElementPropertiesTableCondAlg.h:56
InDet::SiElementPropertiesTableCondAlg::m_idHelper
const SCT_ID * m_idHelper
Definition: SiElementPropertiesTableCondAlg.h:70
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...
InDet::SiElementPropertiesTableCondAlg::m_epsWidth
FloatProperty m_epsWidth
Definition: SiElementPropertiesTableCondAlg.h:63
InDetDD::SiDetectorElementCollection
Definition: SiDetectorElementCollection.h:30
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
SiElementPropertiesTableCondAlg.h
InDet
Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
InDet::SiElementPropertiesTableCondAlg::initialize
virtual StatusCode initialize() override final
Definition: SiElementPropertiesTableCondAlg.cxx:19
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
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
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
InDet::SiElementPropertiesTableCondAlg::SiElementPropertiesTableCondAlg
SiElementPropertiesTableCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: SiElementPropertiesTableCondAlg.cxx:14
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
InDet::SiElementPropertiesTableCondAlg::finalize
virtual StatusCode finalize() override final
Definition: SiElementPropertiesTableCondAlg.cxx:75
SiDetectorElement.h
InDet::SiElementPropertiesTableCondAlg::m_readKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_readKey
Definition: SiElementPropertiesTableCondAlg.h:49
InDet::SiElementPropertiesTableCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition: SiElementPropertiesTableCondAlg.cxx:32
SG::WriteCondHandle
Definition: WriteCondHandle.h:26