LDMX Software
CKFProcessor.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/TrackFitting/GaussianSumFitter.hpp"
66#include "Acts/Propagator/MultiEigenStepperLoop.hpp"
67
68//--- Tracking ---//
69#include "Tracking/Event/Measurement.h"
70#include "Tracking/Event/Track.h"
71#include "Tracking/Reco/TrackExtrapolatorTool.h"
72#include "Tracking/Sim/IndexSourceLink.h"
73#include "Tracking/Sim/MeasurementCalibrator.h"
74#include "Tracking/Sim/TrackingUtils.h"
75
76//--- Interpolated magnetic field ---//
77#include "Tracking/Sim/BFieldXYZUtils.h"
78// mg Aug 2024 not sure if these are needed...
79using Updater = Acts::GainMatrixUpdater;
80using Smoother = Acts::GainMatrixSmoother;
81
82using ActionList =
83 Acts::ActionList<Acts::detail::SteppingLogger, Acts::MaterialInteractor>;
84using AbortList = Acts::AbortList<Acts::EndOfWorldReached>;
85
86using CkfPropagator = Acts::Propagator<Acts::EigenStepper<>, Acts::Navigator>;
87using TrackContainer = Acts::TrackContainer<Acts::VectorTrackContainer,
88 Acts::VectorMultiTrajectory>;
89
90namespace tracking {
91namespace reco {
92
93class CKFProcessor final : public TrackingGeometryUser {
94 public:
101 CKFProcessor(const std::string &name, framework::Process &process);
102
105
109 void onProcessStart() override;
110
117 void onNewRun(const ldmx::RunHeader &rh) override;
118
122 void onProcessEnd() override;
123
129 void configure(framework::config::Parameters &parameters) override;
130
136 void produce(framework::Event &event) override;
137
138 private:
139 // Make geoid -> source link map Measurements
140 auto makeGeoIdSourceLinkMap(const geo::TrackersTrackingGeometry &tg,
141 const std::vector<ldmx::Measurement> &ldmxsps)
142 -> std::unordered_multimap<Acts::GeometryIdentifier,
144
145 // If we want to dump the tracking geometry
146 bool dumpobj_{false};
147
148 int pionstates_{10};
149
150 int nevents_{0};
151
152 // Processing time counter
153 double processing_time_{0.};
154
155 // time profiling
156 std::map<std::string, double> profiling_map_;
157
158 bool debug_acts_{false};
159
160 std::shared_ptr<Acts::PlaneSurface> target_surface;
161 Acts::RotationMatrix3 surf_rotation;
162 // Constant BField
163 double bfield_{0};
164 // Use constant bfield
165 bool const_b_field_{true};
166
167 // Remove stereo measurements
168 bool remove_stereo_{false};
169
170 // Use 2d measurements instead of 1D
171 bool use1Dmeasurements_{true};
172
173 // Minimum number of hits on tracks
174 int min_hits_{7};
175
176 // Stepping size (in mm)
177 double propagator_step_size_{200.};
178 int propagator_maxSteps_{1000};
179
180 // The extrapolation surface
181 bool use_extrapolate_location_{true};
182 std::vector<double> extrapolate_location_{0., 0., 0.};
183 bool use_seed_perigee_{false};
184
185 // The measurement collection to use for track reconstruction
186 std::string measurement_collection_{"TaggerMeasurements"};
187
188 // Outlier removal pvalue
189 // The Chi2Cut is applied at filtering stage.
190 // 1DOF pvalues: 0.1 = 2.706 0.05 = 3.841 0.025 = 5.024 0.01 = 6.635 0.005
191 // = 7.879 The probability to reject a good measurement is pvalue The
192 // probability to reject an outlier is given in NIM A262 (1987) 444-450
193 double outlier_pval_{3.84};
194
195 // The output track collection
196 std::string out_trk_collection_{"Tracks"};
197
198 // The seed track collection
199 std::string seed_coll_name_{"seedTracks"};
200
201 // The interpolated bfield
202 std::string field_map_{""};
203
204 // The Propagator
205 std::unique_ptr<const CkfPropagator> propagator_;
206
207 // The CKF
208 std::unique_ptr<
209 const Acts::CombinatorialKalmanFilter<CkfPropagator, TrackContainer>>
210 ckf_;
211
212 // Track Extrapolator Tool
213 std::shared_ptr<tracking::reco::TrackExtrapolatorTool<CkfPropagator>>
214 trk_extrap_;
215
217 int nseeds_{0};
218 int ntracks_{0};
219 int eventnr_{0};
220
221 // BField Systematics
222 std::vector<double> map_offset_{
223 0.,
224 0.,
225 0.,
226 };
227
228 // Keep track on which system this processor is running on
229 bool taggerTracking_{true};
230
231}; // CKFProcessor
232
233} // namespace reco
234} // 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
void produce(framework::Event &event) override
Run the processor.
void configure(framework::config::Parameters &parameters) override
Configure the processor using the given user specified parameters.
void onNewRun(const ldmx::RunHeader &rh) override
onNewRun is the first function called for each processor after the conditions are fully configured an...
int nseeds_
n seeds and n tracks
void onProcessStart() override
Callback for the EventProcessor to take any necessary action when the processing of events starts,...
void onProcessEnd() override
Callback for the EventProcessor to take any necessary action when the processing of events finishes,...
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...