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
26namespace {
27 constexpr double c_inv = 1. /Gaudi::Units::c_light;
28
29bool isPrecision(const MuonR4::SpacePoint& hit) {
30 using enum xAOD::UncalibMeasType;
31 return hit.type() == MdtDriftCircleType || hit.type() == MMClusterType ||
32 (hit.type() == sTgcStripType &&
33 static_cast<const xAOD::sTgcMeasurement*>(hit.primaryMeasurement())->channelType() ==
35}
36bool isPrecision(const MuonR4::CalibratedSpacePoint& hit) {
37 using enum xAOD::UncalibMeasType;
39 return false;
40 }
41 return isPrecision(*hit.spacePoint());
42}
43
44}
45
46
47namespace MuonValR4 {
48 using namespace MuonR4;
49 using namespace MuonVal;
50 using namespace Muon::MuonStationIndex;
51 using namespace Acts::UnitLiterals;
52
53
55
57 ATH_CHECK(m_geoCtxKey.initialize());
58
59 {
60 int infoOpts = 0;
61 if (m_isMC) infoOpts = EventInfoBranch::isMC;
62 m_tree.addBranch(std::make_unique<EventInfoBranch>(m_tree, infoOpts));
63 }
64
65 ATH_CHECK(m_recoSegKey.initialize());
66 for (const std::string& recoLink : m_recoSegLinks) {
67 m_truthSegLinkKeys.emplace_back(m_recoSegKey, recoLink);
68 }
69 ATH_CHECK(m_truthSegmentKey.initialize(!m_truthSegmentKey.empty()));
70 for (const std::string& link: m_truthLinks) {
71 m_truthSegLinkKeys.emplace_back(m_truthSegmentKey, link);
72 }
74
76 ATH_CHECK(m_patternSeedKeys.initialize());
79 m_spTester = std::make_unique<SpacePointTesterModule>(m_tree, m_spKeys.front().key(), msgLevel());
80 m_tree.addBranch(m_spTester);
81 } else {
82 m_tree.disableBranch(m_spMatchedToPattern.name());
83 m_tree.disableBranch(m_spMatchedToSegment.name());
84 }
85
86 for (std::size_t cov = 0 ; cov < m_segmentCov.size(); ++cov){
87 using namespace MuonR4::SegmentFit;
88 const auto [i, j] = Acts::symMatIndices<Acts::toUnderlying(ParamDefs::nPars)>(cov);
89 ParamDefs pI{static_cast<std::uint8_t>(i)},
90 pJ{static_cast<std::uint8_t>(j)};
91 std::string brName = (pI!= pJ) ? std::format("segment_cov_{:}_{:}", pI, pJ)
92 : std::format("segment_cov_{:}", pI);
93 m_segmentCov[cov] = std::make_shared<MuonVal::VectorBranch<float>>(m_tree, brName);
94 m_tree.addBranch(m_segmentCov[cov]);
95 }
96
97 ATH_CHECK(m_tree.init(this));
98 ATH_CHECK(m_idHelperSvc.retrieve());
99 ATH_CHECK(detStore()->retrieve(m_detMgr));
100
101 ATH_CHECK(m_visionTool.retrieve(EnableTool{!m_visionTool.empty()}));
102
103 return StatusCode::SUCCESS;
104 }
105
106
108 const xAOD::MuonSegment& recoSeg) const{
109 unsigned int same{0};
110 using namespace SegmentFit;
111 const MuonR4::Segment* detailSeg = detailedSegment(recoSeg);
112 const auto[truePos, trueDir] = makeLine(localSegmentPars(truthSeg));
113 const auto[recoPos, recoDir] = makeLine(localSegmentPars(recoSeg));
114 const std::vector<int> truthSigns = SeedingAux::strawSigns(truePos, trueDir, detailSeg->measurements());
115 const std::vector<int> recoSigns = SeedingAux::strawSigns(recoPos, recoDir, detailSeg->measurements());
116 for (unsigned int s = 0 ; s < truthSigns.size(); ++s) {
117 same += (truthSigns[s] != 0) && truthSigns[s] == recoSigns[s];
118 }
119 return same;
120 }
121 std::vector<ObjectMatching>
123 const xAOD::MuonSegmentContainer& segmentContainer,
124 const xAOD::MuonSegmentContainer* truthSegments) const {
125 std::vector<ObjectMatching> allAssociations{};
126 std::unordered_set<const SegmentSeed*> usedSeeds{};
129 for (const xAOD::MuonSegment* recoSeg : segmentContainer) {
130 const MuonR4::Segment* segment = detailedSegment(*recoSeg);
131 assert(segment != nullptr);
132 std::vector<ObjectMatching>::iterator assoc_itr = allAssociations.end();
133 const xAOD::MuonSegment* truthSeg = getMatchedTruthSegment(*recoSeg);
135 if (truthSeg) {
136 assoc_itr = std::ranges::find_if(allAssociations, [truthSeg](const ObjectMatching& obj){
137 return obj.truthSegment == truthSeg;
138 });
139 }
141 if (assoc_itr == allAssociations.end()) {
142 ObjectMatching& newObj = allAssociations.emplace_back();
143 newObj.chamber = m_detMgr->getSectorEnvelope(recoSeg->chamberIndex(),
144 recoSeg->sector(),
145 recoSeg->etaIndex());
146 newObj.truthSegment = truthSeg;
147 assoc_itr = allAssociations.end() -1;
148 }
149 ObjectMatching& assocObj{*assoc_itr};
150 assocObj.matchedSegments.push_back(recoSeg);
151 assocObj.matchedSeeds.push_back(segment->parent());
152 assocObj.matchedSeedFoundSegment.push_back(1);
153 usedSeeds.insert(segment->parent());
154 }
155
156 if (truthSegments) {
158 for (ObjectMatching& assocObj : allAssociations) {
159 if (!assocObj.truthSegment) {
160 continue;
161 }
162 std::ranges::sort(assocObj.matchedSegments,
163 [&](const xAOD::MuonSegment* a,
164 const xAOD::MuonSegment* b){
165 return countOnSameSide(*assocObj.truthSegment, *a) >
166 countOnSameSide(*assocObj.truthSegment, *b);
167 });
168 }
169 }
171 for (const SegmentSeed* seed : seedContainer) {
173 if (usedSeeds.count(seed)) {
174 continue;
175 }
177 std::vector<std::pair<const xAOD::MuonSegment*, std::size_t>> segCounts{};
178 std::unordered_set<const xAOD::MuonSimHit* > matchedHits = getMatchingSimHits(*seed);
179 for (const xAOD::MuonSimHit* hit : matchedHits) {
180 const xAOD::MuonSegment* truthSeg = getMatchedTruthSegment(*hit);
181 if (!truthSeg) {
182 continue;
183 }
184 auto count_itr = std::ranges::find_if(segCounts, [truthSeg](const auto& segCounter){
185 return segCounter.first == truthSeg;
186 });
187 if (count_itr != segCounts.end()) {
188 ++(count_itr->second);
189 } else {
190 segCounts.emplace_back(std::make_pair(truthSeg, 1ul));
191 }
192 }
194 std::ranges::sort(segCounts, [](const auto& a, const auto& b){
195 return a.second > b.second;
196 });
197 // Add a criterion on the number of counts?
198 const xAOD::MuonSegment* truthSeg = segCounts.size()
199 ? segCounts.front().first : nullptr;
200 if (truthSeg) {
201 auto assoc_itr = std::ranges::find_if(allAssociations,
202 [truthSeg](const ObjectMatching& obj){
203 return obj.truthSegment == truthSeg;
204 });
205 if (assoc_itr == allAssociations.end()) {
206 ObjectMatching & newObj = allAssociations.emplace_back();
207 newObj.chamber = seed->msSector();
208 newObj.truthSegment = truthSeg;
209 assoc_itr = allAssociations.end() -1;
210 }
211 assoc_itr->matchedSeeds.push_back(seed);
212 assoc_itr->matchedSeedFoundSegment.push_back(0);
213 } else {
214 ObjectMatching & newObj = allAssociations.emplace_back();
215 newObj.chamber = seed->msSector();
216 newObj.matchedSeeds.push_back(seed);
217 newObj.matchedSeedFoundSegment.push_back(0);
218 }
219 }
221 if (truthSegments) {
222 for (const xAOD::MuonSegment* truthSeg : *truthSegments) {
224 if (std::ranges::any_of(allAssociations, [truthSeg](const auto& assocObj){
225 return assocObj.truthSegment == truthSeg;
226 })) {
227 continue;
228 }
229 ObjectMatching & newObj = allAssociations.emplace_back();
230 newObj.chamber = m_detMgr->getSectorEnvelope(truthSeg->chamberIndex(),
231 truthSeg->sector(),
232 truthSeg->etaIndex());
233 newObj.truthSegment = truthSeg;
234 }
235 }
236 return allAssociations;
237 }
238
240 ATH_CHECK(m_tree.write());
241 return StatusCode::SUCCESS;
242 }
243 StatusCode MuonHoughTransformTester::execute(const EventContext& ctx) {
244
245 const ActsTrk::GeometryContext* gctxPtr{nullptr};
246 ATH_CHECK(SG::get(gctxPtr, m_geoCtxKey, ctx));
247 const ActsTrk::GeometryContext& gctx{*gctxPtr};
248
251 const SegmentSeedContainer* readSegmentSeeds{nullptr};
252 ATH_CHECK(SG::get(readSegmentSeeds, key, ctx));
253 segmentSeeds.insert(segmentSeeds.end(), readSegmentSeeds->begin(), readSegmentSeeds->end());
254 }
255
256 const xAOD::MuonSegmentContainer* truthSegments{nullptr};
257 ATH_CHECK(SG::get(truthSegments, m_truthSegmentKey, ctx));
258
259 const xAOD::MuonSegmentContainer* recoSegments{nullptr};
260 ATH_CHECK(SG::get(recoSegments, m_recoSegKey, ctx));
261
262 ATH_MSG_DEBUG("Succesfully retrieved input collections. Seeds: "<<segmentSeeds.size()
263 <<", segments: "<<recoSegments->size()
264 <<", truth segments: "<<(truthSegments? truthSegments->size() : -1)
265 <<".");
266 std::vector<ObjectMatching> objects = matchWithTruth(*segmentSeeds.asDataVector(),
267 *recoSegments, truthSegments);
268 for (const ObjectMatching& obj : objects) {
269 fillChamberInfo(obj.chamber);
270 fillSeedInfo(obj);
271 fillSegmentInfo(obj);
272 if(m_isMC) fillTruthInfo(gctx, obj.truthSegment);
273 ATH_CHECK(m_tree.fill(ctx));
274 }
275 return StatusCode::SUCCESS;
276 }
278 m_out_chamberIndex = Acts::toUnderlying(msSector->chamberIndex());
279 m_out_stationSide = msSector->side();
280 m_out_stationPhi = msSector->stationPhi();
281 }
283 const xAOD::MuonSegment* segment) {
284 if (!segment) {
285 return;
286 }
287 m_out_hasTruth = true;
288
289 const Amg::Vector3D segDir{segment->direction()};
290 static const SG::ConstAccessor<float> acc_pt{"pt"};
291 static const SG::ConstAccessor<float> acc_charge{"charge"};
292 // eta is interpreted as the eta-location
293 m_out_gen_Eta = segDir.eta();
294 m_out_gen_Phi = segDir.phi();
295 m_out_gen_Pt = acc_pt(*segment);
296 m_out_gen_Q = acc_charge(*segment);
297
298 const auto [chamberPos, chamberDir] = SegmentFit::makeLine(SegmentFit::localSegmentPars(*segment));
299
300 ATH_MSG_DEBUG("Number of precision Hits in the truth segment is "<<segment->nPrecisionHits()<<" and number of phi layers is "
301 <<segment->nPhiLayers()<<" and number of trigger eta layers is "<<segment->nTrigEtaLayers());
305 unsigned nMmEtaHits{0}, nMmStereoHits{0}, nStgcHits{0};
306 for (const xAOD::MuonSimHit* simHit : getMatchingSimHits(*segment)) {
307 if (!m_out_gen_truthBeta.isUpdated()) {
308 m_out_gen_truthBeta = simHit->beta();
309 m_out_gen_truthPdgId = simHit->pdgId();
310 }
311 nStgcHits += m_idHelperSvc->technologyIndex(simHit->identify()) == TechnologyIndex::STGC;
312 if(m_idHelperSvc->technologyIndex(simHit->identify()) != TechnologyIndex::MM) {
313 continue;
314 }
315 const bool isStereo = m_idHelperSvc->mmIdHelper().isStereo(simHit->identify());
316 nMmEtaHits += (!isStereo);
317 nMmStereoHits += isStereo;
318 }
319 m_out_gen_nMmEtaHits = nMmEtaHits;
320 m_out_gen_nMmStereoHits = nMmStereoHits;
321 m_out_gen_nStgcHits = nStgcHits;
322
323 m_out_gen_tanbeta = houghTanBeta(chamberDir);
324 m_out_gen_tanalpha = houghTanAlpha(chamberDir);
325 m_out_gen_y0 = chamberPos.y();
326 m_out_gen_x0 = chamberPos.x();
327 m_out_gen_time = segment->t0();
328
329 double minYhit = std::numeric_limits<double>::max();
330 double maxYhit = -1 * std::numeric_limits<double>::max();
331 for (const xAOD::MuonSimHit* hit : getMatchingSimHits(*segment)){
332 const Identifier hitId = hit->identify();
333 const MuonGMR4::MuonReadoutElement* RE = m_detMgr->getReadoutElement(hitId);
334 const IdentifierHash hash{m_idHelperSvc->isMdt(hitId) ? RE->measurementHash(hitId)
335 : RE->layerHash(hitId) };
336 const Amg::Transform3D localToChamber = RE->msSector()->globalToLocalTransform(gctx) * RE->localToGlobalTransform(gctx, hash);
337 const Amg::Vector3D chamberPos = localToChamber * xAOD::toEigen(hit->localPosition());
338 minYhit = std::min(chamberPos.y(), minYhit);
339 maxYhit = std::max(chamberPos.y(), maxYhit);
340 }
341 m_out_gen_minYhit = minYhit;
342 m_out_gen_maxYhit = maxYhit;
343
344 const xAOD::TruthParticle* truthMuon = getTruthMatchedParticle(*segment);
345 if (truthMuon) {
346 using namespace xAOD::TruthHelpers;
349 }
350 }
352 m_out_bucketEnd = bucket.coveredMax();
353 m_out_bucketStart = bucket.coveredMin();
354 m_out_nSpacePoints = bucket.size();
355
356 ATH_MSG_DEBUG("Filling bucket with "<<bucket.size()<<" space points between "<< bucket.coveredMin() <<" and "<< bucket.coveredMax() );
357
358 // 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
359 std::vector<const MuonR4::SpacePoint*> etaHits{};
360 etaHits.reserve(bucket.size());
361 for (const auto& sp : bucket) {
362 if (sp->measuresEta()) {
363 etaHits.push_back(sp.get());
364 }
365 }
366 std::ranges::sort(etaHits, [](const MuonR4::SpacePoint* a,
367 const MuonR4::SpacePoint* b) {
368 return a->localPosition().y() < b->localPosition().y();
369 });
370
371
372 double maxEtaHitGap{-1.f};
373 for (std::size_t i = 1; i < etaHits.size(); ++i) {
374 maxEtaHitGap = std::max(maxEtaHitGap,
375 std::abs(etaHits[i]->localPosition().y()
376 - etaHits[i - 1]->localPosition().y()));
377 }
378
379 m_out_bucketEtaHitGap = maxEtaHitGap;
380
381
382 m_out_nPrecSpacePoints = std::ranges::count_if(bucket, [](const SpacePointBucket::value_type& sp){
383 return isPrecision(*sp);
384 });
385 m_out_nPhiSpacePoints = std::ranges::count_if(bucket, [](const SpacePointBucket::value_type& sp){
386 return sp->measuresPhi();
387 });
388 if (!m_visionTool.isEnabled()){
389 return;
390 }
391 m_out_nTrueSpacePoints = std::ranges::count_if(bucket,[this](const SpacePointBucket::value_type& sp){
392 return m_visionTool->isLabeled(*sp);
393 });
394 m_out_nTruePrecSpacePoints = std::ranges::count_if(bucket,[this](const SpacePointBucket::value_type& sp){
395 return isPrecision(*sp) && m_visionTool->isLabeled(*sp);
396 });
397 m_out_nTruePhiSpacePoints = std::ranges::count_if(bucket,[this](const SpacePointBucket::value_type& sp){
398 return sp->measuresPhi() && m_visionTool->isLabeled(*sp);
399 });
400 }
402
403 m_out_seed_n = obj.matchedSeeds.size();
404 for (const auto [iseed, seed] : Acts::enumerate(obj.matchedSeeds)){
405 if (iseed ==0) {
406 fillBucketInfo(*seed->parentBucket());
407 }
408 double minYhit = m_out_bucketEnd.getVariable();
409 double maxYhit = m_out_bucketStart.getVariable();
410 for (const SpacePoint* hit : seed->getHitsInMax()){
411 minYhit = std::min(hit->localPosition().y(),minYhit);
412 maxYhit = std::max(hit->localPosition().y(),maxYhit);
413 }
414 m_out_seed_minYhit.push_back(minYhit);
415 m_out_seed_maxYhit.push_back(maxYhit);
416
417 m_out_seed_hasPhiExtension.push_back(seed->hasPhiExtension());
418 m_out_seed_y0.push_back(seed->interceptY());
419 m_out_seed_tanbeta.push_back(seed->tanBeta());
420 if (seed->hasPhiExtension()){
421 m_out_seed_x0.push_back(seed->interceptX());
422 m_out_seed_tanalpha.push_back(seed->tanAlpha());
423 } else{
424 m_out_seed_x0.push_back(-999);
425 m_out_seed_tanalpha.push_back(-999);
426 }
427 m_out_seed_ledToSegment.push_back(obj.matchedSeedFoundSegment.at(iseed));
428
429
432 auto hitCounter = [seed](auto lambda) {
433 return std::count_if(seed->getHitsInMax().begin(),
434 seed->getHitsInMax().end(), lambda);
435 };
436
437 m_out_seed_nPrecHits += hitCounter([](const SpacePoint* sp) {
438 return isPrecision(*sp);
439 });
440 m_out_seed_nEtaHits += hitCounter([](const SpacePoint* sp) {
441 return !isPrecision(*sp) && sp->measuresEta();
442 });
443 m_out_seed_nPhiHits += hitCounter([](const SpacePoint* sp) {
444 return sp->measuresPhi();
445 });
446
447 m_out_seed_nTruePrecHits += hitCounter([this](const SpacePoint* sp) {
448 return isPrecision(*sp) &&
449 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*sp));
450 });
451 m_out_seed_nTrueEtaHits += hitCounter([this](const SpacePoint* sp) {
452 return !isPrecision(*sp) && sp->measuresEta() &&
453 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*sp));
454 });
455 m_out_seed_nTruePhiHits += hitCounter([this](const SpacePoint* sp) {
456 return sp->measuresPhi() &&
457 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*sp));
458 });
459
460 /***
461 * Split hit counts for the NSW!
462 */
463 m_out_seed_nMmEtaHits += hitCounter([this](const SpacePoint* sp){
464 return sp->type() == xAOD::UncalibMeasType::MMClusterType &&
465 !m_idHelperSvc->mmIdHelper().isStereo(sp->identify());
466 });
467 m_out_seed_nMmStereoHits += hitCounter([this](const SpacePoint* sp){
468 return sp->type() == xAOD::UncalibMeasType::MMClusterType &&
469 m_idHelperSvc->mmIdHelper().isStereo(sp->identify());
470 });
471
472 m_out_seed_nsTgcStripHits+=hitCounter([](const SpacePoint* sp){
473 return sp->type() == xAOD::UncalibMeasType::sTgcStripType &&
474 isPrecision(*sp);
475 });
476 m_out_seed_nsTgcWireHits+=hitCounter([this](const SpacePoint* sp) {
477 return sp->type() == xAOD::UncalibMeasType::sTgcStripType &&
478 sp->measuresPhi() &&
479 m_idHelperSvc->stgcIdHelper().channelType(sp->identify()) !=
481 });
482 m_out_seed_nsTgcPadHits.push_back(hitCounter([this](const SpacePoint* sp){
483 return sp->type() == xAOD::UncalibMeasType::sTgcStripType &&
484 m_idHelperSvc->stgcIdHelper().channelType(sp->identify()) ==
486 }));
487
489 m_out_seed_nTrueMmEtaHits += hitCounter([this](const SpacePoint* sp){
490 return sp->type() == xAOD::UncalibMeasType::MMClusterType &&
491 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*sp)) &&
492 !m_idHelperSvc->mmIdHelper().isStereo(sp->identify());
493 });
494 m_out_seed_nTrueMmStereoHits += hitCounter([this](const SpacePoint* sp){
495 return sp->type() == xAOD::UncalibMeasType::MMClusterType &&
496 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*sp)) &&
497 m_idHelperSvc->mmIdHelper().isStereo(sp->identify());
498 });
499
500 m_out_seed_nTruesTgcStripHits+=hitCounter([this](const SpacePoint* sp){
501 return sp->type() == xAOD::UncalibMeasType::sTgcStripType &&
502 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*sp)) &&
503 isPrecision(*sp);
504 });
505 m_out_seed_nTruesTgcWireHits+=hitCounter([this](const SpacePoint* sp) {
506 return sp->type() == xAOD::UncalibMeasType::sTgcStripType &&
507 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*sp)) &&
508 sp->measuresPhi() &&
509 m_idHelperSvc->stgcIdHelper().channelType(sp->identify()) !=
511 });
512 m_out_seed_nTruesTgcPadHits.push_back(hitCounter([this](const SpacePoint* sp){
513 return sp->type() == xAOD::UncalibMeasType::sTgcStripType &&
514 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*sp)) &&
515 m_idHelperSvc->stgcIdHelper().channelType(sp->identify()) ==
517 }));
518
519 if (m_writeSpacePoints) {
520 std::vector<unsigned char> treeIdxs{};
521 for (const HoughHitType & houghSP: seed->getHitsInMax()){
523 unsigned treeIdx = m_spTester->push_back(*houghSP);
524 treeIdxs.push_back(treeIdx);
525 }
526 }
527 m_spMatchedToPattern[iseed] = std::move(treeIdxs);
528 }
529 }
530 }
531
533 using namespace SegmentFit;
534
535 m_out_segment_n = obj.matchedSegments.size();
536 for (const xAOD::MuonSegment* segment : obj.matchedSegments) {
537
539 const auto pars = localSegmentPars(*segment);
540 const auto cov = localSegmentCov(*segment);
541
542 m_out_segment_theta.push_back(pars[Acts::toUnderlying(ParamDefs::theta)]);
543 m_out_segment_phi.push_back(pars[Acts::toUnderlying(ParamDefs::phi)]);
544 m_out_segment_y0.push_back(pars[Acts::toUnderlying(ParamDefs::y0)]);
545 m_out_segment_x0.push_back(pars[Acts::toUnderlying(ParamDefs::x0)]);
546 m_out_segment_time.push_back(pars[Acts::toUnderlying(ParamDefs::t0)] +
547 segment->position().mag() * c_inv);
548
549 for (std::size_t i =0; i < Acts::toUnderlying(ParamDefs::nPars); ++i) {
550 for (std::size_t j = 0; j <=i; ++j) {
551 const std::size_t vecIdx = Acts::vecIdxFromSymMat<Acts::toUnderlying(ParamDefs::nPars)>(i,j);
552 m_segmentCov[vecIdx]->push_back((*cov)(i,j));
553 }
554 }
555
557 const MuonR4::Segment* detailSeg = detailedSegment(*segment);
558 m_out_segment_fitIter.push_back(detailSeg->nFitIterations());
559 m_out_segment_chi2.push_back(segment->chiSquared());
560 m_out_segment_nDoF.push_back(segment->numberDoF());
561 m_out_segment_hasTimeFit.push_back(detailSeg->hasTimeFit());
564 auto hitCounter = [detailSeg](auto lambda) {
565 return std::count_if(detailSeg->measurements().begin(),
566 detailSeg->measurements().end(), lambda);
567 };
568 const unsigned nAuxilliary = hitCounter([](const auto& m){
569 return m->type() == xAOD::UncalibMeasType::Other;
570 });
572 m_out_segment_nTrigEtaHits += segment->nTrigEtaLayers() - nAuxilliary;
573 m_out_segment_nTrigPhiHits += segment->nPhiLayers() - nAuxilliary;
574
578
583 m_out_segment_nTruePrecHits += hitCounter([this](const auto& meas) {
584 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
585 isPrecision(*meas) && (!m_visionTool.isEnabled() ||
586 m_visionTool->isLabeled(*meas->spacePoint()));
587 });
589 m_out_segment_nTrueTrigEtaHits += hitCounter([this](const auto& meas) {
590 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
591 !isPrecision(*meas) && meas->measuresEta() &&
592 meas->spacePoint() &&
593 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint()));
594 });
596 m_out_segment_nTrueTrigPhiHits += hitCounter([this](const auto& meas) {
597 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
598 !isPrecision(*meas) && meas->measuresPhi() &&
599 meas->spacePoint() &&
600 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint()));
601 });
603 m_out_segment_nTruePrecOutliers += hitCounter([this](const auto& meas) {
604 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
605 isPrecision(*meas) && (!m_visionTool.isEnabled() ||
606 m_visionTool->isLabeled(*meas->spacePoint()));
607 });
609 m_out_segment_nTrueTrigEtaOutliers += hitCounter([this](const auto& meas) {
610 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
611 !isPrecision(*meas) && meas->measuresEta() &&
612 meas->spacePoint() &&
613 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint()));
614 });
616 m_out_segment_nTrueTrigPhiOutliers += hitCounter([this](const auto& meas) {
617 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
618 !isPrecision(*meas) && meas->measuresPhi() &&
619 meas->spacePoint() &&
620 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint()));
621 });
622
623 /***
624 * Split hit counts for the NSW!
625 */
626 m_out_segment_nMmEtaHits.push_back(hitCounter([this](const auto& meas){
627 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
628 meas->type() == xAOD::UncalibMeasType::MMClusterType &&
629 !m_idHelperSvc->mmIdHelper().isStereo(meas->spacePoint()->identify());
630 }));
631 m_out_segment_nMmStereoHits.push_back(hitCounter([this](const auto& meas){
632 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
633 meas->type() == xAOD::UncalibMeasType::MMClusterType &&
634 m_idHelperSvc->mmIdHelper().isStereo(meas->spacePoint()->identify());
635 }));
636 m_out_segment_nMmEtaOutliers.push_back(hitCounter([this](const auto& meas){
637 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
638 meas->type() == xAOD::UncalibMeasType::MMClusterType &&
639 !m_idHelperSvc->mmIdHelper().isStereo(meas->spacePoint()->identify());
640 }));
641 m_out_segment_nMmStereoOutliers.push_back(hitCounter([this](const auto& meas){
642 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
643 meas->type() == xAOD::UncalibMeasType::MMClusterType &&
644 m_idHelperSvc->mmIdHelper().isStereo(meas->spacePoint()->identify());
645 }));
646
647 m_out_segment_nSTgcStripHits.push_back(hitCounter([](const auto& meas){
648 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
649 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
650 isPrecision(*meas);
651 }));
652 m_out_segment_nSTgcWireHits.push_back(hitCounter([this](const auto& meas){
653 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
654 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
655 meas->measuresPhi() &&
656 m_idHelperSvc->stgcIdHelper().channelType(meas->spacePoint()->identify()) !=
658 }));
659 m_out_segment_nSTgcPadHits.push_back(hitCounter([this](const auto& meas){
660 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
661 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
662 m_idHelperSvc->stgcIdHelper().channelType(meas->spacePoint()->identify()) ==
664 }));
665 m_out_segment_nSTgcStripOutliers.push_back(hitCounter([](const auto& meas){
666 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
667 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
668 isPrecision(*meas);
669 }));
670 m_out_segment_nSTgcWireOutliers.push_back(hitCounter([this](const auto& meas){
671 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
672 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
673 meas->measuresPhi() &&
674 m_idHelperSvc->stgcIdHelper().channelType(meas->spacePoint()->identify()) !=
676 }));
677 m_out_segment_nSTgcPadOutliers.push_back(hitCounter([this](const auto& meas){
678 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
679 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
680 m_idHelperSvc->stgcIdHelper().channelType(meas->spacePoint()->identify()) ==
682 }));
684 m_out_segment_nMmTrueEtaHits.push_back(hitCounter([this](const auto& meas){
685 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
686 meas->type() == xAOD::UncalibMeasType::MMClusterType &&
687 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) &&
688 !m_idHelperSvc->mmIdHelper().isStereo(meas->spacePoint()->identify());
689 }));
690 m_out_segment_nMmTrueStereoHits.push_back(hitCounter([this](const auto& meas){
691 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
692 meas->type() == xAOD::UncalibMeasType::MMClusterType &&
693 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) &&
694 m_idHelperSvc->mmIdHelper().isStereo(meas->spacePoint()->identify());
695 }));
696 m_out_segment_nMmTrueEtaOutliers.push_back(hitCounter([this](const auto& meas){
697 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
698 meas->type() == xAOD::UncalibMeasType::MMClusterType &&
699 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) &&
700 !m_idHelperSvc->mmIdHelper().isStereo(meas->spacePoint()->identify());
701 }));
702 m_out_segment_nMmTrueStereoOutliers.push_back(hitCounter([this](const auto& meas){
703 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
704 meas->type() == xAOD::UncalibMeasType::MMClusterType &&
705 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) &&
706 m_idHelperSvc->mmIdHelper().isStereo(meas->spacePoint()->identify());
707 }));
708 m_out_segment_nSTgcTrueStripHits.push_back(hitCounter([this](const auto& meas){
709 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
710 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
711 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) &&
712 isPrecision(*meas);
713 }));
714 m_out_segment_nSTgcTrueWireHits.push_back(hitCounter([this](const auto& meas){
715 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
716 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
717 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) &&
718 meas->measuresPhi() &&
719 m_idHelperSvc->stgcIdHelper().channelType(meas->spacePoint()->identify()) !=
721 }));
722 m_out_segment_nSTgcTruePadHits.push_back(hitCounter([this](const auto& meas){
723 return meas->fitState() == CalibratedSpacePoint::State::Valid &&
724 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
725 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) &&
726 m_idHelperSvc->stgcIdHelper().channelType(meas->spacePoint()->identify()) ==
728 }));
729 m_out_segment_nSTgcTrueStripOutliers.push_back(hitCounter([this](const auto& meas){
730 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
731 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
732 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) &&
733 isPrecision(*meas);
734 }));
735 m_out_segment_nSTgcTrueWireOutliers.push_back(hitCounter([this](const auto& meas){
736 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
737 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
738 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) &&
739 meas->measuresPhi() &&
740 m_idHelperSvc->stgcIdHelper().channelType(meas->spacePoint()->identify()) !=
742 }));
743 m_out_segment_nSTgcTruePadOutliers.push_back(hitCounter([this](const auto& meas){
744 return meas->fitState() != CalibratedSpacePoint::State::Valid &&
745 meas->type() == xAOD::UncalibMeasType::sTgcStripType &&
746 (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) &&
747 m_idHelperSvc->stgcIdHelper().channelType(meas->spacePoint()->identify()) ==
749 }));
750
751 double minYhit = 1._km;
752 double maxYhit = -1._km;
753 double minYTruehit = 1._km;
754 double maxYTruehit = -1._km;
755
756 std::vector<unsigned char> matched{};
757 for (const auto & meas : detailSeg->measurements()){
758 // skip dummy measurement from beam spot constraint
759 ATH_MSG_VERBOSE(__func__<<"() - "<<__LINE__<<" Dump "<<(*meas));
760 if (meas->type() == xAOD::UncalibMeasType::Other) {
761 continue;
762 }
763 minYhit = std::min(meas->localPosition().y(),minYhit);
764 maxYhit = std::max(meas->localPosition().y(),maxYhit);
765 if (!m_visionTool.isEnabled() || m_visionTool->isLabeled(*meas->spacePoint())) {
766 minYTruehit = std::min(meas->localPosition().y(), minYTruehit);
767 maxYTruehit = std::max(meas->localPosition().y(), maxYTruehit);
768 }
769 if (m_writeSpacePoints) {
770 unsigned treeIdx = m_spTester->push_back(*meas->spacePoint());
771 if (treeIdx >= matched.size()){
772 matched.resize(treeIdx +1);
773 }
774 matched[treeIdx] = true;
775 }
776 }
777
778 m_out_segment_minYhit += minYhit;
779 m_out_segment_maxYhit += maxYhit;
780 m_out_segment_minTrueYhit += minYTruehit;
781 m_out_segment_maxTrueYhit += maxYTruehit;
782 if (m_writeSpacePoints) {
783 m_spMatchedToSegment.push_back(std::move(matched));
784 }
785 }
786 }
787} // namespace MuonValR4
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
DataVector adapter that acts like it holds const pointers.
static Double_t sp
static Double_t a
#define y
const ServiceHandle< StoreGateSvc > & detStore() const
hash_t hash(const std::string &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.
virtual IdentifierHash measurementHash(const Identifier &measId) const =0
The measurement hash is a continous numbering schema of all readout channels described by the specifi...
const Amg::Transform3D & 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 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.
Amg::Transform3D 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.
const SpacePoint * spacePoint() const
The pointer to the space point out of which this space point has been built.
xAOD::UncalibMeasType type() const
Returns the space point type.
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...
const Identifier & identify() const
: Identifier of the primary measurement
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::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< 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< 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
ActsTrk::GeoContextReadKey_t m_geoCtxKey
Tracking geometry context.
MuonVal::VectorBranch< unsigned short > & m_out_seed_nTrueMmEtaHits
MuonVal::ScalarBranch< int > & m_out_gen_truthOrigin
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.
Eigen::Affine3d Transform3D
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.