ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloAlignment
CaloAlignmentAlgs
src
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
7
#include "
CaloDetDescrUtils/CaloDetDescrBuilder.h
"
8
#include "
AthenaKernel/getMessageSvc.h
"
9
#include "
AthenaKernel/IOVInfiniteRange.h
"
10
11
#include <memory>
12
13
StatusCode
CaloAlignCondAlg::initialize
()
14
{
15
ATH_MSG_DEBUG
(
"initialize "
<< name());
16
17
ATH_CHECK
(
m_readKeyGeoAlign
.initialize(
SG::AllowEmpty
));
18
ATH_CHECK
(
m_readKeyCellPosShift
.initialize(
SG::AllowEmpty
));
19
ATH_CHECK
(
m_writeCaloMgrKey
.initialize());
20
21
return
StatusCode::SUCCESS;
22
}
23
24
StatusCode
CaloAlignCondAlg::execute
(
const
EventContext& ctx)
const
25
{
26
// ____________ Construct Write Cond Handle and check its validity ____________
27
SG::WriteCondHandle<CaloDetDescrManager>
writeCaloMgrHandle{
m_writeCaloMgrKey
,ctx};
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()) {
37
SG::ReadCondHandle<GeoAlignmentStore>
readHandleGeoAlign{
m_readKeyGeoAlign
,ctx};
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()) {
47
SG::ReadCondHandle<CaloRec::CaloCellPositionShift>
readHandleCellPosShift{
m_readKeyCellPosShift
,ctx};
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()
60
,
Athena::getMessageSvc
()
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
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloAlignCondAlg.h
CaloDetDescrBuilder.h
buildCaloDetDescr
std::unique_ptr< CaloDetDescrManager > buildCaloDetDescr(ISvcLocator *svcLocator, IMessageSvc *msgSvc, const GeoAlignmentStore *geoAlignStore, const CaloRec::CaloCellPositionShift *cellPosShift)
Definition
CaloDetDescrBuilder.cxx:46
IOVInfiniteRange.h
CaloAlignCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
CaloAlignCondAlg.cxx:24
CaloAlignCondAlg::initialize
virtual StatusCode initialize() override
Definition
CaloAlignCondAlg.cxx:13
CaloAlignCondAlg::m_readKeyCellPosShift
SG::ReadCondHandleKey< CaloRec::CaloCellPositionShift > m_readKeyCellPosShift
Definition
CaloAlignCondAlg.h:38
CaloAlignCondAlg::m_readKeyGeoAlign
SG::ReadCondHandleKey< GeoAlignmentStore > m_readKeyGeoAlign
Definition
CaloAlignCondAlg.h:33
CaloAlignCondAlg::m_writeCaloMgrKey
SG::WriteCondHandleKey< CaloDetDescrManager > m_writeCaloMgrKey
Definition
CaloAlignCondAlg.h:43
CaloRec::CaloCellPositionShift
Container for a cell-level rescaling-factors, typically obtained by Z->ee intercalibration.
Definition
CaloCellPositionShift.h:31
GeoAlignmentStore
Ensure that the extensions for the Vector3D are properly loaded.
Definition
GeoAlignmentStore.h:24
IOVInfiniteRange::infiniteRunLB
static EventIDRange infiniteRunLB()
Produces an EventIDRange that is infinite in RunLumi and invalid in Time.
Definition
IOVInfiniteRange.h:39
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::isValid
bool isValid()
Definition
ReadCondHandle.h:205
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
SG::WriteCondHandle::key
const std::string & key() const
Definition
WriteCondHandle.h:44
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition
WriteCondHandle.h:279
SG::WriteCondHandle::getRange
const EventIDRange & getRange() const
Definition
WriteCondHandle.h:93
SG::WriteCondHandle::record
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
Definition
WriteCondHandle.h:161
SG::WriteCondHandle::isValid
bool isValid() const
Definition
WriteCondHandle.h:252
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition
getMessageSvc.cxx:20
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:27
Generated on
for ATLAS Offline Software by
1.17.0