ATLAS Offline Software
AdaptiveMultiPriVtxFinderTool.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 ACTSTRKPRIVTXFINDERTOOL_ADAPTIVEMULTIPRIVTXFINDERTOOL_H
6 #define ACTSTRKPRIVTXFINDERTOOL_ADAPTIVEMULTIPRIVTXFINDERTOOL_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/Definitions/Units.hpp"
37 #include "Acts/Utilities/Helpers.hpp"
38 #include "Acts/Vertexing/AdaptiveMultiVertexFinder.hpp"
39 #include "Acts/Vertexing/AdaptiveMultiVertexFitter.hpp"
40 #include "Acts/Vertexing/HelicalTrackLinearizer.hpp"
41 #include "Acts/Vertexing/TrackDensityVertexFinder.hpp"
42 #include "Acts/Vertexing/TrackAtVertex.hpp"
43 #include "Acts/Vertexing/Vertex.hpp"
44 #include "Acts/Vertexing/ImpactPointEstimator.hpp"
45 
46 #include <cmath>
47 
48 namespace Acts {
49 class Surface;
50 class BoundaryCheck;
51 }
52 
53 namespace ActsTrk {
54  class AdaptiveMultiPriVtxFinderTool : public extends<AthAlgTool, InDet::IVertexFinder>
55  {
56 
57  // Track wrapper input for the Acts vertexing
58  class TrackWrapper {
59  public:
60  TrackWrapper(const Trk::ITrackLink* trkLink, const Acts::BoundTrackParameters& boundParams)
61  : m_trkLink(trkLink)
62  , m_boundParams(boundParams)
63  {}
64 
65  const Acts::BoundTrackParameters& parameters() const {return m_boundParams;}
66 
67  const Trk::ITrackLink* trackLink() const {return m_trkLink;}
68 
69  static Acts::BoundTrackParameters extractParameters(const Acts::InputTrack& input) {
70  return input.template as<TrackWrapper>()->parameters();
71  }
72 
73  private:
75  Acts::BoundTrackParameters m_boundParams;
76  };
77 
78  public:
79  virtual StatusCode initialize() override;
80 
81  AdaptiveMultiPriVtxFinderTool(const std::string& type,
82  const std::string& name,
83  const IInterface* parent);
84 
86 
87  virtual std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
88  findVertex(const EventContext& ctx, const TrackCollection* trackTES) const override;
89 
90  virtual std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
91  findVertex(const EventContext& ctx, const xAOD::TrackParticleContainer* trackParticles) const override;
92 
93 
94  private:
95 
96  std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
97  findVertex(const EventContext& ctx, const std::vector<std::unique_ptr<Trk::ITrackLink>>& trackVector) const;
98 
100  const Acts::BoundTrackParameters& bound, const Acts::Vector3& surfCenter) const;
101 
102  double estimateSignalCompatibility(xAOD::Vertex* vtx) const;
103 
104  virtual
107  {
108  return m_trackingGeometryTool.get();
109  }
110 
112  std::unique_ptr<const Acts::Logger> m_logger {nullptr};
113  const Acts::Logger &logger() const { return *m_logger; }
114 
115  using Propagator = Acts::Propagator<Acts::EigenStepper<>, Acts::Navigator>;
116  using TrackLinearizer = Acts::HelicalTrackLinearizer;
117  using VertexFitter = Acts::AdaptiveMultiVertexFitter;
118  using VertexSeedFinder = Acts::TrackDensityVertexFinder;
119  using VertexFinder = Acts::AdaptiveMultiVertexFinder;
120 
121  std::shared_ptr<VertexFinder> m_vertexFinder = nullptr;
122 
123  std::shared_ptr<Propagator> m_propagator = nullptr;
124 
125  // optional because of late initializatio
126  std::optional<TrackLinearizer> m_linearizer = std::nullopt;
127 
128  ToolHandle<IActsTrackingGeometryTool> m_trackingGeometryTool{this, "TrackingGeometryTool", "", "ActsTrackingGeometryTool"};
129  ToolHandle<IActsExtrapolationTool> m_extrapolationTool{this, "ExtrapolationTool", "", "ActsExtrapolationTool"};
130  ToolHandle<InDet::IInDetTrackSelectionTool> m_trkFilter{this, "TrackSelector", "", "InDetTrackSelectionTool"};
131  SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey {this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot"};
132 
133 
134  // Configuration variables
135  // For details check ACTS documentation
136  //
137  // Annealing tool config
138  DoubleArrayProperty m_annealingTemps{this, "annealingTemps", {1.0}, "Annealing temperatures"};
139  DoubleProperty m_annealingCutOff{this, "annealingCutOff", 9., "Annealing cut-off value"};
140  // Fitter config variables
141  UnsignedIntegerProperty m_fitterMaxIterations{this, "fitterMaxIterations", 30, "Vertex fitter max. iterations"};
142  DoubleProperty m_fitterMaxDistToLinPoint{this, "fitterMaxDistToLinPoint", 0.5, "Vertex fitter max. distance to LinPoint"};
143  DoubleProperty m_fitterMaxRelativeShift{this, "fitterMaxRelativeShift", 0.01, "Vertex fitter max. relative shift"};
144  BooleanProperty m_fitterDoSmoothing{this, "fitterDoSmoothing", true, "Vertex fitter doSmoothing"};
145  DoubleProperty m_minWeightFitter{this, "minWeightFitter", 0.001, "Min track weight for fitter"};
146  // Finder config variables
147  BooleanProperty m_useBeamConstraint{this, "useBeamConstraint", true, "Use beam constraint"};
148  DoubleProperty m_tracksMaxZinterval{this, "tracksMaxZinterval", 1., "Tracks max. Z-interval"};
149  DoubleProperty m_tracksMaxSignificance{this, "tracksMaxSignificance", 5., "Tracks max. significance"};
150  DoubleProperty m_maxVertexChi2{this, "maxVertexChi2", 18.42, "Max vertex chi2"};
151  BooleanProperty m_doRealMultiVertex{this, "doRealMultiVertex", true, "Do real multivertex fit"};
152  BooleanProperty m_useFastCompatibility{this, "useFastCompatibility", true, "Use fast compatibility estimation"};
153  DoubleProperty m_maxMergeVertexSignificance{this, "maxMergeVertexSignificance", 3., "Max merge vertex significance"};
154  DoubleProperty m_minWeight{this, "minWeight", 0.0001, "Min track weight for finder"};
155  UnsignedIntegerProperty m_maxIterations{this, "maxIterations", 100, "Vertex finder max. iterations"};
156  BooleanProperty m_addSingleTrackVertices{this, "addSingleTrackVertices", false, "Add single-track vertices"};
157  BooleanProperty m_doFullSplitting{this, "doFullSplitting", false, "Do full-splitting"};
158  DoubleProperty m_maximumVertexContamination{this, "maximumVertexContamination", 0.5, "Max. vertex contamination"};
159  DoubleProperty m_looseConstrValue{this, "looseConstrValue", 1e+8, "Loose constraint value"};
160  BooleanProperty m_useVertexCovForIPEstimation{this, "useVertexCovForIPEstimation", false, "Use seed vertex cov for IPEstimation"};
161  BooleanProperty m_useSeedConstraint{this, "useSeedConstraint", false, "Use seed constraint in fit"};
162  // Final vertex selection variables
163  DoubleProperty m_finalCutMaxVertexChi2{this, "finalCutMaxVertexChi2", 18.42, "Final cut max. vertex chi2"};
164  // Gaussian seed finder variables
165  DoubleProperty m_gaussianMaxD0Significance{this, "gaussianMaxD0Significance", 3.5, "Gaussian seeder max d0 track significance"};
166  DoubleProperty m_gaussianMaxZ0Significance{this, "gaussianMaxDZSignificance", 12.0, "Gaussian seeder max z0 track significance"};
167  // IP Estimator config
168  UnsignedIntegerProperty m_ipEstMaxIterations{this, "ipEstMaxIterations", 20, "IpEstimator max. iterations"};
169  DoubleProperty m_ipEstPrecision{this, "ipEstPrecision", 1e-10, "IpEstimator precision"};
170 
171  };
172 }
173 
174 #endif // ACTSTRKPRIVTXFINDERTOOL_ADAPTIVEMULTIPRIVTXFINDERTOOL_H
ActsTrk::AdaptiveMultiPriVtxFinderTool::logger
const Acts::Logger & logger() const
Definition: AdaptiveMultiPriVtxFinderTool.h:113
ActsTrk::AdaptiveMultiPriVtxFinderTool::TrackWrapper::TrackWrapper
TrackWrapper(const Trk::ITrackLink *trkLink, const Acts::BoundTrackParameters &boundParams)
Definition: AdaptiveMultiPriVtxFinderTool.h:60
LinkToTrack.h
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_fitterMaxRelativeShift
DoubleProperty m_fitterMaxRelativeShift
Definition: AdaptiveMultiPriVtxFinderTool.h:143
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_trkFilter
ToolHandle< InDet::IInDetTrackSelectionTool > m_trkFilter
Definition: AdaptiveMultiPriVtxFinderTool.h:130
ActsTrk::AdaptiveMultiPriVtxFinderTool::AdaptiveMultiPriVtxFinderTool
AdaptiveMultiPriVtxFinderTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: AdaptiveMultiPriVtxFinderTool.cxx:43
InDet::IVertexFinder::findVertex
virtual std::pair< xAOD::VertexContainer *, xAOD::VertexAuxContainer * > findVertex(const EventContext &ctx, const TrackCollection *trackTES) const =0
Find vertex from Trk::TrackCollection.
ActsTrk::AdaptiveMultiPriVtxFinderTool::TrackWrapper
Definition: AdaptiveMultiPriVtxFinderTool.h:58
ActsGeometryContext.h
ActsTrk::detail::Navigator
Acts::Navigator Navigator
Definition: Tracking/Acts/ActsTrackReconstruction/src/detail/Definitions.h:31
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_maxVertexChi2
DoubleProperty m_maxVertexChi2
Definition: AdaptiveMultiPriVtxFinderTool.h:150
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_vertexFinder
std::shared_ptr< VertexFinder > m_vertexFinder
Definition: AdaptiveMultiPriVtxFinderTool.h:121
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_linearizer
std::optional< TrackLinearizer > m_linearizer
Definition: AdaptiveMultiPriVtxFinderTool.h:126
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_tracksMaxZinterval
DoubleProperty m_tracksMaxZinterval
Definition: AdaptiveMultiPriVtxFinderTool.h:148
ActsTrk::AdaptiveMultiPriVtxFinderTool::trackingGeometryTool
virtual const IActsTrackingGeometryTool * trackingGeometryTool() const
Definition: AdaptiveMultiPriVtxFinderTool.h:106
ActsTrk::AdaptiveMultiPriVtxFinderTool
Definition: AdaptiveMultiPriVtxFinderTool.h:55
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_useBeamConstraint
BooleanProperty m_useBeamConstraint
Definition: AdaptiveMultiPriVtxFinderTool.h:147
Surface
Definition: Trigger/TrigAccel/TrigCudaFitter/src/Surface.h:8
ATLASMagneticFieldWrapper.h
ActsTrk::AdaptiveMultiPriVtxFinderTool::TrackWrapper::m_boundParams
Acts::BoundTrackParameters m_boundParams
Definition: AdaptiveMultiPriVtxFinderTool.h:75
ActsTrk::AdaptiveMultiPriVtxFinderTool::TrackWrapper::extractParameters
static Acts::BoundTrackParameters extractParameters(const Acts::InputTrack &input)
Definition: AdaptiveMultiPriVtxFinderTool.h:69
ActsTrk::AdaptiveMultiPriVtxFinderTool::TrackWrapper::parameters
const Acts::BoundTrackParameters & parameters() const
Definition: AdaptiveMultiPriVtxFinderTool.h:65
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_doRealMultiVertex
BooleanProperty m_doRealMultiVertex
Definition: AdaptiveMultiPriVtxFinderTool.h:151
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_logger
std::unique_ptr< const Acts::Logger > m_logger
logging instance
Definition: AdaptiveMultiPriVtxFinderTool.h:112
IActsTrackingGeometryTool
Definition: IActsTrackingGeometryTool.h:18
IVertexFinder.h
ActsTrk::AdaptiveMultiPriVtxFinderTool::TrackWrapper::m_trkLink
const Trk::ITrackLink * m_trkLink
Definition: AdaptiveMultiPriVtxFinderTool.h:74
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_maximumVertexContamination
DoubleProperty m_maximumVertexContamination
Definition: AdaptiveMultiPriVtxFinderTool.h:158
ActsTrk::AdaptiveMultiPriVtxFinderTool::Propagator
Acts::Propagator< Acts::EigenStepper<>, Acts::Navigator > Propagator
Definition: AdaptiveMultiPriVtxFinderTool.h:115
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_fitterMaxDistToLinPoint
DoubleProperty m_fitterMaxDistToLinPoint
Definition: AdaptiveMultiPriVtxFinderTool.h:142
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_tracksMaxSignificance
DoubleProperty m_tracksMaxSignificance
Definition: AdaptiveMultiPriVtxFinderTool.h:149
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_gaussianMaxD0Significance
DoubleProperty m_gaussianMaxD0Significance
Definition: AdaptiveMultiPriVtxFinderTool.h:165
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_minWeight
DoubleProperty m_minWeight
Definition: AdaptiveMultiPriVtxFinderTool.h:154
Acts
Definition: ChamberAssembleTool.h:18
ActsTrk::AdaptiveMultiPriVtxFinderTool::VertexFitter
Acts::AdaptiveMultiVertexFitter VertexFitter
Definition: AdaptiveMultiPriVtxFinderTool.h:117
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_fitterDoSmoothing
BooleanProperty m_fitterDoSmoothing
Definition: AdaptiveMultiPriVtxFinderTool.h:144
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_addSingleTrackVertices
BooleanProperty m_addSingleTrackVertices
Definition: AdaptiveMultiPriVtxFinderTool.h:156
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_maxIterations
UnsignedIntegerProperty m_maxIterations
Definition: AdaptiveMultiPriVtxFinderTool.h:155
VertexFinder
Definition: VertexFinder.h:14
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
AthAlgTool.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_useSeedConstraint
BooleanProperty m_useSeedConstraint
Definition: AdaptiveMultiPriVtxFinderTool.h:161
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_trackingGeometryTool
ToolHandle< IActsTrackingGeometryTool > m_trackingGeometryTool
Definition: AdaptiveMultiPriVtxFinderTool.h:128
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_fitterMaxIterations
UnsignedIntegerProperty m_fitterMaxIterations
Definition: AdaptiveMultiPriVtxFinderTool.h:141
ActsTrk::AdaptiveMultiPriVtxFinderTool::estimateSignalCompatibility
double estimateSignalCompatibility(xAOD::Vertex *vtx) const
Definition: AdaptiveMultiPriVtxFinderTool.cxx:415
DataVector< Trk::Track >
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_ipEstMaxIterations
UnsignedIntegerProperty m_ipEstMaxIterations
Definition: AdaptiveMultiPriVtxFinderTool.h:168
IInDetTrackSelectionTool.h
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_minWeightFitter
DoubleProperty m_minWeightFitter
Definition: AdaptiveMultiPriVtxFinderTool.h:145
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_doFullSplitting
BooleanProperty m_doFullSplitting
Definition: AdaptiveMultiPriVtxFinderTool.h:157
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_ipEstPrecision
DoubleProperty m_ipEstPrecision
Definition: AdaptiveMultiPriVtxFinderTool.h:169
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_maxMergeVertexSignificance
DoubleProperty m_maxMergeVertexSignificance
Definition: AdaptiveMultiPriVtxFinderTool.h:153
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_finalCutMaxVertexChi2
DoubleProperty m_finalCutMaxVertexChi2
Definition: AdaptiveMultiPriVtxFinderTool.h:163
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_extrapolationTool
ToolHandle< IActsExtrapolationTool > m_extrapolationTool
Definition: AdaptiveMultiPriVtxFinderTool.h:129
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_useFastCompatibility
BooleanProperty m_useFastCompatibility
Definition: AdaptiveMultiPriVtxFinderTool.h:152
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_annealingCutOff
DoubleProperty m_annealingCutOff
Definition: AdaptiveMultiPriVtxFinderTool.h:139
SG::ReadCondHandleKey< InDet::BeamSpotData >
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_beamSpotKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Definition: AdaptiveMultiPriVtxFinderTool.h:131
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ActsTrk::AdaptiveMultiPriVtxFinderTool::initialize
virtual StatusCode initialize() override
Definition: AdaptiveMultiPriVtxFinderTool.cxx:50
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:54
BeamSpotData.h
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_gaussianMaxZ0Significance
DoubleProperty m_gaussianMaxZ0Significance
Definition: AdaptiveMultiPriVtxFinderTool.h:166
ActsTrk::AdaptiveMultiPriVtxFinderTool::TrackLinearizer
Acts::HelicalTrackLinearizer TrackLinearizer
Definition: AdaptiveMultiPriVtxFinderTool.h:116
ActsTrk::AdaptiveMultiPriVtxFinderTool::TrackWrapper::trackLink
const Trk::ITrackLink * trackLink() const
Definition: AdaptiveMultiPriVtxFinderTool.h:67
Logger.h
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_propagator
std::shared_ptr< Propagator > m_propagator
Definition: AdaptiveMultiPriVtxFinderTool.h:123
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_annealingTemps
DoubleArrayProperty m_annealingTemps
Definition: AdaptiveMultiPriVtxFinderTool.h:138
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_looseConstrValue
DoubleProperty m_looseConstrValue
Definition: AdaptiveMultiPriVtxFinderTool.h:159
ActsTrk::AdaptiveMultiPriVtxFinderTool::findVertex
virtual std::pair< xAOD::VertexContainer *, xAOD::VertexAuxContainer * > findVertex(const EventContext &ctx, const TrackCollection *trackTES) const override
Definition: AdaptiveMultiPriVtxFinderTool.cxx:143
ActsTrk::AdaptiveMultiPriVtxFinderTool::actsBoundToTrkPerigee
Trk::Perigee * actsBoundToTrkPerigee(const Acts::BoundTrackParameters &bound, const Acts::Vector3 &surfCenter) const
Definition: AdaptiveMultiPriVtxFinderTool.cxx:401
IActsTrackingGeometryTool.h
IActsExtrapolationTool.h
ActsTrk::AdaptiveMultiPriVtxFinderTool::VertexSeedFinder
Acts::TrackDensityVertexFinder VertexSeedFinder
Definition: AdaptiveMultiPriVtxFinderTool.h:118
ActsTrk::AdaptiveMultiPriVtxFinderTool::m_useVertexCovForIPEstimation
BooleanProperty m_useVertexCovForIPEstimation
Definition: AdaptiveMultiPriVtxFinderTool.h:160