4#ifndef MUONTRACKFINDINGALGS_MLMSTRACKSEEDER_H
5#define MUONTRACKFINDINGALGS_MLMSTRACKSEEDER_H
21#include <unordered_map>
44 public extends<AthAlgTool, ITrackSeedingTool> {
46 using base_class::base_class;
50 StatusCode
finalize()
override final;
54 std::vector<MsTrackSeed>& outSeeds)
const override final;
58 const EventContext& ctx,
63 this,
"BaselineSeeder",
"",
64 "Standard seeder: initial-parameter estimates for ML-built seeds and the projection "
65 "onto its seeding cylinder used by PointingWindow"};
68 this,
"SegmentContainer",
"MsSegments"};
70 this,
"CandidateDecoration",
m_segmentKey,
"trackCandidateIds",
71 "Scheduler dependency on the ML candidate decoration"};
73 this,
"ComponentScoreDecoration",
m_segmentKey,
"mlComponentScore",
74 "ML scores per segment: [component's strongest cross-layer edge, segment's strongest cross-layer edge]"};
76 this,
"MinSegmentsPerCandidate", 2};
78 this,
"MaxSegmentsPerCandidate", 0,
79 "Discard ML components with more than this many segments; zero disables the cap"};
81 this,
"MinLayers", 2,
"Minimum number of distinct muon layers a seed must span"};
83 this,
"MinCosConsistency", 0.819,
84 "Minimum cos(angle) between a segment's direction and its seed anchor's "
85 "direction for the segment to be included in the seed"};
87 this,
"PointingWindow", 250.,
88 "Keep only seed segments whose position projected onto the standard seeder's cylinder "
89 "lies within this distance [mm] of the window centre (the standard seeder uses "
90 "SeedHalfLength = 250 mm); zero disables"};
92 this,
"ClusterWindowCentre",
true,
93 "PointingWindow: centre the window on the segment whose window covers the most distinct "
94 "layers (ties: segment quality) instead of the anchor"};
96 this,
"ExtraClusterSeeds", 2,
97 "PointingWindow: after the first seed of an anchor, build up to this many further window seeds "
98 "from the component segments not covered by an earlier window; zero disables"};
100 this,
"ExtraClusterMinScore", 0.8,
101 "ExtraClusterSeeds: an extra seed needs a segment whose own strongest selected cross-layer ML "
102 "edge (ComponentScoreDecoration) reaches this value"};
104 this,
"InnerPointingMaxDeg", 2.,
105 "Remove from the seed pools the endcap inner segments whose |theta(direction) - theta(position)| "
106 "exceeds this value [deg], i.e. that do not point back to the IP; zero disables"};
108 this,
"InnerRescueWindow", 0.,
109 "After the MinLayers check and the 2-segment rule: fill a missing Inner layer with the closest "
110 "IP-pointing (InnerRescueMaxDeg), direction-compatible inner segment of any component that "
111 "projects within this distance [mm] of the window centre; zero disables"};
113 this,
"InnerRescueMaxDeg", 1.,
114 "InnerRescueWindow: maximum |theta(direction) - theta(position)| [deg] of the filled segment"};
116 this,
"VariantSeeds",
true,
117 "PointingWindow: after a seed passing the Variant* gates, emit a second seed in which every "
118 "layer takes its runner-up segment from the window (or, without any alternative, the weakest "
119 "non-inner member is dropped), as a fallback if the fit of the first seed fails"};
121 this,
"VariantMinLayers", 3,
122 "VariantSeeds: minimum number of station layers of the seed"};
124 this,
"VariantMaxPointingDeg", 1.,
125 "VariantSeeds: endcap seeds need an inner segment with |theta(dir) - theta(pos)| below this [deg]"};
127 this,
"VariantMinScore", 0.8,
128 "VariantSeeds: minimum strongest cross-layer ML edge of the seed's component (ComponentScoreDecoration); "
131 this,
"TwoSegmentMinComponentScore", 0.3,
132 "Keep a 2-segment seed only if its component's strongest selected cross-layer edge "
133 "(ComponentScoreDecoration) reaches this value; zero disables"};
135 this,
"SegmentSelectionTool",
"",
136 "Seeding-quality check of the standard seeder, used by the truth diagnostics"};
138 this,
"EnableTruthDiagnostics",
false,
139 "MC only, and only at DEBUG level: truth-classify the seeds and time their fits"};
245 std::array<std::atomic<std::size_t>, 2>
dropped{};
283 std::array<std::atomic<std::size_t>, 3>
filled{};
299 std::vector<std::uint8_t>
pBin{};
303 std::vector<std::array<std::uint8_t, 8>>
desc{};
305 std::chrono::steady_clock::time_point
lastEnd{};
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid from which a ReadHandle is made.
Define macros for attributes used to control the static checker.
Utility class to handle the three contexts neeeded in an ACTS reconstruction job 1) GeometryContext -...
ITrackSeedingTool implementation which constructs seeds directly from sufficiently large ML-nominated...
Gaudi::Property< bool > m_clusterWindowCentre
StatusCode initialize() override final
Gaudi::Property< double > m_extraClusterMinScore
StatusCode findTrackSeeds(const EventContext &ctx, std::vector< MsTrackSeed > &outSeeds) const override final
Retrieves the segment container from StoreGate and constructs TrackSeeds from them.
Gaudi::Property< unsigned int > m_extraClusterSeeds
SG::ReadDecorHandleKey< xAOD::MuonSegmentContainer > m_componentScoreKey
Gaudi::Property< unsigned int > m_minSegmentsPerCandidate
Gaudi::Property< double > m_innerRescueMaxDeg
Acts::Result< Acts::BoundTrackParameters > estimateStartParameters(const EventContext &ctx, const MsTrackSeed &seed) const override final
Estimate the start track parameters for a given track seed.
Gaudi::Property< double > m_variantMinScore
Gaudi::Property< double > m_pointingWindow
Gaudi::Property< double > m_twoSegMinScore
ActsTrk::ContextUtility m_ctxProvider
SeedingCounters m_counters ATLAS_THREAD_SAFE
Gaudi::Property< double > m_minCosConsistency
ToolHandle< ISegmentSelectionTool > m_segSelector
SG::ReadDecorHandleKey< xAOD::MuonSegmentContainer > m_candidateDecorKey
Gaudi::Property< unsigned int > m_variantMinLayers
Gaudi::Property< double > m_innerPointingMaxDeg
Gaudi::Property< bool > m_truthDiag
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_segmentKey
Gaudi::Property< bool > m_variantSeeds
Gaudi::Property< double > m_variantMaxPointingDeg
Gaudi::Property< double > m_innerRescueWindow
ToolHandle< ITrackSeedingDiagnosticsTool > m_seedParameterEstimator
StatusCode finalize() override final
Prints the job-summed seeding counters (DEBUG only).
Gaudi::Property< unsigned int > m_minLayers
Gaudi::Property< unsigned int > m_maxSegmentsPerCandidate
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid from which a ReadHandle is made.
This header ties the generic definitions in this package.
D12 seeding funnel per truth muon (EnableTruthDiagnostics && DEBUG, PointingWindow on): selected trut...
std::array< std::atomic< std::size_t >, kRegions > withMissing
stage-7 muons missing >= 1 layer
std::array< std::atomic< std::size_t >, kRegions > withFake
stage-7 muons with >= 1 fake
static constexpr std::size_t kStages
0 not in ML / 1 split over components / 2 component rejected / 3 cos cut / 4 window / 5 layer pick / ...
std::array< std::atomic< std::size_t >, kRegions *kStages > stage
std::array< std::atomic< std::size_t >, kRegions *kMissReasons > missingLayers
static constexpr std::size_t kRegions
std::array< std::atomic< std::size_t >, kRegions > notSeedable
selected muons with segments in < 2 layers
std::array< std::atomic< std::size_t >, kRegions *2 > fakes
fake seed segments: background / other particle
static constexpr std::size_t kMissReasons
why a muon layer is missing from the stage-7 seed: other component or not in ML / cos cut / window / ...
InnerPointingMaxDeg / InnerRescueWindow truth diagnostics (EnableTruthDiagnostics && DEBUG).
std::array< std::atomic< std::size_t >, 2 > pointingRemoved
removed segment truth-matched / not
std::array< std::atomic< std::size_t >, 3 > filled
filled segment belongs to [0 the seed's truth owner, 1 another particle or none, 2 seed without owner...
Truth diagnostics (EnableTruthDiagnostics && DEBUG) on the seeds that are handed to MsTrackFindingAlg...
static constexpr std::size_t kPBins
D5: momentum estimate of the start parameters, <3 / 3-6 / 6-10 / 10-20 / >=20 GeV.
std::array< std::atomic< std::size_t >, kGroups *kPairBins > twoSegLayersN
static constexpr std::size_t kPointBins
D13: fitted seeds by IP pointing of the inner segment, |theta(dir) - theta(pos)| <1 / 1-2 / 2-5 / 5-1...
std::array< std::atomic< std::uint64_t >, 2 *2 > fitNsBySegs
std::array< std::atomic< std::size_t >, kClasses *kPBins > seedsByP
seeds with valid start parameters
std::array< std::atomic< std::size_t >, 2 *2 > fitCountBySegs
[pure, junk][2, 3+ segments]
std::array< std::atomic< std::size_t >, kClasses *4 > thetaSpread
<2 / 2-4 / 4-8 / >=8 deg
std::array< std::atomic< std::uint64_t >, kGroups *kPointCats *kPointBins > pointNs
static constexpr std::size_t kQualBins
std::array< std::atomic< std::size_t >, kGroups *2 > twoSegRegionN
barrel / endcap seed
std::array< std::atomic< std::size_t >, 3 > extraSeedClass
ExtraClusterSeeds: extra seeds pure / partial / junk.
std::array< std::atomic< std::size_t >, kGroups *kDistBins *kScoreBins > twoSegJointN
D9b: joint table of the fitted 2-segment seeds: [group][distance bin * kScoreBins + score bin].
std::array< std::atomic< std::uint64_t >, kGroups *kQualBins > twoSegQualNs
std::array< std::atomic< std::uint64_t >, kGroups *kScoreBins > twoSegPairScoreNs
std::atomic< std::size_t > pureNoStartPars
std::array< std::atomic< std::size_t >, kGroups *kQualBins > twoSegQualN
static constexpr std::size_t kScoreBins
std::array< std::atomic< std::uint64_t >, kClasses *kPBins > fitNsByP
D1 fit time by momentum.
std::array< std::atomic< std::size_t >, kGroups *kDistBins > twoSegDistN
std::array< std::atomic< std::size_t >, 2 > pureTwoSegOwnerHasLonger
D11: pure 2-segment seeds: [0 the owner also has a >= 3-segment pure/partial seed,...
static constexpr std::size_t kClasses
static constexpr std::size_t kMeasBins
D10: all fitted seeds by number of measurements <10 / 10-15 / 15-20 / 20-30 / >=30.
static constexpr std::size_t kPointCats
static constexpr std::size_t kPairBins
std::array< std::atomic< std::size_t >, kClasses *2 > fitCount
std::array< std::atomic< std::size_t >, 2 > pureNoStartParsQuality
D7: pure seeds whose start parameters fail: [0 no segment passes the seeding quality,...
std::array< std::atomic< std::size_t >, kGroups *kScoreBins > twoSegCompScoreN
component's best cross-layer edge
static constexpr std::size_t kGroups
D9: fitted (valid start parameters) 2-segment seeds; groups [0 pure, 1 partial, 2 junk].
std::array< std::atomic< std::size_t >, kGroups *kScoreBins > twoSegPairScoreN
weaker of the two segments' best cross-layer edges
std::array< std::atomic< std::size_t >, 2 > pureNoStartParsNsw
std::array< std::atomic< std::uint64_t >, kGroups *kDistBins *kScoreBins > twoSegJointNs
std::array< std::atomic< std::size_t >, kClasses *3 > nSegments
D3: descriptors of the fitted seeds by class.
std::array< std::atomic< std::size_t >, kGroups > twoSegDropped
2-segment rule: seeds dropped by the score cut per group
std::array< std::atomic< std::uint64_t >, kGroups *kMeasBins > measNs
std::atomic< std::size_t > untimedLastSeeds
last seed of an event: no following call
std::array< std::atomic< std::size_t >, kGroups *kPointCats *kPointBins > pointN
std::array< std::atomic< std::uint64_t >, kGroups *kDistBins > twoSegDistNs
static constexpr std::size_t kDistBins
std::array< std::atomic< std::uint64_t >, kGroups *2 > twoSegRegionNs
std::array< std::atomic< std::size_t >, kClasses *kPBins > fitCountByP
std::array< std::atomic< std::uint64_t >, kGroups *kScoreBins > twoSegCompScoreNs
std::array< std::atomic< std::uint64_t >, kGroups *kPairBins > twoSegLayersNs
std::array< std::atomic< std::uint64_t >, kClasses *2 > fitNs
D1: wall time between consecutive estimateStartParameters calls, i.e.
std::array< std::atomic< std::size_t >, kGroups *kMeasBins > measN
Job-summed counters, only touched when the tool runs at DEBUG level.
std::atomic< std::size_t > windowOutOfBounds
PointingWindow: segments projecting outside the cylinder.
std::atomic< std::size_t > extraSeeds
ExtraClusterSeeds: seeds built.
std::atomic< std::size_t > twoSegLowScore
TwoSegmentMinComponentScore: seeds dropped.
std::atomic< std::size_t > rejectedTooSmall
std::atomic< std::size_t > rejectedNoAnchor
std::atomic< std::uint64_t > startParNs
wall time spent in estimateStartParameters
std::atomic< std::uint64_t > findSeedsNs
wall time spent in findTrackSeeds
std::atomic< std::size_t > anchorsTooFewLayers
anchor yielded < MinLayers layers
std::atomic< std::size_t > rejectedTooLarge
std::atomic< std::size_t > acceptedComponents
std::array< std::atomic< std::size_t >, 4 > seedSegments
2 / 3 / 4 / 5+ segments
std::atomic< std::size_t > extraNoStrong
ExtraClusterSeeds: clusters without a strong segment.
std::atomic< std::size_t > windowCentreOutOfBounds
PointingWindow: centre outside the cylinder, window not applied.
std::atomic< std::size_t > windowDropped
PointingWindow: segments further than the window.
std::atomic< std::size_t > seeds
std::atomic< std::size_t > events
std::atomic< std::size_t > pointingRemoved
InnerPointingMaxDeg: segments removed (first clusters).
std::atomic< std::size_t > pointingCentreSkipped
InnerPointingMaxDeg: clusters skipped.
std::atomic< std::size_t > windowCentreNotAnchor
PointingWindow: centred on another segment than the anchor.
std::atomic< std::size_t > twoSegNoScore
2-segment seeds without a score (kept)
std::atomic< std::size_t > variantNone
VariantSeeds: gated seeds without a different variant.
std::atomic< std::size_t > startParFailures
std::atomic< std::size_t > variantSeeds
VariantSeeds: seeds built.
std::atomic< std::size_t > components
std::atomic< std::size_t > innerRescued
InnerRescueWindow: inner layers filled.
std::atomic< std::size_t > startParCalls
D1 bookkeeping per event slot: the seeds of the current event and the last timed call.
std::vector< std::uint8_t > seedClass
std::vector< std::array< std::uint8_t, 8 > > desc
D9/D10/D13 bins per seed: dist, quality, component score, pair score, layer pair, region,...
std::vector< std::uint8_t > startOk
std::chrono::steady_clock::time_point lastEnd
std::vector< std::uint8_t > pBin
VariantSeeds truth diagnostics (EnableTruthDiagnostics && DEBUG).
std::array< std::atomic< std::size_t >, 3 > seedClass
variant seeds pure / partial / junk
std::atomic< std::size_t > pureMainNotPure
pure variants whose main seed is not pure
PointingWindow truth diagnostics (EnableTruthDiagnostics && DEBUG).
std::array< std::atomic< std::size_t >, 2 *kDistBins > distance
projected distance to the window centre; [0 same particle as the centre, 1 other / none][bin]
std::array< std::atomic< std::size_t >, 2 > dropped
dropped: same particle / other
std::array< std::atomic< std::size_t >, 3 > seedsLost
... of which < MinLayers after the window
std::atomic< std::size_t > oracleKeeps
... an owner-centred window keeps >= MinLayers owner layers
std::atomic< std::size_t > particlesSeeded
particles with a pure/partial seed without window
std::atomic< std::size_t > ownerSeeds
D6 (seeds with a truth owner without window):
std::atomic< std::size_t > actualKeeps
... the emitted seed holds >= 2 owner segments
std::array< std::atomic< std::size_t >, 3 > seedsPureAfter
... of which the windowed seed is pure
std::atomic< std::size_t > particlesLost
... of which none with the window
std::array< std::atomic< std::size_t >, 3 > seedsWithout
seeds without window, pure / partial / junk
std::atomic< std::size_t > centreOnOwner
... whose chosen centre belongs to the owner
static constexpr std::size_t kDistBins