ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonPhaseII
MuonValidation
MuonObjectMarker
src
SegmentMarkerAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
SegmentMarkerAlg.h
"
5
6
#include "
StoreGate/ReadDecorHandle.h
"
7
#include "
StoreGate/ReadHandle.h
"
8
#include "
xAODMuonViews/ContainerDecorator.h
"
9
10
11
namespace
MuonR4
{
12
StatusCode
SegmentMarkerAlg::initialize
() {
13
ATH_CHECK
(
m_muonKey
.initialize());
14
ATH_CHECK
(
m_readMarkKey
.initialize());
15
ATH_CHECK
(
m_segKey
.initialize());
16
m_writeMarkKey
=
SG:: decorKeyFromKey
(
m_readMarkKey
.key());
17
ATH_CHECK
(
m_writeMarkKey
.initialize());
18
return
StatusCode::SUCCESS;
19
}
20
StatusCode
SegmentMarkerAlg::execute
(
const
EventContext& ctx)
const
{
21
const
xAOD::MuonContainer
* muons{
nullptr
};
22
ATH_CHECK
(
SG::get
(muons,
m_muonKey
, ctx));
23
24
SG::ReadDecorHandle<xAOD::MuonContainer, std::uint8_t>
selHandle{
m_readMarkKey
, ctx};
25
xAOD::ContainerDecorator
decorHandle{
m_writeMarkKey
, ctx, std::uint8_t{0}};
26
27
for
(
const
xAOD::Muon
* muon : *muons) {
28
if
(!selHandle(*muon)) {
29
continue
;
30
}
31
for
(
unsigned
int
s =0; s < muon->nMuonSegments(); ++s){
32
const
xAOD::MuonSegment
* seg = muon->muonSegment(s);
33
if
(seg->container() != decorHandle.
container
()) {
34
ATH_MSG_FATAL
(
"The segment "
<<seg<<
" does not live in container "
<<
m_segKey
.fullKey());
35
return
StatusCode::FAILURE;
36
}
37
decorHandle(*seg)= selHandle(*muon);
38
}
39
}
40
return
StatusCode::SUCCESS;
41
}
42
43
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ContainerDecorator.h
SegmentMarkerAlg.h
ReadDecorHandle.h
Handle class for reading a decoration on an object.
ReadHandle.h
Handle class for reading from StoreGate.
MuonR4::SegmentMarkerAlg::m_writeMarkKey
SG::WriteDecorHandleKey< xAOD::MuonSegmentContainer > m_writeMarkKey
Key to the decoration.
Definition
SegmentMarkerAlg.h:34
MuonR4::SegmentMarkerAlg::m_readMarkKey
SG::ReadDecorHandleKey< xAOD::MuonContainer > m_readMarkKey
Key to the decoration to fetch the marked muons.
Definition
SegmentMarkerAlg.h:30
MuonR4::SegmentMarkerAlg::initialize
virtual StatusCode initialize() override final
Definition
SegmentMarkerAlg.cxx:12
MuonR4::SegmentMarkerAlg::m_muonKey
SG::ReadHandleKey< xAOD::MuonContainer > m_muonKey
Key to the primary muon container to select the muon from.
Definition
SegmentMarkerAlg.h:28
MuonR4::SegmentMarkerAlg::m_segKey
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_segKey
Key to the segment container to fetch the marked segments.
Definition
SegmentMarkerAlg.h:32
MuonR4::SegmentMarkerAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition
SegmentMarkerAlg.cxx:20
SG::ReadDecorHandle
Handle class for reading a decoration on an object.
Definition
StoreGate/StoreGate/ReadDecorHandle.h:94
xAOD::ContainerDecorator
Auxiliary class to instantiate WriteDecorHandles.The handles can be created in an empty state.
Definition
ContainerDecorator.h:18
xAOD::ContainerDecorator::container
const Cont_t * container() const
Returns the underlying container.
Definition
ContainerDecorator.h:76
MuonR4
This header ties the generic definitions in this package.
Definition
GlobalPattern.h:14
SG::decorKeyFromKey
std::string decorKeyFromKey(const std::string &key, const std::string &deflt)
Extract the decoration part of key.
Definition
DecorKeyHelpers.cxx:42
SG::get
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Definition
ReadCondHandle.h:282
xAOD::Muon
Muon_v1 Muon
Reference the current persistent version:
Definition
Event/xAOD/xAODMuon/xAODMuon/Muon.h:13
xAOD::MuonContainer
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
Definition
Event/xAOD/xAODMuon/xAODMuon/MuonContainer.h:14
xAOD::MuonSegment
MuonSegment_v1 MuonSegment
Reference the current persistent version:
Definition
Event/xAOD/xAODMuon/xAODMuon/MuonSegment.h:13
Generated on
for ATLAS Offline Software by
1.17.0