![]() |
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 | PatternState |
| Pattern state object storing pattern information during construction. More... | |
| struct | LineCompatibilityResult |
| : Small struct to encapsulate the checkLineCompatibility result 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. | |
| 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 | CompatibilityResult : std::int8_t { eAddHit = 0 , eBranchPattern = 1 , eRejectHit = -1 } |
| : Enum for the possible outcomes of the line compatibility test of one pattern against one test hit 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 | TreeNode = std::pair<SearchTree_t::coordinate_t, HitPayload> |
| Type alias for a tree node, formed by a hit payload and its indexing coordinates. | |
| 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 building of patterns in eta. | |
| void | extendPatterns (PatternStateVec &activePatterns, const HitPayload &test, const HitPayload &seed, const HitPayload &prevCandidate, PatternHitVisualInfoVec *visualInfo=nullptr) const |
| Function testing pattern compatibility of a set of active patterns (patterns produced from the same seed hit) against one test hit. | |
| LineCompatibilityResult | checkLineCompatibility (const HitPayload &seed, const HitPayload &test, const PatternState &pat) const |
| Method to check the line compatibility of a test hit with a given pattern. | |
| LineCompatibilityResult | computeResidual (const HitPayload &seed, const HitPayload &test, const PatternState &pat, const uint8_t patHitIdx, const Amg::Vector3D &beamSpot) const |
| Helper method to compute the residual of a test hit against a reference pattern hit and check whether it is within the acceptance window. | |
| bool | isBetter (const PatternState &a, const PatternState &b) const |
| Operator to compare two patterns. | |
| 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. | |
| bool | isPhiCompatible (const double testPhi, const PatternState &pattern) const |
| Method to check the phi compatibility of a test hit with a given pattern. | |
| 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 LayerOrdering | checkLayerOrdering (const HitPayload &hit1, const HitPayload &hit2) |
| Method to check the logical layer ordering of two hits. | |
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). | |
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 29 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 40 of file GlobalPatternFinder.h.
Type alias for the station layer index.
Definition at line 34 of file GlobalPatternFinder.h.
| using MuonR4::FastReco::GlobalPatternFinder::PatternHitVisualInfo = MuonValR4::IFastRecoVisualizationTool::PatternHitVisualInfo |
Type alias for the visual information of a pattern.
Definition at line 42 of file GlobalPatternFinder.h.
| using MuonR4::FastReco::GlobalPatternFinder::PatternHitVisualInfoVec = std::vector<PatternHitVisualInfo> |
Abrivation for a vector of visual information objects.
Definition at line 44 of file GlobalPatternFinder.h.
|
private |
Definition at line 274 of file GlobalPatternFinder.h.
| using MuonR4::FastReco::GlobalPatternFinder::PatternVec = std::vector<GlobalPattern> |
Abrivation for a vector of global patterns.
Definition at line 38 of file GlobalPatternFinder.h.
|
private |
Definition of the search tree class.
Definition at line 164 of file GlobalPatternFinder.h.
| using MuonR4::FastReco::GlobalPatternFinder::SpacePointContainerVec = std::vector<const SpacePointContainer*> |
Abrivation for a vector of space-point containers.
Definition at line 36 of file GlobalPatternFinder.h.
Type alias for the station index.
Definition at line 32 of file GlobalPatternFinder.h.
|
private |
Type alias for a tree node, formed by a hit payload and its indexing coordinates.
Definition at line 166 of file GlobalPatternFinder.h.
|
strongprivate |
: Enum for the possible outcomes of the line compatibility test of one pattern against one test hit
| Enumerator | |
|---|---|
| eAddHit | Test successfull, add the hit to the pattern. |
| eBranchPattern | Test successfull with multiple pattern hits in the same logical measurement layer, branch the pattern. |
| eRejectHit | Test failed, discard the hit. |
Definition at line 303 of file GlobalPatternFinder.h.
|
strongprivate |
Enum to express the logical measurement layer ordering given two hits.
| Enumerator | |
|---|---|
| eSameLayer | |
| eLowerLayer | |
| eHigherLayer | |
Definition at line 371 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 168 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 52 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 569 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 1044 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 845 of file GlobalPatternFinder.cxx.
|
private |
Method to check the line compatibility of a test hit with a given pattern.
| seed | seed hit information |
| test | test hit information |
| pattern | pattern to be extended |
Safety check that the test hit is not on the same layer as the seed
Here we can retrieve the beamspot if desired
Helper function to make the result
| patHitIdx | Pattern hit index to use to compute the pattern line |
| isNewLayer | Flag indicating if the test hit is in a new layer |
Fetch the last inserted hit
Test hit coincides with the last inserted hit
We add the test hit to the pattern if they are consecutive MDT hits
sTGCs: if the test hit is a trigger hit (Pad) and the last inserted is precision (strip), we keep the precision hit
If they are not consecutive MDT hits && we have no inserted hits yet (last hit = seed), we give priority to the seed and reject the test hit
Find first previously inserted hit on a different layer from test, starting counting from the second-to-last hit
Definition at line 337 of file GlobalPatternFinder.cxx.
|
private |
Helper method to compute the residual of a test hit against a reference pattern hit and check whether it is within the acceptance window.
The residual is defined against the line passing through seed and the reference pattern hit
| seed | seed hit information |
| test | test hit information |
| pattern | pattern to be extended |
| patHitIdx | Index of the pattern hit to use for residual computation |
| beamSpot | Needed to draw the pattern line when the provided pattern hit is too close to the seed |
The dynamic acceptance window is defined using the error propagation law for the residual. We have two contributions: the line extrapolation distance and the uncertainty on the line slope
Alpha parameter determining the propagation/ line extrapolation magnitude
Loosen the window when using the beamspot as reference, as the line slope is less well defined
Apply LR correction if the pat hit is a straw
Definition at line 407 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
Blow-up the number of sectors by a factor of 2. The even numbers represent the segments expressed @ the sector centre. The odd numbers represent the overlap region between two adjacent sectors. For sector 16, the right overlap region is mapped to 1
Definition at line 782 of file GlobalPatternFinder.cxx.
|
private |
Method to convert a PatternState into a GlobalPattern object.
| candidate | PatternState to be converted |
Definition at line 748 of file GlobalPatternFinder.cxx.
|
private |
Method to convert a vector of PatternStates into GlobalPattern objects.
| candidates | PatternStates to be converted |
Definition at line 770 of file GlobalPatternFinder.cxx.
|
private |
Function testing 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.
| activePatterns | Vector of active patterns to be extended |
| test | Hit to be tested |
| seed | Seed hit information |
| prevCandidate | Previous candidate hit information |
| visualInfo | Pointer to visual information for pattern visualization (nullptr if the VisualizationTool is disabled) |
Check angular compatibility of the test hit and the pattern
Add the test hit to the pattern
Branch the pattern: we clone it and overwrite the existing hit with the test hit
Update visual information of the original pattern
Add the new pattern to the list of next patterns
Definition at line 240 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
Add phi-only hits to the patterns
Fill the output buckets & visual info
Add the successfull pattern to visual info, as we won't touch it again
Plot patterns
Definition at line 65 of file GlobalPatternFinder.cxx.
|
private |
Method steering the building of patterns in eta.
| 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. |
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 (and overlapping) 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 one hit is precision and one trigger, put first the trigger one. Relevant for STGCs
If the two hits are in the same layer, sort them by local y coordinate.
Initialize a pattern from the seed hit
Helper function to process a new candidate hit. During pattern building, we can have pattern branching when the initial pattern is compatible with multiple hits in the same layer. These patterns will be stored in activePatterns. For each new hit, extendPatterns
will try to extend every active pattern and remove the ones not meeting continuation criteria.
| testPair | The new candidate hit to process. |
Helper function ensuring we have at the end one pattern for seed hit. If multiple survived at the end, we keep the best.
First search for compatible hits from the seed layer onwards
Then try to proceed toward the innermost layer
Check that the pattern meets the minimum requirements for trigger and precision hits
Definition at line 100 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.
|
private |
Operator to compare two patterns.
| a | First pattern to compare |
| b | Second pattern to compare |
Function computing the score for a pattern
Definition at line 479 of file GlobalPatternFinder.cxx.
|
private |
Method to check the phi compatibility of a test hit with a given pattern.
| testPhi | test global phi |
| pattern | pattern to be extended |
We check that the test hit is compatible with the pattern phi, if available, which is given by the first phi measurement in the pattern. If the pattern doesn't have a phi yet, we check that the test hit is in the same pattern sector(s)
Definition at line 728 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 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 half the hits of the smaller pattern are shared
Definition at line 502 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.
|
mutableprivateinherited |
Messaging initialized (initMessaging).
Definition at line 141 of file AthMessaging.h.
|
private |
Global Pattern Recognition configuration.
Definition at line 394 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 392 of file GlobalPatternFinder.h.