![]() |
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... | |
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, 10> |
| 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 StIndex testStation, const HitPayload &seed, const HitPayload &prevCandidate, const StIndex prevCandidateStation, 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. | |
| std::pair< CompatibilityResult, double > | checkLineCompatibility (const HitPayload &seed, const HitPayload &test, const StIndex testStation, const PatternState &pattern) const |
| Method to check the line compatibility of a test hit with a given pattern. | |
| bool | isPhiCompatible (const HitPayload &test, const HitPayload &seed, const PatternState &pattern) const |
| Method to check the phi compatibility of a test hit with a given pattern. | |
| double | computeLineSlope (const HitPayload &lastPatHit, const HitPayload &seed, const bool useSeed2Beamspot, const Amg::Vector3D &beamSpot) const |
| Helper method to compute the line slope between the seed and the last hit in a given pattern in the R-Z plane. | |
| double | computeResidual (const HitPayload &testHit, const HitPayload &seed, const double lineSlope) const |
| Method to compute the residual in globalR given the pattern line and test hit. | |
| double | computeAcceptanceWindow (const HitPayload &testHit, const HitPayload &seed, const HitPayload &lastPatHit, const double lineSlope, const bool useSeed2Beamspot, const Amg::Vector3D &beamSpot) const |
| Method to compute the acceptance window in global R for a given pattern line and test hit. | |
| PatternStateVec | resolveOverlaps (PatternStateVec &&toResolve, PatternHitVisualInfoVec *visualInfo=nullptr) const |
| Method to remove overlapping patterns. | |
| 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. | |
| LayerOrdering | checkLayerOrdering (const HitPayload &hit1, const HitPayload &hit2, const StIndex station1, const StIndex station2) const |
| Method to check the logical layer ordering of two hits. | |
| 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. | |
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. It will optionally write the final GlobalPatterns into the event store for downstream use.
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 199 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 113 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 115 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 231 of file GlobalPatternFinder.h.
|
strongprivate |
Enum to express the logical measurement layer ordering given two hits.
| Enumerator | |
|---|---|
| eSameLayer | |
| eLowerLayer | |
| eHigherLayer | |
Definition at line 304 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 117 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 71 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 719 of file GlobalPatternFinder.cxx.
|
private |
Method to check the logical layer ordering of two hits.
| hit1 | first hit |
| hit2 | second hit |
| station1 | station index of the first hit |
| station2 | station index of the 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 576 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 |
| testStation | station of the test hit |
| pattern | pattern to be extended |
Here we can retrieve the beamspot if desired
Helper function to get whether the test hit is within the acceptance window of the last pattern hit
Fetch the last filled station and the last inserted hit
Check the layer ordering between the last inserted hit and the test hit
Check whether the test hit is in the same layer as the last hit in the pattern
Check that the hits are not the same
We add the test hit to the pattern if they are consecutive MDT hits
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
If they are not consecutive MDT hits && we have inserted hits, we We draw a line using the seed and last hit being on a different layer from the second-to-last inserted hit, and we check that the test hit residual is within the acceptance window. If we have no at least 2 inserted hits yet, we compute the line using the seed and the beamspot.
Fallback when we have all the previously inserted hits on the same layer
The new hit is in a new layer. We draw a line using the last inserted hit and the seed, and we check that the test hit residual is within the acceptance window. If we have no inserted hits yet, we compute the line using the seed and the beamspot.
Definition at line 306 of file GlobalPatternFinder.cxx.
|
private |
Method to compute the acceptance window in global R for a given pattern line and test hit.
| testHit | test hit information |
| seed | seed hit information |
| lastPatHit | last hit in the pattern, used to compute the pattern line |
| lineSlope | pattern line slope in the R-Z plane |
| useSeed2Beamspot | whether we used the beamspot instead of the last pattern hit to compute the pattern line with the seed |
| beamspot | beamspot global position |
The acceptance window is defined according to the error propagation law for the residual. We have a contribution given by the geometrical amplification of the measurement error and a contribution from the uncertainty in the line slope
Reference z: last hit in the pattern or beamspot
Alpha parameter determining the propagation/ line extrapolation magnitude
Definition at line 426 of file GlobalPatternFinder.cxx.
|
private |
Helper method to compute the line slope between the seed and the last hit in a given pattern in the R-Z plane.
| lastPatHit | reference to the last hit in the pattern |
| seed | seed hit information |
| useSeed2Beamspot | whether we should use the beamspot instead of the last pattern hit to compute the pattern line with the seed |
| beamSpot | beamspot global position |
Safe-guard check: if we are inserting the first hit or if the last pattern hit and the seed are too close in Z, we use the beamspot
Definition at line 405 of file GlobalPatternFinder.cxx.
|
private |
Method to compute the residual in globalR given the pattern line and test hit.
| testHit | test hit information |
| seed | seed hit information |
| lineSlope | pattern line slope in the R-Z plane |
Definition at line 418 of file GlobalPatternFinder.cxx.
|
private |
Method to construct the search tree by filling it up with spacepoints from the given containers.
| gctx | Geometry context |
| spacepoints | Vector of space point containers |
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 527 of file GlobalPatternFinder.cxx.
|
private |
Method to convert a PatternState into a GlobalPattern object.
| candidate | PatternState to be converted |
Definition at line 492 of file GlobalPatternFinder.cxx.
|
private |
Method to convert a vector of PatternStates into GlobalPattern objects.
| candidates | PatternStates to be converted |
Definition at line 515 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 |
| testPair | TreeNode (Hit with its tree coordinates) corresponding to the hit to be tested |
| testStation | Station index of the hit to be tested |
| seed | Seed hit information |
| prevCandidate | Previous candidate hit information |
| prevCandidateStation | Station index of the previous candidate hit (used to check the layer ordering) |
| 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
We branch only once, otherwise we would create duplicate patterns
Branch the pattern: we clone it and overwrite the existing hit with the test hit. Watch out, from now on lastPatHit will be the test hit
Update visual information of the original pattern
Add the new pattern to the list of next patterns
Definition at line 234 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
Find patterns in eta first
Fill the output buckets
Plot patterns
Definition at line 78 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) |
We try to build a pattern in eta starting from every hit in the three
Check the seed is in the current seeding layer, measures eta and if seeding from MDT hits is enabled
check how many existing patterns contain this hit
Define the search range.
Allowing just one value for the expanded sector range, we also include patterns extending in the overlap region of neighbouring physical sectors
Pattern search is performed within a theta window of size m_thetaSearchWindow. This window corresponds to the maximum allowed theta spread for the target pT.
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.
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 patters 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.
Only-phi measurement will be treated later
Helper funtion insuring 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 108 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 |
Method to check the phi compatibility of a test hit with a given pattern.
| seed | seed hit information |
| test | test hit information |
| pattern | pattern to be extended |
If the test hits does not measure phi but the pattern has already a phi, we check that the pattern is within the test hit sector.
If the test hit measures phi we check that it's compatible with the pattern phi, if avalilable, which is the average of the phi values of accepted hits of the pattern. If the pattern doesn't have a defined phi yet, we check that the test hit is in the same sector as the seed hit
Definition at line 378 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
Determine if one pattern is better than another
Definition at line 447 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 330 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 328 of file GlobalPatternFinder.h.