LDMX Software
tracking::reco::GSFProcessor Class Referencefinal

Public Member Functions

 GSFProcessor (const std::string &name, framework::Process &process)
 Constructor.
 
virtual ~GSFProcessor ()=default
 Destructor.
 
void onProcessStart () override
 Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms.
 
void onNewRun (const ldmx::RunHeader &rh) override
 onNewRun is the first function called for each processor after the conditions are fully configured and accessible.
 
void onProcessEnd () override
 Callback for the EventProcessor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities.
 
void configure (framework::config::Parameters &parameters) override
 Configure the processor using the given user specified parameters.
 
void produce (framework::Event &event) override
 Run the processor.
 
- Public Member Functions inherited from tracking::reco::TrackingGeometryUser
 TrackingGeometryUser (const std::string &name, framework::Process &p)
 
- Public Member Functions inherited from framework::Producer
 Producer (const std::string &name, Process &process)
 Class constructor.
 
virtual void process (Event &event) final
 Processing an event for a Producer is calling produce.
 
- Public Member Functions inherited from framework::EventProcessor
 DECLARE_FACTORY (EventProcessor, EventProcessor *, const std::string &, Process &)
 declare that we have a factory for this class
 
 EventProcessor (const std::string &name, Process &process)
 Class constructor.
 
virtual ~EventProcessor ()=default
 Class destructor.
 
virtual void beforeNewRun (ldmx::RunHeader &run_header)
 Callback for Producers to add parameters to the run header before conditions are initialized.
 
virtual void onFileOpen (EventFile &event_file)
 Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened.
 
virtual void onFileClose (EventFile &event_file)
 Callback for the EventProcessor to take any necessary action when a event input ROOT file is closed.
 
template<class T >
const T & getCondition (const std::string &condition_name)
 Access a conditions object for the current event.
 
TDirectory * getHistoDirectory ()
 Access/create a directory in the histogram file for this event processor to create histograms and analysis tuples.
 
void setStorageHint (framework::StorageControl::Hint hint)
 Mark the current event as having the given storage control hint from this module_.
 
void setStorageHint (framework::StorageControl::Hint hint, const std::string &purposeString)
 Mark the current event as having the given storage control hint from this module and the given purpose string.
 
int getLogFrequency () const
 Get the current logging frequency from the process.
 
int getRunNumber () const
 Get the run number from the process.
 
std::string getName () const
 Get the processor name.
 
void createHistograms (const std::vector< framework::config::Parameters > &histos)
 Internal function which is used to create histograms passed from the python configuration @parma histos vector of Parameters that configure histograms to create.
 

Private Attributes

std::map< std::string, double > profiling_map_
 Time profiling data for performance analysis.
 
bool debug_ {false}
 Enable verbose debug output logging.
 
std::default_random_engine generator_
 Random number generator for smearing operations.
 
std::shared_ptr< std::normal_distribution< float > > normal_
 Normal distribution for smearing measurements.
 
std::vector< double > extrapolate_location_ {0., 0., 0.}
 Location to extrapolate tracks to (x, y, z in mm)
 
std::string measurement_collection_ {"TaggerMeasurements"}
 Collection name for input measurements.
 
std::string out_trk_collection_ {"GSFTracks"}
 Collection name for output GSF-refitted tracks.
 
std::string seed_coll_name_ {"seedTracks"}
 Collection name for seed tracks (currently unused)
 
std::unique_ptr< const Acts::GaussianSumFitter< GsfPropagator, BetheHeitlerApprox, Acts::VectorMultiTrajectory > > gsf_
 Gaussian Sum Fitter instance for track refitting.
 
std::string track_collection_ {"TaggerTracks"}
 Collection name for input tracks to be refit.
 
std::string meas_collection_ {"DigiTaggerSimHits"}
 Collection name for measurements associated with tracks.
 
std::string track_passname_
 Pass name for track collection in event.
 
std::string meas_passname_
 Pass name for measurement collection in event.
 
std::string track_collection_event_passname_
 Pass name qualifier for track collection event key.
 
std::string meas_collection_event_passname_
 Pass name qualifier for measurement collection event key.
 
size_t max_components_ {4}
 Maximum number of mixture components in GSF fit.
 
bool abort_on_error_ {false}
 Abort fit if any error occurs (strict error handling)
 
bool disable_all_material_handling_ {false}
 Disable all material interactions during propagation.
 
double weight_cutoff_ {1.0e-4}
 Weight threshold below which mixture components are dropped.
 
double propagator_step_size_ {200.}
 Step size for track propagation in mm.
 
int propagator_max_steps_ {1000}
 Maximum number of propagation steps before aborting.
 
std::string field_map_ {""}
 Path to magnetic field map file.
 
bool use_perigee_ {false}
 Use perigee parameterization for tracks.
 
bool tagger_tracking_ {true}
 
std::unique_ptr< const Propagator > propagator_
 Propagator for track extrapolation using eigen stepper.
 
std::unordered_map< unsigned int, const Acts::Surface * > layer_surface_map_
 Layer ID to ACTS Surface mapping for hit surface lookup.
 
std::shared_ptr< tracking::reco::TrackExtrapolatorTool< Propagator > > trk_extrap_
 
std::shared_ptr< Acts::Surface > beam_origin_surface_
 Beam origin surface at z=-700 mm (tagger track initialization)
 
std::shared_ptr< Acts::Surface > target_surface_
 Target surface at z=0 mm (recoil track initialization, perigee output)
 
std::shared_ptr< Acts::Surface > ecal_surface_
 ECAL surface at z=240.5 mm (ECAL scoring plane for recoil tracking)
 

Additional Inherited Members

- Protected Member Functions inherited from tracking::reco::TrackingGeometryUser
const Acts::GeometryContext & geometryContext ()
 
const Acts::MagneticFieldContext & magneticFieldContext ()
 
const Acts::CalibrationContext & calibrationContext ()
 
const geo::TrackersTrackingGeometrygeometry ()
 
void loadBField (const std::string &path, const std::vector< double > &map_offset={0., 0., 0.})
 Load the interpolated B-field map from path and cache it.
 
void loadBField (const std::vector< double > &map_offset={0., 0., 0.})
 Load B-field from the path recorded in the detector GDML.
 
std::shared_ptr< Acts::MagneticFieldProvider > bField () const
 Return the loaded B-field provider.
 
- Protected Member Functions inherited from framework::EventProcessor
void abortEvent ()
 Abort the event immediately.
 
- Protected Attributes inherited from framework::EventProcessor
HistogramPool histograms_
 helper object for making and filling histograms
 
NtupleManagerntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger the_log_
 The logger for this EventProcessor.
 

Detailed Description

Definition at line 102 of file GSFProcessor.h.

Constructor & Destructor Documentation

◆ GSFProcessor()

tracking::reco::GSFProcessor::GSFProcessor ( const std::string & name,
framework::Process & process )

Constructor.

Parameters
nameThe name of the instance of this object.
processThe process running this producer.

Definition at line 11 of file GSFProcessor.cxx.

12 : TrackingGeometryUser(name, process) {}
virtual void process(Event &event) final
Processing an event for a Producer is calling produce.

Member Function Documentation

◆ configure()

void tracking::reco::GSFProcessor::configure ( framework::config::Parameters & parameters)
overridevirtual

Configure the processor using the given user specified parameters.

Parameters
parametersSet of parameters used to configure this processor.

Reimplemented from framework::EventProcessor.

Definition at line 74 of file GSFProcessor.cxx.

74 {
76 parameters.get<std::string>("out_trk_collection", "GSFTracks");
77
79 parameters.get<std::string>("track_collection", "TaggerTracks");
81 parameters.get<std::string>("meas_collection", "DigiTaggerSimHits");
82
83 track_passname_ = parameters.get<std::string>("track_passname");
84 meas_passname_ = parameters.get<std::string>("meas_passname");
86 parameters.get<std::string>("track_collection_event_passname");
88 parameters.get<std::string>("meas_collection_event_passname");
89
90 max_components_ = parameters.get<int>("max_components", 4);
91 abort_on_error_ = parameters.get<bool>("abort_on_error", false);
93 parameters.get<bool>("disable_all_material_handling", false);
94 weight_cutoff_ = parameters.get<double>("weight_cutoff_", 1.0e-4);
95
96 propagator_max_steps_ = parameters.get<int>("propagator_max_steps", 10000);
97 propagator_step_size_ = parameters.get<double>("propagator_step_size", 200.);
98 field_map_ = parameters.get<std::string>("field_map");
99 use_perigee_ = parameters.get<bool>("usePerigee", false);
100
101 debug_ = parameters.get<bool>("debug", false);
102 tagger_tracking_ = parameters.get<bool>("tagger_tracking", true);
103
104 // final_reduction_method_ =
105 // parameters.get<double>("finalReductionMethod",);
106} // end of configure()
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:78
bool disable_all_material_handling_
Disable all material interactions during propagation.
bool debug_
Enable verbose debug output logging.
std::string track_collection_
Collection name for input tracks to be refit.
size_t max_components_
Maximum number of mixture components in GSF fit.
std::string meas_collection_
Collection name for measurements associated with tracks.
bool abort_on_error_
Abort fit if any error occurs (strict error handling)
std::string meas_passname_
Pass name for measurement collection in event.
double weight_cutoff_
Weight threshold below which mixture components are dropped.
std::string field_map_
Path to magnetic field map file.
int propagator_max_steps_
Maximum number of propagation steps before aborting.
bool use_perigee_
Use perigee parameterization for tracks.
std::string track_collection_event_passname_
Pass name qualifier for track collection event key.
double propagator_step_size_
Step size for track propagation in mm.
std::string track_passname_
Pass name for track collection in event.
std::string meas_collection_event_passname_
Pass name qualifier for measurement collection event key.
std::string out_trk_collection_
Collection name for output GSF-refitted tracks.

References abort_on_error_, debug_, disable_all_material_handling_, field_map_, framework::config::Parameters::get(), max_components_, meas_collection_, meas_collection_event_passname_, meas_passname_, out_trk_collection_, propagator_max_steps_, propagator_step_size_, track_collection_, track_collection_event_passname_, track_passname_, use_perigee_, and weight_cutoff_.

◆ onNewRun()

void tracking::reco::GSFProcessor::onNewRun ( const ldmx::RunHeader & rh)
overridevirtual

onNewRun is the first function called for each processor after the conditions are fully configured and accessible.

This is where you could create single-processors, multi-event calculation objects.

Reimplemented from framework::EventProcessor.

Definition at line 14 of file GSFProcessor.cxx.

14 {
15 beam_origin_surface_ = tracking::sim::utils::unboundSurface(-700);
16 target_surface_ = tracking::sim::utils::unboundSurface(0.);
17 ecal_surface_ = tracking::sim::utils::unboundSurface(240.5);
18
19 // Setup a interpolated bfield map
20 if (field_map_.empty())
21 loadBField();
22 else
24 const auto map =
25 std::static_pointer_cast<InterpolatedMagneticField3>(bField());
26
27 auto acts_logging_level = Acts::Logging::FATAL;
28
29 if (debug_) acts_logging_level = Acts::Logging::VERBOSE;
30
31 // Setup the GSF Fitter
32
33 // Stepper
34 // Acts::MixtureReductionMethod finalReductionMethod;
35 // const auto multi_stepper = Acts::MultiEigenStepperLoop{map};
36
37 // Acts::ComponentMergeMethod reductionMethod =
38 // Acts::ComponentMergeMethod::eMaxWeight;
39 // Acts::MultiEigenStepperLoop multi_stepper(
40 // map, reductionMethod,
41 // Acts::getDefaultLogger("GSF_STEP", acts_loggingLevel));
42
43 Acts::MultiEigenStepperLoop multi_stepper(map);
44 // Detailed Stepper
45
46 // Acts::MultiEigenStepperLoop multi_stepper(map, finalReductionMethod);
47
48 // Navigator
49 Acts::Navigator::Config nav_cfg{geometry().getTG()};
50 nav_cfg.resolveMaterial = true;
51 nav_cfg.resolvePassive = false;
52 nav_cfg.resolveSensitive = true;
53 const Acts::Navigator navigator(nav_cfg);
54
55 auto gsf_propagator =
56 GsfPropagator(std::move(multi_stepper), std::move(navigator),
57 Acts::getDefaultLogger("GSF_PROP", acts_logging_level));
58
59 BetheHeitlerApprox bethe_heitler = Acts::makeDefaultBetheHeitlerApprox();
60
61 gsf_ = std::make_unique<std::decay_t<decltype(*gsf_)>>(
62 std::move(gsf_propagator), std::move(bethe_heitler),
63 Acts::getDefaultLogger("GSF", acts_logging_level));
64
65 const auto stepper = Acts::EigenStepper<>{map};
66 propagator_ = std::make_unique<Propagator>(
67 stepper, navigator,
68 Acts::getDefaultLogger("GSF_EXTRAP", acts_logging_level));
69
70 trk_extrap_ = std::make_shared<std::decay_t<decltype(*trk_extrap_)>>(
71 *propagator_, geometryContext(), magneticFieldContext());
72}
std::unique_ptr< const Acts::GaussianSumFitter< GsfPropagator, BetheHeitlerApprox, Acts::VectorMultiTrajectory > > gsf_
Gaussian Sum Fitter instance for track refitting.
std::shared_ptr< Acts::Surface > target_surface_
Target surface at z=0 mm (recoil track initialization, perigee output)
std::unique_ptr< const Propagator > propagator_
Propagator for track extrapolation using eigen stepper.
std::shared_ptr< Acts::Surface > beam_origin_surface_
Beam origin surface at z=-700 mm (tagger track initialization)
std::shared_ptr< Acts::Surface > ecal_surface_
ECAL surface at z=240.5 mm (ECAL scoring plane for recoil tracking)
std::shared_ptr< Acts::MagneticFieldProvider > bField() const
Return the loaded B-field provider.
void loadBField(const std::string &path, const std::vector< double > &map_offset={0., 0., 0.})
Load the interpolated B-field map from path and cache it.

References beam_origin_surface_, tracking::reco::TrackingGeometryUser::bField(), debug_, ecal_surface_, field_map_, gsf_, tracking::reco::TrackingGeometryUser::loadBField(), propagator_, and target_surface_.

◆ onProcessEnd()

void tracking::reco::GSFProcessor::onProcessEnd ( )
overridevirtual

Callback for the EventProcessor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities.

Reimplemented from framework::EventProcessor.

Definition at line 413 of file GSFProcessor.cxx.

413{};

◆ onProcessStart()

void tracking::reco::GSFProcessor::onProcessStart ( )
overridevirtual

Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms.

Reimplemented from framework::EventProcessor.

Definition at line 412 of file GSFProcessor.cxx.

412{};

◆ produce()

void tracking::reco::GSFProcessor::produce ( framework::Event & event)
overridevirtual

Run the processor.

Parameters
eventThe event to process.

Implements framework::Producer.

Definition at line 108 of file GSFProcessor.cxx.

108 {
109 // General Setup
110
111 auto tg{geometry()};
112
113 // Retrieve the tracks
115 return;
116 const auto& tracks =
117 event.getCollection<ldmx::Track>(track_collection_, track_passname_);
118
119 // Retrieve the measurements
121 const auto& measurements =
123
124 tracking::sim::LdmxMeasurementCalibrator calibrator{measurements};
125
126 // GSF Setup
127 Acts::GainMatrixUpdater updater;
128 Acts::GsfExtensions<Acts::VectorMultiTrajectory> gsf_extensions;
129 gsf_extensions.updater.connect<
130 &Acts::GainMatrixUpdater::operator()<Acts::VectorMultiTrajectory>>(
131 &updater);
132 gsf_extensions.calibrator
134 Acts::VectorMultiTrajectory>>(&calibrator);
135
136 // Surface Accessor
137 struct SurfaceAccessor {
138 const Acts::TrackingGeometry* tracking_geometry_;
139
140 const Acts::Surface* operator()(const Acts::SourceLink& sourceLink) const {
141 const auto& index_source_link =
142 sourceLink.get<acts_examples::IndexSourceLink>();
143 return tracking_geometry_->findSurface(index_source_link.geometryId());
144 }
145 };
146
147 SurfaceAccessor m_sl_surface_accessor{tg.getTG().get()};
148 // m_slSurfaceAccessor.trackingGeometry = tg.getTG();
149 gsf_extensions.surfaceAccessor.connect<&SurfaceAccessor::operator()>(
150 &m_sl_surface_accessor);
151 gsf_extensions.mixtureReducer.connect<&Acts::reduceMixtureLargestWeights>();
152
153 // Propagator Options
154
155 // Move this at the start of the producer
156 Acts::PropagatorOptions<Acts::StepperPlainOptions,
157 Acts::NavigatorPlainOptions, ActionList, AbortList>
158 propagator_options(geometryContext(), magneticFieldContext());
159
160 propagator_options.pathLimit = std::numeric_limits<double>::max();
161
162 // Activate loop protection at some pt value
163 propagator_options.loopProtection = false;
164 //(startParameters.transverseMomentum() < cfg.ptLoopers);
165
166 // Switch the material interaction on/off & eventually into logging mode
167 auto& m_interactor =
168 propagator_options.actionList.get<Acts::MaterialInteractor>();
169 m_interactor.multipleScattering = true;
170 m_interactor.energyLoss = true;
171 m_interactor.recordInteractions = false;
172
173 // The logger can be switched to sterile, e.g. for timing logging
174 auto& s_logger =
175 propagator_options.actionList.get<Acts::detail::SteppingLogger>();
176 s_logger.sterile = true;
177 // Set a maximum step size
178 propagator_options.stepping.maxStepSize =
179 propagator_step_size_ * Acts::UnitConstants::mm;
180 propagator_options.maxSteps = propagator_max_steps_;
181
182 // Electron hypothesis
183 // propagator_options.mass = 0.511 * Acts::UnitConstants::MeV;
184
185 // GSF options will be configured per-track
186 std::shared_ptr<const Acts::Surface> gsf_ref_surface;
187 Acts::GsfOptions<Acts::VectorMultiTrajectory> gsf_options{
188 geometryContext(), magneticFieldContext(), calibrationContext()};
189 gsf_options.extensions = gsf_extensions;
190 gsf_options.propagatorPlainOptions = propagator_options;
191 gsf_options.maxComponents = max_components_;
192 gsf_options.weightCutoff = weight_cutoff_;
193 gsf_options.abortOnError = abort_on_error_;
194 gsf_options.disableAllMaterialHandling = disable_all_material_handling_;
195
196 // Output track container
197 std::vector<ldmx::Track> out_tracks;
198
199 Acts::VectorTrackContainer vtc;
200 Acts::VectorMultiTrajectory mtj;
201 Acts::TrackContainer tc{vtc, mtj};
202
203 // Loop on tracks
204 unsigned int itrk = 0;
205 ldmx_log(debug) << "Starting GSF processing of " << tracks.size()
206 << " tracks";
207
208 for (auto& track : tracks) {
209 ldmx_log(debug) << "Processing track " << itrk << " with "
210 << track.getMeasurementsIdxs().size() << " measurements";
211 // Retrieve measurements on track
212 std::vector<ldmx::Measurement> meas_on_track;
213
214 // std::vector<ActsExamples::IndexSourceLink> fit_trackSourceLinks;
215 std::vector<Acts::SourceLink> fit_track_source_links;
216
217 for (auto imeas : track.getMeasurementsIdxs()) {
218 auto meas = measurements.at(imeas);
219 meas_on_track.push_back(meas);
220
221 // Retrieve the surface
222
223 const Acts::Surface* hit_surface =
224 tg.geo::TrackingGeometry::getSurface(meas.getLayerID());
225
226 // Store the index_ source link
227 acts_examples::IndexSourceLink idx_sl(hit_surface->geometryId(), imeas);
228 fit_track_source_links.push_back(Acts::SourceLink(idx_sl));
229 }
230
231 // Reverse the order of the vectors
232 std::reverse(meas_on_track.begin(), meas_on_track.end());
233 std::reverse(fit_track_source_links.begin(), fit_track_source_links.end());
234
235 for (auto m : meas_on_track) {
236 ldmx_log(trace) << " Measurement:\n" << m << "\n";
237 }
238
239 ldmx_log(debug) << " Track bound track parameters preparation:";
240
241 // Reconstruct BoundTrackParameters at perigee (target) from stored params.
242 // perigee_ is stored in LDMX frame; rotate to ACTS frame for surface
243 // creation.
244 Acts::Vector3 perigee_acts = tracking::sim::utils::ldmx2Acts(Acts::Vector3(
245 track.getPerigeeX(), track.getPerigeeY(), track.getPerigeeZ()));
246 std::shared_ptr<Acts::PerigeeSurface> perigee =
247 Acts::Surface::makeShared<Acts::PerigeeSurface>(perigee_acts);
248
249 Acts::BoundTrackParameters trk_btp =
250 tracking::sim::utils::boundTrackParameters(track, perigee);
251
252 // GSF starting parameters: for tagger, extrapolate back to beam origin;
253 // for recoil, use target parameters directly.
254 Acts::BoundTrackParameters trk_btp_fit_start = trk_btp;
255
256 if (tagger_tracking_) {
257 auto opt_beam_origin =
258 trk_extrap_->extrapolate(trk_btp, beam_origin_surface_);
259 if (!opt_beam_origin) {
260 ldmx_log(warn) << "Failed extrapolating to beam origin for GSF start. "
261 "Skipping..";
262 continue;
263 }
264 trk_btp_fit_start = *opt_beam_origin;
265 }
266
267 ldmx_log(debug) << " Perigee surface (acts): (" << track.getPerigeeX()
268 << ", " << track.getPerigeeY() << ", "
269 << track.getPerigeeZ() << ")";
270
271 const Acts::BoundVector& trkpars = trk_btp.parameters();
272 ldmx_log(debug) << " Perigee parameters (d0, z0, phi, theta, q/p)= ("
273 << trkpars[Acts::eBoundLoc0] << ", "
274 << trkpars[Acts::eBoundLoc1] << ", "
275 << trkpars[Acts::eBoundPhi] << ", "
276 << trkpars[Acts::eBoundTheta] << ", "
277 << trkpars[Acts::eBoundQOverP] << ")";
278
279 const Acts::BoundVector& fit_start_pars = trk_btp_fit_start.parameters();
280 ldmx_log(debug) << " GSF start parameters (d0, z0, phi, theta, q/p)= ("
281 << fit_start_pars[Acts::eBoundLoc0] << ", "
282 << fit_start_pars[Acts::eBoundLoc1] << ", "
283 << fit_start_pars[Acts::eBoundPhi] << ", "
284 << fit_start_pars[Acts::eBoundTheta] << ", "
285 << fit_start_pars[Acts::eBoundQOverP] << ")";
286
287 ldmx_log(debug) << " About to run GSF fit with "
288 << fit_track_source_links.size() << " source links";
289
290 // Update GSF reference surface for this track
291 if (tagger_tracking_) {
292 gsf_ref_surface = beam_origin_surface_;
293 } else {
294 gsf_ref_surface = target_surface_;
295 }
296 gsf_options.referenceSurface = &(*gsf_ref_surface);
297
298 auto gsf_refit_result =
299 gsf_->fit(fit_track_source_links.begin(), fit_track_source_links.end(),
300 trk_btp_fit_start, gsf_options, tc);
301
302 if (!gsf_refit_result.ok()) {
303 ldmx_log(warn) << "GSF re-fit failed: "
304 << gsf_refit_result.error().message();
305 continue;
306 }
307
308 ldmx_log(debug) << " GSF fit succeeded, tc.size() = " << tc.size();
309
310 if (tc.size() < 1) continue;
311
312 auto gsftrk = tc.getTrack(0);
313 // calculateTrackQuantities(gsftrk);
314
315 const Acts::BoundVector& perigee_pars = gsftrk.parameters();
316 const Acts::BoundMatrix& trk_cov = gsftrk.covariance();
317 const Acts::Surface& perigee_surface = gsftrk.referenceSurface();
318
319 ldmx_log(debug)
320 << " Reference Surface (acts-x, acts-y, acts-z) = ("
321 << perigee_surface.transform(geometryContext()).translation()(0) << ", "
322 << perigee_surface.transform(geometryContext()).translation()(1) << ", "
323 << perigee_surface.transform(geometryContext()).translation()(2) << ")";
324
325 ldmx_log(debug) << " Found track has " << gsftrk.nTrackStates()
326 << " track states";
327
328 ldmx_log(debug) << " Track parameters (d0, z0, phi, theta, q/p)= ("
329 << perigee_pars[Acts::eBoundLoc0] << ", "
330 << perigee_pars[Acts::eBoundLoc1] << ", "
331 << perigee_pars[Acts::eBoundPhi] << ", "
332 << perigee_pars[Acts::eBoundTheta] << ", "
333 << perigee_pars[Acts::eBoundQOverP] << ") ";
334
335 ldmx::Track trk;
336
337 // Extrapolate GSF track to target surface to get perigee parameters
338 auto opt_target = trk_extrap_->extrapolate(gsftrk, target_surface_);
339
340 if (opt_target) {
341 ldmx_log(debug) << " GSF target extrapolation succeeded";
342 auto ts_at_target = tracking::sim::utils::makeTrackState(
343 geometryContext(), *opt_target, ldmx::AtTarget);
344 trk.addTrackState(ts_at_target);
345
346 trk.setPerigeeParameters(tracking::sim::utils::convertActsToLdmxPars(
347 opt_target->parameters()));
348 if (opt_target->covariance()) {
349 std::vector<double> cov_vec;
350 tracking::sim::utils::flatCov(*(opt_target->covariance()), cov_vec);
351 trk.setPerigeeCov(cov_vec);
352 }
353 Acts::Vector3 target_loc_ldmx = tracking::sim::utils::acts2Ldmx(
354 target_surface_->transform(geometryContext()).translation());
355 trk.setPerigeeLocation(target_loc_ldmx[0], target_loc_ldmx[1],
356 target_loc_ldmx[2]);
357
358 ldmx_log(debug)
359 << " GSF target parameters (d0, z0, phi, theta, q/p)= ("
360 << opt_target->parameters()[Acts::eBoundLoc0] << ", "
361 << opt_target->parameters()[Acts::eBoundLoc1] << ", "
362 << opt_target->parameters()[Acts::eBoundPhi] << ", "
363 << opt_target->parameters()[Acts::eBoundTheta] << ", "
364 << opt_target->parameters()[Acts::eBoundQOverP] << ")";
365 } else {
366 ldmx_log(debug) << " GSF target extrapolation failed, using GSF fit "
367 "parameters at reference surface";
368 trk.setPerigeeParameters(
369 tracking::sim::utils::convertActsToLdmxPars(perigee_pars));
370 std::vector<double> v_trk_cov;
371 tracking::sim::utils::flatCov(trk_cov, v_trk_cov);
372 trk.setPerigeeCov(v_trk_cov);
373 }
374
375 // Tagger: also add beam-origin state; Recoil: add ECAL state
376 if (tagger_tracking_) {
377 auto opt_beam_origin =
378 trk_extrap_->extrapolate(gsftrk, beam_origin_surface_);
379 if (opt_beam_origin)
380 trk.addTrackState(tracking::sim::utils::makeTrackState(
381 geometryContext(), *opt_beam_origin, ldmx::AtBeamOrigin));
382 } else {
383 ldmx_log(debug) << " ECAL extrapolation";
384 auto opt_ecal = trk_extrap_->extrapolate(gsftrk, ecal_surface_);
385 if (opt_ecal)
386 trk.addTrackState(tracking::sim::utils::makeTrackState(
387 geometryContext(), *opt_ecal, ldmx::AtECAL));
388 }
389
390 trk.setChi2(gsftrk.chi2());
391 trk.setNhits(gsftrk.nMeasurements());
392 trk.setNdf(gsftrk.nMeasurements() - 5);
393 trk.setCharge(perigee_pars[Acts::eBoundQOverP] > 0 ? 1 : -1);
394
395 // Truth information carried over from input track
396 trk.setTrackID(track.getTrackID());
397 trk.setPdgID(track.getPdgID());
398 trk.setTruthProb(track.getTruthProb());
399
400 itrk++;
401
402 ldmx_log(debug) << " Added track to output, total tracks = "
403 << (out_tracks.size() + 1);
404
405 out_tracks.push_back(trk);
406
407 } // loop on tracks
408
409 event.add(out_trk_collection_, out_tracks);
410} // end of produce()
bool exists(const std::string &name, const std::string &passName, bool unique=true) const
Check for the existence of an object or collection with the given name and pass name in the event.
Definition Event.cxx:105
Implementation of a track object.
Definition Track.h:53
void calibrate1d(const Acts::GeometryContext &, const Acts::CalibrationContext &, const Acts::SourceLink &genericSourceLink, typename traj_t::TrackStateProxy trackState) const
Find the measurement corresponding to the source link.

References abort_on_error_, beam_origin_surface_, tracking::sim::LdmxMeasurementCalibrator::calibrate1d(), disable_all_material_handling_, ecal_surface_, framework::Event::exists(), gsf_, max_components_, meas_collection_, meas_collection_event_passname_, meas_passname_, out_trk_collection_, propagator_max_steps_, propagator_step_size_, target_surface_, track_collection_, track_collection_event_passname_, track_passname_, and weight_cutoff_.

Member Data Documentation

◆ abort_on_error_

bool tracking::reco::GSFProcessor::abort_on_error_ {false}
private

Abort fit if any error occurs (strict error handling)

Definition at line 247 of file GSFProcessor.h.

247{false};

Referenced by configure(), and produce().

◆ beam_origin_surface_

std::shared_ptr<Acts::Surface> tracking::reco::GSFProcessor::beam_origin_surface_
private

Beam origin surface at z=-700 mm (tagger track initialization)

Definition at line 281 of file GSFProcessor.h.

Referenced by onNewRun(), and produce().

◆ debug_

bool tracking::reco::GSFProcessor::debug_ {false}
private

Enable verbose debug output logging.

Definition at line 175 of file GSFProcessor.h.

175{false};

Referenced by configure(), and onNewRun().

◆ disable_all_material_handling_

bool tracking::reco::GSFProcessor::disable_all_material_handling_ {false}
private

Disable all material interactions during propagation.

Definition at line 250 of file GSFProcessor.h.

250{false};

Referenced by configure(), and produce().

◆ ecal_surface_

std::shared_ptr<Acts::Surface> tracking::reco::GSFProcessor::ecal_surface_
private

ECAL surface at z=240.5 mm (ECAL scoring plane for recoil tracking)

Definition at line 287 of file GSFProcessor.h.

Referenced by onNewRun(), and produce().

◆ extrapolate_location_

std::vector<double> tracking::reco::GSFProcessor::extrapolate_location_ {0., 0., 0.}
private

Location to extrapolate tracks to (x, y, z in mm)

Definition at line 198 of file GSFProcessor.h.

198{0., 0., 0.};

◆ field_map_

std::string tracking::reco::GSFProcessor::field_map_ {""}
private

Path to magnetic field map file.

Definition at line 262 of file GSFProcessor.h.

262{""};

Referenced by configure(), and onNewRun().

◆ generator_

std::default_random_engine tracking::reco::GSFProcessor::generator_
private

Random number generator for smearing operations.

Definition at line 178 of file GSFProcessor.h.

◆ gsf_

std::unique_ptr<const Acts::GaussianSumFitter< GsfPropagator, BetheHeitlerApprox, Acts::VectorMultiTrajectory> > tracking::reco::GSFProcessor::gsf_
private

Gaussian Sum Fitter instance for track refitting.

Definition at line 223 of file GSFProcessor.h.

Referenced by onNewRun(), and produce().

◆ layer_surface_map_

std::unordered_map<unsigned int, const Acts::Surface *> tracking::reco::GSFProcessor::layer_surface_map_
private

Layer ID to ACTS Surface mapping for hit surface lookup.

Definition at line 274 of file GSFProcessor.h.

◆ max_components_

size_t tracking::reco::GSFProcessor::max_components_ {4}
private

Maximum number of mixture components in GSF fit.

Definition at line 244 of file GSFProcessor.h.

244{4};

Referenced by configure(), and produce().

◆ meas_collection_

std::string tracking::reco::GSFProcessor::meas_collection_ {"DigiTaggerSimHits"}
private

Collection name for measurements associated with tracks.

Definition at line 229 of file GSFProcessor.h.

229{"DigiTaggerSimHits"};

Referenced by configure(), and produce().

◆ meas_collection_event_passname_

std::string tracking::reco::GSFProcessor::meas_collection_event_passname_
private

Pass name qualifier for measurement collection event key.

Definition at line 241 of file GSFProcessor.h.

Referenced by configure(), and produce().

◆ meas_passname_

std::string tracking::reco::GSFProcessor::meas_passname_
private

Pass name for measurement collection in event.

Definition at line 235 of file GSFProcessor.h.

Referenced by configure(), and produce().

◆ measurement_collection_

std::string tracking::reco::GSFProcessor::measurement_collection_ {"TaggerMeasurements"}
private

Collection name for input measurements.

Definition at line 202 of file GSFProcessor.h.

202{"TaggerMeasurements"};

◆ normal_

std::shared_ptr<std::normal_distribution<float> > tracking::reco::GSFProcessor::normal_
private

Normal distribution for smearing measurements.

Definition at line 181 of file GSFProcessor.h.

◆ out_trk_collection_

std::string tracking::reco::GSFProcessor::out_trk_collection_ {"GSFTracks"}
private

Collection name for output GSF-refitted tracks.

Definition at line 207 of file GSFProcessor.h.

207{"GSFTracks"};

Referenced by configure(), and produce().

◆ profiling_map_

std::map<std::string, double> tracking::reco::GSFProcessor::profiling_map_
private

Time profiling data for performance analysis.

Definition at line 168 of file GSFProcessor.h.

◆ propagator_

std::unique_ptr<const Propagator> tracking::reco::GSFProcessor::propagator_
private

Propagator for track extrapolation using eigen stepper.

Definition at line 271 of file GSFProcessor.h.

Referenced by onNewRun().

◆ propagator_max_steps_

int tracking::reco::GSFProcessor::propagator_max_steps_ {1000}
private

Maximum number of propagation steps before aborting.

Definition at line 259 of file GSFProcessor.h.

259{1000};

Referenced by configure(), and produce().

◆ propagator_step_size_

double tracking::reco::GSFProcessor::propagator_step_size_ {200.}
private

Step size for track propagation in mm.

Definition at line 256 of file GSFProcessor.h.

256{200.};

Referenced by configure(), and produce().

◆ seed_coll_name_

std::string tracking::reco::GSFProcessor::seed_coll_name_ {"seedTracks"}
private

Collection name for seed tracks (currently unused)

Definition at line 218 of file GSFProcessor.h.

218{"seedTracks"};

◆ tagger_tracking_

bool tracking::reco::GSFProcessor::tagger_tracking_ {true}
private

Definition at line 268 of file GSFProcessor.h.

268{true};

◆ target_surface_

std::shared_ptr<Acts::Surface> tracking::reco::GSFProcessor::target_surface_
private

Target surface at z=0 mm (recoil track initialization, perigee output)

Definition at line 284 of file GSFProcessor.h.

Referenced by onNewRun(), and produce().

◆ track_collection_

std::string tracking::reco::GSFProcessor::track_collection_ {"TaggerTracks"}
private

Collection name for input tracks to be refit.

Definition at line 226 of file GSFProcessor.h.

226{"TaggerTracks"};

Referenced by configure(), and produce().

◆ track_collection_event_passname_

std::string tracking::reco::GSFProcessor::track_collection_event_passname_
private

Pass name qualifier for track collection event key.

Definition at line 238 of file GSFProcessor.h.

Referenced by configure(), and produce().

◆ track_passname_

std::string tracking::reco::GSFProcessor::track_passname_
private

Pass name for track collection in event.

Definition at line 232 of file GSFProcessor.h.

Referenced by configure(), and produce().

◆ trk_extrap_

std::shared_ptr<tracking::reco::TrackExtrapolatorTool<Propagator> > tracking::reco::GSFProcessor::trk_extrap_
private

Definition at line 278 of file GSFProcessor.h.

◆ use_perigee_

bool tracking::reco::GSFProcessor::use_perigee_ {false}
private

Use perigee parameterization for tracks.

Definition at line 265 of file GSFProcessor.h.

265{false};

Referenced by configure().

◆ weight_cutoff_

double tracking::reco::GSFProcessor::weight_cutoff_ {1.0e-4}
private

Weight threshold below which mixture components are dropped.

Definition at line 253 of file GSFProcessor.h.

253{1.0e-4};

Referenced by configure(), and produce().


The documentation for this class was generated from the following files: