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 180 of file MuonSpectrometer/MuonPhaseII/MuonTrackBuilding/MuonTrackFindingTools/src/TrackSummaryTool.cxx.

181 {
182 ATH_MSG_DEBUG("Copy the summary \n "<<summary<<"\n pT: "<<(track.pt() * 1.e-3)
183 <<", eta: "<<track.eta()<<", phi: "<<track.phi());
184
185 auto acc = [&track](const xAOD::MuonSummaryType type) -> std::uint8_t& {
186 const std::string accName = SG::AuxTypeRegistry::instance().getName(
188 const SG::Decorator<std::uint8_t> dec{accName};
189 return dec(track);
190 };
191 using enum xAOD::MuonSummaryType;
193 acc(innerSmallHits) = summary.value(Cat_t::Precision, Stat_t::OnTrack, LayerIndex::Inner, true);
194 acc(innerLargeHits) = summary.value(Cat_t::Precision, Stat_t::OnTrack, LayerIndex::Inner, false);
195 acc(middleSmallHits) = summary.value(Cat_t::Precision, Stat_t::OnTrack, LayerIndex::Middle, true);
196 acc(middleLargeHits) = summary.value(Cat_t::Precision, Stat_t::OnTrack, LayerIndex::Middle, false);
197 acc(outerSmallHits) = summary.value(Cat_t::Precision, Stat_t::OnTrack, LayerIndex::Outer, true);
198 acc(outerLargeHits) = summary.value(Cat_t::Precision, Stat_t::OnTrack, LayerIndex::Outer, false);
199 acc(extendedSmallHits) = summary.value(Cat_t::Precision, Stat_t::OnTrack, LayerIndex::Extended, true);
200 acc(extendedLargeHits) = summary.value(Cat_t::Precision, Stat_t::OnTrack, LayerIndex::Extended, false);
201 if (m_fillHoles) {
202 acc(innerSmallHoles) = summary.value(Cat_t::Precision, Stat_t::Hole, LayerIndex::Inner, true);
203 acc(innerLargeHoles) = summary.value(Cat_t::Precision, Stat_t::Hole, LayerIndex::Inner, false);
204 acc(middleSmallHoles) = summary.value(Cat_t::Precision, Stat_t::Hole, LayerIndex::Middle, true);
205 acc(middleLargeHoles) = summary.value(Cat_t::Precision, Stat_t::Hole, LayerIndex::Middle, false);
206 acc(outerSmallHoles) = summary.value(Cat_t::Precision, Stat_t::Hole, LayerIndex::Outer, true);
207 acc(outerLargeHoles) = summary.value(Cat_t::Precision, Stat_t::Hole, LayerIndex::Outer, false);
208 acc(extendedSmallHoles) = summary.value(Cat_t::Precision, Stat_t::Hole, LayerIndex::Extended, true);
209 acc(extendedLargeHoles) = summary.value(Cat_t::Precision, Stat_t::Hole, LayerIndex::Extended, false);
210 }
211 if (m_fillOutliers) {
212 acc(innerOutBoundsPrecisionHits) = summary.value(Cat_t::Precision, Stat_t::Outlier, LayerIndex::Inner, false)
213 + summary.value(Cat_t::Precision, Stat_t::Outlier, LayerIndex::Inner, true);
214
215 acc(middleOutBoundsPrecisionHits) = summary.value(Cat_t::Precision, Stat_t::Outlier, LayerIndex::Middle, false)
216 + summary.value(Cat_t::Precision, Stat_t::Outlier, LayerIndex::Middle, true);
217
218 acc(outerOutBoundsPrecisionHits) = summary.value(Cat_t::Precision, Stat_t::Outlier, LayerIndex::Outer, false)
219 + summary.value(Cat_t::Precision, Stat_t::Outlier, LayerIndex::Outer, true);
220
221 acc(extendedOutBoundsPrecisionHits) = summary.value(Cat_t::Precision, Stat_t::Outlier, LayerIndex::Extended, false)
222 + summary.value(Cat_t::Precision, Stat_t::Outlier, LayerIndex::Extended, true);
223 }
224
226 acc(etaLayer1Hits) = summary.value(Cat_t::TriggerEta, Stat_t::OnTrack, LayerIndex::Inner, true)
227 + summary.value(Cat_t::TriggerEta, Stat_t::OnTrack, LayerIndex::Inner, false);
228
229 acc(etaLayer2Hits) = summary.value(Cat_t::TriggerEta, Stat_t::OnTrack, LayerIndex::Middle, true)
230 + summary.value(Cat_t::TriggerEta, Stat_t::OnTrack, LayerIndex::Middle, false);
231
232 acc(etaLayer3Hits) = summary.value(Cat_t::TriggerEta, Stat_t::OnTrack, LayerIndex::Outer, true)
233 + summary.value(Cat_t::TriggerEta, Stat_t::OnTrack, LayerIndex::Outer, false);
234
235 acc(etaLayer4Hits) = summary.value(Cat_t::TriggerEta, Stat_t::OnTrack, LayerIndex::Extended, true)
236 + summary.value(Cat_t::TriggerEta, Stat_t::OnTrack, LayerIndex::Extended, false);
237
238 if (m_fillHoles) {
239 acc(etaLayer1Holes) = summary.value(Cat_t::TriggerEta, Stat_t::Hole, LayerIndex::Inner, true)
240 + summary.value(Cat_t::TriggerEta, Stat_t::Hole, LayerIndex::Inner, false);
241
242 acc(etaLayer2Holes) = summary.value(Cat_t::TriggerEta, Stat_t::Hole, LayerIndex::Middle, true)
243 + summary.value(Cat_t::TriggerEta, Stat_t::Hole, LayerIndex::Middle, false);
244
245 acc(etaLayer3Holes) = summary.value(Cat_t::TriggerEta, Stat_t::Hole, LayerIndex::Outer, true)
246 + summary.value(Cat_t::TriggerEta, Stat_t::Hole, LayerIndex::Outer, false);
247
248 acc(etaLayer4Holes) = summary.value(Cat_t::TriggerEta, Stat_t::Hole, LayerIndex::Extended, true)
249 + summary.value(Cat_t::TriggerEta, Stat_t::Hole, LayerIndex::Extended, false);
250 }
251 acc(phiLayer1Hits) = summary.value(Cat_t::TriggerPhi, Stat_t::OnTrack, LayerIndex::Inner, true)
252 + summary.value(Cat_t::TriggerPhi, Stat_t::OnTrack, LayerIndex::Inner, false);
253
254 acc(phiLayer2Hits) = summary.value(Cat_t::TriggerPhi, Stat_t::OnTrack, LayerIndex::Middle, true)
255 + summary.value(Cat_t::TriggerPhi, Stat_t::OnTrack, LayerIndex::Middle, false);
256
257 acc(phiLayer3Hits) = summary.value(Cat_t::TriggerPhi, Stat_t::OnTrack, LayerIndex::Outer, true)
258 + summary.value(Cat_t::TriggerPhi, Stat_t::OnTrack, LayerIndex::Outer, false);
259
260 acc(phiLayer4Hits) = summary.value(Cat_t::TriggerPhi, Stat_t::OnTrack, LayerIndex::Extended, true)
261 + summary.value(Cat_t::TriggerPhi, Stat_t::OnTrack, LayerIndex::Extended, false);
262 if (m_fillHoles) {
263 acc(phiLayer1Holes) = summary.value(Cat_t::TriggerPhi, Stat_t::Hole, LayerIndex::Inner, true)
264 + summary.value(Cat_t::TriggerPhi, Stat_t::Hole, LayerIndex::Inner, false);
265
266 acc(phiLayer2Holes) = summary.value(Cat_t::TriggerPhi, Stat_t::Hole, LayerIndex::Middle, true)
267 + summary.value(Cat_t::TriggerPhi, Stat_t::Hole, LayerIndex::Middle, false);
268
269 acc(phiLayer3Holes) = summary.value(Cat_t::TriggerPhi, Stat_t::Hole, LayerIndex::Outer, true)
270 + summary.value(Cat_t::TriggerPhi, Stat_t::Hole, LayerIndex::Outer, false);
271
272 acc(phiLayer4Holes) = summary.value(Cat_t::TriggerPhi, Stat_t::Hole, LayerIndex::Extended, true)
273 + summary.value(Cat_t::TriggerPhi, Stat_t::Hole, LayerIndex::Extended, false);
274 }
275 }
#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 67 of file MuonSpectrometer/MuonPhaseII/MuonTrackBuilding/MuonTrackFindingTools/src/TrackSummaryTool.cxx.

70 {
72 const TechIdx techIdx = m_idHelperSvc->technologyIndex(hitId);
73
75 if (techIdx == TechIdx::TechnologyUnknown) {
76 return;
77 }
78 const ChIndex chIdx = m_idHelperSvc->chamberIndex(hitId);
79 const LayerIndex layer{toLayerIndex(chIdx)};
80 const bool small{isSmall(chIdx)};
81
82 Cat_t cat1{Cat_t::nCategories}, cat2{Cat_t::nCategories};
83
84 if (techIdx == TechIdx::MDT || techIdx == TechIdx::MM) {
85 cat1 = Cat_t::Precision;
87 if (prdDim == 2){
88 cat2 = Cat_t::TriggerPhi;
89 }
90 } else if (techIdx == TechIdx::RPC || techIdx == TechIdx::TGC) {
92 if (prdDim == 0 || prdDim == 2) {
93 cat1 = Cat_t::TriggerEta;
94 cat2 = Cat_t::TriggerPhi;
95 } else if (m_idHelperSvc->measuresPhi(hitId)) {
96 cat1 = Cat_t::TriggerPhi;
97 } else {
98 cat1 = Cat_t::TriggerEta;
99 }
100 } else if (techIdx == TechIdx::STGC) {
101 if(m_idHelperSvc->stgcIdHelper().channelType(hitId) == sTgcIdHelper::sTgcChannelTypes::Pad){
102 cat1 = Cat_t::sTgcPad;
103 } else if (m_idHelperSvc->stgcIdHelper().channelType(hitId) == sTgcIdHelper::sTgcChannelTypes::Wire){
104 cat1 = Cat_t::TriggerPhi;
105 } else if (m_idHelperSvc->stgcIdHelper().channelType(hitId) == sTgcIdHelper::sTgcChannelTypes::Strip){
106 cat1 = Cat_t::Precision;
107 }
108 } else {
109 ATH_MSG_ERROR(__FILE__ << ":" << __LINE__ << " Unkown technology index "<<static_cast<int>(techIdx));
110 return;
111 }
112
113 if (cat1 != Cat_t::nCategories){
114 ATH_MSG_VERBOSE("Increment "<<summary.toString(cat1)<<", "<<summary.toString(status)<<", layer: "
115 <<Muon::MuonStationIndex::layerName(layer)<<", small: "<<(small ? "yes" : "no"));
116 ++summary.value(cat1, status, layer, small);
117 }
118 if (cat2 != Cat_t::nCategories) {
119 ATH_MSG_VERBOSE("Increment "<<summary.toString(cat2)<<", "<<summary.toString(status)<<", layer: "
120 <<Muon::MuonStationIndex::layerName(layer)<<", small: "<<(small ? "yes" : "no"));
121 ++summary.value(cat2, status, layer, small);
122 }
123 }
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(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 24 of file MuonSpectrometer/MuonPhaseII/MuonTrackBuilding/MuonTrackFindingTools/src/TrackSummaryTool.cxx.

24 {
25 ATH_CHECK(m_idHelperSvc.retrieve());
26 return StatusCode::SUCCESS;
27 }
#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 28 of file MuonSpectrometer/MuonPhaseII/MuonTrackBuilding/MuonTrackFindingTools/src/TrackSummaryTool.cxx.

29 {
30 HitSummary summary{};
31 trackProxy.container().trackStateContainer().visitBackwards(trackProxy.tipIndex(),
32 [&](const auto& state){
33 Stat_t status{Stat_t::OnTrack};
34 if (state.typeFlags().isOutlier()){
35 status = Stat_t::Outlier;
36 } else if (state.typeFlags().isHole()) {
37 status = Stat_t::Hole;
38 }
39 if (state.hasUncalibratedSourceLink()) {
40 const auto* meas = xAODUncalibMeasCalibrator::unpack(state.getUncalibratedSourceLink());
41 // for the combined sTgc space point we have to fill the primary and secodnray measuremment seperately to resolve the strip/pad/wire combinations
42 if(meas->type() == xAOD::UncalibMeasType::sTgcStripType && meas->numDimensions() == 0){
43 const auto* combinedMeas = static_cast<const xAOD::CombinedMuonStrip*>(meas);
44 incrementSummary(xAOD::identify(combinedMeas->primaryStrip()), status, combinedMeas->primaryStrip()->numDimensions(), summary);
45 incrementSummary(xAOD::identify(combinedMeas->secondaryStrip()), status, combinedMeas->secondaryStrip()->numDimensions(), summary);
46
47 } else {
48 incrementSummary(xAOD::identify(meas), status, meas->numDimensions(), summary);
49 }
50 } else if (state.hasReferenceSurface()) {
51 const Acts::Surface& surf{state.referenceSurface()};
53 const Acts::SurfacePlacementBase* detEl = surf.surfacePlacement();
54 if (!detEl) {
55 return;
56 }
57 incrementSummary(static_cast<const ActsTrk::IDetectorElementBase*>(detEl)->identify(),
58 status, 1, summary);
59 }
60 });
61 ATH_MSG_DEBUG("Obtained track summary from track with "<<Acts::toString(trackProxy.fourMomentum())
62 <<", q: "<<trackProxy.qOverP()
63 <<", chi2: "<<(trackProxy.chi2()/ std::max(trackProxy.nDoF(), 1u))
64 <<", nDoF: "<<trackProxy.nDoF()<<"\n"<<summary);
65 return summary;
66 }
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 125 of file MuonSpectrometer/MuonPhaseII/MuonTrackBuilding/MuonTrackFindingTools/src/TrackSummaryTool.cxx.

126 {
127 HitSummary summary{};
128 for (const xAOD::MuonSegment* seg : segments) {
129 const LayerIndex lay = toLayerIndex(seg->chamberIndex());
130 const bool small = isSmall(seg->chamberIndex());
131 if (!m_reDoSegments) {
132 summary.value(Cat_t::Precision, Stat_t::OnTrack, lay, small) = seg->nPrecisionHits();
133 summary.value(Cat_t::TriggerEta, Stat_t::OnTrack, lay, small) = seg->nTrigEtaLayers();
134 summary.value(Cat_t::TriggerPhi, Stat_t::OnTrack, lay, small) = seg->nPhiLayers();
135 } else {
136 const std::size_t nHits = nMeasurements(*seg);
137 for (std::size_t hit = 0; hit < nHits; ++hit) {
138 Stat_t state = isOutlierMeasurement(*seg, hit) ? Stat_t::Outlier : Stat_t::OnTrack;
139 const auto * meas = getMeasurement(*seg, hit);
140 // for the combined sTgc space point we have to fill the primary and secodnray measuremment seperately to resolve the strip/pad/wire combinations
141 if(meas->type() == xAOD::UncalibMeasType::sTgcStripType && meas->numDimensions() == 0){
142 const auto* combinedMeas = static_cast<const xAOD::CombinedMuonStrip*>(meas);
143 incrementSummary(xAOD::identify(combinedMeas->primaryStrip()), state, combinedMeas->primaryStrip()->numDimensions(), summary);
144 incrementSummary(xAOD::identify(combinedMeas->secondaryStrip()), state, combinedMeas->secondaryStrip()->numDimensions(), summary);
145
146 } else {
147 incrementSummary(xAOD::identify(meas), state, meas->numDimensions(), summary);
148 }
149 }
150 }
151 }
152 return summary;
153 }
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:
CombinedMuonStrip_v1 CombinedMuonStrip

◆ makeSummary() [3/3]

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

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

155 {
156 HitSummary summary{};
157 for (const Trk::TrackStateOnSurface* tsos : *track.trackStateOnSurfaces()) {
159 if (tsos->type(Hole)){
160 incrementSummary(tsos->surface().associatedDetectorElementIdentifier(),
161 Stat_t::Hole, 1, summary);
162 continue;
163 }
164 const auto* meas = tsos->measurementOnTrack();
165 if (!meas) {
166 continue;
167 }
168 Stat_t state = tsos->type(Outlier) ? Stat_t::Outlier : Stat_t::OnTrack;
169 if (const auto* rot = dynamic_cast<const Trk::RIO_OnTrack*>(meas); rot != nullptr) {
170 incrementSummary(rot->identify(), state, 1, summary);
171 } else if (const auto* rot = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(meas); rot != nullptr) {
172 for (unsigned n = 0; n <rot->numberOfContainedROTs(); ++n) {
173 incrementSummary(rot->rioOnTrack(n).identify(), state, 1, summary);
174 }
175 }
176 }
177 return summary;
178 }

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: