ATLAS Offline Software
TrackStatePrinterTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ACTSTRACKRECONSTRUCTION_TRACKSTATEPRINTERTOOL_H
6 #define ACTSTRACKRECONSTRUCTION_TRACKSTATEPRINTERTOOL_H
7 
8 // Base
10 
11 // ATHENA
13 #include "GaudiKernel/EventContext.h"
17 
18 // ACTS CORE
19 #include "Acts/Geometry/TrackingGeometry.hpp"
20 #include "Acts/EventData/TrackParameters.hpp"
21 #include "Acts/EventData/TrackStateType.hpp"
22 
23 // PACKAGE
25 #include "ActsEvent/Seed.h"
30 
32 
33 // Other
34 #include <vector>
35 #include <memory>
36 #include <tuple>
37 #include <boost/container/small_vector.hpp>
38 
39 namespace Acts
40 {
41  class Surface;
42 }
43 
44 namespace ActsTrk
45 {
46  class TrackStatePrinterTool : virtual public AthAlgTool
47  {
48  public:
49  TrackStatePrinterTool(const std::string &type,
50  const std::string &name,
51  const IInterface *parent);
52  virtual ~TrackStatePrinterTool() = default;
53 
54  // standard Athena methods
55  virtual StatusCode initialize() override;
56 
57  void
58  printMeasurements(const EventContext &ctx,
59  const std::vector<const xAOD::UncalibratedMeasurementContainer *> &clusterContainers,
60  const DetectorElementToActsGeometryIdMap &detectorElementToGeometryIdMap,
61  const std::vector<size_t> &offsets) const;
62 
63  void
64  printSeed(const Acts::GeometryContext &tgContext,
65  const ActsTrk::Seed &seed,
66  const Acts::BoundTrackParameters &initialParameters,
67  const std::vector<std::pair<const xAOD::UncalibratedMeasurementContainer *, size_t>> &offset,
68  size_t iseed,
69  bool isKF) const;
70 
71  template <typename track_container_t>
72  void
73  printTrack(const Acts::GeometryContext &tgContext,
74  const track_container_t &tracks,
75  const typename track_container_t::TrackProxy &track,
76  const std::vector<std::pair<const xAOD::UncalibratedMeasurementContainer *, size_t>> &offset) const;
77 
78  template <typename track_state_proxy_t>
79  bool
80  printTrackState(const Acts::GeometryContext &tgContext,
81  const track_state_proxy_t &state,
82  const std::vector<std::pair<const xAOD::UncalibratedMeasurementContainer *, size_t>> &container_offset,
83  bool useFiltered = false,
84  bool newLine = true) const;
85 
86  using MeasurementInfo = std::tuple<size_t,
87  const ATLASUncalibSourceLink *,
88  std::vector<const xAOD::SpacePoint *>>;
89 
90  private:
91  // Handles
92  SG::ReadHandleKeyArray<xAOD::SpacePointContainer> m_spacePointKey{this, "InputSpacePoints", {}, "Input Space Points for debugging"};
93 
94  // Tools
95  ToolHandle<IActsTrackingGeometryTool> m_trackingGeometryTool{this, "TrackingGeometryTool", ""};
96 
97  // Configuration
98  Gaudi::Property<bool> m_compareMeasurementTransforms{this, "compareMeasurementTransforms", false, "compare measurement coordinates transformed with Athena or ACTS"};
99  Gaudi::Property<bool> m_printFilteredStates{this, "printFilteredStates", false, "print track states during filtering"};
100 
101  // most measurements are associated to only one SP, but allow some headroom to reduce number of allocations
102  static constexpr unsigned int N_SP_PER_MEAS = 2;
103  template <class T>
104  using small_vector = boost::container::small_vector<T, N_SP_PER_MEAS>;
105 
106  std::vector<std::vector<small_vector<const xAOD::SpacePoint *>>>
107  addSpacePoints(const EventContext &ctx,
108  const std::vector<const xAOD::UncalibratedMeasurementContainer *> &clusterContainers,
109  const std::vector<size_t> &offset) const;
110 
111  void
112  printMeasurementAssociatedSpacePoint(const Acts::GeometryContext &tgContext,
113  const Acts::TrackingGeometry &tracking_geometry,
114  const DetectorElementToActsGeometryIdMap &detectorElementToGeometryIdMap,
115  const xAOD::UncalibratedMeasurement *measurement,
116  const std::vector<small_vector<const xAOD::SpacePoint *>> &measToSp,
117  size_t offset) const;
118 
119  // static member functions used by TrackStatePrinter.icc
120  static void printParameters(const Acts::Surface &surface, const Acts::GeometryContext &tgContext, const Acts::BoundVector &bound);
121  static std::string actsSurfaceName(const Acts::Surface &surface);
122  static std::string trackStateName(Acts::ConstTrackStateType trackStateType);
123 
124  };
125 
126 } // namespace
127 
129 
130 #endif
ReadHandleKeyArray.h
ActsTrk::TrackStatePrinterTool::TrackStatePrinterTool
TrackStatePrinterTool(const std::string &type, const std::string &name, const IInterface *parent)
=========================================================================
Definition: TrackStatePrinterTool.cxx:430
ActsTrk::TrackStatePrinterTool::addSpacePoints
std::vector< std::vector< small_vector< const xAOD::SpacePoint * > > > addSpacePoints(const EventContext &ctx, const std::vector< const xAOD::UncalibratedMeasurementContainer * > &clusterContainers, const std::vector< size_t > &offset) const
Definition: TrackStatePrinterTool.cxx:523
ActsTrk::TrackStatePrinterTool::printTrack
void printTrack(const Acts::GeometryContext &tgContext, const track_container_t &tracks, const typename track_container_t::TrackProxy &track, const std::vector< std::pair< const xAOD::UncalibratedMeasurementContainer *, size_t >> &offset) const
ActsTrk::DetectorElementToActsGeometryIdMap
Definition: DetectorElementToActsGeometryIdMap.h:31
ActsGeometryContext.h
ActsTrk::TrackStatePrinterTool::printSeed
void printSeed(const Acts::GeometryContext &tgContext, const ActsTrk::Seed &seed, const Acts::BoundTrackParameters &initialParameters, const std::vector< std::pair< const xAOD::UncalibratedMeasurementContainer *, size_t >> &offset, size_t iseed, bool isKF) const
Definition: TrackStatePrinterTool.cxx:450
Surface
Definition: Trigger/TrigAccel/TrigCudaFitter/src/Surface.h:8
ActsTrk::TrackStatePrinterTool::printMeasurementAssociatedSpacePoint
void printMeasurementAssociatedSpacePoint(const Acts::GeometryContext &tgContext, const Acts::TrackingGeometry &tracking_geometry, const DetectorElementToActsGeometryIdMap &detectorElementToGeometryIdMap, const xAOD::UncalibratedMeasurement *measurement, const std::vector< small_vector< const xAOD::SpacePoint * >> &measToSp, size_t offset) const
Definition: TrackStatePrinterTool.cxx:342
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
ActsTrk::TrackStatePrinterTool::m_compareMeasurementTransforms
Gaudi::Property< bool > m_compareMeasurementTransforms
Definition: TrackStatePrinterTool.h:98
ActsTrk::TrackStatePrinterTool::printParameters
static void printParameters(const Acts::Surface &surface, const Acts::GeometryContext &tgContext, const Acts::BoundVector &bound)
Definition: TrackStatePrinterTool.cxx:409
GeoPrimitives.h
xAOD::UncalibratedMeasurement_v1
Definition: UncalibratedMeasurement_v1.h:13
ActsTrk::TrackStatePrinterTool::MeasurementInfo
std::tuple< size_t, const ATLASUncalibSourceLink *, std::vector< const xAOD::SpacePoint * > > MeasurementInfo
Definition: TrackStatePrinterTool.h:88
Acts
Definition: ChamberAssembleTool.h:18
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
UncalibratedMeasurementContainer.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TrackStatePrinterTool.icc
ActsTrk::TrackStatePrinterTool::m_spacePointKey
SG::ReadHandleKeyArray< xAOD::SpacePointContainer > m_spacePointKey
Definition: TrackStatePrinterTool.h:92
ActsTrk::Seed
Acts::Seed< xAOD::SpacePoint, 3ul > Seed
Definition: Seed.h:12
SpacePoint.h
ActsTrk::TrackStatePrinterTool::printMeasurements
void printMeasurements(const EventContext &ctx, const std::vector< const xAOD::UncalibratedMeasurementContainer * > &clusterContainers, const DetectorElementToActsGeometryIdMap &detectorElementToGeometryIdMap, const std::vector< size_t > &offsets) const
Definition: TrackStatePrinterTool.cxx:489
ActsTrk::TrackStatePrinterTool::m_printFilteredStates
Gaudi::Property< bool > m_printFilteredStates
Definition: TrackStatePrinterTool.h:99
ActsTrk::TrackStatePrinterTool::initialize
virtual StatusCode initialize() override
Definition: TrackStatePrinterTool.cxx:436
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Seed.h
ActsTrk::TrackStatePrinterTool::m_trackingGeometryTool
ToolHandle< IActsTrackingGeometryTool > m_trackingGeometryTool
Definition: TrackStatePrinterTool.h:95
SpacePointContainer.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
ActsTrk::TrackStatePrinterTool::printTrackState
bool printTrackState(const Acts::GeometryContext &tgContext, const track_state_proxy_t &state, const std::vector< std::pair< const xAOD::UncalibratedMeasurementContainer *, size_t >> &container_offset, bool useFiltered=false, bool newLine=true) const
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:54
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
AthAlgTool
Definition: AthAlgTool.h:26
ActsTrk::TrackStatePrinterTool::~TrackStatePrinterTool
virtual ~TrackStatePrinterTool()=default
ActsTrk::TrackStatePrinterTool::small_vector
boost::container::small_vector< T, N_SP_PER_MEAS > small_vector
Definition: TrackStatePrinterTool.h:104
ActsTrk::TrackStatePrinterTool::trackStateName
static std::string trackStateName(Acts::ConstTrackStateType trackStateType)
========================================================================= file-local static functions...
Definition: TrackStatePrinterTool.cxx:42
ActsTrk::TrackStatePrinterTool
Definition: TrackStatePrinterTool.h:47
TrackContainer.h
IActsTrackingGeometryTool.h
ActsTrk::TrackStatePrinterTool::N_SP_PER_MEAS
static constexpr unsigned int N_SP_PER_MEAS
Definition: TrackStatePrinterTool.h:102
ActsTrk::TrackStatePrinterTool::actsSurfaceName
static std::string actsSurfaceName(const Acts::Surface &surface)
Definition: TrackStatePrinterTool.cxx:62
DetectorElementToActsGeometryIdMap.h