ATLAS Offline Software
Loading...
Searching...
No Matches
CaloAlignCondAlg.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 "CaloAlignCondAlg.h"
6
10
11#include <memory>
12
14{
15 ATH_MSG_DEBUG("initialize " << name());
16
19 ATH_CHECK(m_writeCaloMgrKey.initialize());
20
21 return StatusCode::SUCCESS;
22}
23
24StatusCode CaloAlignCondAlg::execute(const EventContext& ctx) const
25{
26 // ____________ Construct Write Cond Handle and check its validity ____________
28 if (writeCaloMgrHandle.isValid()) {
29 ATH_MSG_DEBUG("Found valid write handle");
30 return StatusCode::SUCCESS;
31 }
32
33 // ____________ Get Read Cond Objects ____________
34 // 1. GeoAlignmentStore
35 const GeoAlignmentStore* geoAlign{nullptr};
36 if(!m_readKeyGeoAlign.empty()) {
38 ATH_CHECK(readHandleGeoAlign.isValid());
39 ATH_MSG_DEBUG("Retrieved GeoAlignmentStore object form the Condition Store");
40 writeCaloMgrHandle.addDependency(readHandleGeoAlign);
41 geoAlign = *readHandleGeoAlign;
42 }
43
44 // 2. CaloCellPositionShift
45 const CaloRec::CaloCellPositionShift* cellPosShift{nullptr};
46 if(!m_readKeyCellPosShift.empty()) {
48 ATH_CHECK(readHandleCellPosShift.isValid());
49 ATH_MSG_DEBUG("Retrieved CaloRec::CaloCellPositionShift object form the Condition Store");
50 writeCaloMgrHandle.addDependency(readHandleCellPosShift);
51 cellPosShift = *readHandleCellPosShift;
52 }
53
54 if(m_readKeyGeoAlign.empty() && m_readKeyCellPosShift.empty()) {
55 writeCaloMgrHandle.addDependency(EventIDRange(IOVInfiniteRange::infiniteRunLB()));
56 }
57
58 // ____________ Build new CaloDetDescrManager _________________
59 std::unique_ptr<CaloDetDescrManager> caloMgr = buildCaloDetDescr(serviceLocator()
61 , geoAlign
62 , cellPosShift);
63
64 ATH_CHECK(writeCaloMgrHandle.record(std::move(caloMgr)));
65 ATH_MSG_INFO("recorded new CaloDetDescr Manager condition object with key " << writeCaloMgrHandle.key()
66 << " and range " << writeCaloMgrHandle.getRange());
67
68 return StatusCode::SUCCESS;
69}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
std::unique_ptr< CaloDetDescrManager > buildCaloDetDescr(ISvcLocator *svcLocator, IMessageSvc *msgSvc, const GeoAlignmentStore *geoAlignStore, const CaloRec::CaloCellPositionShift *cellPosShift)
virtual StatusCode execute(const EventContext &ctx) const override
virtual StatusCode initialize() override
SG::ReadCondHandleKey< CaloRec::CaloCellPositionShift > m_readKeyCellPosShift
SG::ReadCondHandleKey< GeoAlignmentStore > m_readKeyGeoAlign
SG::WriteCondHandleKey< CaloDetDescrManager > m_writeCaloMgrKey
Container for a cell-level rescaling-factors, typically obtained by Z->ee intercalibration.
Ensure that the extensions for the Vector3D are properly loaded.
static EventIDRange infiniteRunLB()
Produces an EventIDRange that is infinite in RunLumi and invalid in Time.
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
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)