|
|
|||
File indexing completed on 2026-05-16 07:35:27
0001 // This file is part of the ACTS project. 0002 // 0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project 0004 // 0005 // This Source Code Form is subject to the terms of the Mozilla Public 0006 // License, v. 2.0. If a copy of the MPL was not distributed with this 0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/. 0008 0009 #pragma once 0010 0011 #include "Acts/MagneticField/MagneticFieldContext.hpp" 0012 #include "Acts/Utilities/Result.hpp" 0013 #include "Acts/Vertexing/AdaptiveGridTrackDensity.hpp" 0014 #include "Acts/Vertexing/DummyVertexFitter.hpp" 0015 #include "Acts/Vertexing/IVertexFinder.hpp" 0016 #include "Acts/Vertexing/Vertex.hpp" 0017 #include "Acts/Vertexing/VertexingOptions.hpp" 0018 0019 #include <unordered_map> 0020 0021 namespace Acts { 0022 0023 /// @class AdaptiveGridDensityVertexFinder 0024 /// @brief Vertex finder that makes use of a track density grid. 0025 /// Each single track is modelled as a 2-dim Gaussian distribution grid 0026 /// in the d0-z0 plane, but only the overlap with the z-axis (i.e. a 1-dim 0027 /// density vector) needs to be calculated. All track contributions along the 0028 /// beam axis (main density vector) are superimposed and the z-value of the bin 0029 /// with the highest track density is returned as a vertex candidate. 0030 /// Unlike the GridDensityVertexFinder, this seeder implements an adaptive 0031 /// version where the density grid grows bigger with added tracks. 0032 class AdaptiveGridDensityVertexFinder final : public IVertexFinder { 0033 public: 0034 /// Type alias for the density map used in adaptive grid vertex finding 0035 using DensityMap = AdaptiveGridTrackDensity::DensityMap; 0036 0037 /// @brief The Config struct 0038 struct Config { 0039 ///@param gDensity The grid density 0040 explicit Config(const AdaptiveGridTrackDensity& gDensity) 0041 : gridDensity(gDensity) {} 0042 0043 // The grid density object 0044 /// Grid density calculator for track density estimation 0045 AdaptiveGridTrackDensity gridDensity; 0046 0047 // Cache the main grid and the density contributions (trackGrid and z-bin) 0048 // for every single track. 0049 // This option enables the possibility to calculate the entire main grid 0050 // only once in the first iteration. If tracks are removed from the track 0051 // collection, the individual track density contributions to the main grid 0052 // can just be removed without calculating the entire grid from scratch. 0053 /// Flag to enable caching of grid state for efficient track removal 0054 bool cacheGridStateForTrackRemoval = true; 0055 0056 // Maximum d0 impact parameter significance to use a track 0057 /// Maximum d0 impact parameter significance threshold 0058 double maxD0TrackSignificance = 3.5; 0059 // Maximum z0 impact parameter significance to use a track 0060 /// Maximum z0 impact parameter significance threshold 0061 double maxZ0TrackSignificance = 12.; 0062 // The actual corresponding cut values in the algorithm 0063 /// Squared d0 significance cut value for track selection 0064 double d0SignificanceCut = maxD0TrackSignificance * maxD0TrackSignificance; 0065 /// Squared z0 significance cut value for track selection 0066 double z0SignificanceCut = maxZ0TrackSignificance * maxZ0TrackSignificance; 0067 /// Flag indicating whether to estimate seed width 0068 bool estimateSeedWidth = false; 0069 0070 // Function to extract parameters from InputTrack 0071 /// Function to extract track parameters from InputTrack 0072 InputTrack::Extractor extractParameters; 0073 }; 0074 0075 /// @brief The State struct 0076 /// 0077 /// Only needed if cacheGridStateForTrackRemoval == true 0078 struct State { 0079 // Map from the z bin values to the corresponding track density 0080 /// Main density map storing cumulative track density per z-bin 0081 DensityMap mainDensityMap; 0082 0083 // Map from input track to corresponding track density map 0084 /// Map storing individual track density contributions 0085 std::unordered_map<InputTrack, DensityMap> trackDensities; 0086 0087 // Store tracks that have been removed from track collection. These 0088 // tracks will be removed from the main grid 0089 /// Vector of tracks to be removed from density calculation 0090 std::vector<InputTrack> tracksToRemove; 0091 0092 /// Flag indicating whether the state has been initialized 0093 bool isInitialized = false; 0094 }; 0095 0096 /// @brief Function that finds single vertex candidate 0097 /// 0098 /// @param trackVector Input track collection 0099 /// @param vertexingOptions Vertexing options 0100 /// @param anyState The state object to cache the density grid 0101 /// and density contributions of each track, to be used 0102 /// if cacheGridStateForTrackRemoval == true 0103 /// 0104 /// @return Vector of vertices, filled with a single 0105 /// vertex (for consistent interfaces) 0106 Result<std::vector<Vertex>> find( 0107 const std::vector<InputTrack>& trackVector, 0108 const VertexingOptions& vertexingOptions, 0109 IVertexFinder::State& anyState) const override; 0110 0111 IVertexFinder::State makeState( 0112 const Acts::MagneticFieldContext& /*mctx*/) const override { 0113 return IVertexFinder::State{State{}}; 0114 } 0115 0116 void setTracksToRemove( 0117 IVertexFinder::State& anyState, 0118 const std::vector<InputTrack>& removedTracks) const override { 0119 auto& state = anyState.template as<State>(); 0120 state.tracksToRemove = removedTracks; 0121 } 0122 0123 /// @brief Constructor for user-defined InputTrack type 0124 /// 0125 /// @param cfg Configuration object 0126 explicit AdaptiveGridDensityVertexFinder(const Config& cfg) : m_cfg(cfg) {} 0127 0128 private: 0129 /// @brief Checks if a track passes the selection criteria for seeding 0130 /// 0131 /// @param trk The track 0132 /// 0133 /// @return Bool track passes selection 0134 bool doesPassTrackSelection(const BoundTrackParameters& trk) const; 0135 0136 // The configuration object 0137 const Config m_cfg; 0138 }; 0139 0140 } // namespace Acts
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|