ATLAS Offline Software
Loading...
Searching...
No Matches
MsTrackTester.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4#include "MsTrackTester.h"
5
14
15#include "Acts/Definitions/Units.hpp"
16
17#include <format>
18
19using namespace MuonVal;
20using namespace MuonPRDTest;
21using namespace MuonR4;
22using namespace Acts::UnitLiterals;
23
24namespace {
26 using SegLinkVec_t = std::vector<SegLink_t>;
27 static const SG::ConstAccessor<SegLinkVec_t> acc_truthSegLinks{"truthSegmentLinks"};
28 constexpr double MeVtoGeV = 1.e-3;
29
30 using Location = MsTrackSeeder::Location;
31
32
33 constexpr int overlapSector(const int sec1 , const int sec2) {
34 constexpr int nSec = Muon::MuonStationIndex::numberOfSectors();
35 if (sec2 > sec1) return overlapSector(sec2, sec1);
36 if (sec1 == 1 && sec2 == nSec) return 0;
37 return sec1 + sec2;
38 }
39
40}
41
42namespace MuonValR4 {
43 std::optional<MsTrackSeed> MsTrackTester::makeSeedFromTruth(const ActsTrk::GeometryContext& gctx,
44 const xAOD::TruthParticle& truthMuon) const {
45 int secMax{-1}, secMin{100};
46 std::vector<const xAOD::MuonSegment*> matchedSegs = MuonR4::getTruthSegments(truthMuon);
47 if (matchedSegs.empty()) {
48 return std::nullopt;
49 }
50 for (const xAOD::MuonSegment* seg : matchedSegs) {
51 secMax = std::max(secMax, seg->sector());
52 secMin = std::min(secMin, seg->sector());
53 }
54 const int orSec = overlapSector(secMax, secMin);
56 MsTrackSeed barrelSeed{Location::Barrel, orSec};
57 MsTrackSeed endcapSeed{Location::Endcap, orSec};
58 for (const xAOD::MuonSegment* seg : matchedSegs) {
59 barrelSeed.addSegment(seg);
60 endcapSeed.addSegment(seg);
61 }
62 barrelSeed.setPosition(matchedSegs[0]->position());
63 endcapSeed.setPosition(matchedSegs[0]->position());
64 const auto [barrelLength, barrelTheta] = calcSeedLength(gctx, barrelSeed);
65 const auto [endcapLength, endcapTheta] = calcSeedLength(gctx, endcapSeed);
66 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - Constructed new seed from truth muon wih pT:"
67 <<(truthMuon.pt()/ Gaudi::Units::GeV)<<" [GeV], eta: "<<truthMuon.eta()
68 <<", phi: "<<(truthMuon.phi() / 1._degree)<<", q: "<<truthMuon.charge()
69 <<", matchedSeg: "<<matchedSegs.size()<< " barrel (L/theta): "<<barrelLength
70 <<"/"<<(barrelTheta / 1._degree)<<" - endcap (L/theta): "
71 <<endcapLength<<"/"<<(endcapTheta / 1._degree)<<"\n"<<barrelSeed);
72 if (barrelLength < 0 && endcapLength < 0) {
73 ATH_MSG_WARNING(__func__<<"() "<<__LINE__<<" - Invalid seed");
74 return std::nullopt;
75 }
76 return barrelLength < 0 || std::abs(endcapLength) < barrelLength
77 ? endcapSeed : barrelSeed;
78 }
79
80 std::pair<double, double> MsTrackTester::calcSeedLength(const ActsTrk::GeometryContext& gctx,
81 const MuonR4::MsTrackSeed& seed) const {
82 double maxL{-1.*Gaudi::Units::km}, minL{1.*Gaudi::Units::km},
83 maxTheta{-M_PI}, minTheta{M_PI};
84 for (const xAOD::MuonSegment* seg : seed.segments()) {
85 const auto secProj = m_seeder->projectorFromSeed(*seg, seed);
86 const Amg::Vector2D projPos{m_seeder->expressOnCylinder(gctx, *seg, seed.location(), secProj)};
87 if (!m_seeder->withinBounds(projPos, seed.location())) {
88 continue;
89 }
90 const double projected = projPos[seed.location()==Location::Barrel];
91 const double theta = seg->direction().theta();
92 minL = std::min(minL, projected);
93 maxL = std::max(maxL, projected);
94 minTheta = std::min(minTheta, theta);
95 maxTheta = std::max(maxTheta, theta);
96 }
97 return std::make_pair(maxL - minL, maxTheta - minTheta);
98 }
101 ATH_CHECK(m_truthKey.initialize(m_isMC));
102 ATH_CHECK(m_msTrkSeedKey.initialize());
103 ATH_CHECK(m_recoSegmentKey.initialize());
104 ATH_CHECK(m_segSelector.retrieve());
105 ATH_CHECK(m_geoCtxKey.initialize());
106 ATH_CHECK(m_fieldCacheKey.initialize());
107 ATH_CHECK(m_trackKey.initialize());
108 ATH_CHECK(m_summaryTool.retrieve());
109
110 ATH_CHECK(m_legacyTrackKey.initialize(!m_legacyTrackKey.empty()));
111 ATH_CHECK(m_legacySegmentKey.initialize(!m_legacySegmentKey.empty()));
112 ATH_CHECK(m_legacyMuonKey.initialize(!m_legacyMuonKey.empty()));
113
114 ATH_CHECK(detStore()->retrieve(m_detMgr));
115
116 MsTrackSeeder::Config seederCfg{};
117 seederCfg.detMgr = m_detMgr;
118 seederCfg.seedHalfLength = 2.*Gaudi::Units::m;
119 seederCfg.endcapDiscRadius = 40.*Gaudi::Units::m;
120 m_seeder = std::make_unique<MuonR4::MsTrackSeeder>(name(), std::move(seederCfg));
121
122 int evOpts{0};
123
124 m_recoSegs = std::make_unique<SegmentVariables>(m_tree, m_recoSegmentKey.key(), "Segments", msgLevel());
126 "Segments_passSeedQual",[this](const SG::AuxElement* aux){
127 const auto* seg = static_cast<const xAOD::MuonSegment*>(aux);
128 return m_segSelector->passSeedingQuality(Gaudi::Hive::currentContext(),
129 *MuonR4::detailedSegment(*seg)); }));
131 "Segments_passTrackQual",[this](const SG::AuxElement* aux){
132 const auto* seg = static_cast<const xAOD::MuonSegment*>(aux);
133 return m_segSelector->passTrackQuality(Gaudi::Hive::currentContext(),
135 }));
136
137
138 if (m_isMC) {
139 evOpts |= EventInfoBranch::isMC;
141 "Segments_truthSegLink",[this](const SG::AuxElement* aux){
142 const auto* seg = static_cast<const xAOD::MuonSegment*>(aux);
144 const unsigned linkIdx = truthS ? m_truthSegs->push_back(*truthS) : -1;
146 if (truthS) {
147 m_truthSegToRecoLink.push_back(linkIdx, m_recoSegs->push_back(*seg));
148 const xAOD::TruthParticle* truthMuon = MuonR4::getTruthMatchedParticle(*truthS);
149 if (truthMuon){
150 m_truthTrks->push_back(truthMuon);
151 m_truthMuRecoSegLinks[m_truthTrks->find(truthMuon)].push_back(m_recoSegs->push_back(*seg));
152 }
153 }
154 return linkIdx;
155 }));
156
157 m_truthSegs = std::make_unique<SegmentVariables>(m_tree, m_truthSegmentKey.key(), "TruthSegments", msgLevel());
158
160 "TruthSegments_truthLink",[this](const SG::AuxElement* aux){
161 const auto* seg = static_cast<const xAOD::MuonSegment*>(aux);
163 m_truthTrks->push_back(truthP);
164 unsigned short linkIdx = m_truthTrks->find(truthP);
165 return linkIdx;
166 }));
168 "TruthSegments_hasBarrelProj", [this](const SG::AuxElement* aux){
169 const auto* seg = static_cast<const xAOD::MuonSegment*>(aux);
170 const ActsTrk::GeometryContext* gctx{nullptr};
171 SG::get(gctx, m_geoCtxKey, Gaudi::Hive::currentContext()).ignore();
173 for (const auto proj : {leftOverlap, center, rightOverlap}) {
174 const Amg::Vector2D projPos{m_seeder->expressOnCylinder(*gctx, *seg, Location::Barrel, proj)};
175 if (m_seeder->withinBounds(projPos, Location::Barrel)) {
176 return 1;
177 }
178 }
179 return 0;
180 }));
181
183 "TruthSegments_hasEndcapProj", [this](const SG::AuxElement* aux){
184 const auto* seg = static_cast<const xAOD::MuonSegment*>(aux);
185 const ActsTrk::GeometryContext* gctx{nullptr};
186 SG::get(gctx, m_geoCtxKey, Gaudi::Hive::currentContext()).ignore();
188 for (const auto proj : {leftOverlap, center, rightOverlap}) {
189 const Amg::Vector2D projPos{m_seeder->expressOnCylinder(*gctx, *seg, Location::Endcap, proj)};
190 if (m_seeder->withinBounds(projPos, Location::Endcap)) {
191 return 1;
192 }
193 }
194 return 0;
195 }));
196 m_tree.addBranch(m_truthSegs);
197
198 m_truthTrks = std::make_unique<IParticleFourMomBranch>(m_tree, "TruthMuons");
199 m_truthTrks->addVariable<int>(-1, "truthOrigin");
200 m_truthTrks->addVariable<int>(-1, "truthType");
201 m_tree.addBranch(m_truthTrks);
202 m_trkTruthLinks.emplace_back(m_truthSegmentKey, "truthParticleLink");
203 m_trkTruthLinks.emplace_back(m_truthKey, "truthSegmentLinks");
204 m_trkTruthLinks.emplace_back(m_recoSegmentKey, "truthSegmentLink");
205 }
206
207 m_tree.addBranch(m_recoSegs);
208 m_tree.addBranch(std::make_unique<EventInfoBranch>(m_tree, evOpts));
209 m_tree.addBranch(std::make_unique<TrackContainerModule>(m_tree, m_trackKey.key(), msgLevel()));
210
211 if(!m_legacyTrackKey.empty()) {
212 m_legacyTrks = std::make_unique<IParticleFourMomBranch>(m_tree, "LegacyMSTrks");
213 m_legacyTrks->addVariable(std::make_unique<TrackChi2Branch>(*m_legacyTrks));
214 if (m_isMC) {
216 return xAOD::TruthHelpers::getTruthParticle(*trk); }, "truth", "LegacyMS");
217 }
218 for (const auto& summary :{
219 // Inner
220 "innerSmallHits", "innerLargeHits", "innerSmallHoles", "innerLargeHoles",
221 // Middle
222 "middleSmallHits", "middleLargeHits", "middleSmallHoles",
223 "middleLargeHoles",
224 // Outer
225 "outerSmallHits", "outerLargeHits", "outerSmallHoles", "outerLargeHoles",
226 // Extended
227 "extendedSmallHits", "extendedLargeHits", "extendedSmallHoles",
228 "extendedLargeHoles",
229 "etaLayer1Hits", "phiLayer1Hits", "etaLayer2Hits", "phiLayer2Hits",
230 "etaLayer3Hits", "phiLayer3Hits", "etaLayer4Hits", "phiLayer4Hits",
231 "etaLayer1Holes", "phiLayer1Holes", "etaLayer2Holes", "phiLayer2Holes",
232 "etaLayer3Holes", "phiLayer3Holes", "etaLayer4Holes", "phiLayer4Holes" }) {
233 m_legacyTrks->addVariable<uint8_t>(-1, summary);
234 }
235
236 m_tree.addBranch(m_legacyTrks);
237
238
239 m_legacyRecoSegs = std::make_unique<SegmentVariables>(m_tree, m_legacySegmentKey.key(), "LegacyRecoSegments", msgLevel());
240 m_tree.addBranch(m_legacyRecoSegs);
241 }
242
243
244 m_seedSummary = std::make_shared<TrackSummaryModule>(m_tree, "MsTrkSeed", m_summaryTool.get());
245 m_trackSummary = std::make_shared<TrackSummaryModule>(m_tree, "ActsMsTracks", m_summaryTool.get());
246 m_tree.addBranch(m_seedSummary);
247 m_tree.addBranch(m_trackSummary);
248
249 ATH_CHECK(m_trkTruthLinks.initialize());
250 ATH_CHECK(m_tree.init(this));
251 return StatusCode::SUCCESS;
252 }
254 const EventContext& ctx{Gaudi::Hive::currentContext()};
255
256 const xAOD::TrackParticleContainer* legacyTrks{nullptr};
257 ATH_CHECK(SG::get(legacyTrks, m_legacyTrackKey, ctx));
258
259 //This for now is to be able to retrieve the matching between the legacy segments and tracks ...
260 const xAOD::MuonContainer* legacyMuons{nullptr};
261 ATH_CHECK(SG::get(legacyMuons, m_legacyMuonKey, ctx));
262
263 //Dump also legacy segments
264 const xAOD::MuonSegmentContainer* legacyRecoSegs{nullptr};
265 ATH_CHECK(SG::get(legacyRecoSegs, m_legacySegmentKey, ctx));
266
267
268 std::unordered_map<const xAOD::MuonSegment*, unsigned short> segIndex;
269
270 if (legacyTrks){
271 unsigned short iTrk = 0;
272 for (const xAOD::TrackParticle* track : *legacyTrks) {
273 ATH_MSG_VERBOSE("Legacy track "<< iTrk << ": pT: "<<(track->pt() *MeVtoGeV)<<" [GeV], eta: "<<track->eta()
274 <<", phi: "<<(track->phi() / 1._degree)<<", q: "<<track->charge());
275 m_summaryTool->copySummary(m_summaryTool->makeSummary(ctx, *track->track()),
276 *track);
277 m_legacyTrks->push_back(track);
278
279 //Change navigation from down to particle track? Initially only tracks were stored/looked at, whereas the following code is to navigate to associated muon segments ... in principle can change the order and thus avoid the matching part and some extra looping
280 unsigned iMuon = 0;
281 for (const xAOD::Muon* muon : *legacyMuons){
282 ATH_MSG_VERBOSE("iMuon " << iMuon << " pT: "<<(muon->pt() *MeVtoGeV)<<" [GeV], eta: "<<muon->eta()
283 <<", phi: "<<(muon->phi() / 1._degree)<<", q: "<<muon->charge() <<", nSegments: "<<muon->nMuonSegments());
284
285 ++iMuon;
286
287 //MS or ME? MS as we probably don't have yet material and extrapolated to IP
288 const xAOD::TrackParticle* msTrack = muon->trackParticle( xAOD::Muon::MuonSpectrometerTrackParticle);
289 if ( !msTrack || (msTrack != track) ) { continue; }
290
291 // retrieve associated segments for this track
292 for (size_t s = 0; s < muon->nMuonSegments(); ++s) {
293 const xAOD::MuonSegment* segment = muon->muonSegment(s);
294
295 ATH_MSG_VERBOSE(std::format( "Legacy muon-segment link: segment {:} @{:}, eta: {:.2f}, phi {:.2f}",
296 printID(*segment), Amg::toString(segment->position()),
297 segment->direction().eta(), segment->direction().phi() / 1._degree));
298
299 segIndex[segment] = iTrk;
300 }
301
302 }
303 ++iTrk;
304 }
305 }
306
307 if (legacyRecoSegs) {
308 unsigned short iSeg = 0;
309 m_legacySegToTrkLinks[legacyRecoSegs->size()-1];
310 for (const xAOD::MuonSegment* seg : *legacyRecoSegs) {
311 //Store all segments
312 m_legacyRecoSegs->push_back(*seg);
313
314 //Get the ordering in the legacy segment container to be able to link to the legacy tracks later on
315 m_legacySegToTrkLinks[iSeg] = segIndex.find(seg) != segIndex.end() ? segIndex[seg] : -1;
316
317 ATH_MSG_VERBOSE(std::format( "Dump legacy reco segment index {:} {:} @{:}, eta: {:.2f}, phi {:.2f} associated muon: {:}",
318 iSeg, printID(*seg), Amg::toString(seg->position()),
319 seg->direction().eta(), seg->direction().phi() / 1._degree, m_legacySegToTrkLinks[iSeg]));
320
321 ++iSeg;
322 }
323 }
324
326 const xAOD::MuonSegmentContainer* recoSegments{nullptr};
327 ATH_CHECK(SG::get(recoSegments, m_recoSegmentKey, ctx));
328 const MuonR4::MsTrackSeedContainer* trkSeeds{nullptr};
329 ATH_CHECK(SG::get(trkSeeds, m_msTrkSeedKey, ctx));
330 const ActsTrk::GeometryContext* gctx{nullptr};
331 ATH_CHECK(SG::get(gctx, m_geoCtxKey, ctx));
332 const AtlasFieldCacheCondObj* magCache{nullptr};
333 ATH_CHECK(SG::get(magCache, m_fieldCacheKey, ctx));
334
335 std::map<const xAOD::TruthParticle*, std::vector<unsigned>> truthToSeedMatchCounter{};
336 for (const MuonR4::MsTrackSeed& seed : *trkSeeds) {
337 unsigned int seedIdx = m_seedPos.size();
338 m_seedPos += seed.position();
339 m_seedType+= Acts::toUnderlying(seed.location());
340 m_seedSector += seed.sector();
341 m_seedSummary->push_back(ctx, seed);
342 ATH_MSG_VERBOSE(" Dump new seed: "<<seed);
343 for (const xAOD::MuonSegment* seg : seed.segments()){
344 m_seedRecoSegMatch[seedIdx].push_back(m_recoSegs->push_back(*seg));
345 if (const xAOD::MuonSegment* truthSeg = MuonR4::getMatchedTruthSegment(*seg);
346 truthSeg != nullptr) {
347 std::vector<unsigned>& matchCounter = truthToSeedMatchCounter[MuonR4::getTruthMatchedParticle(*truthSeg)];
348 if (seedIdx >= matchCounter.size()) {
349 matchCounter.resize(seedIdx +1);
350 }
351 ++matchCounter[seedIdx];
352 }
353 }
354 const auto[seedLength, theta] = calcSeedLength(*gctx, seed);
355 m_seedLength+= seedLength;
357 m_seedQP += m_seeder->estimateQtimesP(*gctx, *magCache, seed) / Gaudi::Units::GeV;
358 }
359 for (const xAOD::MuonSegment* seg : *recoSegments) {
360 m_recoSegs->push_back(*seg);
361 }
363 const xAOD::MuonSegmentContainer* truthSegs{nullptr};
364 ATH_CHECK(SG::get(truthSegs, m_truthSegmentKey, ctx));
365 if (truthSegs) {
366 for (const xAOD::MuonSegment* seg : *truthSegs) {
367 ATH_MSG_VERBOSE(std::format( "Dump truth segment {:} @{:}, eta: {:.2f}, phi {:.2f}",
368 printID(*seg), Amg::toString(seg->position()),
369 seg->direction().eta(), seg->direction().phi() / 1._degree));
370 m_truthSegs->push_back(*seg);
371 }
372 if (truthSegs->size()) {
373 m_truthSegToRecoLink[truthSegs->size()-1];
374 }
375 }
377 const xAOD::TruthParticleContainer* truthMuons{nullptr};
378 ATH_CHECK(SG::get(truthMuons, m_truthKey, ctx));
379 if (truthMuons && truthMuons->size()) {
381 m_truthMuToSeedIdx[truthMuons->size() -1];
382 m_truthMuToSeedCounter[truthMuons->size() -1];
383 m_truthMuTruthSegLinks[truthMuons->size() -1];
384 m_truthMuRecoSegLinks[truthMuons->size() -1];
385
386 for (const xAOD::TruthParticle* truth : *truthMuons) {
387 ATH_MSG_DEBUG("Truth muon: pT: "<<(truth->pt() *MeVtoGeV)<<", eta: "<<truth->eta()
388 <<", phi: "<<(truth->phi() / 1._degree)<<", q: "<<truth->charge());
389
390 m_truthTrks->push_back(*truth);
391 unsigned truthIdx = m_truthTrks->find(truth);
392 std::vector<unsigned>& matchCounter = truthToSeedMatchCounter[truth];
393 std::vector<unsigned>::iterator maxSeed = matchCounter.begin();
395 while ( (maxSeed = std::ranges::max_element(matchCounter))!=matchCounter.end() && (*maxSeed) > 0) {
396 m_truthMuToSeedIdx[truthIdx].push_back(std::distance(matchCounter.begin(), maxSeed));
397 m_truthMuToSeedCounter[truthIdx].push_back(*maxSeed);
398 (*maxSeed) = 0;
399 }
400
401 std::vector<unsigned short>& truthSegLinks = m_truthMuTruthSegLinks[truthIdx];
402 const std::vector<const xAOD::MuonSegment*> truthSegs = getTruthSegments(*truth);
403 m_truthMuTruthNSegs += truthSegs.size();
404 for (const xAOD::MuonSegment* truthSeg: truthSegs) {
405 truthSegLinks.push_back(m_truthSegs->push_back(*truthSeg));
406 }
407
408 auto truthSeed = makeSeedFromTruth(*gctx, *truth);
409 if (!truthSeed) {
410 m_truthMuonsSeedLength[truthIdx] = -1;
411 m_truthMuonsSeedCone[truthIdx] = -1;
412 m_truthMuonQP[truthIdx] =0;
413 } else {
414 const auto [length, cone] = calcSeedLength(*gctx, *truthSeed);
415 m_truthMuonsSeedLength[truthIdx] = length;
416 m_truthMuonsSeedCone [truthIdx] = cone;
417 m_truthMuonQP[truthIdx] = m_seeder->estimateQtimesP(*gctx, *magCache, *truthSeed) / Gaudi::Units::GeV;
418 }
419
420 }
421 }
422 const ActsTrk::TrackContainer* msTracks{nullptr};
423 ATH_CHECK(SG::get(msTracks, m_trackKey, ctx));
424 for (const auto trk : *msTracks) {
425 m_trackSummary->push_back(ctx, trk);
426 }
427
428 ATH_CHECK(m_tree.fill(ctx));
429 return StatusCode::SUCCESS;
430 }
432 ATH_CHECK(m_tree.write());
433 return StatusCode::SUCCESS;
434 }
435}
#define M_PI
Scalar theta() const
theta method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
double length(const pvec &v)
Handle class for reading from StoreGate.
const ServiceHandle< StoreGateSvc > & detStore() const
size_type size() const noexcept
Returns the number of elements in the collection.
void addSegment(const xAOD::MuonSegment *seg)
Append a segment to the seed.
void setPosition(Amg::Vector3D &&pos)
set the seed's position
MsTrackSeed::Location Location
Enum toggling whether the segment is in the endcap or barrel.
SectorProjector
Enumeration to select the sector projection.
const MuonGMR4::MuonDetectorManager * m_detMgr
std::optional< MuonR4::MsTrackSeed > makeSeedFromTruth(const ActsTrk::GeometryContext &gctx, const xAOD::TruthParticle &truthMuon) const
Construct MS track seed from the truth associated segments.
ToolHandle< MuonR4::ITrackSummaryTool > m_summaryTool
Hit summary tool.
SegmentKey_t m_legacySegmentKey
Legacy segment container.
MuonVal::VectorBranch< unsigned short > & m_legacySegToTrkLinks
Link of the legacy track to the legacy segment.
ParticleBranchPtr_t m_truthTrks
std::unique_ptr< MuonR4::MsTrackSeeder > m_seeder
MuonVal::VectorBranch< int > & m_seedSector
Sector of the seed, even center, odd overlap regions, for details see:
MuonVal::VectorBranch< float > & m_seedThetaCone
Maximum angular difference between the segments part of the seed.
ParticleBranchPtr_t m_legacyTrks
Output branches of the legacy MS tracks.
SegmentBranchPtr_t m_truthSegs
SegmentBranchPtr_t m_legacyRecoSegs
MuonVal::MatrixBranch< unsigned short > & m_truthMuRecoSegLinks
Links from the truth muon to the segments.
MuonVal::MatrixBranch< unsigned short > & m_truthMuToSeedIdx
Links to all MsTrkSeeds that could be matched to the truthMuon, i.e.
StatusCode execute() override final
MuonVal::VectorBranch< float > & m_truthMuonQP
Estimated Q x P from the seeder algorithm class.
MuonVal::VectorBranch< float > & m_truthMuonsSeedLength
MuonVal::VectorBranch< char > & m_seedType
Is the seed in the encap or in the barrel chambers.
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_legacyTrackKey
Legacy track reconstruction chain.
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthKey
Key to the truth particle collection.
Gaudi::Property< bool > m_isMC
MuonVal::MatrixBranch< unsigned short > & m_truthSegToRecoLink
Link of the truth segments to the matchin reco segments.
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheKey
Dependency on the magnetic field.
SegmentBranchPtr_t m_recoSegs
SG::ReadHandleKey< MuonR4::MsTrackSeedContainer > m_msTrkSeedKey
Temporary container write handle to push the seeds to store gate for later efficiency analysis.
SG::ReadDecorHandleKeyArray< SG::AuxVectorBase > m_trkTruthLinks
Decoration dependency to the MS truth track links.
MuonVal::MatrixBranch< unsigned short > & m_truthMuTruthSegLinks
Links from the truth muon to the segments.
MuonVal::VectorBranch< float > & m_truthMuonsSeedCone
Angular deviation of the true segment seed.
StatusCode initialize() override final
MuonVal::MatrixBranch< unsigned short > & m_seedRecoSegMatch
Link of the track seed to the building segment.
MuonVal::VectorBranch< float > & m_seedQP
Estimated momentum times charge from the track seed.
MuonVal::MatrixBranch< unsigned short > & m_truthMuToSeedCounter
Corresponding matching counter of reconstructed segments.
MuonVal::VectorBranch< unsigned short > & m_truthMuTruthNSegs
Number of associated truth muon segments.
MuonVal::ThreeVectorBranch m_seedPos
Simple seed information.
SG::ReadHandleKey< xAOD::MuonContainer > m_legacyMuonKey
Legacy muons.
MuonVal::VectorBranch< float > & m_seedLength
Maximum separation between the segments on the reference plane.
SG::ReadHandleKey< ActsTrk::TrackContainer > m_trackKey
Dependency on the R4 MS track container.
ToolHandle< MuonR4::ISegmentSelectionTool > m_segSelector
Segment selection tool to pick the good quality segments.
SegmentKey_t m_recoSegmentKey
Primary segment container.
MuonVal::MuonTesterTree m_tree
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
Dependency on the geometry alignment.
SegmentKey_t m_truthSegmentKey
Segment from the truth hits.
std::shared_ptr< TrackSummaryModule > m_trackSummary
Hit summary on the reconstructed track.
StatusCode finalize() override final
std::shared_ptr< TrackSummaryModule > m_seedSummary
Hit summary on the track seed.
std::pair< double, double > calcSeedLength(const ActsTrk::GeometryContext &gctx, const MuonR4::MsTrackSeed &seed) const
static bool connectCollections(ParticleBranch_ptr primColl, ParticleBranch_ptr secondColl, Linker_t fromPrimToSec, const std::string &altPrimName="", const std::string &altSecName="")
@ isMC
Flag determining whether the branch is simulation.
Generic branch object where the information is evaluated by a std::function instead reading it from t...
Helper class to provide constant type-safe access to aux data.
Class providing the definition of the 4-vector interface.
Amg::Vector3D direction() const
Returns the direction as Amg::Vector.
Amg::Vector3D position() const
Returns the position as Amg::Vector.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Matrix< double, 2, 1 > Vector2D
constexpr float MeVtoGeV
This header ties the generic definitions in this package.
const xAOD::TruthParticle * getTruthMatchedParticle(const xAOD::MuonSegment &segment)
Returns the particle truth-matched to the segment.
std::vector< MsTrackSeed > MsTrackSeedContainer
Definition MsTrackSeed.h:63
std::string printID(const xAOD::MuonSegment &seg)
Print the chamber ID of a segment, e.g.
std::vector< const xAOD::MuonSegment * > getTruthSegments(const xAOD::TruthParticle &truthMuon)
Returns the segments associated to the truth muon.
const xAOD::MuonSegment * getMatchedTruthSegment(const xAOD::MuonSegment &segment)
Returns the truth-matched segment.
ElementLink< MuonR4::SegmentContainer > SegLink_t
Abrivation of the link to the reco segment container.
std::vector< SegLink_t > SegLinkVec_t
const Segment * detailedSegment(const xAOD::MuonSegment &seg)
Helper function to navigate from the xAOD::MuonSegment to the MuonR4::Segment.
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
Class to store array like branches into the n-tuples.
Definition HitValAlg.cxx:19
constexpr unsigned numberOfSectors()
return total number of sectors
AuxElement(SG::AuxVectorData *container, size_t index)
Base class for elements of a container that can have aux data.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
const xAOD::TruthParticle * getTruthParticle(const xAOD::IParticle &p)
Return the truthParticle associated to the given IParticle (if any).
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TruthParticle_v1 TruthParticle
Typedef to implementation.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
Muon_v1 Muon
Reference the current persistent version:
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
MuonSegment_v1 MuonSegment
Reference the current persistent version:
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.
Configuration object.
double endcapDiscRadius
Radius of the endcap discs.
const MuonGMR4::MuonDetectorManager * detMgr
Detector manager to fetch the sector enevelope transforms.
double seedHalfLength
Maximum separation of point on the cylinder to be picked up onto a seed.