ATLAS Offline Software
Loading...
Searching...
No Matches
MdtSegmentSeedGenerator.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
5
6
10
11#include <Acts/Utilities/Enumerate.hpp>
12#include <Acts/Definitions/Units.hpp>
13#include <Acts/Utilities/UnitVectors.hpp>
14
15#include <format>
16
17using namespace Acts;
18using namespace Acts::UnitLiterals;
19namespace MuonR4::SegmentFit{
22
24 const ISpacePointCalibrator* calibrator,
25 const bool calibratePull,
26 SeedSelector_t&& seedSelector):
27 SpacePointPerLayerSplitter{parentSeed->getHitsInMax()},
28 m_parent{parentSeed},
29 m_calibrator{calibrator},
30 m_calibratePull{calibratePull},
31 m_selector{std::move(seedSelector)} {}
32
34 const ISpacePointCalibrator* calibrator,
35 const bool calibratePull,
37 SeedSelector_t&& seedSelector):
39 m_parent{parentSeed},
40 m_calibrator{calibrator},
41 m_calibratePull{calibratePull},
42 m_selector{std::move(seedSelector)} {}
43
44 const SegmentSeed* SeederStateBase::parent() const { return m_parent; }
45
46 double SeederStateBase::strawRadius(const SpacePoint& testMdt) const {
48 return static_cast<const xAOD::MdtDriftCircle*>(testMdt.primaryMeasurement())
49 ->readoutElement()->tubeRadius();
50 }
51 bool SeederStateBase::goodCandidate(const SpacePoint& testMdt) const {
52 switch (testMdt.type()) {
53 using enum xAOD::UncalibMeasType;
54 case MdtDriftCircleType:
55 return static_cast<const xAOD::MdtDriftCircle*>(testMdt.primaryMeasurement())->status() ==
56 Muon::MdtDriftCircleStatus::MdtStatusDriftTime;
57 case RpcStripType:
58 case TgcStripType:
59 return true;
60 default:
61 return false;
62 }
63 return false;
64 }
65 double SeederStateBase::candidateChi2(const Acts::CalibrationContext& cctx,
66 const Amg::Vector3D& seedPos,
67 const Amg::Vector3D& seedDir,
68 const double t0,
69 const SpacePoint& candidate) const {
70 if (m_calibratePull) {
71 const EventContext& ctx{*cctx.get<const EventContext*>()};
72 auto calibSp = m_calibrator->calibrate(ctx, &candidate, seedPos, seedDir, t0);
73 assert(calibSp != nullptr);
74 return SeedingAux::chi2Term(seedPos, seedDir, *calibSp);
75 }
76 return SeedingAux::chi2Term(seedPos, seedDir, candidate);
77 }
79 SeederStateBase::newContainer(const Acts::CalibrationContext& /*cctx*/) const {
80 return CalibCont_t{};
81 }
82 void SeederStateBase::append(const Acts::CalibrationContext& cctx,
83 const Amg::Vector3D& pos,
84 const Amg::Vector3D& dir,
85 const double t0,
86 const SpacePoint& appendMe,
87 CalibCont_t& appendTo) const {
88 const EventContext& ctx{*cctx.get<const EventContext*>()};
89 appendTo.push_back(m_calibrator->calibrate(ctx, &appendMe, pos, dir, t0));
90 }
91 bool SeederStateBase::stopSeeding(const std::size_t lowerLayer,
92 const std::size_t upperLayer) const {
93 return lowerLayer >= firstLayerFrom2ndMl() || lowerLayer >= upperLayer;
94 }
95
97 const Amg::Vector3D& tangentDir) const {
98 return !m_selector || m_selector(tangentPos, tangentDir);
99 }
100
101}
static Double_t t0
Interface class to refine the space point calibration with an external seed.
Representation of a segment seed (a fully processed hough maximum) produced by the hough transform.
Definition SegmentSeed.h:14
std::size_t firstLayerFrom2ndMl() const
Returns the layer index with hits from the second multilayer.
std::vector< const SpacePoint * > HitVec
SpacePointPerLayerSplitter(const SpacePointBucket &bucket)
Constructor taking a complete bucket.
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...
Eigen::Matrix< double, 3, 1 > Vector3D
SpacePointPerLayerSplitter::HitLayVec HitLayerVec
SpacePointPerLayerSplitter::HitVec HitVec
STL namespace.
MdtDriftCircle_v1 MdtDriftCircle
UncalibMeasType
Define the type of the uncalibrated measurement.
SeederStateBase(const SegmentSeed *parentSeed, const ISpacePointCalibrator *calibrator, const bool calibratedPull, SeedSelector_t &&seedSelector=nullptr)
Protected constructor to prevent instantiation from anything else than the seeder state.
const ISpacePointCalibrator * m_calibrator
const SegmentSeed * parent() const
Returns the parent seed from which the state is constructed.
double candidateChi2(const Acts::CalibrationContext &cctx, const Amg::Vector3D &seedPos, const Amg::Vector3D &seedDir, const double t0, const SpacePoint &candidate) const
Returns the pull of the candidate w.r.t.
std::function< bool(const Amg::Vector3D &pos, const Amg::Vector3D &dir)> SeedSelector_t
Selector function to sort out seed lines that are incompatible with external geometrical constaints e...
double strawRadius(const SpacePoint &testMdt) const
Returns the outer tube radius of the space point.
bool goodCandidate(const SpacePoint &testMdt) const
Returns whether the hit is a good candidate for seeding.
bool goodForSeeding(const Amg::Vector3D &tangentPos, const Amg::Vector3D &tangentDir) const
Selector function to remove the two line tangent seed using external constaints (e....
void append(const Acts::CalibrationContext &cctx, const Amg::Vector3D &pos, const Amg::Vector3D &dir, const double t0, const SpacePoint &appendMe, CalibCont_t &appendTo) const
Appends the space point measurement to the candidate seed container Optionally, the hit may be calibr...
CalibCont_t newContainer(const Acts::CalibrationContext &cctx) const
Creates a new candidate seed container.
Segment::MeasVec CalibCont_t
Abrivation of the collection of calibrated space points.
bool stopSeeding(const std::size_t lowerLayer, const std::size_t upperLayer) const
Requests whether the seed line generation shall be stopped based on the pair of.