ATLAS Offline Software
Loading...
Searching...
No Matches
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
9
10
11namespace MuonR4{
13 ATH_CHECK(m_muonKey.initialize());
14 ATH_CHECK(m_readMarkKey.initialize());
15 ATH_CHECK(m_segKey.initialize());
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
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
Handle class for reading a decoration on an object.
Handle class for reading from StoreGate.
SG::WriteDecorHandleKey< xAOD::MuonSegmentContainer > m_writeMarkKey
Key to the decoration.
SG::ReadDecorHandleKey< xAOD::MuonContainer > m_readMarkKey
Key to the decoration to fetch the marked muons.
virtual StatusCode initialize() override final
SG::ReadHandleKey< xAOD::MuonContainer > m_muonKey
Key to the primary muon container to select the muon from.
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_segKey
Key to the segment container to fetch the marked segments.
virtual StatusCode execute(const EventContext &ctx) const override final
Handle class for reading a decoration on an object.
Auxiliary class to instantiate WriteDecorHandles.The handles can be created in an empty state.
const Cont_t * container() const
Returns the underlying container.
This header ties the generic definitions in this package.
std::string decorKeyFromKey(const std::string &key, const std::string &deflt)
Extract the decoration part of key.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Muon_v1 Muon
Reference the current persistent version:
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
MuonSegment_v1 MuonSegment
Reference the current persistent version: