ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonReconstruction
MuonRecUtils
MuonStationIntersectCond
src
MuonStationIntersectCondAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
MuonStationIntersectCondAlg.h
"
6
7
MuonStationIntersectCondAlg::MuonStationIntersectCondAlg
(
const
std::string& name, ISvcLocator* pSvcLocator) :
8
AthCondAlgorithm
(name, pSvcLocator) {}
9
StatusCode
MuonStationIntersectCondAlg::initialize
() {
10
ATH_CHECK
(
m_idHelperSvc
.retrieve());
11
ATH_CHECK
(
m_writeKey
.initialize());
12
ATH_CHECK
(
m_condKey
.initialize(!
m_condKey
.empty()));
13
ATH_CHECK
(
m_DetectorManagerKey
.initialize());
14
return
StatusCode::SUCCESS;
15
}
16
StatusCode
MuonStationIntersectCondAlg::execute
(
const
EventContext& ctx)
const
{
17
SG::ReadCondHandle<MuonGM::MuonDetectorManager>
det_mgr{
m_DetectorManagerKey
, ctx};
18
if
(!det_mgr.
isValid
()) {
19
ATH_MSG_FATAL
(
"Failed to retrieve Muon detector manager "
<<
m_DetectorManagerKey
.fullKey());
20
return
StatusCode::FAILURE;
21
}
22
23
EventIDRange rangeGeo;
24
if
(!det_mgr.
range
(rangeGeo)) {
25
ATH_MSG_ERROR
(
"Failed to retrieve validity range for "
<<
m_DetectorManagerKey
.key());
26
return
StatusCode::FAILURE;
27
}
28
EventIDRange rangeIntersection = rangeGeo;
29
30
const
MdtCondDbData
* condData{
nullptr
};
31
if
(!
m_condKey
.empty()) {
32
SG::ReadCondHandle<MdtCondDbData>
condDbHandle{
m_condKey
, ctx};
33
if
(!condDbHandle.
isValid
()) {
34
ATH_MSG_FATAL
(
"Failed to retrieve conditions data "
<<
m_condKey
.fullKey());
35
return
StatusCode::FAILURE;
36
}
37
38
EventIDRange rangeCondDb;
39
if
(!condDbHandle.
range
(rangeCondDb)) {
40
ATH_MSG_ERROR
(
"Failed to retrieve validity range for "
<<
m_DetectorManagerKey
.key());
41
return
StatusCode::FAILURE;
42
}
43
// Create an intersection of input IOVs
44
rangeIntersection = EventIDRange::intersect(rangeGeo, rangeCondDb);
45
}
46
47
SG::WriteCondHandle<Muon::MuonIntersectGeoData>
writeHandle{
m_writeKey
, ctx};
48
if
(writeHandle.
isValid
()) {
49
ATH_MSG_DEBUG
(
"CondHandle "
<< writeHandle.
fullKey
() <<
" is already valid."
50
<<
". In theory this should not be called, but may happen"
51
<<
" if multiple concurrent events are being processed out of order."
);
52
return
StatusCode::SUCCESS;
53
}
54
55
std::unique_ptr<Muon::MuonIntersectGeoData> geo_data =
56
std::make_unique<Muon::MuonIntersectGeoData>(msgStream(), det_mgr.
cptr
(),
m_idHelperSvc
.get(), condData);
57
58
if
(writeHandle.
record
(rangeIntersection, std::move(geo_data)).isFailure()) {
59
ATH_MSG_FATAL
(
"Could not record MuonMDT_CablingMap "
<< writeHandle.
key
() <<
" with EventRange "
<< rangeIntersection
60
<<
" into Conditions Store"
);
61
return
StatusCode::FAILURE;
62
}
63
ATH_MSG_DEBUG
(
"Recorded successfully the MuonIntersectionGeoData "
<<writeHandle.
key
()<<
" with EventRange "
<<rangeIntersection);
64
65
return
StatusCode::SUCCESS;
66
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
MuonStationIntersectCondAlg.h
AthCondAlgorithm
Base class for conditions algorithms.
Definition
AthCondAlgorithm.h:22
MdtCondDbData
Definition
MdtCondDbData.h:24
MuonStationIntersectCondAlg::MuonStationIntersectCondAlg
MuonStationIntersectCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
MuonStationIntersectCondAlg.cxx:7
MuonStationIntersectCondAlg::m_DetectorManagerKey
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_DetectorManagerKey
Definition
MuonStationIntersectCondAlg.h:31
MuonStationIntersectCondAlg::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition
MuonStationIntersectCondAlg.h:24
MuonStationIntersectCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
MuonStationIntersectCondAlg.cxx:16
MuonStationIntersectCondAlg::m_condKey
SG::ReadCondHandleKey< MdtCondDbData > m_condKey
Definition
MuonStationIntersectCondAlg.h:29
MuonStationIntersectCondAlg::initialize
virtual StatusCode initialize() override
Definition
MuonStationIntersectCondAlg.cxx:9
MuonStationIntersectCondAlg::m_writeKey
SG::WriteCondHandleKey< Muon::MuonIntersectGeoData > m_writeKey
Definition
MuonStationIntersectCondAlg.h:26
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::range
bool range(EventIDRange &r)
Definition
ReadCondHandle.h:223
SG::ReadCondHandle::isValid
bool isValid()
Definition
ReadCondHandle.h:205
SG::ReadCondHandle::cptr
const_pointer_type cptr()
Definition
ReadCondHandle.h:67
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
SG::WriteCondHandle::key
const std::string & key() const
Definition
WriteCondHandle.h:44
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
SG::WriteCondHandle::fullKey
const DataObjID & fullKey() const
Definition
WriteCondHandle.h:45
Generated on
for ATLAS Offline Software by
1.17.0