ATLAS Offline Software
IterativePriVtxFinderTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ACTSTRKPRIVTXFINDERTOOL_ITERATIVEPRIVTXFINDERTOOL_H
6 #define ACTSTRKPRIVTXFINDERTOOL_ITERATIVEPRIVTXFINDERTOOL_H
7 
8 // ATHENA
10 #include "GaudiKernel/IInterface.h"
11 #include "GaudiKernel/ServiceHandle.h"
12 #include "Gaudi/Property.h"
13 #include "GaudiKernel/EventContext.h"
17 #include "TrkTrack/LinkToTrack.h"
19 
20 // Need to include this early; otherwise, we run into errors with
21 // ReferenceWrapperAnyCompat in clang builds due the is_constructable
22 // specialization defined there getting implicitly instantiated earlier.
23 #include "Acts/Propagator/Propagator.hpp"
24 #include "ActsInterop/Logger.h"
25 
26 // PACKAGE
31 
32 // ACTS
33 #include "Acts/Propagator/EigenStepper.hpp"
34 #include "Acts/Propagator/Propagator.hpp"
35 #include "Acts/Propagator/Navigator.hpp"
36 #include "Acts/Surfaces/PerigeeSurface.hpp"
37 #include "Acts/Definitions/Units.hpp"
38 #include "Acts/Utilities/Helpers.hpp"
39 #include "Acts/Vertexing/IterativeVertexFinder.hpp"
40 #include "Acts/Vertexing/FullBilloirVertexFitter.hpp"
41 #include "Acts/Vertexing/HelicalTrackLinearizer.hpp"
42 #include "Acts/Vertexing/TrackDensityVertexFinder.hpp"
43 #include "Acts/Vertexing/TrackAtVertex.hpp"
44 #include "Acts/Vertexing/Vertex.hpp"
45 #include "Acts/Vertexing/ImpactPointEstimator.hpp"
46 #include "Acts/Utilities/Logger.hpp"
47 
48 
49 #include <cmath>
50 #include <optional>
51 
52 namespace Acts {
53 class Surface;
54 class BoundaryCheck;
55 }
56 
57 namespace ActsTrk {
58  class IterativePriVtxFinderTool : public extends<AthAlgTool, InDet::IVertexFinder>
59  {
60 
61  // Track wrapper input for the Acts vertexing
62  class TrackWrapper {
63  public:
64  TrackWrapper(const Trk::ITrackLink* trkLink, const Acts::BoundTrackParameters& boundParams)
65  : m_trkLink(trkLink)
66  , m_boundParams(boundParams)
67  {}
68 
69  const Acts::BoundTrackParameters& parameters() const {return m_boundParams;}
70 
71  const Trk::ITrackLink* trackLink() const {return m_trkLink;}
72 
73  static Acts::BoundTrackParameters extractParameters(const Acts::InputTrack& input) {
74  return input.template as<TrackWrapper>()->parameters();
75  }
76 
77  private:
79  Acts::BoundTrackParameters m_boundParams;
80  };
81 
82  public:
83  virtual StatusCode initialize() override;
84 
88  IterativePriVtxFinderTool(const std::string& type,
89  const std::string& name,
90  const IInterface* parent);
91 
93 
94  virtual std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
95  findVertex(const EventContext& ctx, const TrackCollection* trackTES) const override;
96 
97  virtual std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
98  findVertex(const EventContext& ctx, const xAOD::TrackParticleContainer* trackParticles) const override;
99 
100  private:
101 
103  std::unique_ptr<const Acts::Logger> m_logger {nullptr};
104  const Acts::Logger &logger() const { return *m_logger; }
105 
106  std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
107  findVertex(const EventContext& ctx, const std::vector<std::unique_ptr<Trk::ITrackLink>>& trackVector) const;
108 
110  const Acts::BoundTrackParameters& bound, const Acts::Vector3& surfCenter) const;
111 
112  virtual
115  {
116  return m_trackingGeometryTool.get();
117  }
118 
119  using Propagator = Acts::Propagator<Acts::EigenStepper<>, Acts::Navigator>;
120  using TrackLinearizer = Acts::HelicalTrackLinearizer;
121  using VertexFitter = Acts::FullBilloirVertexFitter;
122  using VertexSeedFinder = Acts::TrackDensityVertexFinder;
123  using VertexFinder = Acts::IterativeVertexFinder;
124 
125  std::shared_ptr<VertexFinder> m_vertexFinder = nullptr;
126  std::shared_ptr<ATLASMagneticFieldWrapper> m_bField = nullptr;
127 
128  std::shared_ptr<Propagator> m_propagator = nullptr;
129 
130  // optional because of late initializatio
131  std::optional<TrackLinearizer> m_linearizer = std::nullopt;
132 
133  ToolHandle<IActsTrackingGeometryTool> m_trackingGeometryTool{this, "TrackingGeometryTool", "", "ActsTrackingGeometryTool"};
134  ToolHandle<IActsExtrapolationTool> m_extrapolationTool{this, "ExtrapolationTool", "", "ActsExtrapolationTool"};
135  ToolHandle<InDet::IInDetTrackSelectionTool> m_trkFilter{this, "TrackSelector", "", "InDetTrackSelectionTool"};
136  SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey {this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot"};
137 
138  // Configuration variables
139  // For details check ACTS documentation
140 
141  // Full-Billoir Fitter config variables
142  UnsignedIntegerProperty m_fitterMaxIterations{this, "fitterMaxIterations", 5, "Vertex fitter max. iterations"};
143 
144  // Iterative vertex Finder config variables
145  BooleanProperty m_useBeamConstraint{this, "useBeamConstraint", true, "Use beam constraint"};
146  DoubleProperty m_significanceCutSeeding{this, "significanceCutSeeding", 10, "Seeding Cut Significance"};
147  DoubleProperty m_maximumChi2cutForSeeding{this, "maximumChi2cutForSeeding", 36., "Max. Chi2 cut for seeding"};
148  UnsignedIntegerProperty m_maxVertices{this, "maxVertices", 50, "Max number of vertices"};
149  BooleanProperty m_createSplitVertices{this, "createSplitVertices", false, "Create split vertices or not"};
150  UnsignedIntegerProperty m_splitVerticesTrkInvFraction{this, "splitVerticesTrkInvFraction", 2, "Track Inv. fraction for split vertices"};
151  BooleanProperty m_reassignTracksAfterFirstFit{this, "reassignTracksAfterFirstFit", false, "Whether re-assign tracks after first vertex fit or not"};
152  BooleanProperty m_doMaxTracksCut{this, "doMaxTracksCut", false, "Whether use max. tracks cut or not"};
153  UnsignedIntegerProperty m_maxTracks{this, "maxTracks", 5000, "Max. number of tracks to use for vertex finding"};
154  DoubleProperty m_cutOffTrackWeight{this, "cutOffTrackWeight", 0.01, "Min. track weight allowed"};
155 
156  // Gaussian seed finder variables
157  DoubleProperty m_gaussianMaxD0Significance{this, "gaussianMaxD0Significance", 3.5, "Gaussian seeder max d0 track significance"};
158  DoubleProperty m_gaussianMaxZ0Significance{this, "gaussianMaxDZSignificance", 12.0, "Gaussian seeder max z0 track significance"};
159 
160  // IP Estimator config
161  UnsignedIntegerProperty m_ipEstMaxIterations{this, "ipEstMaxIterations", 20, "IpEstimator max. iterations"};
162  DoubleProperty m_ipEstPrecision{this, "ipEstPrecision", 1e-10, "IpEstimator precision"};
163 
164  };
165 }
166 
167 #endif // ACTSTRKPRIVTXFINDERTOOL_ITERATIVEPRIVTXFINDERTOOL_H
LinkToTrack.h
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
ActsTrk::IterativePriVtxFinderTool::m_extrapolationTool
ToolHandle< IActsExtrapolationTool > m_extrapolationTool
Definition: IterativePriVtxFinderTool.h:134
ActsTrk::IterativePriVtxFinderTool::initialize
virtual StatusCode initialize() override
Definition: IterativePriVtxFinderTool.cxx:49
ActsTrk::IterativePriVtxFinderTool::m_fitterMaxIterations
UnsignedIntegerProperty m_fitterMaxIterations
Definition: IterativePriVtxFinderTool.h:142
InDet::IVertexFinder::findVertex
virtual std::pair< xAOD::VertexContainer *, xAOD::VertexAuxContainer * > findVertex(const EventContext &ctx, const TrackCollection *trackTES) const =0
Find vertex from Trk::TrackCollection.
ActsGeometryContext.h
ActsTrk::IterativePriVtxFinderTool::m_splitVerticesTrkInvFraction
UnsignedIntegerProperty m_splitVerticesTrkInvFraction
Definition: IterativePriVtxFinderTool.h:150
ActsTrk::IterativePriVtxFinderTool::m_ipEstMaxIterations
UnsignedIntegerProperty m_ipEstMaxIterations
Definition: IterativePriVtxFinderTool.h:161
ActsTrk::detail::Navigator
Acts::Navigator Navigator
Definition: Tracking/Acts/ActsTrackReconstruction/src/detail/Definitions.h:31
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
ActsTrk::IterativePriVtxFinderTool::TrackLinearizer
Acts::HelicalTrackLinearizer TrackLinearizer
Definition: IterativePriVtxFinderTool.h:120
ActsTrk::IterativePriVtxFinderTool::Propagator
Acts::Propagator< Acts::EigenStepper<>, Acts::Navigator > Propagator
Definition: IterativePriVtxFinderTool.h:119
ActsTrk::IterativePriVtxFinderTool::VertexFitter
Acts::FullBilloirVertexFitter VertexFitter
Definition: IterativePriVtxFinderTool.h:121
ActsTrk::IterativePriVtxFinderTool::TrackWrapper::trackLink
const Trk::ITrackLink * trackLink() const
Definition: IterativePriVtxFinderTool.h:71
Surface
Definition: Trigger/TrigAccel/TrigCudaFitter/src/Surface.h:8
ATLASMagneticFieldWrapper.h
ActsTrk::IterativePriVtxFinderTool::TrackWrapper::extractParameters
static Acts::BoundTrackParameters extractParameters(const Acts::InputTrack &input)
Definition: IterativePriVtxFinderTool.h:73
ActsTrk::IterativePriVtxFinderTool::TrackWrapper
Definition: IterativePriVtxFinderTool.h:62
IActsTrackingGeometryTool
Definition: IActsTrackingGeometryTool.h:18
IVertexFinder.h
ActsTrk::IterativePriVtxFinderTool
Definition: IterativePriVtxFinderTool.h:59
ActsTrk::IterativePriVtxFinderTool::m_bField
std::shared_ptr< ATLASMagneticFieldWrapper > m_bField
Definition: IterativePriVtxFinderTool.h:126
ActsTrk::IterativePriVtxFinderTool::actsBoundToTrkPerigee
Trk::Perigee * actsBoundToTrkPerigee(const Acts::BoundTrackParameters &bound, const Acts::Vector3 &surfCenter) const
Definition: IterativePriVtxFinderTool.cxx:402
ActsTrk::IterativePriVtxFinderTool::m_useBeamConstraint
BooleanProperty m_useBeamConstraint
Definition: IterativePriVtxFinderTool.h:145
ActsTrk::IterativePriVtxFinderTool::m_beamSpotKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Definition: IterativePriVtxFinderTool.h:136
ActsTrk::IterativePriVtxFinderTool::m_trackingGeometryTool
ToolHandle< IActsTrackingGeometryTool > m_trackingGeometryTool
Definition: IterativePriVtxFinderTool.h:133
Acts
Definition: ChamberAssembleTool.h:18
ActsTrk::IterativePriVtxFinderTool::m_logger
std::unique_ptr< const Acts::Logger > m_logger
logging instance
Definition: IterativePriVtxFinderTool.h:103
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ActsTrk::IterativePriVtxFinderTool::TrackWrapper::m_trkLink
const Trk::ITrackLink * m_trkLink
Definition: IterativePriVtxFinderTool.h:78
ActsTrk::IterativePriVtxFinderTool::TrackWrapper::TrackWrapper
TrackWrapper(const Trk::ITrackLink *trkLink, const Acts::BoundTrackParameters &boundParams)
Definition: IterativePriVtxFinderTool.h:64
VertexFinder
Definition: VertexFinder.h:14
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
AthAlgTool.h
ActsTrk::IterativePriVtxFinderTool::m_cutOffTrackWeight
DoubleProperty m_cutOffTrackWeight
Definition: IterativePriVtxFinderTool.h:154
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ActsTrk::IterativePriVtxFinderTool::IterativePriVtxFinderTool
IterativePriVtxFinderTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
Definition: IterativePriVtxFinderTool.cxx:42
ActsTrk::IterativePriVtxFinderTool::VertexSeedFinder
Acts::TrackDensityVertexFinder VertexSeedFinder
Definition: IterativePriVtxFinderTool.h:122
ActsTrk::IterativePriVtxFinderTool::m_maximumChi2cutForSeeding
DoubleProperty m_maximumChi2cutForSeeding
Definition: IterativePriVtxFinderTool.h:147
ActsTrk::IterativePriVtxFinderTool::m_reassignTracksAfterFirstFit
BooleanProperty m_reassignTracksAfterFirstFit
Definition: IterativePriVtxFinderTool.h:151
ActsTrk::IterativePriVtxFinderTool::m_gaussianMaxZ0Significance
DoubleProperty m_gaussianMaxZ0Significance
Definition: IterativePriVtxFinderTool.h:158
DataVector< Trk::Track >
ActsTrk::IterativePriVtxFinderTool::m_vertexFinder
std::shared_ptr< VertexFinder > m_vertexFinder
Definition: IterativePriVtxFinderTool.h:125
IInDetTrackSelectionTool.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ActsTrk::IterativePriVtxFinderTool::m_maxVertices
UnsignedIntegerProperty m_maxVertices
Definition: IterativePriVtxFinderTool.h:148
ActsTrk::IterativePriVtxFinderTool::m_gaussianMaxD0Significance
DoubleProperty m_gaussianMaxD0Significance
Definition: IterativePriVtxFinderTool.h:157
ActsTrk::IterativePriVtxFinderTool::m_linearizer
std::optional< TrackLinearizer > m_linearizer
Definition: IterativePriVtxFinderTool.h:131
ActsTrk::IterativePriVtxFinderTool::TrackWrapper::m_boundParams
Acts::BoundTrackParameters m_boundParams
Definition: IterativePriVtxFinderTool.h:79
ActsTrk::IterativePriVtxFinderTool::m_maxTracks
UnsignedIntegerProperty m_maxTracks
Definition: IterativePriVtxFinderTool.h:153
ActsTrk::IterativePriVtxFinderTool::m_significanceCutSeeding
DoubleProperty m_significanceCutSeeding
Definition: IterativePriVtxFinderTool.h:146
SG::ReadCondHandleKey< InDet::BeamSpotData >
ActsTrk::IterativePriVtxFinderTool::trackingGeometryTool
virtual const IActsTrackingGeometryTool * trackingGeometryTool() const
Definition: IterativePriVtxFinderTool.h:114
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ActsTrk::IterativePriVtxFinderTool::m_ipEstPrecision
DoubleProperty m_ipEstPrecision
Definition: IterativePriVtxFinderTool.h:162
ActsTrk::IterativePriVtxFinderTool::m_createSplitVertices
BooleanProperty m_createSplitVertices
Definition: IterativePriVtxFinderTool.h:149
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:54
BeamSpotData.h
ActsTrk::IterativePriVtxFinderTool::m_doMaxTracksCut
BooleanProperty m_doMaxTracksCut
Definition: IterativePriVtxFinderTool.h:152
Logger.h
ActsTrk::IterativePriVtxFinderTool::m_propagator
std::shared_ptr< Propagator > m_propagator
Definition: IterativePriVtxFinderTool.h:128
IActsTrackingGeometryTool.h
ActsTrk::IterativePriVtxFinderTool::TrackWrapper::parameters
const Acts::BoundTrackParameters & parameters() const
Definition: IterativePriVtxFinderTool.h:69
IActsExtrapolationTool.h
ActsTrk::IterativePriVtxFinderTool::logger
const Acts::Logger & logger() const
Definition: IterativePriVtxFinderTool.h:104
ActsTrk::IterativePriVtxFinderTool::m_trkFilter
ToolHandle< InDet::IInDetTrackSelectionTool > m_trkFilter
Definition: IterativePriVtxFinderTool.h:135
ActsTrk::IterativePriVtxFinderTool::findVertex
virtual std::pair< xAOD::VertexContainer *, xAOD::VertexAuxContainer * > findVertex(const EventContext &ctx, const TrackCollection *trackTES) const override
Definition: IterativePriVtxFinderTool.cxx:128