ATLAS Offline Software
Loading...
Searching...
No Matches
CaloSuperCellAlignCondAlg.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
13{
14 ATH_MSG_DEBUG("initialize " << name());
15
16 ATH_CHECK(m_scidTool.retrieve());
17 ATH_CHECK(m_readCaloMgrKey.initialize());
19
20 return StatusCode::SUCCESS;
21}
22
23StatusCode CaloSuperCellAlignCondAlg::execute(const EventContext& ctx) const
24{
25 // ____________ Construct Write Cond Handle and check its validity ____________
27 if (writeCaloSuperCellMgrHandle.isValid()) {
28 ATH_MSG_DEBUG("Found valid write handle");
29 return StatusCode::SUCCESS;
30 }
31
32 // ____________ Get Read Cond Object ____________
34 ATH_CHECK(readCaloMgrHandle.isValid());
35 ATH_MSG_DEBUG("Retrieved CaloDetDescrManager object form the Condition Store");
36 writeCaloSuperCellMgrHandle.addDependency(readCaloMgrHandle);
37
38 // ____________ Build new CaloSuperCellDetDescrManager _________________
39 std::unique_ptr<CaloSuperCellDetDescrManager> mgr = std::make_unique<CaloSuperCellDetDescrManager>();
40
41 const CaloIdManager* caloId_mgr{nullptr};
42 ATH_CHECK(detStore()->retrieve(caloId_mgr, "CaloIdManager"));
43
44 mgr->set_helper(caloId_mgr->getCaloCell_SuperCell_ID());
45 mgr->set_helper(caloId_mgr);
46 mgr->initialize();
47
48 createDescriptors(mgr.get());
49 createElements(mgr.get());
50
51 // ____________ Apply Alignment Corrections ____________________________
52 ATH_CHECK(updateElements(mgr.get(),*readCaloMgrHandle,m_scidTool.get()));
53 updateDescriptors(mgr.get(),*readCaloMgrHandle,m_scidTool.get());
54
55 ATH_CHECK(writeCaloSuperCellMgrHandle.record(std::move(mgr)));
56 ATH_MSG_INFO("recorded new CaloSuperCellDetDescr Manager condition object with key " << writeCaloSuperCellMgrHandle.key()
57 << " and range " << writeCaloSuperCellMgrHandle.getRange());
58
59 return StatusCode::SUCCESS;
60}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
void updateDescriptors(CaloSuperCellDetDescrManager *mgr, const CaloDetDescrManager *cellmgr, const ICaloSuperCellIDTool *scidTool)
This is a collection of helper functions for building Calo Super Cell detector manager,...
void createDescriptors(CaloSuperCellDetDescrManager *mgr)
void createElements(CaloSuperCellDetDescrManager *mgr)
StatusCode updateElements(CaloSuperCellDetDescrManager *mgr, const CaloDetDescrManager *cellmgr, const ICaloSuperCellIDTool *scidTool)
const ServiceHandle< StoreGateSvc > & detStore() const
This class initializes the Calo (LAr and Tile) offline identifiers.
const CaloCell_SuperCell_ID * getCaloCell_SuperCell_ID(void) const
virtual StatusCode execute(const EventContext &ctx) const override
SG::WriteCondHandleKey< CaloSuperCellDetDescrManager > m_writeCaloSuperCellMgrKey
virtual StatusCode initialize() override
ToolHandle< ICaloSuperCellIDTool > m_scidTool
SG::ReadCondHandleKey< CaloDetDescrManager > m_readCaloMgrKey
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