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