ATLAS Offline Software
Loading...
Searching...
No Matches
SiDetElementBoundaryLinksCondAlg_xk.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
11
12namespace InDet {
13
14 SiDetElementBoundaryLinksCondAlg_xk::SiDetElementBoundaryLinksCondAlg_xk(const std::string& name, ISvcLocator* pSvcLocator)
15 : ::AthCondAlgorithm(name, pSvcLocator)
16{
17}
18
20 {
21 ATH_MSG_DEBUG("initialize " << name());
22
23 // Read Handle
24 ATH_CHECK(m_readKey.initialize());
25
26 // Write Handle
27 ATH_CHECK(m_writeKey.initialize());
28
29 return StatusCode::SUCCESS;
30 }
31
32 StatusCode SiDetElementBoundaryLinksCondAlg_xk::execute(const EventContext& ctx) const
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 // Copied from
60 // InnerDetector/InDetRecTools/SiCombinatorialTrackFinderTool_xk/src/SiCombinatorialTrackFinder_xk.cxx
61 std::unique_ptr<InDet::SiDetElementBoundaryLinks_xk> writeCdo{std::make_unique<InDet::SiDetElementBoundaryLinks_xk>()};
62 // ____________ Fill writeCdo using readCdo ____________
63 for (const InDetDD::SiDetectorElement* newEl: *readCdo) {
65 writeCdo->push_back(dl);
66 }
67
68 // Record WriteCondHandle
69 if (writeHandle.record(std::move(writeCdo)).isFailure()) {
70 ATH_MSG_FATAL("Could not record " << writeHandle.key()
71 << " with EventRange " << writeHandle.getRange()
72 << " into Conditions Store");
73 return StatusCode::FAILURE;
74 }
75 ATH_MSG_DEBUG("recorded new CDO " << writeHandle.key() << " with range " << writeHandle.getRange() << " into ConditionStore");
76
77 return StatusCode::SUCCESS;
78 }
79
81 {
82 ATH_MSG_DEBUG("finalize " << name());
83
84 return StatusCode::SUCCESS;
85 }
86
87}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
Base class for conditions algorithms.
Class to hold the SiDetectorElement objects to be put in the detector store.
Class to hold geometrical description of a silicon detector element.
SG::WriteCondHandleKey< InDet::SiDetElementBoundaryLinks_xk > m_writeKey
Output condition object for SiCombinatorialTrackFinder_xk.
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_readKey
Input condition object, detector elements of Pixel or SCT in condition store.
SiDetElementBoundaryLinksCondAlg_xk(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode execute(const EventContext &ctx) const override
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
Primary Vertex Finder.