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
33 const SegmentSeed* SeederStateBase::parent() const { return m_parent; }
34
35 double SeederStateBase::strawRadius(const SpacePoint& testMdt) const {
37 return static_cast<const xAOD::MdtDriftCircle*>(testMdt.primaryMeasurement())
38 ->readoutElement()->tubeRadius();
39 }
40 bool SeederStateBase::goodCandidate(const SpacePoint& testMdt) const {
41 switch (testMdt.type()) {
42 using enum xAOD::UncalibMeasType;
43 case MdtDriftCircleType:
44 return static_cast<const xAOD::MdtDriftCircle*>(testMdt.primaryMeasurement())->status() ==
45 Muon::MdtDriftCircleStatus::MdtStatusDriftTime;
46 case RpcStripType:
47 case TgcStripType:
48 return true;
49 default:
50 return false;
51 }
52 return false;
53 }
54 double SeederStateBase::candidateChi2(const Acts::CalibrationContext& cctx,
55 const Amg::Vector3D& seedPos,
56 const Amg::Vector3D& seedDir,
57 const double t0,
58 const SpacePoint& candidate) const {
59 if (m_calibratePull) {
60 const EventContext& ctx{*cctx.get<const EventContext*>()};
61 auto calibSp = m_calibrator->calibrate(ctx, &candidate, seedPos, seedDir, t0);
62 assert(calibSp != nullptr);
63 return SeedingAux::chi2Term(seedPos, seedDir, *calibSp);
64 }
65 return SeedingAux::chi2Term(seedPos, seedDir, candidate);
66 }
68 SeederStateBase::newContainer(const Acts::CalibrationContext& /*cctx*/) const {
69 return CalibCont_t{};
70 }
71 void SeederStateBase::append(const Acts::CalibrationContext& cctx,
72 const Amg::Vector3D& pos,
73 const Amg::Vector3D& dir,
74 const double t0,
75 const SpacePoint& appendMe,
76 CalibCont_t& appendTo) const {
77 const EventContext& ctx{*cctx.get<const EventContext*>()};
78 appendTo.push_back(m_calibrator->calibrate(ctx, &appendMe, pos, dir, t0));
79 }
80 bool SeederStateBase::stopSeeding(const std::size_t lowerLayer,
81 const std::size_t upperLayer) const {
82 return lowerLayer >= firstLayerFrom2ndMl() || lowerLayer >= upperLayer;
83 }
84
86 const Amg::Vector3D& tangentDir) const {
87 return !m_selector || m_selector(tangentPos, tangentDir);
88 }
89
90}
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.