ATLAS Offline Software
Loading...
Searching...
No Matches
TgcL0RdoDecoder.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 "TgcL0RdoDecoder.h"
6
7#include "Identifier/Identifier.h"
10#include "MuonRDO/TgcRdo.h"
13
14#include <string>
15
16namespace {
17
19 const Identifier& identifier, const Muon::IMuonIdHelperSvc& idHelperSvc) {
21 const std::string stationName = idHelperSvc.tgcIdHelper().stationNameString(
22 idHelperSvc.tgcIdHelper().stationName(identifier));
23 if (stationName.rfind("T1", 0) == 0) {
24 return Station::M1;
25 }
26 if (stationName.rfind("T2", 0) == 0) {
27 return Station::M2;
28 }
29 if (stationName.rfind("T3", 0) == 0) {
30 return Station::M3;
31 }
32 if (stationName.rfind("T4", 0) == 0) {
33 return Station::Inner;
34 }
35 return Station::Unknown;
36}
37
38} // namespace
39
40namespace L0Muon {
41namespace TgcL0Floating {
42
43StatusCode RdoDecoder::decode(const TgcRdoContainer& rdos,
44 const Muon::TgcCablingMap& cabling,
45 const Muon::IMuonIdHelperSvc& idHelperSvc,
46 HitGroups& hitGroups,
47 DecodeStatistics& statistics) const {
48 hitGroups.clear();
49 statistics = DecodeStatistics{};
50
51 // This decoder assumes the Run-3 ROD, SSW and SLB-based TGC RDO format.
52 // The Run-4 TGC RDO will have a substantially different structure, and
53 // this decoder and its hit organization will require a broad rewrite when
54 // that format becomes available. The HitGroups output is the boundary to
55 // the later reconstruction, so the downstream Station Coincidence,
56 // segment, candidate, Inner Coincidence and Track Selector code is not
57 // expected to require corresponding changes.
58 for (const TgcRdo* rdo : rdos) {
59 for (const TgcRawData* rawData : *rdo) {
60 ++statistics.nRawData;
61 if (rawData->type() != TgcRawData::TYPE_HIT) {
62 continue;
63 }
64
65 Identifier identifier;
66 const bool mapped = cabling.getOfflineIDfromReadoutID(
67 identifier, rawData->subDetectorId(), rawData->rodId(),
68 rawData->sswId(), rawData->slbId(), rawData->channel());
69 if (!mapped) {
70 ++statistics.nMappingFailures;
71 continue;
72 }
73
74 const Station hitStation = station(identifier, idHelperSvc);
75 const bool hitIsStrip = idHelperSvc.tgcIdHelper().isStrip(identifier);
76 const Hit hit{
77 .subDetectorId = rawData->subDetectorId(),
78 .detectorSector = rawData->rodId(),
79 .bcTag = rawData->bcTag(),
80 .sswId = rawData->sswId(),
81 .slbId = rawData->slbId(),
82 .readoutChannel = rawData->channel(),
83 .stationEta = static_cast<std::int16_t>(
84 idHelperSvc.tgcIdHelper().stationEta(identifier)),
85 .stationPhi = static_cast<std::uint16_t>(
86 idHelperSvc.tgcIdHelper().stationPhi(identifier)),
87 .gasGap = static_cast<std::uint8_t>(
88 idHelperSvc.tgcIdHelper().gasGap(identifier)),
89 .channel = static_cast<std::uint16_t>(
90 idHelperSvc.tgcIdHelper().channel(identifier)),
91 .station = hitStation,
92 .isStrip = hitIsStrip,
93 };
94 const HitGroupKey key{
95 .subDetectorId = hit.subDetectorId,
96 .detectorSector = hit.detectorSector,
97 .bcTag = hit.bcTag,
98 .stationEta = hit.stationEta,
99 .stationPhi = hit.stationPhi,
100 .station = hit.station,
101 .isStrip = hit.isStrip,
102 };
103 hitGroups[key].push_back(hit);
104
105 ++statistics.nHits;
106 if (hitIsStrip) {
107 ++statistics.nStripHits;
108 } else {
109 ++statistics.nWireHits;
110 }
111 switch (hitStation) {
112 case Station::M1:
113 ++statistics.nM1Hits;
114 break;
115 case Station::M2:
116 ++statistics.nM2Hits;
117 break;
118 case Station::M3:
119 ++statistics.nM3Hits;
120 break;
121 case Station::Inner:
122 ++statistics.nInnerHits;
123 break;
124 default:
125 ++statistics.nUnknownStation;
126 break;
127 }
128 }
129 }
130 return StatusCode::SUCCESS;
131}
132
133} // namespace TgcL0Floating
134} // namespace L0Muon
StatusCode decode(const TgcRdoContainer &rdos, const Muon::TgcCablingMap &cabling, const Muon::IMuonIdHelperSvc &idHelperSvc, HitGroups &hitGroups, DecodeStatistics &statistics) const
const std::string & stationNameString(const Identifier &id) const
int stationName(const Identifier &id) const
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
virtual const TgcIdHelper & tgcIdHelper() const =0
access to TgcIdHelper
int isStrip(const Identifier &id) const
isStrip corresponds to measuresPhi
An unit object of TGC ROD output.
Definition TgcRawData.h:23
std::vector< std::string > mapped
Definition hcg.cxx:56
std::map< HitGroupKey, HitContainer > HitGroups
Event-local key used to group decoded Run-3 TGC hits.