ATLAS Offline Software
TrackFindingAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 #include "src/TrackFindingAlg.h"
5 #include "Acts/Propagator/PropagatorOptions.hpp"
7 
8 // Athena
9 #include "AsgTools/ToolStore.h"
20 
21 // ACTS
22 #include "Acts/Definitions/Units.hpp"
23 #include "Acts/Geometry/TrackingGeometry.hpp"
24 #include "Acts/Geometry/GeometryIdentifier.hpp"
25 #include "Acts/MagneticField/MagneticFieldProvider.hpp"
26 #include "Acts/Surfaces/Surface.hpp"
27 #include "Acts/TrackFinding/MeasurementSelector.hpp"
28 #include "Acts/TrackFinding/CombinatorialKalmanFilter.hpp"
29 #include "Acts/Surfaces/PerigeeSurface.hpp"
30 #include "Acts/Utilities/TrackHelpers.hpp"
31 #include "Acts/TrackFitting/MbfSmoother.hpp"
32 
33 // ActsTrk
37 #include "ActsInterop/Logger.h"
38 #include "ActsInterop/TableUtils.h"
41 
42 // STL
43 #include <sstream>
44 #include <functional>
45 #include <tuple>
46 #include <utility>
47 #include <algorithm>
48 
49 namespace ActsTrk
50 {
52  {
53  };
54 
57 
59  ISvcLocator *pSvcLocator)
60  : AthReentrantAlgorithm(name, pSvcLocator)
61  {
62  }
63 
65 
66  // === initialize ==========================================================
67 
69  {
70  ATH_MSG_INFO("Initializing " << name() << " ... ");
71  ATH_MSG_DEBUG("Properties Summary:");
75  ATH_MSG_DEBUG(" " << m_etaBins);
83  ATH_MSG_DEBUG(" " << m_doTwoWay);
85  ATH_MSG_DEBUG(" " << m_phiMin);
86  ATH_MSG_DEBUG(" " << m_phiMax);
87  ATH_MSG_DEBUG(" " << m_etaMin);
88  ATH_MSG_DEBUG(" " << m_etaMax);
89  ATH_MSG_DEBUG(" " << m_absEtaMin);
90  ATH_MSG_DEBUG(" " << m_absEtaMax);
91  ATH_MSG_DEBUG(" " << m_ptMin);
92  ATH_MSG_DEBUG(" " << m_ptMax);
93  ATH_MSG_DEBUG(" " << m_z0Min);
94  ATH_MSG_DEBUG(" " << m_z0Max);
98  ATH_MSG_DEBUG(" " << m_maxHoles);
105  ATH_MSG_DEBUG(" " << m_maxChi2);
107  ATH_MSG_DEBUG(" " << m_seedLabels);
111 
112  // Read and Write handles
113  ATH_CHECK(m_seedContainerKeys.initialize());
119 
120  if (m_estimatedTrackParametersKeys.size() != m_seedLabels.size())
121  {
122  ATH_MSG_FATAL("There are " << m_seedLabels.size() << " SeedLabels, but " << m_estimatedTrackParametersKeys.size() << " EstimatedTrackParametersKeys");
123  return StatusCode::FAILURE;
124  }
125 
127  {
128  ATH_MSG_FATAL("There are " << m_estimatedTrackParametersKeys.size() << " EstimatedTrackParametersKeys, but " << m_seedContainerKeys.size() << " SeedContainerKeys");
129  return StatusCode::FAILURE;
130  }
131 
132  ATH_CHECK(m_monTool.retrieve(EnableTool{not m_monTool.empty()}));
133  ATH_CHECK(m_trackingGeometryTool.retrieve());
134  ATH_CHECK(m_extrapolationTool.retrieve());
135  ATH_CHECK(m_trackStatePrinter.retrieve(EnableTool{not m_trackStatePrinter.empty()}));
136  ATH_CHECK(m_fitterTool.retrieve());
137  ATH_CHECK(m_pixelCalibTool.retrieve(EnableTool{not m_pixelCalibTool.empty()}));
138  ATH_CHECK(m_stripCalibTool.retrieve(EnableTool{not m_stripCalibTool.empty()}));
139  ATH_CHECK(m_hgtdCalibTool.retrieve(EnableTool{not m_hgtdCalibTool.empty()}));
140 
141  m_logger = makeActsAthenaLogger(this, "Acts");
142 
143  auto magneticField = std::make_unique<ATLASMagneticFieldWrapper>();
144  auto trackingGeometry = m_trackingGeometryTool->trackingGeometry();
145 
146  detail::Stepper stepper(std::move(magneticField));
147  detail::Navigator::Config cfg{trackingGeometry};
148  cfg.resolvePassive = false;
149  cfg.resolveMaterial = true;
150  cfg.resolveSensitive = true;
151  detail::Navigator navigator(cfg, logger().cloneWithSuffix("Navigator"));
152  detail::Propagator propagator(std::move(stepper), std::move(navigator), logger().cloneWithSuffix("Prop"));
153 
154  // Using the CKF propagator as extrapolator
155  detail::Extrapolator extrapolator = propagator;
156 
157  std::vector<double> etaBins;
158  // m_etaBins (from flags.Tracking.ActiveConfig.etaBins) includes a dummy first and last bin, which we ignore
159  if (m_etaBins.size() > 2) {
160  etaBins.assign(m_etaBins.begin() + 1, m_etaBins.end() - 1);
161  }
162  Acts::MeasurementSelectorCuts measurementSelectorCuts{etaBins};
163 
164  if (!m_chi2CutOff.empty())
165  measurementSelectorCuts.chi2CutOff = m_chi2CutOff;
166  if (!m_chi2OutlierCutOff.empty() && m_chi2OutlierCutOff.size() == m_chi2CutOff.size())
167  measurementSelectorCuts.chi2CutOffOutlier = m_chi2OutlierCutOff;
168  if (!m_numMeasurementsCutOff.empty())
169  measurementSelectorCuts.numMeasurementsCutOff = m_numMeasurementsCutOff;
170 
171  Acts::MeasurementSelector::Config measurementSelectorCfg{{Acts::GeometryIdentifier(), std::move(measurementSelectorCuts)}};
172  Acts::MeasurementSelector measurementSelector(measurementSelectorCfg);
173 
174  std::vector<double> absEtaEdges;
175  absEtaEdges.reserve(etaBins.size() + 2);
176  if (etaBins.empty())
177  {
178  absEtaEdges.push_back(0.0);
179  absEtaEdges.push_back(std::numeric_limits<double>::infinity());
180  }
181  else
182  {
183  absEtaEdges.push_back(m_absEtaMin);
184  absEtaEdges.insert(absEtaEdges.end(), etaBins.begin(), etaBins.end());
185  absEtaEdges.push_back(m_absEtaMax);
186  }
187 
188  auto setCut = [](auto &cfgVal, const auto &cuts, size_t ind) -> void
189  {
190  if (cuts.empty())
191  return;
192  cfgVal = (ind < cuts.size()) ? cuts[ind] : cuts[cuts.size() - 1];
193  };
194 
195  Acts::TrackSelector::EtaBinnedConfig trackSelectorCfg{std::move(absEtaEdges)};
196  if (etaBins.empty())
197  {
198  assert(trackSelectorCfg.cutSets.size() == 1);
199  trackSelectorCfg.cutSets[0].absEtaMin = m_absEtaMin;
200  trackSelectorCfg.cutSets[0].absEtaMax = m_absEtaMax;
201  }
202  size_t cutIndex = 0;
203  for (auto &cfg : trackSelectorCfg.cutSets)
204  {
205  setCut(cfg.phiMin, m_phiMin, cutIndex);
206  setCut(cfg.phiMax, m_phiMax, cutIndex);
207  setCut(cfg.etaMin, m_etaMin, cutIndex);
208  setCut(cfg.etaMax, m_etaMax, cutIndex);
209  setCut(cfg.ptMin, m_ptMin, cutIndex);
210  setCut(cfg.ptMax, m_ptMax, cutIndex);
211  setCut(cfg.loc0Min, m_d0Min, cutIndex);
212  setCut(cfg.loc0Max, m_d0Max, cutIndex);
213  setCut(cfg.loc1Min, m_z0Min, cutIndex);
214  setCut(cfg.loc1Max, m_z0Max, cutIndex);
215  setCut(cfg.minMeasurements, m_minMeasurements, cutIndex);
216  setCut(cfg.maxHoles, m_maxHoles, cutIndex);
217  setCut(cfg.maxOutliers, m_maxOutliers, cutIndex);
218  setCut(cfg.maxSharedHits, m_maxSharedHits, cutIndex);
219  setCut(cfg.maxChi2, m_maxChi2, cutIndex);
220  ++cutIndex;
221  }
222 
223  ATH_MSG_INFO(trackSelectorCfg);
224 
225  if (!m_useDefaultMeasurementSelector.value()) {
226  // initializer measurement selector and connect it to the delegates of the track finder optins
228  }
229  else if (!m_chi2OutlierCutOff.empty()) {
230  ATH_MSG_DEBUG("chi2OutlierCutOff set but not supported when using the default measurement selector.");
231  }
232 
233  detail::CKF_config ckfConfig{
234  std::move(extrapolator),
235  {std::move(propagator), logger().cloneWithSuffix("CKF")},
236  measurementSelector,
237  {},
238  trackSelectorCfg};
239 
240  m_trackFinder = std::make_unique<CKF_pimpl>(std::move(ckfConfig));
241 
242  trackFinder().ckfExtensions.updater.connect<&ActsTrk::detail::FitterHelperFunctions::gainMatrixUpdate<detail::RecoTrackStateContainer>>();
243  trackFinder().ckfExtensions.measurementSelector.connect<&Acts::MeasurementSelector::select<detail::RecoTrackStateContainer>>(&trackFinder().measurementSelector);
244  initStatTables();
245 
246  return StatusCode::SUCCESS;
247  }
248 
249  // === finalize ============================================================
250 
252  {
253  printStatTables();
254  return StatusCode::SUCCESS;
255  }
256 
257  // === execute =============================================================
258 
259  StatusCode TrackFindingAlg::execute(const EventContext &ctx) const
260  {
261  ATH_MSG_DEBUG("Executing " << name() << " ... ");
262 
263  auto timer = Monitored::Timer<std::chrono::milliseconds>("TIME_execute");
264  auto mon_nTracks = Monitored::Scalar<int>("nTracks");
265  auto mon = Monitored::Group(m_monTool, timer, mon_nTracks);
266 
267  // ================================================== //
268  // ===================== INPUTS ===================== //
269  // ================================================== //
270 
271  // SEED PARAMETERS
272  std::vector<const ActsTrk::BoundTrackParametersContainer *> estimatedTrackParametersContainers;
273  estimatedTrackParametersContainers.reserve(m_estimatedTrackParametersKeys.size());
274  for (const auto &estimatedTrackParametersKey : m_estimatedTrackParametersKeys)
275  {
276  ATH_MSG_DEBUG("Reading input collection with key " << estimatedTrackParametersKey.key());
277  SG::ReadHandle<ActsTrk::BoundTrackParametersContainer> estimatedTrackParametersHandle = SG::makeHandle(estimatedTrackParametersKey, ctx);
278  ATH_CHECK(estimatedTrackParametersHandle.isValid());
279  estimatedTrackParametersContainers.push_back(estimatedTrackParametersHandle.cptr());
280  ATH_MSG_DEBUG("Retrieved " << estimatedTrackParametersContainers.back()->size() << " input elements from key " << estimatedTrackParametersKey.key());
281  }
282 
283  // SEED TRIPLETS
284  std::vector<const ActsTrk::SeedContainer *> seedContainers;
285  seedContainers.reserve(m_seedContainerKeys.size());
286  std::size_t total_seeds = 0;
287  for (const auto &seedContainerKey : m_seedContainerKeys)
288  {
289  ATH_MSG_DEBUG("Reading input collection with key " << seedContainerKey.key());
290  SG::ReadHandle<ActsTrk::SeedContainer> seedsHandle = SG::makeHandle(seedContainerKey, ctx);
291  ATH_CHECK(seedsHandle.isValid());
292  seedContainers.push_back(seedsHandle.cptr());
293  ATH_MSG_DEBUG("Retrieved " << seedContainers.back()->size() << " input elements from key " << seedContainerKey.key());
294  total_seeds += seedContainers.back()->size();
295  }
296 
297  // MEASUREMENTS
298  std::vector<const xAOD::UncalibratedMeasurementContainer *> uncalibratedMeasurementContainers;
299  uncalibratedMeasurementContainers.reserve(m_uncalibratedMeasurementContainerKeys.size());
300  for (const auto &uncalibratedMeasurementContainerKey : m_uncalibratedMeasurementContainerKeys)
301  {
302  ATH_MSG_DEBUG("Reading input collection with key " << uncalibratedMeasurementContainerKey.key());
303  SG::ReadHandle<xAOD::UncalibratedMeasurementContainer> uncalibratedMeasurementContainerHandle = SG::makeHandle(uncalibratedMeasurementContainerKey, ctx);
304  ATH_CHECK(uncalibratedMeasurementContainerHandle.isValid());
305  uncalibratedMeasurementContainers.push_back(uncalibratedMeasurementContainerHandle.cptr());
306  ATH_MSG_DEBUG("Retrieved " << uncalibratedMeasurementContainers.back()->size() << " input elements from key " << uncalibratedMeasurementContainerKey.key());
307  }
308 
310  detectorElementToGeometryIdMap{m_detectorElementToGeometryIdMapKey, ctx};
311  ATH_CHECK(detectorElementToGeometryIdMap.isValid());
312 
313  detail::DuplicateSeedDetector duplicateSeedDetector(total_seeds, m_skipDuplicateSeeds);
314  for (std::size_t icontainer = 0; icontainer < seedContainers.size(); ++icontainer)
315  {
316  if (!seedContainers[icontainer])
317  continue;
318  duplicateSeedDetector.addSeeds(icontainer, *seedContainers[icontainer]);
319  }
320 
321  detail::TrackFindingMeasurements measurements(uncalibratedMeasurementContainers.size() /* number of measurement containers*/);
322  const Acts::TrackingGeometry *
323  acts_tracking_geometry = m_trackingGeometryTool->trackingGeometry().get();
324  ATH_CHECK(acts_tracking_geometry != nullptr);
325 
326  for (std::size_t icontainer = 0; icontainer < uncalibratedMeasurementContainers.size(); ++icontainer) {
327  ATH_MSG_DEBUG("Create " << uncalibratedMeasurementContainers[icontainer]->size() << " source links from measurements in " << m_uncalibratedMeasurementContainerKeys[icontainer].key());
328  measurements.addMeasurements(icontainer,
329  *uncalibratedMeasurementContainers[icontainer],
330  **detectorElementToGeometryIdMap);
331  }
332 
333  if (!m_trackStatePrinter.empty()) {
334  m_trackStatePrinter->printMeasurements(ctx, uncalibratedMeasurementContainers, **detectorElementToGeometryIdMap, measurements.measurementOffsets());
335  }
336 
337 
338  // ================================================== //
339  // ===================== COMPUTATION ================ //
340  // ================================================== //
341  ActsTrk::MutableTrackContainer tracksContainer;
342  EventStats event_stat;
343  event_stat.resize(m_stat.size());
344 
345  // Perform the track finding for all initial parameters.
346  for (std::size_t icontainer = 0; icontainer < estimatedTrackParametersContainers.size(); ++icontainer)
347  {
348  if (estimatedTrackParametersContainers[icontainer]->empty())
349  continue;
350  ATH_CHECK(findTracks(ctx,
351  *acts_tracking_geometry,
352  **detectorElementToGeometryIdMap,
353  measurements,
354  duplicateSeedDetector,
355  *estimatedTrackParametersContainers[icontainer],
356  seedContainers[icontainer],
357  tracksContainer,
358  icontainer,
359  icontainer < m_seedLabels.size() ? m_seedLabels[icontainer].c_str() : m_seedContainerKeys[icontainer].key().c_str(),
360  event_stat));
361  }
362 
363  ATH_MSG_DEBUG(" \\__ Created " << tracksContainer.size() << " tracks");
364 
365  mon_nTracks = tracksContainer.size();
366 
367  copyStats(event_stat);
368 
369  std::unique_ptr<ActsTrk::TrackContainer> constTracksContainer = m_tracksBackendHandlesHelper.moveToConst(std::move(tracksContainer),
370  m_trackingGeometryTool->getGeometryContext(ctx).context(), ctx);
371  // ================================================== //
372  // ===================== OUTPUTS ==================== //
373  // ================================================== //
374  auto trackContainerHandle = SG::makeHandle(m_trackContainerKey, ctx);
375  ATH_MSG_DEBUG(" \\__ Tracks Container `" << m_trackContainerKey.key() << "` created ...");
376 
377  ATH_CHECK(trackContainerHandle.record(std::move(constTracksContainer)));
378  if (!trackContainerHandle.isValid())
379  {
380  ATH_MSG_FATAL("Failed to write TrackContainer with key " << m_trackContainerKey.key());
381  return StatusCode::FAILURE;
382  }
383 
384  return StatusCode::SUCCESS;
385  }
386 
387  // === findTracks ==========================================================
388 
389  StatusCode
390  TrackFindingAlg::findTracks(const EventContext &ctx,
391  const Acts::TrackingGeometry &trackingGeometry,
392  const ActsTrk::DetectorElementToActsGeometryIdMap &detectorElementToGeoId,
393  const detail::TrackFindingMeasurements &measurements,
394  detail::DuplicateSeedDetector &duplicateSeedDetector,
395  const ActsTrk::BoundTrackParametersContainer &estimatedTrackParameters,
396  const ActsTrk::SeedContainer *seeds,
397  ActsTrk::MutableTrackContainer &tracksContainer,
398  size_t typeIndex,
399  const char *seedType,
400  EventStats &event_stat) const
401  {
402  ATH_MSG_DEBUG(name() << "::" << __FUNCTION__);
403 
404  if (seeds && seeds->size() != estimatedTrackParameters.size())
405  {
406  // should be the same, but we can cope if not
407  ATH_MSG_WARNING("Have " << seeds->size() << " " << seedType << " seeds, but " << estimatedTrackParameters.size() << "estimated track parameters");
408  }
409 
410  // Construct a perigee surface as the target surface
411  auto pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3::Zero());
412 
413  Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context();
414  Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx);
415  // CalibrationContext converter not implemented yet.
416  Acts::CalibrationContext calContext = Acts::CalibrationContext();
417 
418  using AtlUncalibSourceLinkAccessor = detail::UncalibSourceLinkAccessor;
419 
420  AtlUncalibSourceLinkAccessor slAccessor(measurements.measurementRanges());
421  Acts::SourceLinkAccessorDelegate<detail::UncalibSourceLinkAccessor::Iterator> slAccessorDelegate;
422  slAccessorDelegate.connect<&detail::UncalibSourceLinkAccessor::range>(&slAccessor);
423 
424  Acts::PropagatorPlainOptions plainOptions{tgContext, mfContext};
425  Acts::PropagatorPlainOptions plainSecondOptions{tgContext, mfContext};
426 
427  const bool reverseSearch = (typeIndex < m_reverseSearch.size() && m_reverseSearch[typeIndex]);
428  plainOptions.maxSteps = m_maxPropagationStep;
429  plainOptions.direction = reverseSearch ? Acts::Direction::Backward : Acts::Direction::Forward;
430  plainSecondOptions.maxSteps = m_maxPropagationStep;
431  plainSecondOptions.direction = plainOptions.direction.invert();
432 
433  // Set the CombinatorialKalmanFilter options
434  using TrackFinderOptions = Acts::CombinatorialKalmanFilterOptions<detail::UncalibSourceLinkAccessor::Iterator, detail::RecoTrackContainer>;
435  TrackFinderOptions options(tgContext,
436  mfContext,
437  calContext,
438  slAccessorDelegate,
439  trackFinder().ckfExtensions,
440  plainOptions,
441  pSurface.get());
442  if (reverseSearch) options.targetSurface = pSurface.get();
443  if (!m_useDefaultMeasurementSelector.value()) {
444  m_measurementSelector->connect( &options.trackStateCandidateCreator );
445  }
446  std::optional<TrackFinderOptions> secondOptions;
447  if (m_doTwoWay) {
448  secondOptions.emplace(tgContext,
449  mfContext,
450  calContext,
451  slAccessorDelegate,
452  trackFinder().ckfExtensions,
453  plainSecondOptions,
454  pSurface.get());
455  if (!reverseSearch) secondOptions->targetSurface = pSurface.get();
456  if (!m_useDefaultMeasurementSelector.value()) {
457  m_measurementSelector->connect( &secondOptions->trackStateCandidateCreator);
458  }
459  secondOptions->skipPrePropagationUpdate = true;
460  }
461 
462  // ActsTrk::MutableTrackContainer tracksContainerTemp;
463  Acts::VectorTrackContainer trackBackend;
464  Acts::VectorMultiTrajectory trackStateBackend;
465  detail::RecoTrackContainer tracksContainerTemp(trackBackend, trackStateBackend);
466 
467  if (m_addPixelStripCounts) {
468  addPixelStripCounts(tracksContainerTemp);
469  }
470 
471  // Measurement calibration
472  // N.B. OnTrackCalibrator expects disabled tool handles when no calibration is requested.
473  // Therefore, passing them without checking if they are enabled is safe.
474 
475  auto calibrator = detail::OnTrackCalibrator<detail::RecoTrackStateContainer>(trackingGeometry,
476  detectorElementToGeoId,
480 
481  if (m_useDefaultMeasurementSelector.value()) {
482  // for default measurement selector need connect calibrator
483  options.extensions.calibrator.connect<&detail::OnTrackCalibrator<detail::RecoTrackStateContainer>::calibrate>(&calibrator);
484  if (m_doTwoWay) {
485  secondOptions->extensions.calibrator.connect<&detail::OnTrackCalibrator<detail::RecoTrackStateContainer>::calibrate>(&calibrator);
486  }
487  }
488 
489  const auto &trackSelectorCfg = trackFinder().trackSelector.config();
490  auto getCuts = [&trackSelectorCfg](double eta) -> const Acts::TrackSelector::Config & {
491  // return the last bin for |eta|>=4 or nan
492  return (!(std::abs(eta) < trackSelectorCfg.absEtaEdges.back())) ? trackSelectorCfg.cutSets.back()
493  : (std::abs(eta) < trackSelectorCfg.absEtaEdges.front()) ? trackSelectorCfg.cutSets.front()
494  : trackSelectorCfg.getCuts(eta);
495  };
496 
497  std::size_t category_i = 0;
498  const auto measurementContainerOffsets = measurements.measurementContainerOffsets();
499 
500  using BranchStopperResult = Acts::CombinatorialKalmanFilterBranchStopperResult;
501  auto stopBranch = [&](const detail::RecoTrackContainer::TrackProxy &track,
502  const detail::RecoTrackContainer::TrackStateProxy &trackState) -> BranchStopperResult {
503 
504  if (m_addPixelStripCounts) {
505  updatePixelStripCounts(track, trackState.typeFlags(), measurementType(trackState));
507  }
508 
509  if (!m_trackStatePrinter.empty()) {
510  m_trackStatePrinter->printTrackState(tgContext, trackState, measurementContainerOffsets, true);
511  }
512 
513  if (!m_doBranchStopper)
514  return BranchStopperResult::Continue;
515 
516  const auto &parameters = trackState.hasFiltered() ? trackState.filtered() : trackState.predicted();
517  double eta = -std::log(std::tan(0.5 * parameters[Acts::eBoundTheta]));
518  const auto &cutSet = getCuts(eta);
519 
520  if (typeIndex < m_ptMinMeasurements.size() &&
521  !(track.nMeasurements() < m_ptMinMeasurements[typeIndex])) {
522  double pT = std::sin(parameters[Acts::eBoundTheta]) / parameters[Acts::eBoundQOverP];
523  if (std::abs(pT) < cutSet.ptMin * m_branchStopperPtMinFactor) {
524  ++event_stat[category_i][kNStoppedTracksMinPt];
525  ATH_MSG_DEBUG("CkfBranchStopper: drop branch with q*pT="
526  << pT << " after "
527  << track.nMeasurements() << " measurements");
528  return BranchStopperResult::StopAndDrop;
529  }
530  }
531 
532  if (typeIndex < m_absEtaMaxMeasurements.size() &&
533  !(track.nMeasurements() < m_absEtaMaxMeasurements[typeIndex]) &&
534  !(std::abs(eta) < trackSelectorCfg.absEtaEdges.back() + m_branchStopperAbsEtaMaxExtra)) {
535  ++event_stat[category_i][kNStoppedTracksMaxEta];
536  ATH_MSG_DEBUG("CkfBranchStopper: drop branch with eta="
537  << eta << " after "
538  << track.nMeasurements() << " measurements");
539  return BranchStopperResult::StopAndDrop;
540  }
541 
542  bool enoughMeasurements = (track.nMeasurements() >= cutSet.minMeasurements);
543  bool tooManyHoles = (track.nHoles() > cutSet.maxHoles);
544  bool tooManyOutliers = (track.nOutliers() > cutSet.maxOutliers);
545 
546  if (m_addPixelStripCounts) {
547  auto [enoughMeasurementsPS, tooManyHolesPS, tooManyOutliersPS] = selectPixelStripCounts(track, eta);
548  enoughMeasurements = enoughMeasurements && enoughMeasurementsPS;
549  tooManyHoles = tooManyHoles || tooManyHolesPS;
550  tooManyOutliers = tooManyOutliers || tooManyOutliersPS;
551  }
552 
553  if (!(tooManyHoles || tooManyOutliers))
554  return BranchStopperResult::Continue;
555 
556  if (!enoughMeasurements)
557  ++event_stat[category_i][kNStoppedTracksMaxHoles];
558  if (m_addPixelStripCounts) {
559  ATH_MSG_DEBUG("CkfBranchStopper: stop and "
560  << (enoughMeasurements ? "keep" : "drop")
561  << " branch with nHoles=" << track.nHoles()
562  << " (" << s_branchState.nPixelHoles(track)
563  << " pixel+" << s_branchState.nStripHoles(track)
564  << " strip), nOutliers=" << track.nOutliers()
567  << "), nMeasurements=" << track.nMeasurements()
568  << " (" << s_branchState.nPixelHits(track)
569  << "+" << s_branchState.nStripHits(track)
570  << ")");
571  } else {
572  ATH_MSG_DEBUG("CkfBranchStopper: stop and "
573  << (enoughMeasurements ? "keep" : "drop")
574  << " branch with nHoles=" << track.nHoles()
575  << ", nOutliers=" << track.nOutliers()
576  << ", nMeasurements=" << track.nMeasurements());
577  }
578 
579  return enoughMeasurements ? BranchStopperResult::StopAndKeep
580  : BranchStopperResult::StopAndDrop;
581  };
582 
583  options.extensions.branchStopper.connect(stopBranch);
584  if (m_doTwoWay) {
585  // If we extend the track inwards we can utilize the CKF propagation
586  // as extrapolator and therefore do not need to stop branches.
587  // This only works for outside-in extensions.
588  if (reverseSearch)
589  secondOptions->extensions.branchStopper.connect(stopBranch);
590  }
591 
592  Acts::PropagatorOptions<detail::Stepper::Options, detail::Navigator::Options,
593  Acts::ActorList<Acts::MaterialInteractor>>
594  extrapolationOptions(tgContext, mfContext);
595 
596  Acts::TrackExtrapolationStrategy extrapolationStrategy =
598 
599  // Perform the track finding for all initial parameters
600  ATH_MSG_DEBUG("Invoke track finding with " << estimatedTrackParameters.size() << ' ' << seedType << " seeds.");
601 
602  std::size_t nPrinted = 0;
603  auto printSeed = [&](std::size_t iseed, const Acts::BoundTrackParameters &seedParameters, bool isKF = false)
604  {
605  if (m_trackStatePrinter.empty() || !seeds)
606  return;
607  if (!nPrinted++)
608  {
609  ATH_MSG_INFO("CKF results for " << estimatedTrackParameters.size() << ' ' << seedType << " seeds:");
610  }
611  m_trackStatePrinter->printSeed(tgContext, *(*seeds)[iseed], seedParameters, measurementContainerOffsets, iseed, isKF);
612  };
613 
614  // Loop over the track finding results for all initial parameters
615  for (std::size_t iseed = 0; iseed < estimatedTrackParameters.size(); ++iseed)
616  {
617  category_i = typeIndex * (m_statEtaBins.size() + 1);
618  tracksContainerTemp.clear();
619 
620  if (!estimatedTrackParameters[iseed])
621  {
622  ATH_MSG_WARNING("No " << seedType << " seed " << iseed);
623  ++event_stat[category_i][kNoTrackParam];
624  continue;
625  }
626 
627  const Acts::BoundTrackParameters *initialParameters = estimatedTrackParameters[iseed];
628  printSeed(iseed, *initialParameters);
629 
630  double etaInitial = -std::log(std::tan(0.5 * initialParameters->theta()));
631  category_i = getStatCategory(typeIndex, etaInitial);
632  ++event_stat[category_i][kNTotalSeeds];
633 
634  if (duplicateSeedDetector.isDuplicate(typeIndex, iseed))
635  {
636  ATH_MSG_DEBUG("skip " << seedType << " seed " << iseed << " - already found");
637  ++event_stat[category_i][kNDuplicateSeeds];
638  continue;
639  }
640 
641  // Get the Acts tracks, given this seed
642  // Result here contains a vector of TrackProxy objects
643  ++event_stat[category_i][kNUsedSeeds];
644 
645  std::unique_ptr<Acts::BoundTrackParameters> seedParameters;
646  const bool refitSeeds = (typeIndex < m_refitSeeds.size() && m_refitSeeds[typeIndex]);
647  if (refitSeeds)
648  {
649  // Perform KF before CKF
650  const auto fittedSeedCollection = m_fitterTool->fit(ctx, *(*seeds)[iseed], *initialParameters,
651  tgContext, mfContext, calContext,
652  detectorElementToGeoId);
653  if (not fittedSeedCollection)
654  {
655  ATH_MSG_WARNING("KF Fitted Track is nullptr");
656  }
657  else if (fittedSeedCollection->size() != 1)
658  {
659  ATH_MSG_WARNING("KF produced " << fittedSeedCollection->size() << " tracks but should produce 1!");
660  }
661  else
662  {
663  // Check pTmin requirement
664  const auto fittedSeed = fittedSeedCollection->getTrack(0);
665 
666  double etaSeed = -std::log(std::tan(0.5 * fittedSeed.parameters()[Acts::eBoundTheta]));
667  const auto &cutSet = getCuts(etaSeed);
668  if (fittedSeed.transverseMomentum() < cutSet.ptMin)
669  {
670  ATH_MSG_VERBOSE("min pt requirement not satisfied after param refinement: pt min is " << cutSet.ptMin << " but Refined params have pt of " << fittedSeed.transverseMomentum());
671  ++event_stat[category_i][kNRejectedRefinedSeeds];
672  continue;
673  }
674 
675  seedParameters.reset(new Acts::BoundTrackParameters(fittedSeed.referenceSurface().getSharedPtr(),
676  fittedSeed.parameters(),
677  initialParameters->covariance(),
678  fittedSeed.particleHypothesis()));
679  printSeed(iseed, *seedParameters, true);
680 
681  // Pass the refined params to the CKF
682  initialParameters = seedParameters.get();
683  }
684  }
685 
686  auto result = trackFinder().ckf.findTracks(*initialParameters, options, tracksContainerTemp);
687 
688  // The result for this seed
689  if (not result.ok()) {
690  ATH_MSG_WARNING("Track finding failed for " << seedType << " seed " << iseed << " with error" << result.error());
691  continue;
692  }
693  auto &tracksForSeed = result.value();
694 
695  size_t ntracks = 0;
696 
697  // lambda to collect together all the things we do with a viable track.
699  // if the the perigeeSurface was not hit (in particular the case for the inside-out pass,
700  // the track has no reference surface and the extrapolation to the perigee has not been done
701  // yet.
702  if (!track.hasReferenceSurface()) {
703  auto extrapolationResult = Acts::extrapolateTrackToReferenceSurface(
704  track, *pSurface, trackFinder().extrapolator, extrapolationOptions,
705  extrapolationStrategy, logger());
706  if (!extrapolationResult.ok()) {
707  ATH_MSG_WARNING("Extrapolation for seed "
708  << iseed << " and " << track.index()
709  << " failed with error " << extrapolationResult.error()
710  << " dropping track candidate.");
711  return;
712  }
713  }
714 
715  Acts::trimTrack(track, true, true, true);
716  Acts::calculateTrackQuantities(track);
717  if (m_addPixelStripCounts) {
719  for (const auto& trackState : track.trackStatesReversed()) {
720  updatePixelStripCounts(track, trackState.typeFlags(), measurementType(trackState));
721  }
723  }
724 
725  if (!m_trackStatePrinter.empty()) {
726  m_trackStatePrinter->printTrack(tgContext, tracksContainerTemp, track, measurementContainerOffsets);
727  }
728 
729  ++ntracks;
730  ++event_stat[category_i][kNOutputTracks];
731 
732  // copy selected tracks into output tracksContainer
733  auto selectPixelStripCountsFinal = [this](const detail::RecoTrackContainer::TrackProxy &track) {
734  if (!m_addPixelStripCounts) return true;
735  double eta = -std::log(std::tan(0.5 * track.theta()));
736  auto [enoughMeasurementsPS, tooManyHolesPS, tooManyOutliersPS] = selectPixelStripCounts(track, eta);
737  return enoughMeasurementsPS && !tooManyHolesPS && !tooManyOutliersPS;
738  };
739  if (trackFinder().trackSelector.isValidTrack(track) &&
740  selectPixelStripCountsFinal(track)) {
741  auto destProxy = tracksContainer.getTrack(tracksContainer.addTrack());
742  destProxy.copyFrom(track, true); // make sure we copy track states!
743  ++event_stat[category_i][kNSelectedTracks];
744 
745  // Fill the track infos into the duplicate seed detector
746  if (m_skipDuplicateSeeds) {
747  storeSeedInfo(tracksContainerTemp, track, duplicateSeedDetector);
748  }
749  } else {
750  ATH_MSG_DEBUG("Track " << ntracks << " from " << seedType << " seed " << iseed << " failed track selection");
751  }
752  };
753 
754  std::size_t nfirst = 0;
755  for (auto &firstTrack : tracksForSeed) {
756  std::size_t nsecond = 0;
757 
758  auto smoothingResult = Acts::smoothTrack(tgContext, firstTrack, logger(), Acts::MbfSmoother());
759  if (!smoothingResult.ok()) {
760  ATH_MSG_DEBUG("Smoothing for seed "
761  << iseed << " and first track " << firstTrack.index()
762  << " failed with error " << smoothingResult.error());
763  continue;
764  }
765 
766  if (m_doTwoWay) {
767  std::optional<detail::RecoTrackStateContainerProxy> firstMeasurement;
768  for (auto st : firstTrack.trackStatesReversed()) {
769  bool isMeasurement = st.typeFlags().test(Acts::TrackStateFlag::MeasurementFlag);
770  bool isOutlier = st.typeFlags().test(Acts::TrackStateFlag::OutlierFlag);
771  // We are excluding non measurement states and outlier here. Those can
772  // decrease resolution because only the smoothing corrected the very
773  // first prediction as filtering is not possible.
774  if (isMeasurement && !isOutlier)
775  firstMeasurement = st;
776  }
777 
778  if (firstMeasurement.has_value()) {
779  Acts::BoundTrackParameters secondInitialParameters = firstTrack.createParametersFromState(*firstMeasurement);
780 
781  if (!secondInitialParameters.referenceSurface().insideBounds(secondInitialParameters.localPosition())) { // #3751
782  ATH_MSG_DEBUG("Smoothing of first pass fit produced out-of-bounds parameters relative to the surface, '"
783  << secondInitialParameters.referenceSurface().name()
784  << "'. Skipping second pass for " << seedType << " seed " << iseed << " track " << nfirst);
785  } else {
786  auto rootBranch = tracksContainerTemp.makeTrack();
787  rootBranch.copyFrom(firstTrack, false); // #3534
789  copyPixelStripCounts(rootBranch, firstTrack);
790  auto secondResult = trackFinder().ckf.findTracks(secondInitialParameters, *secondOptions, tracksContainerTemp, rootBranch);
791 
792  if (not secondResult.ok()) {
793  ATH_MSG_WARNING("Second track finding failed for " << seedType << " seed " << iseed << " track " << nfirst << " with error" << secondResult.error());
794  } else {
795  // store the original previous state to restore it later
796  auto originalFirstMeasurementPrevious = firstMeasurement->previous();
797 
798  auto &secondTracksForSeed = secondResult.value();
799  for (auto &secondTrack : secondTracksForSeed) {
800  secondTrack.reverseTrackStates(true);
801 
802  firstMeasurement->previous() = secondTrack.outermostTrackState().index();
803  secondTrack.tipIndex() = firstTrack.tipIndex();
804 
805  if (reverseSearch) {
806  // smooth the full track
807  auto secondSmoothingResult = Acts::smoothTrack(tgContext, secondTrack, logger());
808  if (!secondSmoothingResult.ok()) {
809  ATH_MSG_WARNING("Second smoothing for seed " << iseed << " and track " << secondTrack.index() << " failed with error " << secondSmoothingResult.error());
810  continue;
811  }
812 
813  secondTrack.reverseTrackStates(true);
814  }
815 
816  addTrack(secondTrack);
817 
818  ++nsecond;
819  }
820 
821  // restore the original previous state for the first track
822  firstMeasurement->previous() = originalFirstMeasurementPrevious;
823  }
824  }
825  }
826  }
827  if (nsecond == 0) {
828  if (m_doTwoWay) {
829  ATH_MSG_DEBUG("No viable result from second track finding for " << seedType << " seed " << iseed << " track " << nfirst);
830  ++event_stat[category_i][kNoSecond];
831  }
832 
833  addTrack(firstTrack);
834  }
835  nfirst++;
836  }
837  if (ntracks == 0) {
838  ATH_MSG_DEBUG("Track finding found no track candidates for " << seedType << " seed " << iseed);
839  ++event_stat[category_i][kNoTrack];
840  } else if (ntracks >= 2) {
841  ++event_stat[category_i][kMultipleBranches];
842  }
843  if (!m_trackStatePrinter.empty())
844  std::cout << std::flush;
845  }
846 
847  ATH_MSG_DEBUG("Completed " << seedType << " track finding with " << computeStatSum(typeIndex, kNOutputTracks, event_stat) << " track candidates.");
848 
849  return StatusCode::SUCCESS;
850  }
851 
852  void
855  detail::DuplicateSeedDetector &duplicateSeedDetector) const {
856 
857  const auto lastMeasurementIndex = track.tipIndex();
858  duplicateSeedDetector.newTrajectory();
859 
860  tracksContainer.trackStateContainer().visitBackwards(
861  lastMeasurementIndex,
862  [&duplicateSeedDetector](const detail::RecoTrackStateContainer::ConstTrackStateProxy &state) -> void
863  {
864  // Check there is a source link
865  if (not state.hasUncalibratedSourceLink())
866  return;
867 
868  // Fill the duplicate selector
869  auto sl = state.getUncalibratedSourceLink().template get<ATLASUncalibSourceLink>();
870  duplicateSeedDetector.addMeasurement(sl);
871  }); // end visitBackwards
872  }
873 
875  TrackFindingAlg::measurementType (const detail::RecoTrackContainer::TrackStateProxy &trackState)
876  {
877  if (trackState.hasReferenceSurface()) {
878  if (const auto *actsDetElem = dynamic_cast<const ActsDetectorElement *>(trackState.referenceSurface().associatedDetectorElement())) {
879  if (const auto *detElem = dynamic_cast<const InDetDD::SiDetectorElement *>(actsDetElem->upstreamDetectorElement())) {
880  if (detElem->isPixel()) {
882  } else if (detElem->isSCT()) {
884  }
885  }
886  }
887  }
889  }
890 
891  void
893  {
894  tracksContainer.addColumn<unsigned int>("nPixelHits");
895  tracksContainer.addColumn<unsigned int>("nStripHits");
896  tracksContainer.addColumn<unsigned int>("nPixelHoles");
897  tracksContainer.addColumn<unsigned int>("nStripHoles");
898  tracksContainer.addColumn<unsigned int>("nPixelOutliers");
899  tracksContainer.addColumn<unsigned int>("nStripOutliers");
900  }
901 
902  void
903  TrackFindingAlg::initPixelStripCounts(const detail::RecoTrackContainer::TrackProxy &track)
904  {
911  }
912 
913  void
914  TrackFindingAlg::updatePixelStripCounts(const detail::RecoTrackContainer::TrackProxy &track,
915  Acts::ConstTrackStateType typeFlags,
916  xAOD::UncalibMeasType detType)
917  {
919  if (typeFlags.test(Acts::TrackStateFlag::HoleFlag)) {
921  } else if (typeFlags.test(Acts::TrackStateFlag::OutlierFlag)) {
923  } else if (typeFlags.test(Acts::TrackStateFlag::MeasurementFlag)) {
925  }
926  } else if (detType == xAOD::UncalibMeasType::StripClusterType) {
927  if (typeFlags.test(Acts::TrackStateFlag::HoleFlag)) {
929  } else if (typeFlags.test(Acts::TrackStateFlag::OutlierFlag)) {
931  } else if (typeFlags.test(Acts::TrackStateFlag::MeasurementFlag)) {
933  }
934  }
935  }
936 
937  void
938  TrackFindingAlg::copyPixelStripCounts(const detail::RecoTrackContainer::TrackProxy &track,
939  const detail::RecoTrackContainer::TrackProxy &other)
940  {
947  }
948 
949  void
950  TrackFindingAlg::checkPixelStripCounts(const detail::RecoTrackContainer::TrackProxy &track) const
951  {
952  // This check will fail if there are other types (HGTD, MS?) of hits, holes, or outliers.
953  // The check can be removed when it is no longer appropriate.
954  if (track.nMeasurements() != s_branchState.nPixelHits(track) + s_branchState.nStripHits(track))
955  ATH_MSG_WARNING("mismatched hit count: total (" << track.nMeasurements()
956  << ") != pixel (" << s_branchState.nPixelHits(track)
957  << ") + strip (" << s_branchState.nStripHits(track) << ")");
958  if (track.nHoles() < s_branchState.nPixelHoles(track) + s_branchState.nStripHoles(track)) // allow extra HGTD holes
959  ATH_MSG_WARNING("mismatched hole count: total (" << track.nHoles()
960  << ") < pixel (" << s_branchState.nPixelHoles(track)
961  << ") + strip (" << s_branchState.nStripHoles(track) << ")");
963  ATH_MSG_WARNING("mismatched outlier count: total (" << track.nOutliers()
964  << ") != pixel (" << s_branchState.nPixelOutliers(track)
965  << ") + strip (" << s_branchState.nStripOutliers(track) << ")");
966  };
967 
968  std::array<bool, 3>
969  TrackFindingAlg::selectPixelStripCounts(const detail::RecoTrackContainer::TrackProxy &track, double eta) const
970  {
971  bool enoughMeasurements = true, tooManyHoles = false, tooManyOutliers = false;
972  const auto &trackSelectorCfg = trackFinder().trackSelector.config();
973  std::size_t etaBin = (std::abs(eta) < trackSelectorCfg.absEtaEdges.front()) ? 0
974  : (std::abs(eta) >= trackSelectorCfg.absEtaEdges.back()) ? trackSelectorCfg.absEtaEdges.size() - 1
975  : trackSelectorCfg.binIndex(eta);
976  auto cutMin = [etaBin](std::size_t val, const std::vector<std::size_t> &cutSet) {
977  return !cutSet.empty() && (val < (etaBin < cutSet.size() ? cutSet[etaBin] : cutSet.back()));
978  };
979  auto cutMax = [etaBin](std::size_t val, const std::vector<std::size_t> &cutSet) {
980  return !cutSet.empty() && (val > (etaBin < cutSet.size() ? cutSet[etaBin] : cutSet.back()));
981  };
982  enoughMeasurements = enoughMeasurements && !cutMin(s_branchState.nPixelHits(track), m_minPixelHits);
983  enoughMeasurements = enoughMeasurements && !cutMin(s_branchState.nStripHits(track), m_minStripHits);
984  tooManyHoles = tooManyHoles || cutMax(s_branchState.nPixelHoles(track), m_maxPixelHoles);
985  tooManyHoles = tooManyHoles || cutMax(s_branchState.nStripHoles(track), m_maxStripHoles);
986  tooManyOutliers = tooManyOutliers || cutMax(s_branchState.nPixelOutliers(track), m_maxPixelOutliers);
987  tooManyOutliers = tooManyOutliers || cutMax(s_branchState.nStripOutliers(track), m_maxStripOutliers);
988  return {enoughMeasurements, tooManyHoles, tooManyOutliers};
989  }
990 
991  // === Statistics printout =================================================
992 
994  {
995  if (!m_statEtaBins.empty())
996  {
997  m_useAbsEtaForStat = (m_statEtaBins[0] > 0.);
998  float last_eta = m_statEtaBins[0];
999  for (float eta : m_statEtaBins)
1000  {
1001  if (eta < last_eta)
1002  {
1003  ATH_MSG_FATAL("Eta bins for statistics counter not in ascending order.");
1004  }
1005  last_eta = eta;
1006  }
1007  }
1008  m_stat.resize(nSeedCollections() * seedCollectionStride());
1009  }
1010 
1011  // copy statistics
1012  void TrackFindingAlg::copyStats(const EventStats &event_stat) const
1013  {
1014  std::lock_guard<std::mutex> lock(m_mutex);
1015  std::size_t category_i = 0;
1016  for (const std::array<unsigned int, kNStat> &src_stat : event_stat)
1017  {
1018  std::array<std::size_t, kNStat> &dest_stat = m_stat[category_i++];
1019  for (std::size_t i = 0; i < src_stat.size(); ++i)
1020  {
1021  assert(i < dest_stat.size());
1022  dest_stat[i] += src_stat[i];
1023  }
1024  }
1025  }
1026 
1027  // print statistics
1029  {
1030  if (msgLvl(MSG::INFO))
1031  {
1032  std::vector<std::string> stat_labels =
1034  {
1035  std::make_pair(kNTotalSeeds, "Input seeds"),
1036  std::make_pair(kNoTrackParam, "No track parameters"),
1037  std::make_pair(kNUsedSeeds, "Used seeds"),
1038  std::make_pair(kNoTrack, "Cannot find track"),
1039  std::make_pair(kNDuplicateSeeds, "Duplicate seeds"),
1040  std::make_pair(kNRejectedRefinedSeeds, "Rejected refined parameters"),
1041  std::make_pair(kNOutputTracks, "CKF tracks"),
1042  std::make_pair(kNSelectedTracks, "selected tracks"),
1043  std::make_pair(kNStoppedTracksMaxHoles, "Stopped tracks reaching max holes"),
1044  std::make_pair(kMultipleBranches, "Seeds with more than one branch"),
1045  std::make_pair(kNoSecond, "Tracks failing second CKF"),
1046  std::make_pair(kNStoppedTracksMinPt, "Stopped tracks below pT cut"),
1047  std::make_pair(kNStoppedTracksMaxEta, "Stopped tracks above max eta")
1048  });
1049  assert(stat_labels.size() == kNStat);
1050  std::vector<std::string> categories;
1051  categories.reserve(m_seedLabels.size() + 1);
1052  categories.insert(categories.end(), m_seedLabels.begin(), m_seedLabels.end());
1053  categories.push_back("ALL");
1054 
1055  std::vector<std::string> eta_labels;
1056  eta_labels.reserve(m_statEtaBins.size() + 2);
1057  for (std::size_t eta_bin_i = 0; eta_bin_i < m_statEtaBins.size() + 2; ++eta_bin_i)
1058  {
1059  eta_labels.push_back(TableUtils::makeEtaBinLabel(m_statEtaBins, eta_bin_i, m_useAbsEtaForStat));
1060  }
1061 
1062  // vector used as 3D array stat[ eta_bin ][ stat_i ][ seed_type]
1063  // stat_i = [0, kNStat)
1064  // eta_bin = [0, m_statEtaBins.size()+2 ); eta_bin == m_statEtaBinsSize()+1 means sum of all etaBins
1065  // seed_type = [0, nSeedCollections()+1) seed_type == nSeedCollections() means sum of all seed collections
1066  std::vector<std::size_t> stat =
1067  TableUtils::createCounterArrayWithProjections<std::size_t>(nSeedCollections(),
1068  m_statEtaBins.size() + 1,
1069  m_stat);
1070 
1071  // the extra columns and rows for the projections are addeded internally:
1072  std::size_t stat_stride =
1074  m_statEtaBins.size() + 1,
1075  kNStat);
1076  std::size_t eta_stride =
1078  m_statEtaBins.size() + 1,
1079  kNStat);
1080  std::stringstream table_out;
1081 
1082  if (m_dumpAllStatEtaBins.value())
1083  {
1084  // dump for each counter a table with one row per eta bin
1085  std::size_t max_label_width = TableUtils::maxLabelWidth(stat_labels) + TableUtils::maxLabelWidth(eta_labels);
1086  for (std::size_t stat_i = 0; stat_i < kNStat; ++stat_i)
1087  {
1088  std::size_t dest_idx_offset = stat_i * stat_stride;
1089  table_out << makeTable(stat, dest_idx_offset, eta_stride,
1090  eta_labels,
1091  categories)
1092  .columnWidth(10)
1093  // only dump the footer for the last eta bin i.e. total
1094  .dumpHeader(stat_i == 0)
1095  .dumpFooter(stat_i + 1 == kNStat)
1096  .separateLastRow(true) // separate the sum of all eta bins
1097  .minLabelWidth(max_label_width)
1098  .labelPrefix(stat_labels.at(stat_i));
1099  }
1100  }
1101  else
1102  {
1103  // dump one table with one row per counter showing the total eta range
1104  for (std::size_t eta_bin_i = (m_dumpAllStatEtaBins.value() ? 0 : m_statEtaBins.size() + 1);
1105  eta_bin_i < m_statEtaBins.size() + 2;
1106  ++eta_bin_i)
1107  {
1108  std::size_t dest_idx_offset = eta_bin_i * eta_stride;
1109  table_out << makeTable(stat, dest_idx_offset, stat_stride,
1110  stat_labels,
1111  categories,
1112  eta_labels.at(eta_bin_i))
1113  .columnWidth(10)
1114  // only dump the footer for the last eta bin i.e. total
1115  .dumpFooter(!m_dumpAllStatEtaBins.value() || eta_bin_i == m_statEtaBins.size() + 1);
1116  }
1117  }
1118  ATH_MSG_INFO("statistics:\n"
1119  << table_out.str());
1120  table_out.str("");
1121 
1122  // define retios first element numerator, second element denominator
1123  // each element contains a vector of counter and a multiplier e.g. +- 1
1124  // ratios are computed as (sum_i stat[stat_i] * multiplier_i ) / (sum_j stat[stat_j] * multiplier_j )
1125  auto [ratio_labels, ratio_def] =
1127  std::vector<TableUtils::SummandDefinition>{
1131  // no track counted as used but want to include it as failed
1133  }, // failed seeds i.e. seeds which are not duplicates but did not produce a track
1134  std::vector<TableUtils::SummandDefinition>{TableUtils::defineSummand(kNTotalSeeds, 1)}),
1136  TableUtils::defineSimpleRatio("Rejected refined params / seeds", kNRejectedRefinedSeeds, kNTotalSeeds),
1138  TableUtils::defineSimpleRatio("selected tracks / used seeds", kNSelectedTracks, kNUsedSeeds),
1139  TableUtils::defineSimpleRatio("branched tracks / used seeds", kMultipleBranches, kNUsedSeeds),
1140  TableUtils::defineSimpleRatio("no 2nd CKF / CKF tracks", kNoSecond, kNOutputTracks)});
1141 
1142  std::vector<float> ratio = TableUtils::computeRatios(ratio_def,
1143  nSeedCollections() + 1,
1144  m_statEtaBins.size() + 2,
1145  stat);
1146 
1147  // the extra columns and rows for the projections are _not_ added internally
1148  std::size_t ratio_stride = TableUtils::ratioStride(nSeedCollections() + 1,
1149  m_statEtaBins.size() + 2,
1150  ratio_def);
1151  std::size_t ratio_eta_stride = TableUtils::subCategoryStride(nSeedCollections() + 1,
1152  m_statEtaBins.size() + 2,
1153  ratio_def);
1154 
1155  std::size_t max_label_width = TableUtils::maxLabelWidth(ratio_labels) + TableUtils::maxLabelWidth(eta_labels);
1156  if (m_dumpAllStatEtaBins.value())
1157  {
1158  // show for each ratio a table with one row per eta bin
1159  for (std::size_t ratio_i = 0; ratio_i < ratio_labels.size(); ++ratio_i)
1160  {
1161  table_out << makeTable(ratio,
1162  ratio_i * ratio_stride,
1163  ratio_eta_stride,
1164  eta_labels,
1165  categories)
1166  .columnWidth(10)
1167  // only dump the footer for the last eta bin i.e. total
1168  .dumpHeader(ratio_i == 0)
1169  .dumpFooter(ratio_i + 1 == ratio_labels.size())
1170  .separateLastRow(true) // separate the sum of las
1171  .minLabelWidth(max_label_width)
1172  .labelPrefix(ratio_labels.at(ratio_i));
1173  }
1174  }
1175  else
1176  {
1177  // dump one table with one row per ratio showing the total eta range
1178  table_out << makeTable(ratio,
1179  (m_statEtaBins.size() + 1) * ratio_eta_stride + 0 * ratio_stride,
1180  ratio_stride,
1181  ratio_labels,
1182  categories)
1183  .columnWidth(10)
1184  // only dump the footer for the last eta bin i.e. total
1185  .minLabelWidth(max_label_width)
1186  .dumpFooter(false);
1187 
1188  // also dump a table for final tracks over seeds (ratio_i==3) showing one row per eta bin
1189  eta_labels.erase(eta_labels.end() - 1); // drop last line of table which shows again all eta bins summed.
1190  constexpr std::size_t ratio_i = 3;
1191  table_out << makeTable(ratio,
1192  ratio_i * ratio_stride,
1193  ratio_eta_stride,
1194  eta_labels,
1195  categories)
1196  .columnWidth(10)
1197  .dumpHeader(false)
1198  // only dump the footer for the last eta bin i.e. total
1199  .dumpFooter(!m_dumpAllStatEtaBins.value() || ratio_i + 1 == ratio_labels.size())
1200  .separateLastRow(false)
1201  .minLabelWidth(max_label_width)
1202  .labelPrefix(ratio_labels.at(ratio_i));
1203  }
1204 
1205  ATH_MSG_INFO("Ratios:\n"
1206  << table_out.str());
1207  }
1208  }
1209 
1210  inline std::size_t TrackFindingAlg::getStatCategory(std::size_t seed_collection, float eta) const
1211  {
1212  std::vector<float>::const_iterator bin_iter = std::upper_bound(m_statEtaBins.begin(),
1213  m_statEtaBins.end(),
1214  m_useAbsEtaForStat ? std::abs(eta) : eta);
1215  std::size_t category_i = seed_collection * seedCollectionStride() + static_cast<std::size_t>(bin_iter - m_statEtaBins.begin());
1216  assert(category_i < m_stat.size());
1217  return category_i;
1218  }
1219 
1220  inline std::size_t TrackFindingAlg::computeStatSum(std::size_t seed_collection, EStat counter_i, const EventStats &stat) const
1221  {
1222  std::size_t out = 0u;
1223  for (std::size_t category_i = seed_collection * seedCollectionStride() + static_cast<std::size_t>(counter_i);
1224  category_i < (seed_collection + 1) * seedCollectionStride();
1225  ++category_i)
1226  {
1227  assert(category_i < stat.size());
1228  out += stat[category_i][counter_i];
1229  }
1230  return out;
1231  }
1232 
1233 
1235  std::vector<std::pair<float, float> > chi2CutOffOutlier ;
1236  chi2CutOffOutlier .reserve( m_chi2CutOff.size() );
1237  if (!m_chi2OutlierCutOff.empty()) {
1238  if (m_chi2CutOff.size() != m_chi2OutlierCutOff.size()) {
1239  ATH_MSG_ERROR("Outlier chi2 cut off provided but number of elements does not agree with"
1240  " chi2 cut off for measurements which however is required: "
1241  << m_chi2CutOff.size() << " != " << m_chi2OutlierCutOff.size());
1242  return StatusCode::FAILURE;
1243  }
1244  }
1245  unsigned int idx=0;
1246  for (const auto &elm : m_chi2CutOff) {
1247  chi2CutOffOutlier.push_back( std::make_pair(static_cast<float>(elm),
1248  idx < m_chi2OutlierCutOff.size()
1249  ? static_cast<float>(m_chi2OutlierCutOff[idx])
1251  ++idx;
1252  }
1253  std::vector<float> etaBinsf;
1254  if (m_etaBins.size() > 2) {
1255  etaBinsf.assign(m_etaBins.begin() + 1, m_etaBins.end() - 1);
1256  }
1257 
1259  etaBinsf,
1260  chi2CutOffOutlier,
1261  m_numMeasurementsCutOff.value());
1262 
1263  return m_measurementSelector ? StatusCode::SUCCESS : StatusCode::FAILURE;
1264  }
1265 
1266 } // namespace
ActsTrk::TrackFindingAlg::m_maxPixelHoles
Gaudi::Property< std::vector< std::size_t > > m_maxPixelHoles
Definition: TrackFindingAlg.h:141
SCT_ClusterOnTrack.h
CalculateHighPtTerm.pT
pT
Definition: ICHEP2016/CalculateHighPtTerm.py:57
ActsTrk::TrackFindingAlg::m_hgtdCalibTool
ToolHandle< ActsTrk::IOnTrackCalibratorTool< detail::RecoTrackStateContainer > > m_hgtdCalibTool
Definition: TrackFindingAlg.h:84
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ActsTrk::TrackFindingAlg::m_extrapolationTool
ToolHandle< IActsExtrapolationTool > m_extrapolationTool
Definition: TrackFindingAlg.h:76
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
ActsTrk::TrackFindingAlg::selectPixelStripCounts
std::array< bool, 3 > selectPixelStripCounts(const detail::RecoTrackContainer::TrackProxy &track, double eta) const
Definition: TrackFindingAlg.cxx:969
ActsTrk::TrackFindingAlg::m_maxSharedHits
Gaudi::Property< std::vector< std::size_t > > m_maxSharedHits
Definition: TrackFindingAlg.h:135
ActsTrk::TrackFindingAlg::m_statEtaBins
Gaudi::Property< std::vector< float > > m_statEtaBins
Definition: TrackFindingAlg.h:147
get_generator_info.result
result
Definition: get_generator_info.py:21
ActsTrk::TrackFindingAlg::kNStoppedTracksMaxEta
@ kNStoppedTracksMaxEta
Definition: TrackFindingAlg.h:167
TrackParameters.h
ActsTrk::TrackFindingAlg::m_trackingGeometryTool
ToolHandle< IActsTrackingGeometryTool > m_trackingGeometryTool
Definition: TrackFindingAlg.h:77
ActsTrk::MutableTrackContainerHandlesHelper::moveToConst
std::unique_ptr< ActsTrk::TrackContainer > moveToConst(ActsTrk::MutableTrackContainer &&tc, const Acts::GeometryContext &geoContext, const EventContext &evtContext) const
produces ActsTrk::ConstTrackContainer with all backends stored in SG
Definition: TrackContainerHandlesHelper.cxx:130
ActsTrk::TrackFindingAlg::m_branchStopperAbsEtaMaxExtra
Gaudi::Property< double > m_branchStopperAbsEtaMaxExtra
Definition: TrackFindingAlg.h:115
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
FullCPAlgorithmsTest_eljob.flush
flush
Definition: FullCPAlgorithmsTest_eljob.py:182
ActsTrk::detail::TrackFindingMeasurements
Definition: TrackFindingMeasurements.h:17
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
ActsTrk::DetectorElementToActsGeometryIdMap
Definition: DetectorElementToActsGeometryIdMap.h:31
ActsGeometryContext.h
ActsTrk::TrackFindingAlg::logger
const Acts::Logger & logger() const
Private access to the logger.
Definition: TrackFindingAlg.h:259
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
ActsTrk::detail::Navigator
Acts::Navigator Navigator
Definition: Tracking/Acts/ActsTrackReconstruction/src/detail/Definitions.h:31
xAOD::UncalibMeasType::StripClusterType
@ StripClusterType
ActsTrk::TrackFindingAlg::m_absEtaMax
Gaudi::Property< double > m_absEtaMax
Definition: TrackFindingAlg.h:124
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
ActsTrk::TrackFindingAlg::m_maxStripHoles
Gaudi::Property< std::vector< std::size_t > > m_maxStripHoles
Definition: TrackFindingAlg.h:142
ActsTrk::TrackFindingAlg::measurementType
static xAOD::UncalibMeasType measurementType(const detail::RecoTrackContainer::TrackStateProxy &trackState)
Definition: TrackFindingAlg.cxx:875
ActsTrk::TrackFindingAlg::m_detectorElementToGeometryIdMapKey
SG::ReadCondHandleKey< ActsTrk::DetectorElementToActsGeometryIdMap > m_detectorElementToGeometryIdMapKey
Definition: TrackFindingAlg.h:94
ActsTrk::detail::CKF_config::trackSelector
Acts::TrackSelector trackSelector
Definition: Tracking/Acts/ActsTrackReconstruction/src/detail/Definitions.h:49
ActsTrk::detail::Extrapolator
Propagator Extrapolator
Definition: Tracking/Acts/ActsTrackReconstruction/src/detail/Definitions.h:34
ActsTrk::detail::DuplicateSeedDetector::addSeeds
void addSeeds(std::size_t typeIndex, const ActsTrk::SeedContainer &seeds)
Definition: DuplicateSeedDetector.cxx:22
ConvertOldUJHistosToNewHistos.etaBins
list etaBins
Definition: ConvertOldUJHistosToNewHistos.py:145
ActsTrk::TrackFindingAlg::TrackFindingAlg
TrackFindingAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrackFindingAlg.cxx:58
ActsTrk::TrackFindingAlg::BranchState::nPixelOutliers
static constexpr Acts::ProxyAccessor< unsigned int > nPixelOutliers
Definition: TrackFindingAlg.h:223
ActsTrk::TrackFindingAlg::addPixelStripCounts
static void addPixelStripCounts(detail::RecoTrackContainer &tracksContainer)
Definition: TrackFindingAlg.cxx:892
ActsTrk::TrackFindingAlg::kNoTrack
@ kNoTrack
Definition: TrackFindingAlg.h:158
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
ATLASMagneticFieldWrapper.h
AthCommonMsg< Gaudi::Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
ActsTrk::TrackFindingAlg::m_phiMin
Gaudi::Property< std::vector< double > > m_phiMin
Definition: TrackFindingAlg.h:119
TableUtils::defineSimpleRatio
RatioDefinition defineSimpleRatio(T numerator, T denominator)
Definition: TableUtils.h:382
ActsTrk::TrackFindingAlg::initPixelStripCounts
static void initPixelStripCounts(const detail::RecoTrackContainer::TrackProxy &track)
Definition: TrackFindingAlg.cxx:903
ActsTrk::TrackFindingAlg::m_refitSeeds
Gaudi::Property< std::vector< bool > > m_refitSeeds
Definition: TrackFindingAlg.h:103
ActsTrk::TrackFindingAlg::trackFinder
CKF_pimpl & trackFinder()
Definition: TrackFindingAlg.cxx:55
ActsTrk::prefixFromTrackContainerName
std::string prefixFromTrackContainerName(const std::string &tracks)
Parse TrackContainer name to get the prefix for backends The name has to contain XYZTracks,...
Definition: TrackContainerHandlesHelper.cxx:18
ActsTrk::TrackFindingAlg::m_branchStopperPtMinFactor
Gaudi::Property< double > m_branchStopperPtMinFactor
Definition: TrackFindingAlg.h:114
ActsTrk::TrackFindingAlg::BranchState::nStripHoles
static constexpr Acts::ProxyAccessor< unsigned int > nStripHoles
Definition: TrackFindingAlg.h:222
ActsTrk::TrackFindingAlg::m_maxOutliers
Gaudi::Property< std::vector< std::size_t > > m_maxOutliers
Definition: TrackFindingAlg.h:134
ActsTrk::TrackFindingAlg::kNOutputTracks
@ kNOutputTracks
Definition: TrackFindingAlg.h:160
ActsTrk::TrackFindingAlg::kNUsedSeeds
@ kNUsedSeeds
Definition: TrackFindingAlg.h:157
ActsTrk::TrackFindingAlg::m_useAbsEtaForStat
bool m_useAbsEtaForStat
Definition: TrackFindingAlg.h:254
ActsTrk::detail::RecoTrackContainerProxy
RecoTrackContainer::TrackProxy RecoTrackContainerProxy
Definition: Tracking/Acts/ActsTrackReconstruction/src/detail/Definitions.h:24
ActsTrk::TrackFindingAlg::BranchState::nStripOutliers
static constexpr Acts::ProxyAccessor< unsigned int > nStripOutliers
Definition: TrackFindingAlg.h:224
ActsTrk::TrackFindingAlg::kNoTrackParam
@ kNoTrackParam
Definition: TrackFindingAlg.h:156
ActsTrk::TrackFindingAlg::m_seedContainerKeys
SG::ReadHandleKeyArray< ActsTrk::SeedContainer > m_seedContainerKeys
Definition: TrackFindingAlg.h:89
ActsTrk::TrackFindingAlg::m_minPixelHits
Gaudi::Property< std::vector< std::size_t > > m_minPixelHits
Definition: TrackFindingAlg.h:139
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
ActsTrk::detail::RecoTrackContainer
Acts::TrackContainer< Acts::VectorTrackContainer, Acts::VectorMultiTrajectory > RecoTrackContainer
Definition: Tracking/Acts/ActsTrackReconstruction/src/detail/Definitions.h:23
empty
bool empty(TH1 *h)
Definition: computils.cxx:295
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
ActsTrk::MutableTrackContainerHandlesHelper::initialize
StatusCode initialize(const std::string &prefix)
Sets up the handles.
Definition: TrackContainerHandlesHelper.cxx:51
python.utils.AtlRunQueryTimer.timer
def timer(name, disabled=False)
Definition: AtlRunQueryTimer.py:86
ActsTrk::TrackFindingAlg::m_z0Min
Gaudi::Property< std::vector< double > > m_z0Min
Definition: TrackFindingAlg.h:129
ActsTrk::TrackFindingAlg::m_maxPropagationStep
Gaudi::Property< unsigned int > m_maxPropagationStep
Definition: TrackFindingAlg.h:101
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
TableUtils::subCategoryStride
constexpr std::size_t subCategoryStride([[maybe_unused]] const std::size_t categories, [[maybe_unused]] const std::size_t sub_categories, [[maybe_unused]] const std::size_t n_counter)
Definition: TableUtils.h:302
ActsTrk::TrackFindingAlg::nSeedCollections
std::size_t nSeedCollections() const
Definition: TrackFindingAlg.h:243
ActsTrk::TrackFindingAlg::m_estimatedTrackParametersKeys
SG::ReadHandleKeyArray< ActsTrk::BoundTrackParametersContainer > m_estimatedTrackParametersKeys
Definition: TrackFindingAlg.h:90
ActsTrk::detail::getMeasurementSelector
std::unique_ptr< ActsTrk::IMeasurementSelector > getMeasurementSelector(const ActsTrk::IOnBoundStateCalibratorTool *onTrackCalibratorTool, const std::vector< float > &etaBinsf, const std::vector< std::pair< float, float > > &chi2CutOffOutlier, const std::vector< size_t > &numMeasurementsCutOff)
Definition: AtlasMeasurementSelector.cxx:333
ActsTrk::TrackFindingAlg::BranchState::nPixelHoles
static constexpr Acts::ProxyAccessor< unsigned int > nPixelHoles
Definition: TrackFindingAlg.h:221
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
ActsTrk::TrackFindingAlg::m_uncalibratedMeasurementContainerKeys
SG::ReadHandleKeyArray< xAOD::UncalibratedMeasurementContainer > m_uncalibratedMeasurementContainerKeys
Definition: TrackFindingAlg.h:92
makeActsAthenaLogger
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger(IMessageSvc *svc, const std::string &name, int level, std::optional< std::string > parent_name)
Definition: Tracking/Acts/ActsInterop/src/Logger.cxx:64
ActsTrk::TrackFindingAlg::copyStats
void copyStats(const EventStats &event_stat) const
Definition: TrackFindingAlg.cxx:1012
ActsTrk::TrackFindingAlg::m_chi2OutlierCutOff
Gaudi::Property< std::vector< double > > m_chi2OutlierCutOff
Definition: TrackFindingAlg.h:107
ActsTrk::TrackFindingAlg::finalize
virtual StatusCode finalize() override
Definition: TrackFindingAlg.cxx:251
ActsTrk::TrackFindingAlg::printStatTables
void printStatTables() const
Definition: TrackFindingAlg.cxx:1028
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
ActsTrk::detail::UncalibSourceLinkAccessor
GenUncalibSourceLinkAccessor< MeasurementRangeList > UncalibSourceLinkAccessor
Definition: AtlasUncalibSourceLinkAccessor.h:205
ActsTrk::TrackFindingAlg::s_branchState
static constexpr BranchState s_branchState
Definition: TrackFindingAlg.h:226
HGTD_ClusterCollection.h
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
ActsTrk::TrackFindingAlg::computeStatSum
std::size_t computeStatSum(std::size_t seed_collection, EStat counter_i, const EventStats &stat) const
Definition: TrackFindingAlg.cxx:1220
OnTrackCalibrator.h
ActsTrk::TrackFindingAlg::kNDuplicateSeeds
@ kNDuplicateSeeds
Definition: TrackFindingAlg.h:159
ActsTrk::TrackFindingAlg::m_addPixelStripCounts
Gaudi::Property< bool > m_addPixelStripCounts
Definition: TrackFindingAlg.h:138
ActsTrk::TrackFindingAlg::m_seedLabels
Gaudi::Property< std::vector< std::string > > m_seedLabels
Definition: TrackFindingAlg.h:148
SCT_ClusterCollection.h
xAOD::etaBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin
Definition: L2StandAloneMuon_v1.cxx:148
xAOD::addTrack
@ addTrack
Definition: TrackingPrimitives.h:465
TableUtils::counterStride
constexpr std::size_t counterStride([[maybe_unused]] const std::size_t categories, [[maybe_unused]] const std::size_t sub_categories, [[maybe_unused]] const std::size_t n_counter)
Definition: TableUtils.h:307
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ActsTrk::TrackFindingAlg::m_stripCalibTool
ToolHandle< ActsTrk::IOnTrackCalibratorTool< detail::RecoTrackStateContainer > > m_stripCalibTool
Definition: TrackFindingAlg.h:82
makeTable
TableUtils::StatTable< T > makeTable(const std::array< T, N > &counter, const std::array< std::string, N > &label)
Definition: TableUtils.h:521
TableUtils::maxLabelWidth
std::size_t maxLabelWidth(const T_Collection &col)
Definition: TableUtils.h:288
ActsTrk::TrackFindingAlg::findTracks
StatusCode findTracks(const EventContext &ctx, const Acts::TrackingGeometry &trackingGeometry, const ActsTrk::DetectorElementToActsGeometryIdMap &detectorElementToGeoId, const detail::TrackFindingMeasurements &measurements, detail::DuplicateSeedDetector &duplicateSeedDetector, const ActsTrk::BoundTrackParametersContainer &estimatedTrackParameters, const ActsTrk::SeedContainer *seeds, ActsTrk::MutableTrackContainer &tracksContainer, size_t seedCollectionIndex, const char *seedType, EventStats &event_stat) const
invoke track finding procedure
Definition: TrackFindingAlg.cxx:390
lumiFormat.i
int i
Definition: lumiFormat.py:85
ActsTrk::TrackFindingAlg::m_d0Max
Gaudi::Property< std::vector< double > > m_d0Max
Definition: TrackFindingAlg.h:128
ActsTrk::detail::GenUncalibSourceLinkAccessor::range
std::pair< Iterator, Iterator > range(const Acts::Surface &surface) const
Definition: AtlasUncalibSourceLinkAccessor.h:161
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ActsTrk::detail::CKF_config
Definition: Tracking/Acts/ActsTrackReconstruction/src/detail/Definitions.h:40
ActsTrk::TrackFindingAlg::m_ptMin
Gaudi::Property< std::vector< double > > m_ptMin
Definition: TrackFindingAlg.h:125
ActsTrk::TrackFindingAlg::storeSeedInfo
void storeSeedInfo(const detail::RecoTrackContainer &tracksContainer, const detail::RecoTrackContainerProxy &track, detail::DuplicateSeedDetector &duplicateSeedDetector) const
Definition: TrackFindingAlg.cxx:853
ActsTrk::detail::TrackFindingMeasurements::measurementContainerOffsets
std::vector< std::pair< const xAOD::UncalibratedMeasurementContainer *, std::size_t > > measurementContainerOffsets() const
Definition: TrackFindingMeasurements.cxx:82
ActsTrk::TrackFindingAlg::initializeMeasurementSelector
StatusCode initializeMeasurementSelector()
Definition: TrackFindingAlg.cxx:1234
plotBeamSpotVert.cuts
string cuts
Definition: plotBeamSpotVert.py:93
xAOD::Other
@ Other
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ActsTrk::TrackFindingAlg::kNStoppedTracksMinPt
@ kNStoppedTracksMinPt
Definition: TrackFindingAlg.h:166
ActsTrk::TrackFindingAlg::m_absEtaMin
Gaudi::Property< double > m_absEtaMin
Definition: TrackFindingAlg.h:123
python.AtlRunQueryLib.options
options
Definition: AtlRunQueryLib.py:379
ActsDetectorElement
Definition: ActsDetectorElement.h:42
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
ActsTrk::detail::CKF_config::ckf
CKF ckf
Definition: Tracking/Acts/ActsTrackReconstruction/src/detail/Definitions.h:44
TrackSummary.h
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
ActsTrk::TrackFindingAlg::m_maxPixelOutliers
Gaudi::Property< std::vector< std::size_t > > m_maxPixelOutliers
Definition: TrackFindingAlg.h:143
PixelClusterCollection.h
ActsTrk::TrackFindingAlg::m_numMeasurementsCutOff
Gaudi::Property< std::vector< size_t > > m_numMeasurementsCutOff
Definition: TrackFindingAlg.h:108
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
ActsTrk::TrackFindingAlg::m_useDefaultMeasurementSelector
Gaudi::Property< bool > m_useDefaultMeasurementSelector
Definition: TrackFindingAlg.h:151
beamspotman.stat
stat
Definition: beamspotman.py:266
ActsTrk::TrackFindingAlg::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: TrackFindingAlg.h:75
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
ActsTrk::TrackFindingAlg::m_trackStatePrinter
ToolHandle< ActsTrk::TrackStatePrinterTool > m_trackStatePrinter
Definition: TrackFindingAlg.h:78
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
ActsTrk::TrackFindingAlg::m_measurementSelector
std::unique_ptr< ActsTrk::IMeasurementSelector > m_measurementSelector
Definition: TrackFindingAlg.h:213
ActsTrk::detail::DuplicateSeedDetector::addMeasurement
void addMeasurement(const ActsTrk::ATLASUncalibSourceLink &sl)
Definition: DuplicateSeedDetector.cxx:56
ActsTrk::TrackFindingAlg::kNRejectedRefinedSeeds
@ kNRejectedRefinedSeeds
Definition: TrackFindingAlg.h:161
ActsTrk::TrackFindingAlg::initialize
virtual StatusCode initialize() override
Definition: TrackFindingAlg.cxx:68
ActsTrk::detail::TrackFindingMeasurements::addMeasurements
void addMeasurements(std::size_t typeIndex, const xAOD::UncalibratedMeasurementContainer &clusterContainer, const DetectorElementToActsGeometryIdMap &detectorElementToGeoid)
Definition: TrackFindingMeasurements.cxx:14
ActsTrk::TrackFindingAlg::checkPixelStripCounts
void checkPixelStripCounts(const detail::RecoTrackContainer::TrackProxy &track) const
Definition: TrackFindingAlg.cxx:950
TableUtils::makeLabelVector
std::vector< std::string > makeLabelVector(T_index n_entries, std::initializer_list< std::pair< T_index, T_string > > a_list)
Definition: TableUtils.h:273
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
RIO_OnTrack.h
checkNSWValTree.Options
Options
Definition: checkNSWValTree.py:15
AtlasMeasurementSelector.h
ActsTrk::TrackFindingAlg::kMultipleBranches
@ kMultipleBranches
Definition: TrackFindingAlg.h:164
ActsTrk::detail::DuplicateSeedDetector::newTrajectory
void newTrajectory()
Definition: DuplicateSeedDetector.cxx:44
ActsTrk::TrackFindingAlg::BranchState::nPixelHits
static constexpr Acts::ProxyAccessor< unsigned int > nPixelHits
Definition: TrackFindingAlg.h:219
ActsTrk::TrackFindingAlg::m_z0Max
Gaudi::Property< std::vector< double > > m_z0Max
Definition: TrackFindingAlg.h:130
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
WriteCaloSwCorrections.cfg
cfg
Definition: WriteCaloSwCorrections.py:23
TableUtils::splitRatioDefinitionsAndLabels
std::tuple< std::vector< std::string >, std::vector< RatioDefinition > > splitRatioDefinitionsAndLabels(std::initializer_list< std::tuple< std::string, RatioDefinition > > a_ratio_list)
Definition: TableUtils.h:446
ActsTrk::detail::TrackFindingMeasurements::measurementRanges
const ActsTrk::detail::MeasurementRangeList & measurementRanges() const
ActsTrk::TrackFindingAlg::~TrackFindingAlg
virtual ~TrackFindingAlg()
ActsTrk::TrackFindingAlg::m_chi2CutOff
Gaudi::Property< std::vector< double > > m_chi2CutOff
Definition: TrackFindingAlg.h:106
ActsTrk::detail::Stepper
Acts::SympyStepper Stepper
Adapted from Acts Examples/Algorithms/TrackFinding/src/TrackFindingAlgorithmFunction....
Definition: Tracking/Acts/ActsTrackReconstruction/src/detail/Definitions.h:30
ActsTrk::TrackFindingAlg::copyPixelStripCounts
static void copyPixelStripCounts(const detail::RecoTrackContainer::TrackProxy &track, const detail::RecoTrackContainer::TrackProxy &other)
Definition: TrackFindingAlg.cxx:938
ActsTrk::TrackFindingAlg::m_doBranchStopper
Gaudi::Property< bool > m_doBranchStopper
Definition: TrackFindingAlg.h:111
TableUtils::makeEtaBinLabel
std::string makeEtaBinLabel(const std::vector< float > &eta_bins, std::size_t eta_bin_i, bool abs_eta=false)
Definition: TableUtils.h:512
ActsTrk::detail::DuplicateSeedDetector::isDuplicate
bool isDuplicate(std::size_t typeIndex, std::size_t iseed)
Definition: DuplicateSeedDetector.cxx:75
ActsTrk::TrackFindingAlg::m_maxStripOutliers
Gaudi::Property< std::vector< std::size_t > > m_maxStripOutliers
Definition: TrackFindingAlg.h:144
ActsTrk::TrackFindingAlg::m_skipDuplicateSeeds
Gaudi::Property< bool > m_skipDuplicateSeeds
Definition: TrackFindingAlg.h:102
mergePhysValFiles.categories
list categories
Definition: PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/scripts/mergePhysValFiles.py:18
ActsTrk::detail::CKF_config::measurementSelector
Acts::MeasurementSelector measurementSelector
Definition: Tracking/Acts/ActsTrackReconstruction/src/detail/Definitions.h:46
ActsTrk::TrackFindingAlg::CKF_pimpl
Definition: TrackFindingAlg.cxx:52
FitterHelperFunctions.h
ActsTrk::TrackFindingAlg::getStatCategory
std::size_t getStatCategory(std::size_t seed_collection, float eta) const
Definition: TrackFindingAlg.cxx:1210
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
ActsTrk::TrackFindingAlg::BranchState::nStripHits
static constexpr Acts::ProxyAccessor< unsigned int > nStripHits
Definition: TrackFindingAlg.h:220
ActsTrk::TrackFindingAlg::m_minStripHits
Gaudi::Property< std::vector< std::size_t > > m_minStripHits
Definition: TrackFindingAlg.h:140
ActsTrk::TrackFindingAlg::initStatTables
void initStatTables()
Definition: TrackFindingAlg.cxx:993
ActsTrk::detail::Propagator
Acts::Propagator< Stepper, Navigator > Propagator
Definition: Tracking/Acts/ActsTrackReconstruction/src/detail/Definitions.h:32
python.compareTCTs.ratio
ratio
Definition: compareTCTs.py:295
ActsTrk::TrackFindingAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: TrackFindingAlg.cxx:259
TrackFindingAlg.h
ActsTrk::TrackFindingAlg::m_etaMin
Gaudi::Property< std::vector< double > > m_etaMin
Definition: TrackFindingAlg.h:121
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
ActsTrk::TrackFindingAlg::kNStat
@ kNStat
Definition: TrackFindingAlg.h:168
ActsTrk::TrackFindingAlg::m_minMeasurements
Gaudi::Property< std::vector< std::size_t > > m_minMeasurements
Definition: TrackFindingAlg.h:132
ActsTrk::detail::TrackFindingMeasurements::measurementOffsets
const std::vector< std::size_t > & measurementOffsets() const
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
ActsTrk::TrackFindingAlg::updatePixelStripCounts
static void updatePixelStripCounts(const detail::RecoTrackContainer::TrackProxy &track, Acts::ConstTrackStateType typeFlags, xAOD::UncalibMeasType detType)
Definition: TrackFindingAlg.cxx:914
DeMoScan.first
bool first
Definition: DeMoScan.py:536
ActsTrk::TrackFindingAlg::m_ptMinMeasurements
Gaudi::Property< std::vector< std::size_t > > m_ptMinMeasurements
Definition: TrackFindingAlg.h:109
plotBeamSpotMon.mon
mon
Definition: plotBeamSpotMon.py:67
ActsTrk::TrackFindingAlg::m_logger
std::unique_ptr< const Acts::Logger > m_logger
logging instance
Definition: TrackFindingAlg.h:265
ActsTrk::TrackFindingAlg::m_tracksBackendHandlesHelper
ActsTrk::MutableTrackContainerHandlesHelper m_tracksBackendHandlesHelper
Definition: TrackFindingAlg.h:98
xAOD::UncalibMeasType
UncalibMeasType
Define the type of the uncalibrated measurement.
Definition: MeasurementDefs.h:24
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
ActsTrk::TrackFindingAlg::m_trackFinder
std::unique_ptr< CKF_pimpl > m_trackFinder
Definition: TrackFindingAlg.h:214
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
ActsTrk::TrackFindingAlg::m_doTwoWay
Gaudi::Property< bool > m_doTwoWay
Definition: TrackFindingAlg.h:112
ActsTrk::TrackFindingAlg::EventStats
std::vector< std::array< unsigned int, kNStat > > EventStats
Definition: TrackFindingAlg.h:170
ActsTrk::TrackFindingAlg::m_trackContainerKey
SG::WriteHandleKey< ActsTrk::TrackContainer > m_trackContainerKey
Definition: TrackFindingAlg.h:97
ActsTrk::TrackFindingAlg::m_reverseSearch
Gaudi::Property< std::vector< bool > > m_reverseSearch
Definition: TrackFindingAlg.h:113
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
ActsTrk::TrackFindingAlg::kNTotalSeeds
@ kNTotalSeeds
Definition: TrackFindingAlg.h:155
ActsTrk::TrackFindingAlg::kNSelectedTracks
@ kNSelectedTracks
Definition: TrackFindingAlg.h:162
ActsTrk::TrackFindingAlg::kNoSecond
@ kNoSecond
Definition: TrackFindingAlg.h:165
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:54
ActsTrk::TrackFindingAlg::m_absEtaMaxMeasurements
Gaudi::Property< std::vector< std::size_t > > m_absEtaMaxMeasurements
Definition: TrackFindingAlg.h:110
ActsTrk::TrackFindingAlg::m_etaBins
Gaudi::Property< std::vector< double > > m_etaBins
Definition: TrackFindingAlg.h:104
ActsTrk::TrackFindingAlg::m_maxChi2
Gaudi::Property< std::vector< double > > m_maxChi2
Definition: TrackFindingAlg.h:136
ActsTrk::TrackFindingAlg::seedCollectionStride
std::size_t seedCollectionStride() const
Definition: TrackFindingAlg.h:247
TableUtils.h
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
TableUtils::makeRatioDefinition
std::tuple< std::string, RatioDefinition > makeRatioDefinition(std::string &&name, std::vector< SummandDefinition > &&numerator, std::vector< SummandDefinition > &&denominator)
Definition: TableUtils.h:436
ActsTrk::TrackFindingAlg::m_ptMax
Gaudi::Property< std::vector< double > > m_ptMax
Definition: TrackFindingAlg.h:126
ActsTrk::detail::OnTrackCalibrator
Definition: IOnTrackCalibratorTool.h:14
TableUtils::ratioStride
constexpr std::size_t ratioStride([[maybe_unused]] const std::size_t categories, [[maybe_unused]] const std::size_t sub_categories, [[maybe_unused]] const std::vector< RatioDefinition > &ratio_def)
Definition: TableUtils.h:471
ToolStore.h
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
TableUtils::computeRatios
std::vector< float > computeRatios(const std::vector< RatioDefinition > &ratio_def, const std::size_t categories, const std::size_t sub_categories, const std::vector< std::size_t > &counter)
Definition: TableUtils.cxx:21
TableUtils::defineSummand
SummandDefinition defineSummand(T counter_idx, int multiplier)
Definition: TableUtils.h:400
Logger.h
PixelClusterOnTrack.h
ActsTrk::TrackFindingAlg::m_phiMax
Gaudi::Property< std::vector< double > > m_phiMax
Definition: TrackFindingAlg.h:120
ActsTrk::TrackFindingAlg::EStat
EStat
Definition: TrackFindingAlg.h:154
ActsTrk::MutableTrackContainer
Definition: TrackContainer.h:122
ActsTrk::TrackFindingAlg::m_dumpAllStatEtaBins
Gaudi::Property< bool > m_dumpAllStatEtaBins
Definition: TrackFindingAlg.h:149
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
TrackContainer.h
ActsTrk::TrackFindingAlg::m_etaMax
Gaudi::Property< std::vector< double > > m_etaMax
Definition: TrackFindingAlg.h:122
Monitored::Timer
A monitored timer.
Definition: MonitoredTimer.h:32
ActsTrk::detail::CKF_config::ckfExtensions
Acts::CombinatorialKalmanFilterExtensions< RecoTrackContainer > ckfExtensions
Definition: Tracking/Acts/ActsTrackReconstruction/src/detail/Definitions.h:47
checkFileSG.ind
list ind
Definition: checkFileSG.py:118
ActsTrk::detail::DuplicateSeedDetector
Definition: DuplicateSeedDetector.h:19
HGTD_ClusterOnTrack.h
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration.
xAOD::UncalibMeasType::PixelClusterType
@ PixelClusterType
ActsTrk::TrackFindingAlg::kNStoppedTracksMaxHoles
@ kNStoppedTracksMaxHoles
Definition: TrackFindingAlg.h:163
ActsTrk::TrackFindingAlg::m_fitterTool
ToolHandle< ActsTrk::IFitterTool > m_fitterTool
Definition: TrackFindingAlg.h:79
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
ActsTrk::TrackFindingAlg::m_pixelCalibTool
ToolHandle< ActsTrk::IOnTrackCalibratorTool< detail::RecoTrackStateContainer > > m_pixelCalibTool
Definition: TrackFindingAlg.h:80
ActsTrk::TrackFindingAlg::m_d0Min
Gaudi::Property< std::vector< double > > m_d0Min
Definition: TrackFindingAlg.h:127
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
ActsTrk::TrackFindingAlg::m_maxHoles
Gaudi::Property< std::vector< std::size_t > > m_maxHoles
Definition: TrackFindingAlg.h:133