LDMX Software
GreedyAmbiguitySolver.h
1#pragma once
2
3//--- Framework ---//
4#include "Framework/Configure/Parameters.h"
7
8//--- C++ ---//
9#include <memory>
10#include <random>
11
12//--- LDMX ---//
13#include "Tracking/Reco/TrackingGeometryUser.h"
14
15//--- ACTS ---//
16
17// Utils and Definitions
18#include "Acts/Definitions/Common.hpp"
19#include "Acts/Utilities/Logger.hpp"
20
21// geometry
22#include "Acts/Geometry/GeometryContext.hpp"
23
24// geometry
25#include <Acts/Geometry/TrackingGeometry.hpp>
26
27#include "Acts/Geometry/GeometryIdentifier.hpp"
28
29//--- Tracking ---//
30#include "Tracking/Event/Measurement.h"
31#include "Tracking/Event/Track.h"
32#include "Tracking/Reco/TrackExtrapolatorTool.h"
33#include "Tracking/Sim/IndexSourceLink.h"
34#include "Tracking/Sim/MeasurementCalibrator.h"
35#include "Tracking/Sim/TrackingUtils.h"
36
37//--- Interpolated magnetic field ---//
38#include "Tracking/Sim/BFieldXYZUtils.h"
39
40namespace tracking {
41namespace reco {
42
50 public:
58 GreedyAmbiguitySolver(const std::string& name, framework::Process& process);
59
61 virtual ~GreedyAmbiguitySolver() = default;
62
69 void onNewRun(const ldmx::RunHeader& rh) override;
70
80 void configure(framework::config::Parameters& parameters) override;
81
87 void produce(framework::Event& event) override;
88
89 private:
91 std::uint32_t maximum_shared_hits_{1};
93 std::uint32_t maximum_iterations_{1000};
94
96 std::size_t n_meas_min_{7};
97
98 std::string out_trk_collection_{"TaggerTracksClean"};
99
100 std::string track_collection_{"TaggerTracks"};
101
102 std::string meas_collection_{"DigiTaggerSimHits"};
103
104 std::string input_pass_name_{""};
105
106 struct State {
107 std::size_t number_of_tracks{};
108
109 std::vector<int> track_tips;
110 std::vector<float> track_chi2;
111 std::vector<std::vector<std::size_t>> measurements_per_track;
112
113 // TODO consider boost 1.81 unordered_flat_map
114 boost::container::flat_map<std::size_t,
115 boost::container::flat_set<std::size_t>>
116 tracks_per_measurement;
117 std::vector<std::size_t> shared_measurements_per_track;
118
119 // TODO consider boost 1.81 unordered_flat_map
120 boost::container::flat_set<std::size_t> selected_tracks;
121 };
122
129 template <typename geometry_t, typename source_link_hash_t,
130 typename source_link_equality_t>
131 void computeInitialState(std::vector<ldmx::Track> tracks,
132 std::vector<ldmx::Measurement> measurements,
133 State& state, geometry_t& tg,
134 source_link_hash_t&& sourceLinkHash,
135 source_link_equality_t&& sourceLinkEquality) const;
136
142 void resolve(State& state);
143
147 void removeTrack(State& state, std::size_t iTrack) const;
148
149 /*
151 std::size_t sourceLinkHash(const Acts::SourceLink& a);
152
155 bool sourceLinkEquality(const Acts::SourceLink& a, const Acts::SourceLink& b);
156 */
157
158}; // MyProcessor
159
160} // namespace reco
161} // namespace tracking
Base classes for all user event processing components to extend.
Conditions object for random number seeds.
Implements an event buffer system for storing event data.
Definition Event.h:42
Class which represents the process under execution.
Definition Process.h:36
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:29
Run-specific configuration and data stored in its own output TTree alongside the event TTree in the o...
Definition RunHeader.h:57
Minimal example of a processor.
GreedyAmbiguitySolver(const std::string &name, framework::Process &process)
Constructor.
std::size_t n_meas_min_
Minimum number of measurement to form a track.
void removeTrack(State &state, std::size_t iTrack) const
void configure(framework::config::Parameters &parameters) override
Configure the processor using the given user specified parameters.
void computeInitialState(std::vector< ldmx::Track > tracks, std::vector< ldmx::Measurement > measurements, State &state, geometry_t &tg, source_link_hash_t &&sourceLinkHash, source_link_equality_t &&sourceLinkEquality) const
void resolve(State &state)
Updates the state iteratively by evicting one track after the other until the final state conditions ...
void onNewRun(const ldmx::RunHeader &rh) override
onNewRun is the first function called for each processor after the conditions are fully configured an...
virtual ~GreedyAmbiguitySolver()=default
Destructor.
void produce(framework::Event &event) override
Process the event and put new data products into it.
std::uint32_t maximum_iterations_
Maximum number of iterations.
std::uint32_t maximum_shared_hits_
Maximum amount of shared hits per track.
a helper base class providing some methods to shorten access to common conditions used within the tra...
The measurement calibrator can be a function or a class/struct able to retrieve the sim hits containe...