ATLAS Offline Software
Loading...
Searching...
No Matches
MuonR4::TrackSummaryTool Class Reference

#include <TrackSummaryTool.h>

Inheritance diagram for MuonR4::TrackSummaryTool:
Collaboration diagram for MuonR4::TrackSummaryTool:

Public Member Functions

virtual StatusCode initialize () override final
virtual HitSummary makeSummary (const EventContext &ctx, const ConstTrack_t trackProxy) const override final
virtual HitSummary makeSummary (const EventContext &ctx, const std::vector< const xAOD::MuonSegment * > &segments) const override final
virtual HitSummary makeSummary (const EventContext &ctx, const Trk::Track &track) const override final
virtual void copySummary (const HitSummary &summary, const xAOD::IParticle &track) const override final

Private Types

using Stat_t = HitSummary::Status

Private Member Functions

void incrementSummary (const Identifier &hitId, const Stat_t status, const unsigned prdDim, HitSummary &summary) const
 Increments the hit summary based on the identifier extracted from the measurement.

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "IdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
 IdHelperSvc to decode the Identifiers.
Gaudi::Property< bool > m_fillHoles {this, "fillHoles", true}
 Toggle whether holes states shall be copied to the xAOD object.
Gaudi::Property< bool > m_fillOutliers {this, "fillOutliers", true}
 Toggle whether outlier states shall be copied to the xAOD object.
Gaudi::Property< bool > m_reDoSegments {this, "recomputeSegment", true}
 Toggle whether the segment summary shall be recomputed.

Detailed Description

Member Typedef Documentation

◆ Stat_t

Member Function Documentation

◆ copySummary()

void MuonR4::TrackSummaryTool::copySummary ( const HitSummary & summary,
const xAOD::IParticle & track ) const
finaloverridevirtual

Precision hits

Trigger hits

Definition at line 155 of file MuonSpectrometer/MuonPhaseII/MuonTrackBuilding/MuonTrackFindingTools/src/TrackSummaryTool.cxx.

156 {
157 ATH_MSG_DEBUG("Copy the summary \n "<<summary<<"\n pT: "<<(track.pt() * 1.e-3)
158 <<", eta: "<<track.eta()<<", phi: "<<track.phi());
159
160 auto acc = [&track](const xAOD::MuonSummaryType type) -> std::uint8_t& {
161 const std::string accName = SG::AuxTypeRegistry::instance().getName(
163 const SG::Decorator<std::uint8_t> dec{accName};
164 return dec(track);
165 };
166 using enum xAOD::MuonSummaryType;
168 acc(innerSmallHits) = summary.value(Cat_t::Precision, Stat_t::OnTrack, LayerIndex::Inner, true);
169 acc(innerLargeHits) = summary.value(Cat_t::Precision, Stat_t::OnTrack, LayerIndex::Inner, false);
170 acc(middleSmallHits) = summary.value(Cat_t::Precision, Stat_t::OnTrack, LayerIndex::Middle, true);
171 acc(middleLargeHits) = summary.value(Cat_t::Precision, Stat_t::OnTrack, LayerIndex::Middle, false);
172 acc(outerSmallHits) = summary.value(Cat_t::Precision, Stat_t::OnTrack, LayerIndex::Outer, true);
173 acc(outerLargeHits) = summary.value(Cat_t::Precision, Stat_t::OnTrack, LayerIndex::Outer, false);
174 acc(extendedSmallHits) = summary.value(Cat_t::Precision, Stat_t::OnTrack, LayerIndex::Extended, true);
175 acc(extendedLargeHits) = summary.value(Cat_t::Precision, Stat_t::OnTrack, LayerIndex::Extended, false);
176 if (m_fillHoles) {
177 acc(innerSmallHoles) = summary.value(Cat_t::Precision, Stat_t::Hole, LayerIndex::Inner, true);
178 acc(innerLargeHoles) = summary.value(Cat_t::Precision, Stat_t::Hole, LayerIndex::Inner, false);
179 acc(middleSmallHoles) = summary.value(Cat_t::Precision, Stat_t::Hole, LayerIndex::Middle, true);
180 acc(middleLargeHoles) = summary.value(Cat_t::Precision, Stat_t::Hole, LayerIndex::Middle, false);
181 acc(outerSmallHoles) = summary.value(Cat_t::Precision, Stat_t::Hole, LayerIndex::Outer, true);
182 acc(outerLargeHoles) = summary.value(Cat_t::Precision, Stat_t::Hole, LayerIndex::Outer, false);
183 acc(extendedSmallHoles) = summary.value(Cat_t::Precision, Stat_t::Hole, LayerIndex::Extended, true);
184 acc(extendedLargeHoles) = summary.value(Cat_t::Precision, Stat_t::Hole, LayerIndex::Extended, false);
185 }
186 if (m_fillOutliers) {
187 acc(innerOutBoundsPrecisionHits) = summary.value(Cat_t::Precision, Stat_t::Outlier, LayerIndex::Inner, false)
188 + summary.value(Cat_t::Precision, Stat_t::Outlier, LayerIndex::Inner, true);
189
190 acc(middleOutBoundsPrecisionHits) = summary.value(Cat_t::Precision, Stat_t::Outlier, LayerIndex::Middle, false)
191 + summary.value(Cat_t::Precision, Stat_t::Outlier, LayerIndex::Middle, true);
192
193 acc(outerOutBoundsPrecisionHits) = summary.value(Cat_t::Precision, Stat_t::Outlier, LayerIndex::Outer, false)
194 + summary.value(Cat_t::Precision, Stat_t::Outlier, LayerIndex::Outer, true);
195
196 acc(extendedOutBoundsPrecisionHits) = summary.value(Cat_t::Precision, Stat_t::Outlier, LayerIndex::Extended, false)
197 + summary.value(Cat_t::Precision, Stat_t::Outlier, LayerIndex::Extended, true);
198 }
199
201 acc(etaLayer1Hits) = summary.value(Cat_t::TriggerEta, Stat_t::OnTrack, LayerIndex::Inner, true)
202 + summary.value(Cat_t::TriggerEta, Stat_t::OnTrack, LayerIndex::Inner, false);
203
204 acc(etaLayer2Hits) = summary.value(Cat_t::TriggerEta, Stat_t::OnTrack, LayerIndex::Middle, true)
205 + summary.value(Cat_t::TriggerEta, Stat_t::OnTrack, LayerIndex::Middle, false);
206
207 acc(etaLayer3Hits) = summary.value(Cat_t::TriggerEta, Stat_t::OnTrack, LayerIndex::Outer, true)
208 + summary.value(Cat_t::TriggerEta, Stat_t::OnTrack, LayerIndex::Outer, false);
209
210 acc(etaLayer4Hits) = summary.value(Cat_t::TriggerEta, Stat_t::OnTrack, LayerIndex::Extended, true)
211 + summary.value(Cat_t::TriggerEta, Stat_t::OnTrack, LayerIndex::Extended, false);
212
213 if (m_fillHoles) {
214 acc(etaLayer1Holes) = summary.value(Cat_t::TriggerEta, Stat_t::Hole, LayerIndex::Inner, true)
215 + summary.value(Cat_t::TriggerEta, Stat_t::Hole, LayerIndex::Inner, false);
216
217 acc(etaLayer2Holes) = summary.value(Cat_t::TriggerEta, Stat_t::Hole, LayerIndex::Middle, true)
218 + summary.value(Cat_t::TriggerEta, Stat_t::Hole, LayerIndex::Middle, false);
219
220 acc(etaLayer3Holes) = summary.value(Cat_t::TriggerEta, Stat_t::Hole, LayerIndex::Outer, true)
221 + summary.value(Cat_t::TriggerEta, Stat_t::Hole, LayerIndex::Outer, false);
222
223 acc(etaLayer4Holes) = summary.value(Cat_t::TriggerEta, Stat_t::Hole, LayerIndex::Extended, true)
224 + summary.value(Cat_t::TriggerEta, Stat_t::Hole, LayerIndex::Extended, false);
225 }
226 acc(phiLayer1Hits) = summary.value(Cat_t::TriggerPhi, Stat_t::OnTrack, LayerIndex::Inner, true)
227 + summary.value(Cat_t::TriggerPhi, Stat_t::OnTrack, LayerIndex::Inner, false);
228
229 acc(phiLayer2Hits) = summary.value(Cat_t::TriggerPhi, Stat_t::OnTrack, LayerIndex::Middle, true)
230 + summary.value(Cat_t::TriggerPhi, Stat_t::OnTrack, LayerIndex::Middle, false);
231
232 acc(phiLayer3Hits) = summary.value(Cat_t::TriggerPhi, Stat_t::OnTrack, LayerIndex::Outer, true)
233 + summary.value(Cat_t::TriggerPhi, Stat_t::OnTrack, LayerIndex::Outer, false);
234
235 acc(phiLayer4Hits) = summary.value(Cat_t::TriggerPhi, Stat_t::OnTrack, LayerIndex::Extended, true)
236 + summary.value(Cat_t::TriggerPhi, Stat_t::OnTrack, LayerIndex::Extended, false);
237 if (m_fillHoles) {
238 acc(phiLayer1Holes) = summary.value(Cat_t::TriggerPhi, Stat_t::Hole, LayerIndex::Inner, true)
239 + summary.value(Cat_t::TriggerPhi, Stat_t::Hole, LayerIndex::Inner, false);
240
241 acc(phiLayer2Holes) = summary.value(Cat_t::TriggerPhi, Stat_t::Hole, LayerIndex::Middle, true)
242 + summary.value(Cat_t::TriggerPhi, Stat_t::Hole, LayerIndex::Middle, false);
243
244 acc(phiLayer3Holes) = summary.value(Cat_t::TriggerPhi, Stat_t::Hole, LayerIndex::Outer, true)
245 + summary.value(Cat_t::TriggerPhi, Stat_t::Hole, LayerIndex::Outer, false);
246
247 acc(phiLayer4Holes) = summary.value(Cat_t::TriggerPhi, Stat_t::Hole, LayerIndex::Extended, true)
248 + summary.value(Cat_t::TriggerPhi, Stat_t::Hole, LayerIndex::Extended, false);
249 }
250 }
#define ATH_MSG_DEBUG(x)
Gaudi::Property< bool > m_fillHoles
Toggle whether holes states shall be copied to the xAOD object.
Gaudi::Property< bool > m_fillOutliers
Toggle whether outlier states shall be copied to the xAOD object.
std::string getName(SG::auxid_t auxid) const
Return the name of an aux data item.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
const SG::Accessor< uint8_t > & muonTrackSummaryAccessorV1(xAOD::MuonSummaryType type)
Helper function for managing MuonTrackSummary Accessor objects.
MuonSummaryType
Enumerates the different types of information stored in Summary.

◆ incrementSummary()

void MuonR4::TrackSummaryTool::incrementSummary ( const Identifier & hitId,
const Stat_t status,
const unsigned prdDim,
HitSummary & summary ) const
private

Increments the hit summary based on the identifier extracted from the measurement.

Parameters
hitIdIdentifier from the measurement or the hole for which the summary needs to be incremented
statusContribution of the measurement towards the track fit
prdDimDimension of the measurement 0 -> combined measurement (eta + phi), 2 (eta +phi)
summaryReference to the summary where the counts shall be incremented

Hit is not a muon hit

Mdt twin tubes

Combined measurement or it's a 2D BI strip

Definition at line 58 of file MuonSpectrometer/MuonPhaseII/MuonTrackBuilding/MuonTrackFindingTools/src/TrackSummaryTool.cxx.

61 {
63 const TechIdx techIdx = m_idHelperSvc->technologyIndex(hitId);
64
66 if (techIdx == TechIdx::TechnologyUnknown) {
67 return;
68 }
69 const ChIndex chIdx = m_idHelperSvc->chamberIndex(hitId);
70 const LayerIndex layer{toLayerIndex(chIdx)};
71 const bool small{isSmall(chIdx)};
72
73 Cat_t cat1{Cat_t::nCategories}, cat2{Cat_t::nCategories};
74
75 if (techIdx == TechIdx::MDT || techIdx == TechIdx::MM) {
76 cat1 = Cat_t::Precision;
78 if (prdDim == 2){
79 cat2 = Cat_t::TriggerPhi;
80 }
81 } else if (techIdx == TechIdx::RPC || techIdx == TechIdx::TGC) {
83 if (prdDim == 0 || prdDim == 2) {
84 cat1 = Cat_t::TriggerEta;
85 cat2 = Cat_t::TriggerPhi;
86 } else if (m_idHelperSvc->measuresPhi(hitId)) {
87 cat1 = Cat_t::TriggerPhi;
88 } else {
89 cat1 = Cat_t::TriggerEta;
90 }
91 } else {
92 ATH_MSG_ALWAYS(__FILE__<<":"<<__LINE__<<" Implement sTGC!");
93 return;
94 }
95
96 if (cat1 != Cat_t::nCategories){
97 ATH_MSG_VERBOSE("Increment "<<summary.toString(cat1)<<", "<<summary.toString(status)<<", layer: "
98 <<Muon::MuonStationIndex::layerName(layer)<<", small: "<<(small ? "yes" : "no"));
99 ++summary.value(cat1, status, layer, small);
100 }
101 if (cat2 != Cat_t::nCategories) {
102 ATH_MSG_VERBOSE("Increment "<<summary.toString(cat2)<<", "<<summary.toString(status)<<", layer: "
103 <<Muon::MuonStationIndex::layerName(layer)<<", small: "<<(small ? "yes" : "no"));
104 ++summary.value(cat2, status, layer, small);
105 }
106 }
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_ALWAYS(x)
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
IdHelperSvc to decode the Identifiers.
const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
TechnologyIndex
enum to classify the different layers in the muon spectrometer
bool isSmall(const ChIndex index)
Returns true if the chamber index is in a small sector.
LayerIndex toLayerIndex(ChIndex index)
convert ChIndex into LayerIndex
LayerIndex
enum to classify the different layers in the muon spectrometer
ChIndex
enum to classify the different chamber layers in the muon spectrometer
@ layer
Definition HitInfo.h:79

◆ initialize()

StatusCode MuonR4::TrackSummaryTool::initialize ( )
finaloverridevirtual

Definition at line 23 of file MuonSpectrometer/MuonPhaseII/MuonTrackBuilding/MuonTrackFindingTools/src/TrackSummaryTool.cxx.

23 {
24 ATH_CHECK(m_idHelperSvc.retrieve());
25 return StatusCode::SUCCESS;
26 }
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ makeSummary() [1/3]

HitSummary MuonR4::TrackSummaryTool::makeSummary ( const EventContext & ctx,
const ConstTrack_t trackProxy ) const
finaloverridevirtual

Surface is not active

Definition at line 27 of file MuonSpectrometer/MuonPhaseII/MuonTrackBuilding/MuonTrackFindingTools/src/TrackSummaryTool.cxx.

28 {
29 HitSummary summary{};
30 trackProxy.container().trackStateContainer().visitBackwards(trackProxy.tipIndex(),
31 [&](const auto& state){
32 Stat_t status{Stat_t::OnTrack};
33 if (state.typeFlags().test(Acts::TrackStateFlag::OutlierFlag)){
34 status = Stat_t::Outlier;
35 } else if (state.typeFlags().test(Acts::TrackStateFlag::HoleFlag)) {
36 status = Stat_t::Hole;
37 }
38 if (state.hasUncalibratedSourceLink()) {
39 const auto* meas = xAODUncalibMeasCalibrator::unpack(state.getUncalibratedSourceLink());
40 incrementSummary(xAOD::identify(meas), status, meas->numDimensions(), summary);
41 } else if (state.hasReferenceSurface()) {
42 const Acts::Surface& surf{state.referenceSurface()};
44 const Acts::DetectorElementBase* detEl = surf.associatedDetectorElement();
45 if (!detEl) {
46 return;
47 }
48 incrementSummary(static_cast<const ActsTrk::IDetectorElementBase*>(detEl)->identify(),
49 status, 1, summary);
50 }
51 });
52 ATH_MSG_DEBUG("Obtained track summary from track with "<<Acts::toString(trackProxy.fourMomentum())
53 <<", q: "<<trackProxy.qOverP()
54 <<", chi2: "<<(trackProxy.chi2()/ std::max(trackProxy.nDoF(), 1u))
55 <<", nDoF: "<<trackProxy.nDoF()<<"\n"<<summary);
56 return summary;
57 }
if(febId1==febId2)
void incrementSummary(const Identifier &hitId, const Stat_t status, const unsigned prdDim, HitSummary &summary) const
Increments the hit summary based on the identifier extracted from the measurement.
const Identifier & identify(const UncalibratedMeasurement *meas)
Returns the associated identifier from the muon measurement.

◆ makeSummary() [2/3]

HitSummary MuonR4::TrackSummaryTool::makeSummary ( const EventContext & ctx,
const std::vector< const xAOD::MuonSegment * > & segments ) const
finaloverridevirtual

Definition at line 108 of file MuonSpectrometer/MuonPhaseII/MuonTrackBuilding/MuonTrackFindingTools/src/TrackSummaryTool.cxx.

109 {
110 HitSummary summary{};
111 for (const xAOD::MuonSegment* seg : segments) {
112 const LayerIndex lay = toLayerIndex(seg->chamberIndex());
113 const bool small = isSmall(seg->chamberIndex());
114 if (!m_reDoSegments) {
115 summary.value(Cat_t::Precision, Stat_t::OnTrack, lay, small) = seg->nPrecisionHits();
116 summary.value(Cat_t::TriggerEta, Stat_t::OnTrack, lay, small) = seg->nTrigEtaLayers();
117 summary.value(Cat_t::TriggerPhi, Stat_t::OnTrack, lay, small) = seg->nPhiLayers();
118 } else {
119 const std::size_t nHits = nMeasurements(*seg);
120 for (std::size_t hit = 0; hit < nHits; ++hit) {
121 Stat_t state = isOutlierMeasurement(*seg, hit) ? Stat_t::Outlier : Stat_t::OnTrack;
122 const auto * meas = getMeasurement(*seg, hit);
123 incrementSummary(xAOD::identify(meas), state, meas->numDimensions(), summary);
124 }
125 }
126 }
127 return summary;
128 }
static const uint32_t nHits
Gaudi::Property< bool > m_reDoSegments
Toggle whether the segment summary shall be recomputed.
const xAOD::UncalibratedMeasurement * getMeasurement(const xAOD::MuonSegment &segment, const std::size_t n)
Returns the n-th uncalibrated measurement.
std::size_t nMeasurements(const xAOD::MuonSegment &segment)
Returns the number of associated Uncalibrated measurements.
bool isOutlierMeasurement(const xAOD::MuonSegment &segment, const std::size_t n)
Returns whether the n-the uncalibrated measurement is an outlier.
MuonSegment_v1 MuonSegment
Reference the current persistent version:

◆ makeSummary() [3/3]

HitSummary MuonR4::TrackSummaryTool::makeSummary ( const EventContext & ctx,
const Trk::Track & track ) const
finaloverridevirtual

Definition at line 129 of file MuonSpectrometer/MuonPhaseII/MuonTrackBuilding/MuonTrackFindingTools/src/TrackSummaryTool.cxx.

130 {
131 HitSummary summary{};
132 for (const Trk::TrackStateOnSurface* tsos : *track.trackStateOnSurfaces()) {
134 if (tsos->type(Hole)){
135 incrementSummary(tsos->surface().associatedDetectorElementIdentifier(),
136 Stat_t::Hole, 1, summary);
137 continue;
138 }
139 const auto* meas = tsos->measurementOnTrack();
140 if (!meas) {
141 continue;
142 }
143 Stat_t state = tsos->type(Outlier) ? Stat_t::Outlier : Stat_t::OnTrack;
144 if (const auto* rot = dynamic_cast<const Trk::RIO_OnTrack*>(meas); rot != nullptr) {
145 incrementSummary(rot->identify(), state, 1, summary);
146 } else if (const auto* rot = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(meas); rot != nullptr) {
147 for (unsigned n = 0; n <rot->numberOfContainedROTs(); ++n) {
148 incrementSummary(rot->rioOnTrack(n).identify(), state, 1, summary);
149 }
150 }
151 }
152 return summary;
153 }

Member Data Documentation

◆ m_fillHoles

Gaudi::Property<bool> MuonR4::TrackSummaryTool::m_fillHoles {this, "fillHoles", true}
private

Toggle whether holes states shall be copied to the xAOD object.

Definition at line 51 of file MuonSpectrometer/MuonPhaseII/MuonTrackBuilding/MuonTrackFindingTools/src/TrackSummaryTool.h.

51{this, "fillHoles", true};

◆ m_fillOutliers

Gaudi::Property<bool> MuonR4::TrackSummaryTool::m_fillOutliers {this, "fillOutliers", true}
private

Toggle whether outlier states shall be copied to the xAOD object.

Definition at line 53 of file MuonSpectrometer/MuonPhaseII/MuonTrackBuilding/MuonTrackFindingTools/src/TrackSummaryTool.h.

53{this, "fillOutliers", true};

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> MuonR4::TrackSummaryTool::m_idHelperSvc {this, "IdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

IdHelperSvc to decode the Identifiers.

Definition at line 49 of file MuonSpectrometer/MuonPhaseII/MuonTrackBuilding/MuonTrackFindingTools/src/TrackSummaryTool.h.

49{this, "IdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_reDoSegments

Gaudi::Property<bool> MuonR4::TrackSummaryTool::m_reDoSegments {this, "recomputeSegment", true}
private

Toggle whether the segment summary shall be recomputed.

Definition at line 55 of file MuonSpectrometer/MuonPhaseII/MuonTrackBuilding/MuonTrackFindingTools/src/TrackSummaryTool.h.

55{this, "recomputeSegment", true};

The documentation for this class was generated from the following files: