File indexing completed on 2025-01-18 09:27:59
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/EventData/TrackParameters.hpp"
0013 #include "Acts/MagneticField/MagneticFieldContext.hpp"
0014 #include "Acts/Utilities/Result.hpp"
0015 #include "Acts/Vertexing/DummyVertexFitter.hpp"
0016 #include "Acts/Vertexing/GaussianGridTrackDensity.hpp"
0017 #include "Acts/Vertexing/IVertexFinder.hpp"
0018 #include "Acts/Vertexing/Vertex.hpp"
0019 #include "Acts/Vertexing/VertexingOptions.hpp"
0020
0021 #include <map>
0022
0023 namespace Acts {
0024
0025
0026
0027
0028
0029
0030
0031
0032 class GridDensityVertexFinder final : public IVertexFinder {
0033 public:
0034 using MainGridVector = GaussianGridTrackDensity::MainGridVector;
0035 using TrackGridVector = GaussianGridTrackDensity::TrackGridVector;
0036
0037
0038 struct Config {
0039
0040 Config(GaussianGridTrackDensity gDensity) : gridDensity(gDensity) {}
0041
0042
0043 GaussianGridTrackDensity gridDensity;
0044
0045
0046
0047
0048
0049
0050
0051 bool cacheGridStateForTrackRemoval = true;
0052
0053
0054 double maxD0TrackSignificance = 3.5;
0055
0056 double maxZ0TrackSignificance = 12.;
0057
0058 double d0SignificanceCut = maxD0TrackSignificance * maxD0TrackSignificance;
0059 double z0SignificanceCut = maxZ0TrackSignificance * maxZ0TrackSignificance;
0060 bool estimateSeedWidth = false;
0061
0062
0063 InputTrack::Extractor extractParameters;
0064 };
0065
0066
0067
0068
0069 struct State {
0070 State(MainGridVector mainGrid_) : mainGrid(std::move(mainGrid_)) {}
0071
0072
0073 MainGridVector mainGrid;
0074
0075
0076 std::map<InputTrack, std::pair<int, TrackGridVector>> binAndTrackGridMap;
0077
0078
0079 std::map<InputTrack, bool> trackSelectionMap;
0080
0081
0082
0083 std::vector<InputTrack> tracksToRemove;
0084
0085 bool isInitialized = false;
0086 };
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098 Result<std::vector<Vertex>> find(
0099 const std::vector<InputTrack>& trackVector,
0100 const VertexingOptions& vertexingOptions,
0101 IVertexFinder::State& anyState) const override;
0102
0103 IVertexFinder::State makeState(
0104 const Acts::MagneticFieldContext& ) const override {
0105 return IVertexFinder::State{
0106 std::in_place_type<State>,
0107 MainGridVector{m_cfg.gridDensity.config().mainGridSize}};
0108 }
0109
0110 void setTracksToRemove(
0111 IVertexFinder::State& anyState,
0112 const std::vector<InputTrack>& removedTracks) const override {
0113 auto& state = anyState.template as<State>();
0114 state.tracksToRemove = removedTracks;
0115 }
0116
0117
0118
0119
0120 GridDensityVertexFinder(const Config& cfg) : m_cfg(cfg) {
0121 if (!m_cfg.extractParameters.connected()) {
0122 throw std::invalid_argument(
0123 "GridDensityVertexFinder: "
0124 "No track parameter extractor provided.");
0125 }
0126 }
0127
0128 private:
0129
0130
0131
0132
0133
0134 bool doesPassTrackSelection(const BoundTrackParameters& trk) const;
0135
0136
0137 const Config m_cfg;
0138 };
0139
0140 }