![]() |
ATLAS Offline Software
|
Standalone module to handle global pattern recognition. More...
#include <GlobalPatternFinder.h>
Classes | |
| struct | Config |
| Configuration object. More... | |
| struct | HitPayload |
| Hit information stored during pattern building. More... | |
| struct | CandidateHit |
| Small wrapper for candidate hits used to build patterns. More... | |
| struct | LineTestRes |
| : Small struct to encapsulate the result of the line compatibility test More... | |
| struct | PatternState |
| Pattern state object storing pattern information during construction. More... | |
| struct | PatternPrintView |
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. | |
| using | SpacePointContainerVec = std::vector<const SpacePointContainer*> |
| Abrivation for a vector of space-point containers. | |
| using | PatternVec = std::vector<GlobalPattern> |
| Abrivation for a vector of global patterns. | |
| using | BucketPerContainer = std::unordered_map<const SpacePointContainer*, std::vector<const SpacePointBucket*>> |
| Abrivation for a collection of space-point buckets grouped by their corresponding input container. | |
| using | PatternHitVisualInfo = MuonValR4::IFastRecoVisualizationTool::PatternHitVisualInfo |
| Type alias for the visual information of a pattern. | |
| using | PatternHitVisualInfoVec = std::vector<PatternHitVisualInfo> |
| Abrivation for a vector of visual information objects. | |
Public Member Functions | |
| GlobalPatternFinder (const std::string &name, Config &&config) | |
| Standard constructor. | |
| PatternVec | findPatterns (const ActsTrk::GeometryContext &gctx, const SpacePointContainerVec &spacepoints, BucketPerContainer &outBuckets) const |
| Main methods steering the pattern finding. | |
| bool | msgLvl (const MSG::Level lvl) const |
| Test the output level. | |
| MsgStream & | msg () const |
| The standard message stream. | |
| MsgStream & | msg (const MSG::Level lvl) const |
| The standard message stream. | |
| void | setLevel (MSG::Level lvl) |
| Change the current logging level. | |
Private Types | |
| enum class | SeedCoords : std::uint8_t { eSector , eTheta } |
| Abrivation of the seed coordinates. More... | |
| enum class | LineTestDecision : std::int8_t { eAddHit , eBranchPattern , eRejectHit , eConsecutiveMdt , eOverwriteLastHit } |
| : Enum for possible outcomes of pattern line compatibility test More... | |
| enum class | LayerOrdering : std::int8_t { eSameLayer , eLowerLayer , eHigherLayer } |
| Enum to express the logical measurement layer ordering given two hits. More... | |
| using | SearchTree_t = Acts::KDTree<2, HitPayload, double, std::array, 5> |
| Definition of the search tree class. | |
| using | PatternStateVec = std::vector<PatternState> |
Private Member Functions | |
| SearchTree_t | constructTree (const ActsTrk::GeometryContext &gctx, const SpacePointContainerVec &spacepoints) const |
| Method to construct the search tree by filling it up with spacepoints from the given containers. | |
| PatternStateVec | findPatternsInEta (const SearchTree_t &orderedSpacepoints, PatternHitVisualInfoVec *visualInfo=nullptr) const |
| Method steering the global pattern building in the bending plane. | |
| void | extendPatterns (PatternStateVec &startPatterns, PatternStateVec &endPatterns, const CandidateHit &testHit, const Amg::Vector3D &beamSpot, PatternHitVisualInfoVec *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, PatternHitVisualInfoVec *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. | |
| PatternVec | convertToPattern (const PatternStateVec &candidates) const |
| Method to convert a vector of PatternStates into GlobalPattern objects. | |
| void | addVisualInfo (const PatternState &candidate, PatternHitVisualInfo::PatternStatus status, PatternHitVisualInfoVec *visualInfo) const |
| Helper function to add visual information of a given pattern (which is usually going to be destroyed) to the final container. | |
| void | initMessaging () const |
| Initialize our message level and MessageSvc. | |
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 bool | areConsecutiveMdt (const CandidateHit &hit1, const CandidateHit &hit2) |
| Helper function to check whether two hits are consecutive MDT measurements. | |
| static PatternPrintView | brief (const PatternState &p) |
| Print the pattern candidate and stream operator. | |
| static PatternPrintView | detailed (const PatternState &p) |
Private Attributes | |
| SpacePointPerLayerSorter | m_spSorter {} |
| Spacepoint sorter per logical measurement layer. | |
| Config | m_cfg |
| Global Pattern Recognition configuration. | |
| std::string | m_nm |
| Message source name. | |
| boost::thread_specific_ptr< MsgStream > | m_msg_tls |
| MsgStream instance (a std::cout like with print-out levels). | |
| std::atomic< IMessageSvc * > | m_imsg { nullptr } |
| MessageSvc pointer. | |
| std::atomic< MSG::Level > | m_lvl { MSG::NIL } |
| Current logging level. | |
| std::atomic_flag m_initialized | ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT |
| Messaging initialized (initMessaging). | |
Static Private Attributes | |
| static const int | s_nStations {Acts::toUnderlying(StIndex::StIndexMax)} |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const PatternPrintView &v) |
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 30 of file GlobalPatternFinder.h.
| using MuonR4::FastReco::GlobalPatternFinder::BucketPerContainer = std::unordered_map<const SpacePointContainer*, std::vector<const SpacePointBucket*>> |
Abrivation for a collection of space-point buckets grouped by their corresponding input container.
Definition at line 41 of file GlobalPatternFinder.h.
Type alias for the station layer index.
Definition at line 35 of file GlobalPatternFinder.h.
| using MuonR4::FastReco::GlobalPatternFinder::PatternHitVisualInfo = MuonValR4::IFastRecoVisualizationTool::PatternHitVisualInfo |
Type alias for the visual information of a pattern.
Definition at line 43 of file GlobalPatternFinder.h.
| using MuonR4::FastReco::GlobalPatternFinder::PatternHitVisualInfoVec = std::vector<PatternHitVisualInfo> |
Abrivation for a vector of visual information objects.
Definition at line 45 of file GlobalPatternFinder.h.
|
private |
Definition at line 331 of file GlobalPatternFinder.h.
| using MuonR4::FastReco::GlobalPatternFinder::PatternVec = std::vector<GlobalPattern> |
Abrivation for a vector of global patterns.
Definition at line 39 of file GlobalPatternFinder.h.
|
private |
Definition of the search tree class.
Definition at line 139 of file GlobalPatternFinder.h.
| using MuonR4::FastReco::GlobalPatternFinder::SpacePointContainerVec = std::vector<const SpacePointContainer*> |
Abrivation for a vector of space-point containers.
Definition at line 37 of file GlobalPatternFinder.h.
Type alias for the station index.
Definition at line 33 of file GlobalPatternFinder.h.
|
strongprivate |
Enum to express the logical measurement layer ordering given two hits.
| Enumerator | |
|---|---|
| eSameLayer | |
| eLowerLayer | |
| eHigherLayer | |
Definition at line 389 of file GlobalPatternFinder.h.
|
strongprivate |
: Enum for possible outcomes of pattern line compatibility test
| Enumerator | |
|---|---|
| eAddHit | Test successfull, add hit to pattern. |
| eBranchPattern | Test successfull with multiple pattern hits on same layer, branch the pattern. |
| eRejectHit | Test failed, discard the hit. |
| eConsecutiveMdt | Test hit is a consecutive MDT hit. |
| eOverwriteLastHit | Test successful, overwrite the hit. Needed e.g. for sTGCs |
Definition at line 171 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 141 of file GlobalPatternFinder.h.
| MuonR4::FastReco::GlobalPatternFinder::GlobalPatternFinder | ( | const std::string & | name, |
| Config && | config ) |
Standard constructor.
| name | Name to be printed in the messaging |
| config | Configuration parameters |
Definition at line 28 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 |
Struct to model the projection of the pattern line onto the phi strip in a certain station
| refLay | Reference layer coordinate (e.g. R or Z) increasing with the layer number |
| refStrip | Reference strip coordinate (normal to the layer coordinate, along the strip direction) |
| invSlope | Inverse slope, defined as deltaStrip / deltaLay |
We look for phi-only hits in the buckets associated with the pattern
Definition at line 510 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 1266 of file GlobalPatternFinder.cxx.
|
staticprivate |
Helper function to check whether two hits are consecutive MDT measurements.
To understand: in principle we should not have two MDT hits in the same tube... but this can happen now when running run4 digitization. Therefore, for now we don't throw when hit1==hit2 but we just reject one of the two... to understand for future improvements
Definition at line 1251 of file GlobalPatternFinder.cxx.
|
staticprivate |
Print the pattern candidate and stream operator.
Definition at line 1314 of file GlobalPatternFinder.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 1197 of file GlobalPatternFinder.cxx.
|
private |
Method to construct the search tree by filling it up with spacepoints from the given containers.
The tree does not contain only-phi hits.
| gctx | Geometry context |
| spacepoints | Vector of space point containers |
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 698 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 656 of file GlobalPatternFinder.cxx.
|
private |
Method to convert a vector of PatternStates into GlobalPattern objects.
| candidates | PatternStates to be converted |
Definition at line 687 of file GlobalPatternFinder.cxx.
|
staticprivate |
Definition at line 1318 of file GlobalPatternFinder.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) |
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
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 of the original pattern
Check the MDT cluster size on the last layer is not above the maximum, otherwise we break the cluster
We break the residual at the second-to-last hit. So we compute the new cluster residual
We remove all hits on last layer, except the last hit. Then we add the new hit.
Update visual information of the original pattern
Definition at line 261 of file GlobalPatternFinder.cxx.
| GlobalPatternFinder::PatternVec MuonR4::FastReco::GlobalPatternFinder::findPatterns | ( | const ActsTrk::GeometryContext & | gctx, |
| const SpacePointContainerVec & | spacepoints, | ||
| BucketPerContainer & | outBuckets ) 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 |
| outBuckets | output collection of space-point buckets grouped by their corresponding input container to be written into StoreGate. |
Create the search tree by ordering hits in theta and expanded spectrometer sector and find patterns in eta. The tree should outlive the pattern finding process
Add phi-only hits to the patterns
Add the successfull pattern to visual info, as we won't touch it again
Fill the output buckets
Plot patterns
Definition at line 41 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 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
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 78 of file GlobalPatternFinder.cxx.
|
privateinherited |
Initialize our message level and MessageSvc.
This method should only be called once.
Definition at line 39 of file AthMessaging.cxx.
|
staticprivate |
Method to compare two patterns and define which one is better.
| a | first pattern |
| b | second pattern |
Definition at line 1189 of file GlobalPatternFinder.cxx.
|
inlineinherited |
The standard message stream.
Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.
Definition at line 167 of file AthMessaging.h.
|
inlineinherited |
The standard message stream.
Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.
Definition at line 182 of file AthMessaging.h.
|
inlineinherited |
Test the output level.
| lvl | The message level to test against |
| true | Messages at level "lvl" will be printed |
Definition at line 151 of file AthMessaging.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 409 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
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 426 of file GlobalPatternFinder.cxx.
|
inherited |
Change the current logging level.
Use this rather than msg().setLevel() for proper operation with MT.
Definition at line 28 of file AthMessaging.cxx.
|
friend |
Definition at line 1321 of file GlobalPatternFinder.cxx.
|
mutableprivateinherited |
Messaging initialized (initMessaging).
Definition at line 141 of file AthMessaging.h.
|
private |
Global Pattern Recognition configuration.
Definition at line 415 of file GlobalPatternFinder.h.
|
mutableprivateinherited |
|
mutableprivateinherited |
|
mutableprivateinherited |
MsgStream instance (a std::cout like with print-out levels).
Definition at line 132 of file AthMessaging.h.
|
privateinherited |
Message source name.
Definition at line 129 of file AthMessaging.h.
|
private |
Spacepoint sorter per logical measurement layer.
Definition at line 413 of file GlobalPatternFinder.h.
|
staticprivate |
Definition at line 104 of file GlobalPatternFinder.h.