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
24{
25 const EventContext& ctx = Gaudi::Hive::currentContext();
26 // ____________ Construct Write Cond Handle and check its validity ____________
28 if (writeCaloSuperCellMgrHandle.isValid()) {
29 ATH_MSG_DEBUG("Found valid write handle");
30 return StatusCode::SUCCESS;
31 }
32
33 // ____________ Get Read Cond Object ____________
35 ATH_CHECK(readCaloMgrHandle.isValid());
36 ATH_MSG_DEBUG("Retrieved CaloDetDescrManager object form the Condition Store");
37 writeCaloSuperCellMgrHandle.addDependency(readCaloMgrHandle);
38
39 // ____________ Build new CaloSuperCellDetDescrManager _________________
40 std::unique_ptr<CaloSuperCellDetDescrManager> mgr = std::make_unique<CaloSuperCellDetDescrManager>();
41
42 const CaloIdManager* caloId_mgr{nullptr};
43 ATH_CHECK(detStore()->retrieve(caloId_mgr, "CaloIdManager"));
44
45 mgr->set_helper(caloId_mgr->getCaloCell_SuperCell_ID());
46 mgr->set_helper(caloId_mgr);
47 mgr->initialize();
48
49 createDescriptors(mgr.get());
50 createElements(mgr.get());
51
52 // ____________ Apply Alignment Corrections ____________________________
53 ATH_CHECK(updateElements(mgr.get(),*readCaloMgrHandle,m_scidTool.get()));
54 updateDescriptors(mgr.get(),*readCaloMgrHandle,m_scidTool.get());
55
56 ATH_CHECK(writeCaloSuperCellMgrHandle.record(std::move(mgr)));
57 ATH_MSG_INFO("recorded new CaloSuperCellDetDescr Manager condition object with key " << writeCaloSuperCellMgrHandle.key()
58 << " and range " << writeCaloSuperCellMgrHandle.getRange());
59
60 return StatusCode::SUCCESS;
61}
#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() 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