LDMX Software
GSFProcessor.h
1#pragma once
2
3//--- Framework ---//
4#include "Framework/Configure/Parameters.h"
6#include "Framework/Logger.h"
8
9//--- C++ ---//
10#include <memory>
11#include <random>
12
13//--- LDMX ---//
14#include "Tracking/Reco/TrackingGeometryUser.h"
15
16//--- ACTS ---//
17
18// Utils and Definitions
19#include "Acts/Definitions/Common.hpp"
20#include "Acts/Definitions/TrackParametrization.hpp"
21#include "Acts/Definitions/Units.hpp"
22#include "Acts/EventData/TrackParameters.hpp"
23#include "Acts/Utilities/Logger.hpp"
24
25// geometry
26#include "Acts/Geometry/GeometryContext.hpp"
27
28// magfield
29#include "Acts/MagneticField/MagneticFieldContext.hpp"
30#include "Acts/MagneticField/MagneticFieldProvider.hpp"
31
32// geometry
33#include <Acts/Geometry/TrackingGeometry.hpp>
34
35// propagation testing
36#include "Acts/MagneticField/ConstantBField.hpp"
37#include "Acts/Propagator/AbortList.hpp"
38#include "Acts/Propagator/ActionList.hpp"
39#include "Acts/Propagator/DenseEnvironmentExtension.hpp"
40#include "Acts/Propagator/EigenStepper.hpp"
41#include "Acts/Propagator/MaterialInteractor.hpp"
42#include "Acts/Propagator/Navigator.hpp"
43#include "Acts/Propagator/Propagator.hpp"
44#include "Acts/Propagator/StandardAborters.hpp"
45#include "Acts/Propagator/detail/SteppingLogger.hpp"
46#include "Acts/Surfaces/PerigeeSurface.hpp"
47#include "Acts/Utilities/Logger.hpp"
48
49// Kalman Filter
50
51// #include "Acts/EventData/Measurement.hpp"
52#include "Acts/EventData/MultiTrajectory.hpp"
53#include "Acts/EventData/MultiTrajectoryHelpers.hpp"
54#include "Acts/EventData/VectorTrackContainer.hpp"
55#include "Acts/Geometry/GeometryIdentifier.hpp"
56#include "Acts/TrackFinding/CombinatorialKalmanFilter.hpp"
57#include "Acts/TrackFinding/MeasurementSelector.hpp"
58#include "Acts/TrackFitting/GainMatrixSmoother.hpp"
59#include "Acts/TrackFitting/GainMatrixUpdater.hpp"
60#include "Acts/Utilities/CalibrationContext.hpp"
61
62//--- Refit with backward propagation ---//
63#include "Acts/TrackFitting/KalmanFitter.hpp"
64
65// GSF
66#include "Acts/Propagator/MultiEigenStepperLoop.hpp"
67#include "Acts/TrackFitting/BetheHeitlerApprox.hpp"
68#include "Acts/TrackFitting/GaussianSumFitter.hpp"
69#include "Acts/TrackFitting/GsfMixtureReduction.hpp"
70
71//--- Tracking ---//
72#include "Tracking/Event/Measurement.h"
73#include "Tracking/Event/Track.h"
74#include "Tracking/Reco/TrackExtrapolatorTool.h"
75#include "Tracking/Sim/IndexSourceLink.h"
76#include "Tracking/Sim/MeasurementCalibrator.h"
77#include "Tracking/Sim/TrackingUtils.h"
78
79//--- Interpolated magnetic field ---//
80#include "Tracking/Sim/BFieldXYZUtils.h"
81
82using ActionList =
83 Acts::ActionList<Acts::detail::SteppingLogger, Acts::MaterialInteractor>;
84using AbortList = Acts::AbortList<Acts::EndOfWorldReached>;
85
86// using GsfPropagator = Acts::Propagator<
87// Acts::MultiEigenStepperLoop<
88// Acts::StepperExtensionList<
89// Acts::detail::GenericDefaultExtension<double> >,
90// Acts::WeightedComponentReducerLoop,
91// Acts::detail::VoidAuctioneer>,
92// Acts::Navigator>;
93
94using MultiStepper = Acts::MultiEigenStepperLoop<>;
95using Propagator = Acts::Propagator<Acts::EigenStepper<>, Acts::Navigator>;
96using GsfPropagator = Acts::Propagator<MultiStepper, Acts::Navigator>;
97using BetheHeitlerApprox = Acts::AtlasBetheHeitlerApprox<6, 5>;
98
99namespace tracking {
100namespace reco {
101
102class GSFProcessor final : public TrackingGeometryUser {
103 public:
110 GSFProcessor(const std::string &name, framework::Process &process);
111
113 virtual ~GSFProcessor() = default;
114
118 void onProcessStart() override;
119
126 void onNewRun(const ldmx::RunHeader &rh) override;
127
131 void onProcessEnd() override;
132
138 void configure(framework::config::Parameters &parameters) override;
139
145 void produce(framework::Event &event) override;
146
147 private:
148 // Forms the layer to acts map
149 // auto makeLayerSurfacesMap(std::shared_ptr<const Acts::TrackingGeometry>
150 // trackingGeometry) const -> std::unordered_map<unsigned int, const
151 // Acts::Surface*>;
152
153 // Make geoid -> source link map Measurements
154 // auto makeGeoIdSourceLinkMap(
155 // const geo::TrackersTrackingGeometry& tg,
156 // const std::vector<ldmx::Measurement > &ldmxsps) ->
157 // std::unordered_multimap<Acts::GeometryIdentifier,
158 // ActsExamples::IndexSourceLink>;
159
160 // If we want to dump the tracking geometry
161 // bool dumpobj_{false};
162 // int pionstates_{10};
163 // int nevents_{0};
164 // Processing time counter
165 // double processing_time_{0.};
166
167 // time profiling
168 std::map<std::string, double> profiling_map_;
169
170 // refitting of tracks
171 // bool kf_refit_{false};
172 // bool gsf_refit_{false};
173
174 bool debug_{false};
175
176 //--- Smearing ---//
177
178 std::default_random_engine generator_;
179 std::shared_ptr<std::normal_distribution<float>> normal_;
180
181 // Constant BField
182 // double bfield_{0};
183 // Use constant bfield
184 // bool const_b_field_{true};
185
186 // Remove stereo measurements
187 // bool remove_stereo_{false};
188
189 // Use 2d measurements instead of 1D
190 // bool use1Dmeasurements_{true};
191
192 // Minimum number of hits on tracks
193 // int min_hits_{7};
194
195 // The extrapolation surface
196 // bool use_extrapolate_location_{true};
197 std::vector<double> extrapolate_location_{0., 0., 0.};
198 // bool use_seed_perigee_{false};
199
200 // The measurement collection to use for track reconstruction
201 std::string measurement_collection_{"TaggerMeasurements"};
202
203 // double outlier_pval_{3.84};
204
205 // The output track collection
206 std::string out_trk_collection_{"GSFTracks"};
207
208 // Select the hits using TrackID and pdg_id__
209
210 // int track_id_{-1};
211 // int pdg_id_{11};
212
213 // Mass for the propagator hypothesis in MeV
214 // double mass_{0.511};
215
216 // The seed track collection
217 std::string seed_coll_name_{"seedTracks"};
218
219 // The GSF Fitter
220 std::unique_ptr<const Acts::GaussianSumFitter<
221 GsfPropagator, BetheHeitlerApprox, Acts::VectorMultiTrajectory>>
222 gsf_;
223
224 // Configuration
225
226 std::string track_collection_{"TaggerTracks"};
227 std::string meas_collection_{"DigiTaggerSimHits"};
228
229 std::string track_passname_;
230 std::string meas_passname_;
231 std::string track_collection_event_passname_;
232 std::string meas_collection_event_passname_;
233
234 size_t max_components_{4};
235 bool abort_on_error_{false};
236 bool disable_all_material_handling_{false};
237 double weight_cutoff_{1.0e-4};
238
239 double propagator_step_size_{200.}; // mm
240 int propagator_max_steps_{1000};
241 std::string field_map_{""};
242
243 bool use_perigee_{false};
244 // bool usePlaneSurface_{false};
245
246 // Keep track on which system this processor is running on
247 bool tagger_tracking_{true};
248
249 // The Propagators
250 std::unique_ptr<const Propagator> propagator_;
251
252 // The GSF Fitter
253
254 // This could be a vector
255 // The mapping between layers and Acts::Surface
256 std::unordered_map<unsigned int, const Acts::Surface *> layer_surface_map_;
257
258 // Track Extrapolator Tool
259 std::shared_ptr<tracking::reco::TrackExtrapolatorTool<Propagator>>
260 trk_extrap_;
261
262}; // GSFProcessor
263
264} // namespace reco
265} // 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
virtual void process(Event &event) final
Processing an event for a Producer is calling produce.
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
virtual ~GSFProcessor()=default
Destructor.
void produce(framework::Event &event) override
Run the processor.
void onProcessEnd() override
Callback for the EventProcessor to take any necessary action when the processing of events finishes,...
void configure(framework::config::Parameters &parameters) override
Configure the processor using the given user specified parameters.
GSFProcessor(const std::string &name, framework::Process &process)
Constructor.
void onProcessStart() override
Callback for the EventProcessor to take any necessary action when the processing of events starts,...
void onNewRun(const ldmx::RunHeader &rh) override
onNewRun is the first function called for each processor after the conditions are fully configured an...
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...