ATLAS Offline Software
Loading...
Searching...
No Matches
MuonHoughTransformTester.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "GaudiKernel/SystemOfUnits.h"
8
16#include "Acts/Utilities/Enumerate.hpp"
17#include "GaudiKernel/PhysicalConstants.h"
19
22
23 #include "Acts/Utilities/AlgebraHelpers.hpp"
24 #include "Acts/Definitions/Units.hpp"
25
27
28namespace {
29 constexpr double c_inv = 1. /Gaudi::Units::c_light;
30
31bool isPrecision(const MuonR4::SpacePoint& hit) {
32 using enum xAOD::UncalibMeasType;
33 return hit.type() == MdtDriftCircleType || hit.type() == MMClusterType ||
34 (hit.type() == sTgcStripType &&
35 static_cast<const xAOD::sTgcMeasurement*>(hit.primaryMeasurement())->channelType() ==
37}
38bool isPrecision(const MuonR4::CalibratedSpacePoint& hit) {
39 using enum xAOD::UncalibMeasType;
40 if (hit.type() == xAOD::UncalibMeasType::Other){
41 return false;
42 }
43 return isPrecision(*hit.spacePoint());
44}
45
46}
47
48
49namespace MuonValR4 {
50 using namespace MuonR4;
51 using namespace MuonVal;
52 using namespace Muon::MuonStationIndex;
53 using namespace Acts::UnitLiterals;
54
55
57
59 ATH_CHECK(m_geoCtxKey.initialize());
60
61 {
62 int infoOpts = 0;
63 if (m_isMC) infoOpts = EventInfoBranch::isMC;
64 m_tree.addBranch(std::make_unique<EventInfoBranch>(m_tree, infoOpts));
65 }
66
67 ATH_CHECK(m_recoSegKey.initialize());
68 for (const std::string& recoLink : m_recoSegLinks) {
69 m_truthSegLinkKeys.emplace_back(m_recoSegKey, recoLink);
70 }
71 ATH_CHECK(m_truthSegmentKey.initialize(!m_truthSegmentKey.empty()));
72 for (const std::string& link: m_truthLinks) {
73 m_truthSegLinkKeys.emplace_back(m_truthSegmentKey, link);
74 }
76
78 ATH_CHECK(m_patternSeedKeys.initialize());
81 m_spTester = std::make_unique<SpacePointTesterModule>(m_tree, m_spKeys.front().key(), msgLevel());
82 m_tree.addBranch(m_spTester);
83 } else {
84 m_tree.disableBranch(m_spMatchedToPattern.name());
85 m_tree.disableBranch(m_spMatchedToSegment.name());
86 }
87
88 for (std::size_t cov = 0 ; cov < m_segmentCov.size(); ++cov){
89 using namespace MuonR4::SegmentFit;
90 const auto [i, j] = Acts::symMatIndices<Acts::toUnderlying(ParamDefs::nPars)>(cov);
91 ParamDefs pI{static_cast<std::uint8_t>(i)},
92 pJ{static_cast<std::uint8_t>(j)};
93 std::string brName = (pI!= pJ) ? std::format("segment_cov_{:}_{:}", pI, pJ)
94 : std::format("segment_cov_{:}", pI);
95 m_segmentCov[cov] = std::make_shared<MuonVal::VectorBranch<float>>(m_tree, brName);
96 m_tree.addBranch(m_segmentCov[cov]);
97 }
98
99 ATH_CHECK(m_tree.init(this));
100 ATH_CHECK(m_idHelperSvc.retrieve());
101 ATH_CHECK(detStore()->retrieve(m_detMgr));
102
103 ATH_CHECK(m_visionTool.retrieve(EnableTool{!m_visionTool.empty()}));
104
105 return StatusCode::SUCCESS;
106 }
107
108
110 const xAOD::MuonSegment& recoSeg) const{
111 unsigned int same{0};
112 using namespace SegmentFit;
113 const MuonR4::Segment* detailSeg = detailedSegment(recoSeg);
114 const auto[truePos, trueDir] = makeLine(localSegmentPars(truthSeg));
115 const auto[recoPos, recoDir] = makeLine(localSegmentPars(recoSeg));
116 const std::vector<int> truthSigns = SeedingAux::strawSigns(truePos, trueDir, detailSeg->measurements());
117 const std::vector<int> recoSigns = SeedingAux::strawSigns(recoPos, recoDir, detailSeg->measurements());
118 for (unsigned int s = 0 ; s < truthSigns.size(); ++s) {
119 same += (truthSigns[s] != 0) && truthSigns[s] == recoSigns[s];
120 }
121 return same;
122 }
123 std::vector<ObjectMatching>
125 const xAOD::MuonSegmentContainer& segmentContainer,
126 const xAOD::MuonSegmentContainer* truthSegments) const {
127 std::vector<ObjectMatching> allAssociations{};
128 std::unordered_set<const SegmentSeed*> usedSeeds{};
131 for (const xAOD::MuonSegment* recoSeg : segmentContainer) {
132 const MuonR4::Segment* segment = detailedSegment(*recoSeg);
133 assert(segment != nullptr);
134 std::vector<ObjectMatching>::iterator assoc_itr = allAssociations.end();
135 const xAOD::MuonSegment* truthSeg = getMatchedTruthSegment(*recoSeg);
137 if (truthSeg) {
138 assoc_itr = std::ranges::find_if(allAssociations, [truthSeg](const ObjectMatching& obj){
139 return obj.truthSegment == truthSeg;
140 });
141 }
143 if (assoc_itr == allAssociations.end()) {
144 ObjectMatching& newObj = allAssociations.emplace_back();
145 newObj.chamber = m_detMgr->getSectorEnvelope(recoSeg->chamberIndex(),
146 recoSeg->sector(),
147 recoSeg->etaIndex());
148 newObj.truthSegment = truthSeg;
149 assoc_itr = allAssociations.end() -1;
150 }
151 ObjectMatching& assocObj{*assoc_itr};
152 assocObj.matchedSegments.push_back(recoSeg);
153 assocObj.matchedSeeds.push_back(segment->parent());
154 assocObj.matchedSeedFoundSegment.push_back(1);
155 usedSeeds.insert(segment->parent());
156 }
157
158 if (truthSegments) {
160 for (ObjectMatching& assocObj : allAssociations) {
161 if (!assocObj.truthSegment) {
162 continue;
163 }
164 std::ranges::sort(assocObj.matchedSegments,
165 [&](const xAOD::MuonSegment* a,
166 const xAOD::MuonSegment* b){
167 return countOnSameSide(*assocObj.truthSegment, *a) >
168 countOnSameSide(*assocObj.truthSegment, *b);
169 });
170 }
171 }
173 for (const SegmentSeed* seed : seedContainer) {
175 if (usedSeeds.count(seed)) {
176 continue;
177 }
179 std::vector<std::pair<const xAOD::MuonSegment*, std::size_t>> segCounts{};
180 std::unordered_set<const xAOD::MuonSimHit* > matchedHits = getMatchingSimHits(*seed);
181 for (const xAOD::MuonSimHit* hit : matchedHits) {
182 const xAOD::MuonSegment* truthSeg = getMatchedTruthSegment(*hit);
183 if (!truthSeg) {
184 continue;
185 }
186 auto count_itr = std::ranges::find_if(segCounts, [truthSeg](const auto& segCounter){
187 return segCounter.first == truthSeg;
188 });
189 if (count_itr != segCounts.end()) {
190 ++(count_itr->second);
191 } else {
192 segCounts.emplace_back(std::make_pair(truthSeg, 1ul));
193 }
194 }
196 std::ranges::sort(segCounts, [](const auto& a, const auto& b){
197 return a.second > b.second;
198 });
199 // Add a criterion on the number of counts?
200 const xAOD::MuonSegment* truthSeg = segCounts.size()
201 ? segCounts.front().first : nullptr;
202 if (truthSeg) {
203 auto assoc_itr = std::ranges::find_if(allAssociations,
204 [truthSeg](const ObjectMatching& obj){
205 return obj.truthSegment == truthSeg;
206 });
207 if (assoc_itr == allAssociations.end()) {
208 ObjectMatching & newObj = allAssociations.emplace_back();
209 newObj.chamber = seed->msSector();
210 newObj.truthSegment = truthSeg;
211 assoc_itr = allAssociations.end() -1;
212 }
213 assoc_itr->matchedSeeds.push_back(seed);
214 assoc_itr->matchedSeedFoundSegment.push_back(0);
215 } else {
216 ObjectMatching & newObj = allAssociations.emplace_back();
217 newObj.chamber = seed->msSector();
218 newObj.matchedSeeds.push_back(seed);
219 newObj.matchedSeedFoundSegment.push_back(0);
220 }
221 }
223 if (truthSegments) {
224 for (const xAOD::MuonSegment* truthSeg : *truthSegments) {
226 if (std::ranges::any_of(allAssociations, [truthSeg](const auto& assocObj){
227 return assocObj.truthSegment == truthSeg;
228 })) {
229 continue;
230 }
231 ObjectMatching & newObj = allAssociations.emplace_back();
232 newObj.chamber = m_detMgr->getSectorEnvelope(truthSeg->chamberIndex(),
233 truthSeg->sector(),
234 truthSeg->etaIndex());
235 newObj.truthSegment = truthSeg;
236 }
237 }
238 return allAssociations;
239 }
240
242 ATH_CHECK(m_tree.write());
243 return StatusCode::SUCCESS;
244 }
245 StatusCode MuonHoughTransformTester::execute(const EventContext& ctx) {
246
247 const ActsTrk::GeometryContext* gctxPtr{nullptr};
248 ATH_CHECK(SG::get(gctxPtr, m_geoCtxKey, ctx));
249 const ActsTrk::GeometryContext& gctx{*gctxPtr};
250
253 const SegmentSeedContainer* readSegmentSeeds{nullptr};
254 ATH_CHECK(SG::get(readSegmentSeeds, key, ctx));
255 segmentSeeds.insert(segmentSeeds.end(), readSegmentSeeds->begin(), readSegmentSeeds->end());
256 }
257
258 const xAOD::MuonSegmentContainer* truthSegments{nullptr};
259 ATH_CHECK(SG::get(truthSegments, m_truthSegmentKey, ctx));
260
261 const xAOD::MuonSegmentContainer* recoSegments{nullptr};
262 ATH_CHECK(SG::get(recoSegments, m_recoSegKey, ctx));
263
264 ATH_MSG_DEBUG("Succesfully retrieved input collections. Seeds: "<<segmentSeeds.size()
265 <<", segments: "<<recoSegments->size()
266 <<", truth segments: "<<(truthSegments? truthSegments->size() : -1)
267 <<".");
268 std::vector<ObjectMatching> objects = matchWithTruth(*segmentSeeds.asDataVector(),
269 *recoSegments, truthSegments);
270 for (const ObjectMatching& obj : objects) {
271 fillChamberInfo(obj.chamber);
272 fillSeedInfo(obj);
273 fillSegmentInfo(obj);
274 if(m_isMC) fillTruthInfo(gctx, obj.truthSegment);
275 ATH_CHECK(m_tree.fill(ctx));
276 }
277 return StatusCode::SUCCESS;
278 }
280 m_out_chamberIndex = Acts::toUnderlying(msSector->chamberIndex());
281 m_out_stationSide = msSector->side();
282 m_out_stationPhi = msSector->stationPhi();
283 }
285 const xAOD::MuonSegment* segment) {
286 if (!segment) {
287 return;
288 }
289 const xAOD::TruthParticle* truthMuon = getTruthMatchedParticle(*segment);
290 m_out_hasTruth = true;
291
292 const Amg::Vector3D segDir{segment->direction()};
293 static const SG::ConstAccessor<float> acc_pt{"pt"};
294 static const SG::ConstAccessor<float> acc_charge{"charge"};
295 // eta is interpreted as the eta-location
296 m_out_gen_Q = acc_charge(*segment);
297 if (truthMuon) {
298 m_out_gen_Pt = truthMuon->pt();
299 m_out_gen_Eta = truthMuon->eta();
300 m_out_gen_Phi = truthMuon->phi();
301 m_out_gen_truthPdgId = truthMuon->pdgId();
302 m_out_gen_truthBeta = truthMuon->p4().Beta();
303 } else {
304 m_out_gen_Pt = acc_pt(*segment);
305 m_out_gen_Eta = segDir.eta();
306 m_out_gen_Phi = segDir.phi();
307 }
308 m_out_gen_deflection = Amg::angle(segDir, segment->position());
309 m_out_gen_deflectionEta = segDir.eta() - segment->position().eta();
310
311 const auto [chamberPos, chamberDir] = SegmentFit::makeLine(SegmentFit::localSegmentPars(*segment));
312
313 ATH_MSG_DEBUG("Number of precision Hits in the truth segment is "<<segment->nPrecisionHits()<<" and number of phi layers is "
314 <<segment->nPhiLayers()<<" and number of trigger eta layers is "<<segment->nTrigEtaLayers());
318 using namespace Acts::detail::LineHelper;
319 const Acts::Intersection3D bsExtp = lineIntersect<3>(Amg::Vector3D::Zero(),
320 Amg::Vector3D::UnitZ(),
321 segment->position(),
322 segment->direction());
323 const Amg::Vector3D closePoint = bsExtp.position();
324
325 m_out_gen_beamSpotR = closePoint.perp();
326 m_out_gen_beamSpotZ = std::abs(closePoint.z());
327 unsigned nMmEtaHits{0}, nMmStereoHits{0}, nStgcHits{0};
328 for (const xAOD::MuonSimHit* simHit : getMatchingSimHits(*segment)) {
329 if (!m_out_gen_truthBeta.isUpdated()) {
330 m_out_gen_truthBeta = simHit->beta();
331 m_out_gen_truthPdgId = simHit->pdgId();
332 }
333 nStgcHits += m_idHelperSvc->technologyIndex(simHit->identify()) == TechnologyIndex::STGC;
334 if(m_idHelperSvc->technologyIndex(simHit->identify()) != TechnologyIndex::MM) {
335 continue;
336 }
337 const bool isStereo = m_idHelperSvc->mmIdHelper().isStereo(simHit->identify());
338 nMmEtaHits += (!isStereo);
339 nMmStereoHits += isStereo;
340 }
341 m_out_gen_nMmEtaHits = nMmEtaHits;
342 m_out_gen_nMmStereoHits = nMmStereoHits;
343 m_out_gen_nStgcHits = nStgcHits;
344
345 m_out_gen_tanbeta = houghTanBeta(chamberDir);
346 m_out_gen_tanalpha = houghTanAlpha(chamberDir);
347 m_out_gen_y0 = chamberPos.y();
348 m_out_gen_x0 = chamberPos.x();
349 m_out_gen_time = segment->t0();
350
351 double minYhit = std::numeric_limits<double>::max();
352 double maxYhit = -1 * std::numeric_limits<double>::max();
353 for (const xAOD::MuonSimHit* hit : getMatchingSimHits(*segment)){
354 // Tell clang to optimize assuming FP operations may trap.
355 // cf. ATLASRECTS-8447
357 const Identifier hitId = hit->identify();
358 const MuonGMR4::MuonReadoutElement* RE = m_detMgr->getReadoutElement(hitId);
359 const IdentifierHash hash{m_idHelperSvc->isMdt(hitId) ? RE->measurementHash(hitId)
360 : RE->layerHash(hitId) };
361 const Acts::Transform3 localToChamber = RE->msSector()->globalToLocalTransform(gctx) * RE->localToGlobalTransform(gctx, hash);
362 const Amg::Vector3D chamberPos = localToChamber * xAOD::toEigen(hit->localPosition());
363 minYhit = std::min(chamberPos.y(), minYhit);
364 maxYhit = std::max(chamberPos.y(), maxYhit);
365 }
366 m_out_gen_minYhit = minYhit;
367 m_out_gen_maxYhit = maxYhit;
368
369
370 if (truthMuon) {
371 using namespace xAOD::TruthHelpers;
374 }
375 }
377 m_out_bucketEnd = bucket.coveredMax();
378 m_out_bucketStart = bucket.coveredMin();
379 m_out_nSpacePoints = bucket.size();
380
381 ATH_MSG_DEBUG("Filling bucket with "<<bucket.size()<<" space points between "<< bucket.coveredMin() <<" and "<< bucket.coveredMax() );
382
383 // Because the space points are first ordered by layers and then local y within the layer we need to resort them to compute the max gap in y between consecutive hits in the bucket
384 std::vector<const MuonR4::SpacePoint*> etaHits{};
385 etaHits.reserve(bucket.size());
386 for (const auto& sp : bucket) {
387 if (sp->measuresEta()) {
388 etaHits.push_back(sp.get());
389 }
390 }
391 std::ranges::sort(etaHits, [](const MuonR4::SpacePoint* a,
392 const MuonR4::SpacePoint* b) {
393 return a->localPosition().y() < b->localPosition().y();
394 });
395
396
397 double maxEtaHitGap{-1.f};
398 for (std::size_t i = 1; i < etaHits.size(); ++i) {
399 maxEtaHitGap = std::max(maxEtaHitGap,
400 std::abs(etaHits[i]->localPosition().y()
401 - etaHits[i - 1]->localPosition().y()));
402 }
403
404 m_out_bucketEtaHitGap = maxEtaHitGap;
405
406
407 m_out_nPrecSpacePoints = std::ranges::count_if(bucket, [](const SpacePointBucket::value_type& sp){
408 return isPrecision(*sp);
409 });
410 m_out_nPhiSpacePoints = std::ranges::count_if(bucket, [](const SpacePointBucket::value_type& sp){
411 return sp->measuresPhi();
412 });
413 if (!m_visionTool.isEnabled()){
414 return;
415 }
416 m_out_nTrueSpacePoints = std::ranges::count_if(bucket,[this](const SpacePointBucket::value_type& sp){
417 return m_visionTool->isLabeled(*sp);
418 });
419 m_out_nTruePrecSpacePoints = std::ranges::count_if(bucket,[this](const SpacePointBucket::value_type& sp){
420 return isPrecision(*sp) && m_visionTool->isLabeled(*sp);
421 });
422 m_out_nTruePhiSpacePoints = std::ranges::count_if(bucket,[this](const SpacePointBucket::value_type& sp){
423 return sp->measuresPhi() && m_visionTool->isLabeled(*sp);
424 });
425 }
427
428 m_out_seed_n = obj.matchedSeeds.size();
429 for (const auto [iseed, seed] : Acts::enumerate(obj.matchedSeeds)){
430 if (iseed ==0) {
431 fillBucketInfo(*seed->parentBucket());
432 }
433 double minYhit = m_out_bucketEnd.getVariable();
434 double maxYhit = m_out_bucketStart.getVariable();
435 for (const SpacePoint* hit : seed->getHitsInMax()){
436 minYhit = std::min(hit->localPosition().y(),minYhit);
437 maxYhit = std::max(hit->localPosition().y(),maxYhit);
438 }
439 m_out_seed_minYhit.push_back(minYhit);
440 m_out_seed_maxYhit.push_back(maxYhit);
441
442 m_out_seed_hasPhiExtension.push_back(seed->hasPhiExtension());
443 m_out_seed_y0.push_back(seed->interceptY());
444 m_out_seed_tanbeta.push_back(seed->tanBeta());
445 if (seed->hasPhiExtension()){
446 m_out_seed_x0.push_back(seed->interceptX());
447 m_out_seed_tanalpha.push_back(seed->tanAlpha());
448 } else{
449 m_out_seed_x0.push_back(-999);
450 m_out_seed_tanalpha.push_back(-999);
451 }
452 m_out_seed_ledToSegment.push_back(obj.matchedSeedFoundSegment.at(iseed));
453
454
457 auto hitCounter = [seed](auto lambda) {
458 return std::count_if(seed->getHitsInMax().begin(),
459 seed->getHitsInMax().end(), lambda);
460 };
461
462 m_out_seed_nPrecHits += hitCounter([](const SpacePoint* sp) {
463 return isPrecision(*sp);
464 });
465 m_out_seed_nEtaHits += hitCounter([](const SpacePoint* sp) {
466 return !isPrecision(*sp) && sp->measuresEta();
467 });
468 m_out_seed_nPhiHits += hitCounter([](const SpacePoint* sp) {
469 return sp->measuresPhi();
470 });
471
472 m_out_seed_nTruePrecHits += hitCounter([this](const SpacePoint* sp) {
473 return isPrecision(*sp) &&
474 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*sp));
475 });
476 m_out_seed_nTrueEtaHits += hitCounter([this](const SpacePoint* sp) {
477 return !isPrecision(*sp) && sp->measuresEta() &&
478 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*sp));
479 });
480 m_out_seed_nTruePhiHits += hitCounter([this](const SpacePoint* sp) {
481 return sp->measuresPhi() &&
482 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*sp));
483 });
484
485 /***
486 * Split hit counts for the NSW!
487 */
488 m_out_seed_nMmEtaHits += hitCounter([this](const SpacePoint* sp){
489 return sp->type() == xAOD::UncalibMeasType::MMClusterType &&
490 !m_idHelperSvc->mmIdHelper().isStereo(sp->identify());
491 });
492 m_out_seed_nMmStereoHits += hitCounter([this](const SpacePoint* sp){
493 return sp->type() == xAOD::UncalibMeasType::MMClusterType &&
494 m_idHelperSvc->mmIdHelper().isStereo(sp->identify());
495 });
496
497 m_out_seed_nsTgcStripHits+=hitCounter([](const SpacePoint* sp){
498 return sp->type() == xAOD::UncalibMeasType::sTgcStripType &&
499 isPrecision(*sp);
500 });
501 m_out_seed_nsTgcWireHits+=hitCounter([this](const SpacePoint* sp) {
502 return sp->type() == xAOD::UncalibMeasType::sTgcStripType &&
503 sp->measuresPhi() &&
504 m_idHelperSvc->stgcIdHelper().channelType(sp->identify()) !=
506 });
507 m_out_seed_nsTgcPadHits.push_back(hitCounter([this](const SpacePoint* sp){
508 return sp->type() == xAOD::UncalibMeasType::sTgcStripType &&
509 m_idHelperSvc->stgcIdHelper().channelType(sp->identify()) ==
511 }));
512
514 m_out_seed_nTrueMmEtaHits += hitCounter([this](const SpacePoint* sp){
515 return sp->type() == xAOD::UncalibMeasType::MMClusterType &&
516 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*sp)) &&
517 !m_idHelperSvc->mmIdHelper().isStereo(sp->identify());
518 });
519 m_out_seed_nTrueMmStereoHits += hitCounter([this](const SpacePoint* sp){
520 return sp->type() == xAOD::UncalibMeasType::MMClusterType &&
521 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*sp)) &&
522 m_idHelperSvc->mmIdHelper().isStereo(sp->identify());
523 });
524
525 m_out_seed_nTruesTgcStripHits+=hitCounter([this](const SpacePoint* sp){
526 return sp->type() == xAOD::UncalibMeasType::sTgcStripType &&
527 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*sp)) &&
528 isPrecision(*sp);
529 });
530 m_out_seed_nTruesTgcWireHits+=hitCounter([this](const SpacePoint* sp) {
531 return sp->type() == xAOD::UncalibMeasType::sTgcStripType &&
532 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*sp)) &&
533 sp->measuresPhi() &&
534 m_idHelperSvc->stgcIdHelper().channelType(sp->identify()) !=
536 });
537 m_out_seed_nTruesTgcPadHits.push_back(hitCounter([this](const SpacePoint* sp){
538 return sp->type() == xAOD::UncalibMeasType::sTgcStripType &&
539 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*sp)) &&
540 m_idHelperSvc->stgcIdHelper().channelType(sp->identify()) ==
542 }));
543
544 if (m_writeSpacePoints) {
545 std::vector<unsigned char> treeIdxs{};
546 for (const HoughHitType & houghSP: seed->getHitsInMax()){
548 unsigned treeIdx = m_spTester->push_back(*houghSP);
549 treeIdxs.push_back(treeIdx);
550 }
551 }
552 m_spMatchedToPattern[iseed] = std::move(treeIdxs);
553 }
554 }
555 }
556
558 using namespace SegmentFit;
559
560 m_out_segment_n = obj.matchedSegments.size();
561 for (const xAOD::MuonSegment* segment : obj.matchedSegments) {
562
564 const auto pars = localSegmentPars(*segment);
565 const auto cov = localSegmentCov(*segment);
566
567 m_out_segment_theta.push_back(pars[Acts::toUnderlying(ParamDefs::theta)]);
568 m_out_segment_phi.push_back(pars[Acts::toUnderlying(ParamDefs::phi)]);
569 m_out_segment_y0.push_back(pars[Acts::toUnderlying(ParamDefs::y0)]);
570 m_out_segment_x0.push_back(pars[Acts::toUnderlying(ParamDefs::x0)]);
571 m_out_segment_time.push_back(pars[Acts::toUnderlying(ParamDefs::t0)] +
572 segment->position().mag() * c_inv);
573
574 for (std::size_t i =0; i < Acts::toUnderlying(ParamDefs::nPars); ++i) {
575 for (std::size_t j = 0; j <=i; ++j) {
576 const std::size_t vecIdx = Acts::vecIdxFromSymMat<Acts::toUnderlying(ParamDefs::nPars)>(i,j);
577 m_segmentCov[vecIdx]->push_back((*cov)(i,j));
578 }
579 }
580
582 const MuonR4::Segment* detailSeg = detailedSegment(*segment);
583 m_out_segment_fitIter.push_back(detailSeg->nFitIterations());
584 m_out_segment_chi2.push_back(segment->chiSquared());
585 m_out_segment_nDoF.push_back(segment->numberDoF());
586 m_out_segment_hasTimeFit.push_back(detailSeg->hasTimeFit());
589 auto hitCounter = [detailSeg](auto lambda) {
590 return std::count_if(detailSeg->measurements().begin(),
591 detailSeg->measurements().end(), lambda);
592 };
593
597
601
606 m_out_segment_nTruePrecHits += hitCounter([this](const auto& meas) {
607 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
608 isPrecision(*meas) && (!m_visionTool.isEnabled() ||
609 m_visionTool->isLabeled(*meas->spacePoint()));
610 });
612 m_out_segment_nTrueTrigEtaHits += hitCounter([this](const auto& meas) {
613 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
614 !isPrecision(*meas) && meas->measuresEta() &&
615 meas->spacePoint() &&
616 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint()));
617 });
619 m_out_segment_nTrueTrigPhiHits += hitCounter([this](const auto& meas) {
620 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
621 !isPrecision(*meas) && meas->measuresPhi() &&
622 meas->spacePoint() &&
623 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint()));
624 });
626 m_out_segment_nTruePrecOutliers += hitCounter([this](const auto& meas) {
627 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
628 isPrecision(*meas) && (!m_visionTool.isEnabled() ||
629 m_visionTool->isLabeled(*meas->spacePoint()));
630 });
632 m_out_segment_nTrueTrigEtaOutliers += hitCounter([this](const auto& meas) {
633 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
634 !isPrecision(*meas) && meas->measuresEta() &&
635 meas->spacePoint() &&
636 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint()));
637 });
639 m_out_segment_nTrueTrigPhiOutliers += hitCounter([this](const auto& meas) {
640 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
641 !isPrecision(*meas) && meas->measuresPhi() &&
642 meas->spacePoint() &&
643 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint()));
644 });
645
646 /***
647 * Split hit counts for the NSW!
648 */
649 m_out_segment_nMmEtaHits.push_back(hitCounter([this](const auto& meas){
650 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
651 meas->type() == xAOD::UncalibMeasType::MMClusterType &&
652 !m_idHelperSvc->mmIdHelper().isStereo(meas->spacePoint()->identify());
653 }));
654 m_out_segment_nMmStereoHits.push_back(hitCounter([this](const auto& meas){
655 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
656 meas->type() == xAOD::UncalibMeasType::MMClusterType &&
657 m_idHelperSvc->mmIdHelper().isStereo(meas->spacePoint()->identify());
658 }));
659 m_out_segment_nMmEtaOutliers.push_back(hitCounter([this](const auto& meas){
660 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
661 meas->type() == xAOD::UncalibMeasType::MMClusterType &&
662 !m_idHelperSvc->mmIdHelper().isStereo(meas->spacePoint()->identify());
663 }));
664 m_out_segment_nMmStereoOutliers.push_back(hitCounter([this](const auto& meas){
665 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
666 meas->type() == xAOD::UncalibMeasType::MMClusterType &&
667 m_idHelperSvc->mmIdHelper().isStereo(meas->spacePoint()->identify());
668 }));
669
670 m_out_segment_nSTgcStripHits.push_back(hitCounter([](const auto& meas){
671 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
672 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
673 isPrecision(*meas);
674 }));
675 m_out_segment_nSTgcWireHits.push_back(hitCounter([this](const auto& meas){
676 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
677 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
678 meas->measuresPhi() &&
679 m_idHelperSvc->stgcIdHelper().channelType(meas->spacePoint()->identify()) !=
681 }));
682 m_out_segment_nSTgcPadHits.push_back(hitCounter([this](const auto& meas){
683 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
684 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
685 m_idHelperSvc->stgcIdHelper().channelType(meas->spacePoint()->identify()) ==
687 }));
688 m_out_segment_nSTgcStripOutliers.push_back(hitCounter([](const auto& meas){
689 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
690 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
691 isPrecision(*meas);
692 }));
693 m_out_segment_nSTgcWireOutliers.push_back(hitCounter([this](const auto& meas){
694 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
695 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
696 meas->measuresPhi() &&
697 m_idHelperSvc->stgcIdHelper().channelType(meas->spacePoint()->identify()) !=
699 }));
700 m_out_segment_nSTgcPadOutliers.push_back(hitCounter([this](const auto& meas){
701 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
702 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
703 m_idHelperSvc->stgcIdHelper().channelType(meas->spacePoint()->identify()) ==
705 }));
707 m_out_segment_nMmTrueEtaHits.push_back(hitCounter([this](const auto& meas){
708 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
709 meas->type() == xAOD::UncalibMeasType::MMClusterType &&
710 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) &&
711 !m_idHelperSvc->mmIdHelper().isStereo(meas->spacePoint()->identify());
712 }));
713 m_out_segment_nMmTrueStereoHits.push_back(hitCounter([this](const auto& meas){
714 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
715 meas->type() == xAOD::UncalibMeasType::MMClusterType &&
716 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) &&
717 m_idHelperSvc->mmIdHelper().isStereo(meas->spacePoint()->identify());
718 }));
719 m_out_segment_nMmTrueEtaOutliers.push_back(hitCounter([this](const auto& meas){
720 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
721 meas->type() == xAOD::UncalibMeasType::MMClusterType &&
722 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) &&
723 !m_idHelperSvc->mmIdHelper().isStereo(meas->spacePoint()->identify());
724 }));
725 m_out_segment_nMmTrueStereoOutliers.push_back(hitCounter([this](const auto& meas){
726 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
727 meas->type() == xAOD::UncalibMeasType::MMClusterType &&
728 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) &&
729 m_idHelperSvc->mmIdHelper().isStereo(meas->spacePoint()->identify());
730 }));
731 m_out_segment_nSTgcTrueStripHits.push_back(hitCounter([this](const auto& meas){
732 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
733 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
734 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) &&
735 isPrecision(*meas);
736 }));
737 m_out_segment_nSTgcTrueWireHits.push_back(hitCounter([this](const auto& meas){
738 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
739 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
740 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) &&
741 meas->measuresPhi() &&
742 m_idHelperSvc->stgcIdHelper().channelType(meas->spacePoint()->identify()) !=
744 }));
745 m_out_segment_nSTgcTruePadHits.push_back(hitCounter([this](const auto& meas){
746 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
747 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
748 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) &&
749 m_idHelperSvc->stgcIdHelper().channelType(meas->spacePoint()->identify()) ==
751 }));
752 m_out_segment_nSTgcTrueStripOutliers.push_back(hitCounter([this](const auto& meas){
753 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
754 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
755 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) &&
756 isPrecision(*meas);
757 }));
758 m_out_segment_nSTgcTrueWireOutliers.push_back(hitCounter([this](const auto& meas){
759 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
760 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
761 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) &&
762 meas->measuresPhi() &&
763 m_idHelperSvc->stgcIdHelper().channelType(meas->spacePoint()->identify()) !=
765 }));
766 m_out_segment_nSTgcTruePadOutliers.push_back(hitCounter([this](const auto& meas){
767 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
768 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
769 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) &&
770 m_idHelperSvc->stgcIdHelper().channelType(meas->spacePoint()->identify()) ==
772 }));
773
774 double minYhit = 1._km;
775 double maxYhit = -1._km;
776 double minYTruehit = 1._km;
777 double maxYTruehit = -1._km;
778
779 std::vector<unsigned char> matched{};
780 for (const auto & meas : detailSeg->measurements()){
781 // skip dummy measurement from beam spot constraint
782 ATH_MSG_VERBOSE(__func__<<"() - "<<__LINE__<<" Dump "<<(*meas));
783 if (meas->type() == xAOD::UncalibMeasType::Other) {
784 continue;
785 }
786 minYhit = std::min(meas->localPosition().y(),minYhit);
787 maxYhit = std::max(meas->localPosition().y(),maxYhit);
788 if (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) {
789 minYTruehit = std::min(meas->localPosition().y(), minYTruehit);
790 maxYTruehit = std::max(meas->localPosition().y(), maxYTruehit);
791 }
792 if (m_writeSpacePoints) {
793 unsigned treeIdx = m_spTester->push_back(*meas->spacePoint());
794 if (treeIdx >= matched.size()){
795 matched.resize(treeIdx +1);
796 }
797 matched[treeIdx] = true;
798 }
799 }
800
801 m_out_segment_minYhit += minYhit;
802 m_out_segment_maxYhit += maxYhit;
803 m_out_segment_minTrueYhit += minYTruehit;
804 m_out_segment_maxTrueYhit += maxYTruehit;
805 if (m_writeSpacePoints) {
806 m_spMatchedToSegment.push_back(std::move(matched));
807 }
808 }
809 }
810} // namespace MuonValR4
811
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_VERBOSE(x,...)
DataVector adapter that acts like it holds const pointers.
bool hit(const Container &ids, int pdgId)
static Double_t sp
static Double_t a
#define y
const ServiceHandle< StoreGateSvc > & detStore() const
hash_t hash(std::string_view histName) const
Method to calculate a 32-bit hash from a string.
DataVector adapter that acts like it holds const pointers.
iterator end() noexcept
Return an iterator pointing past the end of the collection.
iterator insert(iterator position, value_type pElem)
Add a new element to the collection.
const DV * asDataVector() const
Return a pointer to this object, as a const DataVector.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
This is a "hash" representation of an Identifier.
MuonReadoutElement is an abstract class representing the geometry of a muon detector.
const SpectrometerSector * msSector() const
Returns the pointer to the envelope volume enclosing all chambers in the sector.
const Acts::Transform3 & localToGlobalTransform(const ActsTrk::GeometryContext &ctx) const override final
Returns the transformation from the local coordinate system of the readout element into the global AT...
virtual IdentifierHash measurementHash(const Identifier &measId) const =0
The measurement hash is a continous numbering schema of all readout channels described by the specifi...
virtual IdentifierHash layerHash(const Identifier &measId) const =0
The layer hash removes the bits from the IdentifierHash corresponding to the measurement's channel nu...
A spectrometer sector forms the envelope of all chambers that are placed in the same MS sector & laye...
int8_t side() const
Returns the side of the MS-sector 1 -> A side ; -1 -> C side.
const Acts::Transform3 & globalToLocalTransform(const ActsTrk::GeometryContext &gctx) const
Returns the global -> local transformation from the ATLAS global.
int stationPhi() const
: Returns the station phi of the sector
Muon::MuonStationIndex::ChIndex chamberIndex() const
Returns the chamber index scheme.
The calibrated Space point is created during the calibration process.
Representation of a segment seed (a fully processed hough maximum) produced by the hough transform.
Definition SegmentSeed.h:14
Placeholder for what will later be the muon segment EDM representation.
unsigned int nFitIterations() const
Returns how many iterations the fitter needed to make the segment converge.
const SegmentSeed * parent() const
Returns the seed out of which the segment was built.
const MeasVec & measurements() const
Returns the associated measurements.
: The muon space point bucket represents a collection of points that will bre processed together in t...
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...
MuonVal::ScalarBranch< float > & m_out_gen_tanalpha
MuonVal::VectorBranch< unsigned short > & m_out_segment_nMmStereoHits
MuonVal::ScalarBranch< float > & m_out_gen_Pt
MuonVal::ScalarBranch< unsigned char > & m_out_nTruePhiSpacePoints
Number of phi hits in the bucket.
MuonVal::VectorBranch< float > & m_out_seed_maxYhit
MuonVal::ScalarBranch< float > & m_out_gen_truthBeta
ToolHandle< MuonValR4::IPatternVisualizationTool > m_visionTool
Pattern visualization tool.
MuonVal::ScalarBranch< unsigned > & m_out_segment_n
========== Segment block: Filled when we have one or multiple segments =============
MuonVal::VectorBranch< unsigned char > & m_out_seed_ledToSegment
MuonVal::VectorBranch< unsigned short > & m_out_segment_nTrigPhiOutliers
MuonVal::VectorBranch< unsigned short > & m_out_seed_nTrueEtaHits
const MuonGMR4::MuonDetectorManager * m_detMgr
MuonVal::VectorBranch< char > & m_out_segment_hasTimeFit
void fillTruthInfo(const ActsTrk::GeometryContext &gctx, const xAOD::MuonSegment *truthSegment)
Fill the associated truth information into the tree.
std::array< FloatVecBrPtr_t, Acts::sumUpToN(Acts::toUnderlying(MuonR4::SegmentFit::ParamDefs::nPars))> m_segmentCov
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
SG::ReadHandleKeyArray< MuonR4::SpacePointContainer > m_spKeys
List of the space point containers in the event legacy + NSW containers.
MuonVal::VectorBranch< unsigned short > & m_out_seed_nTrueMmStereoHits
MuonVal::VectorBranch< unsigned short > & m_out_seed_nMmEtaHits
MuonVal::ScalarBranch< float > & m_out_gen_deflection
MuonVal::VectorBranch< float > & m_out_seed_x0
std::vector< ObjectMatching > matchWithTruth(const MuonR4::SegmentSeedContainer &seedContainer, const xAOD::MuonSegmentContainer &segmentContainer, const xAOD::MuonSegmentContainer *truthSegments) const
MuonVal::ScalarBranch< float > & m_out_bucketEtaHitGap
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_recoSegKey
Key to the xAOD::MuonSegment container.
MuonVal::VectorBranch< unsigned short > & m_out_segment_nTrigPhiHits
MuonVal::VectorBranch< unsigned short > & m_out_segment_nSTgcTruePadHits
MuonVal::VectorBranch< unsigned short > & m_out_segment_nTruePrecOutliers
MuonVal::VectorBranch< unsigned short > & m_out_seed_nTruePrecHits
MuonVal::VectorBranch< unsigned short > & m_out_segment_nSTgcPadOutliers
SG::ReadHandleKeyArray< MuonR4::SegmentSeedContainer > m_patternSeedKeys
List of the two segment seed containers from which the segments are buiit (Complets the pattern findi...
MuonVal::VectorBranch< float > & m_out_segment_maxTrueYhit
MuonVal::VectorBranch< unsigned short > & m_out_segment_nSTgcTrueStripHits
MuonVal::VectorBranch< float > & m_out_seed_y0
MuonVal::ScalarBranch< unsigned short > & m_out_gen_nStgcHits
MuonVal::ScalarBranch< unsigned char > & m_out_nPhiSpacePoints
Number of phi hits in the bucket.
MuonVal::ScalarBranch< char > & m_out_hasTruth
======= Truth block: Filled if we have a truth match. ============
MuonVal::VectorBranch< unsigned short > & m_out_seed_hasPhiExtension
MuonVal::ScalarBranch< float > & m_out_gen_deflectionEta
MuonVal::ScalarBranch< unsigned short > & m_out_gen_nMmEtaHits
MuonVal::MatrixBranch< unsigned char > & m_spMatchedToPattern
Branch indicating which space points in the tree are associated to the i-th pattern.
MuonVal::ScalarBranch< int > & m_out_gen_truthType
MuonVal::ScalarBranch< int > & m_out_gen_truthPdgId
void fillSegmentInfo(const ObjectMatching &obj)
Fill the info assciated to the segment.
MuonVal::VectorBranch< unsigned short > & m_out_seed_nsTgcStripHits
MuonVal::ScalarBranch< int > & m_out_stationPhi
phi index of the station
MuonVal::VectorBranch< unsigned short > & m_out_segment_nSTgcTruePadOutliers
MuonVal::VectorBranch< unsigned short > & m_out_segment_nTruePrecHits
True matched hit counters.
MuonVal::VectorBranch< unsigned short > & m_out_segment_nSTgcTrueWireHits
MuonVal::ScalarBranch< float > & m_out_bucketEnd
MuonVal::ScalarBranch< float > & m_out_gen_beamSpotR
Beamspot approach.
MuonVal::ScalarBranch< unsigned char > & m_out_nTrueSpacePoints
Number of all space points in the bucket.
MuonVal::VectorBranch< unsigned short > & m_out_seed_nEtaHits
void fillChamberInfo(const MuonGMR4::SpectrometerSector *chamber)
Fill the current chamber info into the output.
MuonVal::VectorBranch< unsigned short > & m_out_segment_nTrigPhiHoles
MuonVal::VectorBranch< float > & m_out_segment_time
void fillBucketInfo(const MuonR4::SpacePointBucket &bucket)
Fill the hit summary info of the associated bucket.
MuonVal::ScalarBranch< short > & m_out_gen_Q
MuonVal::MatrixBranch< unsigned char > & m_spMatchedToSegment
Branch indicating which space points in the tree are associated to the i-th segment.
MuonVal::VectorBranch< unsigned short > & m_out_segment_nSTgcTrueStripOutliers
MuonVal::VectorBranch< unsigned short > & m_out_segment_nPrecOutliers
MuonVal::ScalarBranch< float > & m_out_gen_y0
Truth - segment parameters.
MuonVal::VectorBranch< unsigned short > & m_out_segment_nMmStereoOutliers
MuonVal::VectorBranch< unsigned short > & m_out_segment_nTrigEtaHits
MuonVal::VectorBranch< unsigned short > & m_out_segment_nSTgcStripOutliers
MuonVal::ScalarBranch< unsigned char > & m_out_nPrecSpacePoints
Number of precision hits in the bucket.
MuonVal::ScalarBranch< unsigned char > & m_out_nTruePrecSpacePoints
Number of precision hits in the bucket.
MuonVal::VectorBranch< unsigned short > & m_out_seed_nTruesTgcPadHits
MuonVal::VectorBranch< unsigned short > & m_out_segment_nTrigEtaHoles
MuonVal::VectorBranch< unsigned short > & m_out_segment_nSTgcWireOutliers
SG::ReadDecorHandleKeyArray< xAOD::MuonSegmentContainer > m_truthSegLinkKeys
Declare the dependencies on the decorations.
MuonVal::ScalarBranch< unsigned > & m_out_seed_n
========== Seed block: Filled when we have one or multiple seeds ============= seed count
MuonVal::VectorBranch< float > & m_out_segment_chi2
MuonVal::VectorBranch< unsigned short > & m_out_segment_nMmTrueEtaOutliers
MuonVal::VectorBranch< unsigned short > & m_out_seed_nTruePhiHits
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_truthSegmentKey
Key to the truth segment.
MuonVal::VectorBranch< unsigned short > & m_out_seed_nMmStereoHits
MuonVal::ScalarBranch< unsigned short > & m_out_gen_nMmStereoHits
MuonVal::ScalarBranch< float > & m_out_gen_Phi
MuonVal::VectorBranch< unsigned short > & m_out_segment_nTrueTrigEtaHits
MuonVal::VectorBranch< unsigned short > & m_out_seed_nsTgcWireHits
MuonVal::VectorBranch< float > & m_out_seed_minYhit
MuonVal::ScalarBranch< float > & m_out_gen_beamSpotZ
ActsTrk::GeoContextReadKey_t m_geoCtxKey
Tracking geometry context.
MuonVal::VectorBranch< unsigned short > & m_out_seed_nTrueMmEtaHits
MuonVal::ScalarBranch< int > & m_out_gen_truthOrigin
MC truth calssifier definition.
MuonVal::VectorBranch< float > & m_out_seed_tanbeta
MuonVal::VectorBranch< float > & m_out_segment_phi
MuonVal::VectorBranch< unsigned short > & m_out_segment_nTrueTrigPhiOutliers
MuonVal::VectorBranch< unsigned short > & m_out_seed_nPrecHits
MuonVal::ScalarBranch< float > & m_out_gen_maxYhit
MuonVal::ScalarBranch< float > & m_out_gen_minYhit
Gaudi::Property< std::vector< std::string > > m_truthLinks
Name of the decorations for the truth segment.
MuonVal::VectorBranch< float > & m_out_seed_tanalpha
MuonVal::VectorBranch< unsigned short > & m_out_seed_nsTgcPadHits
MuonVal::VectorBranch< float > & m_out_segment_theta
MuonVal::VectorBranch< unsigned short > & m_out_segment_nMmTrueStereoHits
MuonVal::VectorBranch< unsigned short > & m_out_segment_nTrigEtaOutliers
MuonVal::ScalarBranch< int > & m_out_chamberIndex
====== Common block: Filled for all entries ===========
MuonVal::ScalarBranch< unsigned char > & m_out_nSpacePoints
Number of all space points in the bucket.
Gaudi::Property< std::vector< std::string > > m_recoSegLinks
name of the truth link decorations for the reco segment container
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
MuonVal::VectorBranch< float > & m_out_segment_minYhit
MuonVal::VectorBranch< unsigned short > & m_out_segment_nMmEtaOutliers
MuonVal::ScalarBranch< unsigned short > & m_out_gen_nPrecHits
Truth - hit count summary.
MuonVal::VectorBranch< unsigned short > & m_out_segment_nMmTrueStereoOutliers
void fillSeedInfo(const ObjectMatching &obj)
Fill the info associated to the seed.
MuonVal::VectorBranch< float > & m_out_segment_x0
MuonVal::ScalarBranch< float > & m_out_gen_Eta
global particle properties
MuonVal::VectorBranch< unsigned short > & m_out_segment_nSTgcPadHits
MuonVal::VectorBranch< unsigned short > & m_out_segment_nMmEtaHits
NSW hit counters.
MuonVal::VectorBranch< unsigned short > & m_out_segment_nTrueTrigPhiHits
MuonVal::VectorBranch< float > & m_out_segment_maxYhit
MuonVal::VectorBranch< unsigned short > & m_out_segment_nSTgcTrueWireOutliers
MuonVal::ScalarBranch< float > & m_out_bucketStart
MuonVal::VectorBranch< float > & m_out_segment_minTrueYhit
MuonVal::VectorBranch< unsigned short > & m_out_segment_nSTgcWireHits
MuonVal::VectorBranch< unsigned short > & m_out_seed_nPhiHits
MuonVal::VectorBranch< unsigned short > & m_out_segment_nPrecHits
Hit counts on segment.
MuonVal::ScalarBranch< float > & m_out_gen_time
MuonVal::ScalarBranch< float > & m_out_gen_x0
MuonVal::VectorBranch< unsigned short > & m_out_seed_nTruesTgcWireHits
unsigned int countOnSameSide(const xAOD::MuonSegment &truthSeg, const xAOD::MuonSegment &recoSeg) const
Calculates how many measurements from the segment fit have the same drift sign as when evaluated with...
MuonVal::ScalarBranch< unsigned short > & m_out_gen_nTrigEtaHits
MuonVal::ScalarBranch< short > & m_out_stationSide
+1 for A-, -1 of C-side
MuonVal::VectorBranch< unsigned short > & m_out_segment_nMmTrueEtaHits
MuonVal::ScalarBranch< float > & m_out_gen_tanbeta
MuonVal::VectorBranch< uint16_t > & m_out_segment_nDoF
MuonVal::VectorBranch< uint16_t > & m_out_segment_fitIter
MuonVal::VectorBranch< float > & m_out_segment_y0
MuonVal::ScalarBranch< unsigned short > & m_out_gen_nTrigPhiHits
std::shared_ptr< SpacePointTesterModule > m_spTester
Branch dumping all the space points from the difference buckets.
MuonVal::VectorBranch< unsigned short > & m_out_segment_nTrueTrigEtaOutliers
MuonVal::VectorBranch< unsigned short > & m_out_seed_nTruesTgcStripHits
MuonVal::VectorBranch< unsigned short > & m_out_segment_nPrecHoles
MuonVal::VectorBranch< unsigned short > & m_out_segment_nSTgcStripHits
@ isMC
Flag determining whether the branch is simulation.
Helper class to provide constant type-safe access to aux data.
Property holding a SG store/key/clid from which a ReadHandle is made.
std::uint8_t nTrigEtaLayers() const
Returns the number of trigger eta hits.
std::uint8_t nTriggerPhiHoles() const
Returns the number of trigger phi holes.
float t0() const
float numberDoF() const
Returns the numberDoF.
Amg::Vector3D direction() const
Returns the direction as Amg::Vector.
std::uint8_t nPrecisionOutliers() const
Returns the number of precision outliers.
std::uint8_t nTriggerPhiOutliers() const
Returns the number of trigger phi outliers.
float chiSquared() const
std::uint8_t nPrecisionHits() const
Returns the number of precision hits.
std::uint8_t nPrecisionHoles() const
Returns the number of precision holes.
Amg::Vector3D position() const
Returns the position as Amg::Vector.
std::uint8_t nTriggerEtaHoles() const
Returns the number of trigger eta holes.
std::uint8_t nPhiLayers() const
Returns the number of trigger phi hits.
std::uint8_t nTriggerEtaOutliers() const
Returns the number of trigger eta outliers.
double angle(const Amg::Vector3D &v1, const Amg::Vector3D &v2)
calculates the opening angle between two vectors
Eigen::Matrix< double, 3, 1 > Vector3D
std::optional< Covariance > localSegmentCov(const xAOD::MuonSegment &seg)
Returns the localCovariance decoration from a xAOD::MuonSegment.
SeedingAux::FitParIndex ParamDefs
Use the same parameter indices as used by the CompSpacePointAuxiliaries.
Parameters localSegmentPars(const xAOD::MuonSegment &seg)
Returns the localSegPars decoration from a xAODMuon::Segment.
std::pair< Amg::Vector3D, Amg::Vector3D > makeLine(const Parameters &pars)
Returns the parsed parameters into an Eigen line parametrization.
const xAOD::TruthParticle * getTruthMatchedParticle(const xAOD::MuonSegment &segment)
Returns the particle truth-matched to the segment.
double houghTanBeta(const Amg::Vector3D &v)
Returns the hough tanBeta [y] / [z].
std::unordered_set< const xAOD::MuonSimHit * > getMatchingSimHits(const xAOD::MuonSegment &segment)
: Returns all sim hits matched to a xAOD::MuonSegment
const xAOD::MuonSegment * getMatchedTruthSegment(const xAOD::MuonSegment &segment)
Returns the truth-matched segment.
DataVector< SegmentSeed > SegmentSeedContainer
double houghTanAlpha(const Amg::Vector3D &v)
: Returns the hough tanAlpha [x] / [z]
const SpacePoint * HoughHitType
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...
MuonHoughTransformTester::ObjectMatching ObjectMatching
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Dedicated namespace for the helper functions.
int getParticleTruthType(const xAOD::IParticle &p)
Return the particle's truth type (as defined by the MC Truth Classifier).
int getParticleTruthOrigin(const xAOD::IParticle &p)
Return the particle's truth origin (as defined by the MC Truth Classifier).
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".
MuonSimHit_v1 MuonSimHit
Defined the version of the MuonSimHit.
Definition MuonSimHit.h:12
TruthParticle_v1 TruthParticle
Typedef to implementation.
UncalibMeasType
Define the type of the uncalibrated measurement.
sTgcMeasurement_v1 sTgcMeasurement
MuonSegment_v1 MuonSegment
Reference the current persistent version:
std::vector< const xAOD::MuonSegment * > matchedSegments
All segments matched to this object.
const xAOD::MuonSegment * truthSegment
Truth segment for reference.
const MuonGMR4::SpectrometerSector * chamber
Associated chamber.
std::vector< const MuonR4::SegmentSeed * > matchedSeeds
All seeds matched to this object.
Tell the compiler to optimize assuming that FP may trap.
#define CXXUTILS_TRAPPING_FP
Definition trapping_fp.h:24