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

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

69 {
71 const TechIdx techIdx = m_idHelperSvc->technologyIndex(hitId);
72
74 if (techIdx == TechIdx::TechnologyUnknown) {
75 return;
76 }
77 const ChIndex chIdx = m_idHelperSvc->chamberIndex(hitId);
78 const LayerIndex layer{toLayerIndex(chIdx)};
79 const bool small{isSmall(chIdx)};
80
81 Cat_t cat1{Cat_t::nCategories}, cat2{Cat_t::nCategories};
82
83 if (techIdx == TechIdx::MDT || techIdx == TechIdx::MM) {
84 cat1 = Cat_t::Precision;
86 if (prdDim == 2){
87 cat2 = Cat_t::TriggerPhi;
88 }
89 } else if (techIdx == TechIdx::RPC || techIdx == TechIdx::TGC) {
91 if (prdDim == 0 || prdDim == 2) {
92 cat1 = Cat_t::TriggerEta;
93 cat2 = Cat_t::TriggerPhi;
94 } else if (m_idHelperSvc->measuresPhi(hitId)) {
95 cat1 = Cat_t::TriggerPhi;
96 } else {
97 cat1 = Cat_t::TriggerEta;
98 }
99 } else if (techIdx == TechIdx::STGC) {
100 switch(m_idHelperSvc->stgcIdHelper().channelType(hitId)) {
102 cat1 = Cat_t::sTgcPad;
103 break;
105 cat1 = Cat_t::TriggerPhi;
106 break;
108 cat1 = Cat_t::Precision;
109 break;
110 } default: {
111 ATH_MSG_ERROR(__FILE__ << ":" << __LINE__ << " Unknown stgc channel type");
112 break;
113 }
114 }
115 } else {
116 ATH_MSG_ERROR(__FILE__ << ":" << __LINE__ << " Unkown technology index "<<static_cast<int>(techIdx));
117 return;
118 }
119
120 if (cat1 != Cat_t::nCategories){
121 ATH_MSG_VERBOSE("Increment "<<summary.toString(cat1)<<", "<<summary.toString(status)<<", layer: "
122 <<Muon::MuonStationIndex::layerName(layer)<<", small: "<<(small ? "yes" : "no"));
123 ++summary.value(cat1, status, layer, small);
124 }
125 if (cat2 != Cat_t::nCategories) {
126 ATH_MSG_VERBOSE("Increment "<<summary.toString(cat2)<<", "<<summary.toString(status)<<", layer: "
127 <<Muon::MuonStationIndex::layerName(layer)<<", small: "<<(small ? "yes" : "no"));
128 ++summary.value(cat2, status, layer, small);
129 }
130 }
#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
enum to classify the different layers in the muon spectrometer
LayerIndex toLayerIndex(ChIndex index)
convert ChIndex into LayerIndex
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* uncalib = dynamic_cast<const xAOD::MuonMeasurement*>(xAODUncalibMeasCalibrator::unpack(state.getUncalibratedSourceLink()));
41 // for the combined sTgc space point we have to fill the primary and secondary measuremment seperately to resolve the strip/pad/wire combinations
42 if(uncalib->type() == xAOD::UncalibMeasType::sTgcStripType && uncalib->numDimensions() == 0){
43 const auto* combinedMeas = dynamic_cast<const xAOD::CombinedMuonStrip*>(uncalib);
44 incrementSummary(combinedMeas->primaryStrip()->identify(), status, combinedMeas->primaryStrip()->numDimensions(), summary);
45 incrementSummary(combinedMeas->secondaryStrip()->identify(), status, combinedMeas->secondaryStrip()->numDimensions(), summary);
46
47 } else {
48 incrementSummary(uncalib->identify(), status, uncalib->numDimensions(), summary);
49 }
50 } else if (state.hasReferenceSurface()) {
51 const Acts::Surface& surf{state.referenceSurface()};
53 const auto* detEl = dynamic_cast<const ActsTrk::IDetectorElementBase*>(surf.surfacePlacement());
54 if (!detEl) {
55 return;
56 }
57 incrementSummary(detEl->identify(), status, 1, summary);
58 }
59 });
60 ATH_MSG_DEBUG("Obtained track summary from track with "<<Acts::toString(trackProxy.fourMomentum())
61 <<", q: "<<trackProxy.qOverP()
62 <<", chi2: "<<(trackProxy.chi2()/ std::max(trackProxy.nDoF(), 1u))
63 <<", nDoF: "<<trackProxy.nDoF()<<"\n"<<summary);
64 return summary;
65 }
if(pathvar)
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.

◆ makeSummary() [2/3]

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

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

133 {
134 HitSummary summary{};
135 for (const xAOD::MuonSegment* seg : segments) {
136 const LayerIndex lay = toLayerIndex(seg->chamberIndex());
137 const bool small = isSmall(seg->chamberIndex());
138 if (!m_reDoSegments) {
139 summary.value(Cat_t::Precision, Stat_t::OnTrack, lay, small) = seg->nPrecisionHits();
140 summary.value(Cat_t::TriggerEta, Stat_t::OnTrack, lay, small) = seg->nTrigEtaLayers();
141 summary.value(Cat_t::TriggerPhi, Stat_t::OnTrack, lay, small) = seg->nPhiLayers();
142 } else {
143 const std::size_t nHits = nMeasurements(*seg);
144 for (std::size_t hit = 0; hit < nHits; ++hit) {
145 Stat_t state = isOutlierMeasurement(*seg, hit) ? Stat_t::Outlier : Stat_t::OnTrack;
146 const auto* uncalibMeas = dynamic_cast<const xAOD::MuonMeasurement*>(getMeasurement(*seg, hit));
147 // for the combined sTgc space point we have to fill the primary and secodnray measuremment seperately to resolve the strip/pad/wire combinations
148 if(uncalibMeas->type() == xAOD::UncalibMeasType::sTgcStripType && uncalibMeas->numDimensions() == 0){
149 const auto* combinedMeas = static_cast<const xAOD::CombinedMuonStrip*>(uncalibMeas);
150 incrementSummary(combinedMeas->primaryStrip()->identify(), state, combinedMeas->primaryStrip()->numDimensions(), summary);
151 incrementSummary(combinedMeas->secondaryStrip()->identify(), state, combinedMeas->secondaryStrip()->numDimensions(), summary);
152
153 } else {
154 incrementSummary(uncalibMeas->identify(), state, uncalibMeas->numDimensions(), summary);
155 }
156 }
157 }
158 }
159 return summary;
160 }
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.
MuonMeasurement_v1 MuonMeasurement
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 161 of file MuonSpectrometer/MuonPhaseII/MuonTrackBuilding/MuonTrackFindingTools/src/TrackSummaryTool.cxx.

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

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: