ATLAS Offline Software
Loading...
Searching...
No Matches
LegendreSegmentFinderTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef L0MuonMDTTools_LEGENDRESEGMENTFINDERTOOL_H
6#define L0MuonMDTTools_LEGENDRESEGMENTFINDERTOOL_H
7
9
10// local includes
15
16// C++ std
17#include <vector>
18#include <cstddef>
19
20namespace L0MDT {
21
22class LegendreSegmentFinderTool : public extends<AthAlgTool, IL0MDTSegmentFinderTool> {
23public:
24 using base_class::base_class;
25 virtual ~LegendreSegmentFinderTool() override = default;
26
27 virtual StatusCode initialize() override;
28
29 virtual StatusCode findSegments(const std::vector<const xAOD::MdtDriftCircle*>& driftCircles,
30 const ActsTrk::GeometryContext& gctx,
31 float m,
32 float b,
33 std::vector<L0MDT::Segment>& segments) const override;
34
35private:
36 // Per-hit information in the current reconstruction plane
37 struct HitInfo {
38 const xAOD::MdtDriftCircle* dc{nullptr};
39 float z{0.f};
40 float R{0.f};
41 float driftRadius{0.f};
42 };
43
44 // One Legendre-space bin
45 struct BinCell {
46 int entries{0};
47 std::vector<const xAOD::MdtDriftCircle*> hits;
48 std::vector<float> zVals;
49 std::vector<float> RVals;
50 };
51
52 // Descriptor of the maximum bin
53 struct MaxBin {
54 int thetaBin{-1};
55 int rBin{-1};
56 int entries{0};
57 bool valid{false};
58 };
59
60 // Final fit result
61 struct FitResult {
62 float m{0.f};
63 float b{0.f};
64 float chi2{0.f};
65 bool valid{false};
66 };
67
68 // Parameters defining the Legendre-space window around the RPC seed
70 float thetaMin{0.f};
71 float thetaMax{0.f};
72 float rMin{0.f};
73 float rMax{0.f};
74 float seedTheta{0.f};
75 float seedR{0.f};
76 };
77
78 StatusCode buildHitInfo(const std::vector<const xAOD::MdtDriftCircle*>& driftCircles,
79 const ActsTrk::GeometryContext& gctx,
80 std::vector<HitInfo>& hitInfos) const;
81
82 LegendreSpacePars setLegendreSpacePars(float seedM, float seedB) const;
83
84 void fillBin(std::vector<std::vector<BinCell>>& bins,
85 int thetaBin,
86 int rBin,
87 const xAOD::MdtDriftCircle* dc,
88 float zPoint,
89 float rPoint) const;
90
91 void fillSinogram(const std::vector<HitInfo>& hitInfos,
92 float thetaMin,
93 float rMin,
94 std::vector<std::vector<BinCell>>& bins) const;
95
96 bool findMaxBin(const std::vector<std::vector<BinCell>>& bins,
97 MaxBin& maxBin) const;
98
99 FitResult extractSegmentFromMaxBin(const MaxBin& maxBin,
100 float thetaMin,
101 float rMin) const;
102
103 FitResult fitLine(const std::vector<float>& zVals,
104 const std::vector<float>& RVals,
105 float sigma = 1.f / 8.f) const;
106
107 int findBin(float value, float min, float binSize, int nBins) const;
108
109private:
110 // Minimal Legendre settings for the first Athena implementation
111 int m_thetaBins{64};
112 float m_thetaRes{0.002f};
113 int m_rBins{64};
114 float m_rRes{2.0f};
116 bool m_doRefit{true};
117 bool m_debugLegendre{false};
118};
119
120} // namespace L0MDT
121
122#endif
static const std::vector< std::string > bins
#define min(a, b)
Definition cfImp.cxx:40
virtual StatusCode findSegments(const std::vector< const xAOD::MdtDriftCircle * > &driftCircles, const ActsTrk::GeometryContext &gctx, float m, float b, std::vector< L0MDT::Segment > &segments) const override
FitResult extractSegmentFromMaxBin(const MaxBin &maxBin, float thetaMin, float rMin) const
virtual StatusCode initialize() override
void fillBin(std::vector< std::vector< BinCell > > &bins, int thetaBin, int rBin, const xAOD::MdtDriftCircle *dc, float zPoint, float rPoint) const
FitResult fitLine(const std::vector< float > &zVals, const std::vector< float > &RVals, float sigma=1.f/8.f) const
int findBin(float value, float min, float binSize, int nBins) const
LegendreSpacePars setLegendreSpacePars(float seedM, float seedB) const
void fillSinogram(const std::vector< HitInfo > &hitInfos, float thetaMin, float rMin, std::vector< std::vector< BinCell > > &bins) const
bool findMaxBin(const std::vector< std::vector< BinCell > > &bins, MaxBin &maxBin) const
StatusCode buildHitInfo(const std::vector< const xAOD::MdtDriftCircle * > &driftCircles, const ActsTrk::GeometryContext &gctx, std::vector< HitInfo > &hitInfos) const
virtual ~LegendreSegmentFinderTool() override=default
Compact Segment Finder algorithm overview.
MdtDriftCircle_v1 MdtDriftCircle
std::vector< const xAOD::MdtDriftCircle * > hits