ATLAS Offline Software
Loading...
Searching...
No Matches
TGCSimulation.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "TGCSimulation.h"
6
12
13#include <memory>
14
15namespace L0Muon {
16
18 ATH_CHECK(m_keyTgcRdo.initialize());
19 ATH_CHECK(m_outputKey.initialize());
20 ATH_CHECK(m_outputToMdtKey.initialize());
26 if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve());
27 return StatusCode::SUCCESS;
28}
29
30StatusCode TGCSimulation::execute(const EventContext& ctx) const {
31 const TgcRdoContainer* tgcRdoContainer{};
32 ATH_CHECK(SG::get(tgcRdoContainer, m_keyTgcRdo, ctx));
33
34 auto nTgcRdoCollections = Monitored::Scalar<unsigned int>(
35 "nTgcRdoCollections", tgcRdoContainer->size());
36 Monitored::Group(m_monTool, nTgcRdoCollections);
37
38 TgcL0CandidateContainer candidates;
39 std::unique_ptr<TgcL0SegmentContainer> validationSegments;
40 if (!m_validationSegmentKey.empty()) {
41 validationSegments = std::make_unique<TgcL0SegmentContainer>();
42 }
44 *tgcRdoContainer, candidates, validationSegments.get(), ctx));
45 if (validationSegments) {
48 ATH_CHECK(segmentHandle.record(std::move(validationSegments)));
49 }
50 if (!m_validationCandidateKey.empty()) {
53 ATH_CHECK(validationCandidates.record(
54 std::make_unique<TgcL0CandidateContainer>(candidates)));
55 }
56 ATH_CHECK(m_innerCoincidenceTool->apply(candidates, ctx));
57
60 output{};
61 ATH_CHECK(m_trackSelectorTool->select(candidates, *output, ctx));
62 const TgcL0MdtCandidateSelector mdtCandidateSelector;
63 std::unique_ptr<xAOD::TGCCandDataContainer> outputToMdt =
64 mdtCandidateSelector.select(*output);
65
66 ATH_CHECK(output.record(m_outputKey, ctx));
68 m_outputToMdtKey, ctx};
69 ATH_CHECK(outputToMdtHandle.record(std::move(outputToMdt)));
70 return StatusCode::SUCCESS;
71}
72
73} // namespace L0Muon
#define ATH_CHECK
Evaluate an expression and check for errors.
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
size_t size() const
Duplicate of fullSize for backwards compatability.
SG::WriteHandleKey< TgcL0CandidateContainer > m_validationCandidateKey
ToolHandle< GenericMonitoringTool > m_monTool
ToolHandle< ITgcL0CandidateBuilderTool > m_candidateBuilderTool
StatusCode initialize() override
SG::WriteHandleKey< xAOD::TGCCandDataContainer > m_outputToMdtKey
SG::ReadHandleKey< TgcRdoContainer > m_keyTgcRdo
ToolHandle< ITgcL0InnerCoincidenceTool > m_innerCoincidenceTool
SG::WriteHandleKey< xAOD::TGCCandDataContainer > m_outputKey
SG::WriteHandleKey< TgcL0SegmentContainer > m_validationSegmentKey
ToolHandle< ITgcL0TrackSelectorTool > m_trackSelectorTool
StatusCode execute(const EventContext &ctx) const override
Select the TGC candidates sent to MDTTP.
std::unique_ptr< xAOD::TGCCandDataContainer > select(xAOD::TGCCandDataContainer &candidates) const
Create a non-owning view of the three candidates with the highest encoded pT per sector for one BC pr...
Group of local monitoring quantities and retain correlation when filling histograms
Declare a monitored scalar variable.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
std::vector< TgcL0Candidate > TgcL0CandidateContainer
Event-local candidate collection.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
TGCCandDataAuxContainer_v1 TGCCandDataAuxContainer