![]() |
ATLAS Offline Software
|
Standalone module to handle global pattern recognition. More...
#include <GlobalPatternFinder.h>
Classes | |
| struct | Config |
| Configuration object for the patter finder. More... | |
| struct | HitPayload |
| Base class for hit struct containing hit information. More... | |
| struct | SearchTreeData |
| Structure to hold the search tree data. More... | |
| struct | CandidateHit |
| Small wrapper for candidate hits used to build patterns. More... | |
| struct | PatternState |
| Pattern state object storing pattern information during construction. More... | |
| struct | PatternPrintView |
| A view of the pattern state for printing purposes. More... | |
Public Types | |
| using | StIndex = Muon::MuonStationIndex::StIndex |
| Type alias for the station index. | |
| using | LayerIndex = Muon::MuonStationIndex::LayerIndex |
| Type alias for the station layer index. | |
Public Member Functions | |
| GlobalPatternFinder (Config &&config, std::unique_ptr< const Acts::Logger > logger=Acts::getDefaultLogger("GlobalPatternFinder", Acts::Logging::Level::INFO)) | |
| Standard constructor. | |
| std::vector< GlobalPattern > | findPatterns (const ActsTrk::GeometryContext &gctx, std::span< const SpacePointContainer * > spacepoints) const |
| Main methods steering the pattern finding. | |
Private Types | |
| enum class | SeedCoords : std::uint8_t { eSector , eTheta } |
| Abrivation of the seed coordinates. More... | |
| enum class | LayerOrdering : std::int8_t { eSameLayer , eLowerLayer , eHigherLayer } |
| Enum to express the logical measurement layer ordering given two hits. More... | |
| using | PatternStateVec = std::vector<PatternState> |
| Type alias for a vector of pattern states. | |
| using | PatHitVisual = MuonValR4::IFastRecoVisualizationTool::PatternHitVisualInfo |
| Type alias for the visual information of a pattern. | |
| using | SearchTree_t = Acts::KDTree<2, const HitPayload*, double, std::array, 50> |
| Definition of the search tree class. | |
Private Member Functions | |
| SearchTreeData | constructTree (const ActsTrk::GeometryContext &gctx, std::span< const SpacePointContainer * > spacepoints) const |
| Construct the search tree from the given spacepoint containers. | |
| PatternStateVec | findPatternsInEta (const Acts::GeometryContext &gctx, const SearchTree_t &orderedSpacepoints, std::vector< PatHitVisual > *visualInfo=nullptr) const |
| Method steering the global pattern building in the bending plane. | |
| void | extendPatterns (const Acts::GeometryContext &gctx, PatternStateVec &startPatterns, PatternStateVec &endPatterns, const CandidateHit &testHit, const Amg::Vector3D &beamSpot, std::vector< PatHitVisual > *visualInfo=nullptr) const |
| Main function controlling the development of patterns, including pattern branching when necessary. | |
| bool | passPatternCuts (const PatternState &pat) const |
| Method to check if a pattern passes the quality cuts. | |
| PatternStateVec | resolveOverlaps (PatternStateVec &toResolve, std::vector< PatHitVisual > *visualInfo=nullptr) const |
| Method to remove overlapping patterns. | |
| void | addPhiOnlyHits (const ActsTrk::GeometryContext &gctx, PatternStateVec &patterns) const |
| Method to add phi-only measurements to existing PatternStates. | |
| GlobalPattern | convertToPattern (const PatternState &candidate) const |
| Method to convert a PatternState into a GlobalPattern object. | |
| std::vector< GlobalPattern > | convertToPattern (const PatternStateVec &candidates) const |
| Method to convert a vector of PatternStates into GlobalPattern objects. | |
| void | addVisualInfo (const PatternState &candidate, PatHitVisual::PatternStatus status, std::vector< PatHitVisual > *visualInfo) const |
| Helper function to add visual information of a given pattern (which is usually going to be destroyed) to the final container. | |
| const Acts::Logger & | logger () const |
Static Private Member Functions | |
| static bool | isBetter (const PatternState &a, const PatternState &b) |
| Method to compare two patterns and define which one is better. | |
| static LayerOrdering | checkLayerOrdering (const HitPayload &hit1, const HitPayload &hit2) |
| Method to check the logical layer ordering of two hits. | |
| static PatternPrintView | brief (const PatternState &p) |
| Print the pattern state with brief information. | |
| static PatternPrintView | detailed (const PatternState &p) |
| Print the pattern state with detailed information. | |
Private Attributes | |
| SpacePointPerLayerSorter | m_spSorter {} |
| Spacepoint sorter per logical measurement layer. | |
| Config | m_cfg |
| Global Pattern Recognition configuration. | |
| std::unique_ptr< const Acts::Logger > | m_logger {} |
| Logger for the Global Pattern Finder. | |
Static Private Attributes | |
| static const int | s_nStations {Acts::toUnderlying(StIndex::StIndexMax)} |
| Number of stations. | |
Standalone module to handle global pattern recognition.
This tool performs global pattern recognition as the first step of the Phase-2 fast reconstruction stage. It builds global patterns of precision and non-precision hits using space-points created in upstream algorithms. It first builds patterns in eta and then adds compatible phi-only hits to the patterns. The resulting patterns are returned by the main method of the tool.
Definition at line 28 of file GlobalPatternFinder.h.
Type alias for the station layer index.
Definition at line 33 of file GlobalPatternFinder.h.
|
private |
Type alias for the visual information of a pattern.
Definition at line 111 of file GlobalPatternFinder.h.
|
private |
Type alias for a vector of pattern states.
Definition at line 109 of file GlobalPatternFinder.h.
|
private |
Definition of the search tree class.
Definition at line 113 of file GlobalPatternFinder.h.
Type alias for the station index.
Definition at line 31 of file GlobalPatternFinder.h.
|
strongprivate |
Enum to express the logical measurement layer ordering given two hits.
| Enumerator | |
|---|---|
| eSameLayer | |
| eLowerLayer | |
| eHigherLayer | |
Definition at line 187 of file GlobalPatternFinder.h.
|
strongprivate |
Abrivation of the seed coordinates.
| Enumerator | |
|---|---|
| eSector | Expanded sector coordinate of the associated spectrometer sector |
| eTheta | Global Theta. |
Definition at line 115 of file GlobalPatternFinder.h.
| MuonR4::FastReco::GlobalPatternFinder::GlobalPatternFinder | ( | Config && | config, |
| std::unique_ptr< const Acts::Logger > | logger = Acts::getDefaultLogger( "GlobalPatternFinder", Acts::Logging::Level::INFO) ) |
Standard constructor.
| name | Name to be printed in the messaging |
| config | Configuration parameters |
Definition at line 22 of file GlobalPatternFinder.cxx.
|
private |
Method to add phi-only measurements to existing PatternStates.
| gctx | Geometry context |
| patterns | Vector of pattern states to which to add phi-only hits |
We use useBeamspot as a flag to indicate whether the pattern line has been determined successfully
We look for phi-only hits in the buckets associated with the pattern
Reject hits from a layer that already contains a phi hit
Definition at line 477 of file GlobalPatternFinder.cxx.
|
private |
Helper function to add visual information of a given pattern (which is usually going to be destroyed) to the final container.
| candidate | PatternState whome visual information is to be added |
| status | Status of the pattern (e.g. successfull, failed or overlap) |
| visualInfo | Final vector of visual information to store the visual information |
Definition at line 824 of file GlobalPatternFinder.cxx.
|
staticprivate |
Print the pattern state with brief information.
Definition at line 608 of file GlobalPatternFinderDefs.cxx.
|
staticprivate |
Method to check the logical layer ordering of two hits.
| hit1 | first hit |
| hit2 | second hit |
Hits in the same spectrometer sector
Hits in the same station and different sectors. We can have this case for hits in the overlap region of two adjacent sectors.
Hit in different stations but same station layer. Expected to happen only for Inner and Middle
If both hits are in the middle layer, the one in the barrel comes first
If both hits are in the inner layer, we use the global R, since in large sector BI comes first, while in small sector EI comes first.
If we have one hit in Inner layer for sure it comes first
If we have one hit in Outer layer for sure it comes last
If we have one hit in BarrelExtended and the other in the Middle layer, the former comes first
If we have one hit in Extended (EE) layer and the other in the Middle layer, it depends if the latter is endcap or barrel
Definition at line 763 of file GlobalPatternFinder.cxx.
|
private |
Construct the search tree from the given spacepoint containers.
The hit payloads are stored in a vector, and the tree will contain the index of the hits in the vector. Hits duplicated across overlapping sectors share the same payload. The tree does not contain only-phi hits.
| gctx | Geometry context |
| spacepoints | Vector of space point containers |
| hitPayloads | Vector of hit payloads to be filled with the spacepoints. |
First estimate the number of hits
Try to duplicate the hit in the neighboring sectors if it is close to the sector border.
This ensures that we can find patterns crossing the sector borders.
Check whether the hit belongs to the left or right sector as well
Definition at line 651 of file GlobalPatternFinder.cxx.
|
private |
Method to convert a PatternState into a GlobalPattern object.
| candidate | PatternState to be converted |
Add eta hits
Add phi-only hits
Definition at line 603 of file GlobalPatternFinder.cxx.
|
private |
Method to convert a vector of PatternStates into GlobalPattern objects.
| candidates | PatternStates to be converted |
Definition at line 640 of file GlobalPatternFinder.cxx.
|
staticprivate |
Print the pattern state with detailed information.
Definition at line 612 of file GlobalPatternFinderDefs.cxx.
|
private |
Main function controlling the development of patterns, including pattern branching when necessary.
It tests pattern compatibility of a set of active patterns (patterns produced from the same seed hit) against one test hit. At the end, activePatterns contains the surviving patterns.
| startPatterns | Vector of active patterns to be extended |
| endPatterns | Vector to store the surviving patterns after testing against the test hit. |
| testHit | Hit to be tested against the patterns |
| beamSpot | Beam spot position, needed when the pattern line cannot be reliably defined from the pattern hits |
| visualInfo | Pointer to visual information for pattern visualization (nullptr if the VisualizationTool is disabled) |
Check the pattern has not already missed too many layers compared to other patterns.
Prunes pattern hypotheses within groups sharing the same last-hit layer. This step reduces branching by
keeping only the best-scoring pattern within each last-hit equivalence group, while preserving all patterns when the last-hit layer matches the reference layer (to allow further branching).
Check angular compatibility of the test hit and the pattern
TO DO: Study feasibility of loosening the criteria for low-confidence hits with OR
If hit is compatible but with poor confidence, we create both a pattern with the hit and a pattern without the hit, to keep also the possibility of rejecting this hit in the next iterations. First we make sure that the low-confidence pattern is original, i.e. accumulating not seen hits
Add the new pattern to the list of next patterns
Update visual information of the original pattern
Branch the pattern: we clone it and overwrite the existing hit with the test hit
Update visual information
Definition at line 254 of file GlobalPatternFinder.cxx.
| std::vector< GlobalPattern > MuonR4::FastReco::GlobalPatternFinder::findPatterns | ( | const ActsTrk::GeometryContext & | gctx, |
| std::span< const SpacePointContainer * > | spacepoints ) const |
Main methods steering the pattern finding.
Given the space-point containers, it creates the search tree,
builds patterns in eta, attach compatible only-phi measurements, and convert PatternStates into GlobalPatterns
| gctx | Geometry context |
| spacepoints | Vector of space point containers |
Create the search tree by ordering hits in theta and expanded spectrometer sector and find patterns in eta. The hit payloads are stored in a vector, and the tree will contain the index of the hits in the vector.
Add phi-only hits to the patterns
Add the successfull pattern to visual info, as we won't touch it again
Plot patterns
Definition at line 36 of file GlobalPatternFinder.cxx.
|
private |
Method steering the global pattern building in the bending plane.
| orderedSpacepoints | Search tree with spacepoints ordered by their corresponding coordinates |
| visualInfo | Pointer to visual information for pattern visualization (nullptr if the VisualizationTool is disabled). Needed to add visual info about pattern candidates discarded during the building stage. |
Define candidate hit buffer
Define two PatternState buffers to avoid reallocations
TODO: Retrieve the beamspot if desired
Helper function to count existing patterns containing a hit
| hit | The hit to check |
| coords | The coordinates of the hit |
We try to build a pattern in eta starting from every hit in the three
Get the seed hit
Check the seed is in the current seeding layer, and if seeding from MDT hits is enabled
check how many existing patterns contain this hit
Define the search range.
Search hits with same expanded sector
Define theta window size. While a middle-layer seed already constrains the track direction more tightly (the line must connect to hits on both sides), inner- and outer-layer seeds are more loosely constraining, and we need a larger theta window with double size to achieve the same angular acceptance as inner/outer seeds
Search for compatible spacepoints with the seed and check if there are enough to build a pattern
Check that the candidate hits extend at least in two layers
Sort the compatible spacepoints by global logical layer
If the two hits are in the same layer, sort them by local y coordinate.
Assign global layer number. This will avoid re-computing it many times later
Start pattern building from the seed
Helper function to extend a given pattern with a set of hits. We can have pattern branching when a pattern is compatible with multiple hits on the same layer, increasing the number of active patterns. For each new hit, extendPatterns will try to extend every active pattern and remove the ones not meeting continuation criteria.
| begin | The iterator pointing to the first hit to process. |
| end | The iterator pointing to the end of the hit range. |
| toExtend | The pattern to extend. |
First search for compatible hits from the seed layer onwards
When inverting the search direction, update last inserted hit and line anchor
Then try to proceed toward the innermost layer
Ensure there are no overlaps
Definition at line 61 of file GlobalPatternFinder.cxx.
|
staticprivate |
Method to compare two patterns and define which one is better.
| a | first pattern |
| b | second pattern |
For patterns that differ by 1–2 layers, don't sacrifice fit quality
unless the extra layers are genuinely comparable. For a ≥3-layer difference,
the multiplicity advantage is strong enough to dominate.
Definition at line 741 of file GlobalPatternFinder.cxx.
|
inlineprivate |
Definition at line 220 of file GlobalPatternFinder.h.
|
private |
Method to check if a pattern passes the quality cuts.
| pattern | Pattern to be checked |
Check that the pattern meets the minimum requirements for trigger and precision layers
Check requirement on the residual
Definition at line 369 of file GlobalPatternFinder.cxx.
|
private |
Method to remove overlapping patterns.
| toResolve | pattern to be resolved |
| visualInfo | Pointer to visual information for pattern visualization (nullptr if the VisualizationTool is disabled) |
Check if two patterns overlap in space
Check first the geometrical overlap
Check the angular difference between the seed hits
If we reach here, the patterns can overlap geometrically, so check the hit content
Overlap if more than 50% of the hits of the smaller pattern are shared
Determine best pattern
Definition at line 386 of file GlobalPatternFinder.cxx.
|
private |
Global Pattern Recognition configuration.
Definition at line 217 of file GlobalPatternFinder.h.
|
private |
|
private |
Spacepoint sorter per logical measurement layer.
Definition at line 214 of file GlobalPatternFinder.h.
|
staticprivate |
Number of stations.
Definition at line 99 of file GlobalPatternFinder.h.