|
|
|||
File indexing completed on 2026-08-27 08:52:39
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/Definitions/Algebra.hpp" 0012 #include "Acts/MagneticField/MagneticFieldContext.hpp" 0013 #include "Acts/Utilities/Result.hpp" 0014 #include "Acts/Vertexing/DummyVertexFitter.hpp" 0015 #include "Acts/Vertexing/GaussianGridTrackDensity.hpp" 0016 #include "Acts/Vertexing/IVertexFinder.hpp" 0017 #include "Acts/Vertexing/Vertex.hpp" 0018 #include "Acts/Vertexing/VertexingOptions.hpp" 0019 0020 #include <map> 0021 0022 namespace Acts { 0023 0024 /// @class GridDensityVertexFinder 0025 /// @brief Vertex finder that makes use of a track density grid. 0026 /// Each single track is modelled as a 2(!)-dim Gaussian distribution grid 0027 /// in the d0-z0 plane, but only the overlap with the z-axis (i.e. a 1-dim 0028 /// density vector) needs to be calculated. All track contributions along the 0029 /// beam axis (main density grid) a superimposed and the z-value of the bin 0030 /// with the highest track density is returned as a vertex candidate. 0031 class GridDensityVertexFinder final : public IVertexFinder { 0032 public: 0033 /// Type alias for main grid vector used in density calculations 0034 using MainGridVector = GaussianGridTrackDensity::MainGridVector; 0035 /// Type alias for track grid vector used for individual track density 0036 using TrackGridVector = GaussianGridTrackDensity::TrackGridVector; 0037 0038 /// @brief The Config struct 0039 struct Config { 0040 ///@param gDensity The grid density 0041 explicit Config(GaussianGridTrackDensity gDensity) 0042 : gridDensity(gDensity) {} 0043 0044 /// The grid density object for track density calculations 0045 GaussianGridTrackDensity 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 grid state for efficient track removal 0054 bool cacheGridStateForTrackRemoval = true; 0055 0056 /// Maximum d0 impact parameter significance to use a track 0057 double maxD0TrackSignificance = 3.5; 0058 /// Maximum z0 impact parameter significance to use a track 0059 double maxZ0TrackSignificance = 12.; 0060 /// The actual corresponding cut values in the algorithm for d0 0061 double d0SignificanceCut = maxD0TrackSignificance * maxD0TrackSignificance; 0062 /// The actual corresponding cut values in the algorithm for z0 0063 double z0SignificanceCut = maxZ0TrackSignificance * maxZ0TrackSignificance; 0064 /// Flag to enable seed width estimation from track density 0065 bool estimateSeedWidth = false; 0066 0067 /// Function to extract parameters from InputTrack 0068 InputTrack::Extractor extractParameters; 0069 }; 0070 0071 /// @brief The State struct 0072 /// 0073 /// Only needed if cacheGridStateForTrackRemoval == true 0074 struct State { 0075 /// Constructor with main grid vector 0076 /// @param mainGrid_ The main density grid for vertex finding 0077 explicit State(MainGridVector mainGrid_) : mainGrid(std::move(mainGrid_)) {} 0078 0079 /// The main density grid for vertex finding 0080 MainGridVector mainGrid; 0081 /// Map to store z-bin and track grid (i.e. the density contribution of 0082 /// a single track to the main grid) for every single track 0083 std::map<InputTrack, std::pair<int, TrackGridVector>> binAndTrackGridMap; 0084 0085 /// Map to store bool if track has passed track selection or not 0086 std::map<InputTrack, bool> trackSelectionMap; 0087 0088 /// Store tracks that have been removed from track collection. These 0089 /// track will be removed from the main grid 0090 std::vector<InputTrack> tracksToRemove; 0091 0092 /// Flag indicating if 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{ 0114 std::in_place_type<State>, 0115 MainGridVector{m_cfg.gridDensity.config().mainGridSize}}; 0116 } 0117 0118 void setTracksToRemove( 0119 IVertexFinder::State& anyState, 0120 const std::vector<InputTrack>& removedTracks) const override { 0121 auto& state = anyState.template as<State>(); 0122 state.tracksToRemove = removedTracks; 0123 } 0124 0125 /// @brief Constructor for user-defined InputTrack type 0126 /// 0127 /// @param cfg Configuration object 0128 explicit GridDensityVertexFinder(const Config& cfg) : m_cfg(cfg) { 0129 if (!m_cfg.extractParameters.connected()) { 0130 throw std::invalid_argument( 0131 "GridDensityVertexFinder: " 0132 "No track parameter extractor provided."); 0133 } 0134 } 0135 0136 private: 0137 /// @brief Checks if a track passes the selection criteria for seeding 0138 /// 0139 /// @param trk The track 0140 /// 0141 /// @return Bool track passes selection 0142 bool doesPassTrackSelection(const BoundTrackParameters& trk) const; 0143 0144 // The configuration object 0145 const Config m_cfg; 0146 }; 0147 0148 } // 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 |
|