ATLAS Offline Software
Loading...
Searching...
No Matches
HoughVtxFinderTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ACTSVERTEXRECONSTRUCTION_HOUGHVTXFINDERTOOL_H
6#define ACTSVERTEXRECONSTRUCTION_HOUGHVTXFINDERTOOL_H
7
8
10#include "Gaudi/Property.h"
11#include "GaudiKernel/EventContext.h"
17
18#include "ActsInterop/Logger.h"
19#include "Acts/Definitions/Algebra.hpp"
20#include "Acts/Vertexing/HoughVertexFinder.hpp"
21
22#include <cmath>
23#include <memory> // unique_ptr
24#include <utility> // pair
25
26namespace ActsTrk {
27
28class HoughVtxFinderTool : public extends<AthAlgTool, InDet::IVertexFinder> {
29public:
30 virtual StatusCode initialize() override;
31
32 using base_class::base_class;
33
34 // no vertex finding with tracks
35 virtual std::pair<xAOD::VertexContainer *, xAOD::VertexAuxContainer *>
36 findVertex(const EventContext & /*ctx*/, const TrackCollection * /*trackTES*/) const override {
37 ATH_MSG_ERROR("Can't call HoughVtxFinderTool::findVertex(ctx, trackTES)");
38 return std::make_pair(nullptr, nullptr);
39 }
40 virtual std::pair<xAOD::VertexContainer *, xAOD::VertexAuxContainer *>
41 findVertex(const EventContext & /*ctx*/, const xAOD::TrackParticleContainer * /*trackParticles*/) const override {
42 ATH_MSG_ERROR("Can't call HoughVtxFinderTool::findVertex(ctx, trackParticles)");
43 return std::make_pair(nullptr, nullptr);
44 }
45
46 // vertex finding with spacepoints
47 std::pair<std::unique_ptr<xAOD::VertexContainer>, std::unique_ptr<xAOD::VertexAuxContainer>>
48 findVertex(const EventContext &ctx, const xAOD::SpacePointContainer &spacePointContainer) const;
49
50private:
52 std::unique_ptr<const Acts::Logger> m_logger{nullptr};
53 const Acts::Logger &logger() const { return *m_logger; }
54
55 // spacepoint is required to have "x()", "y()", "z()", and "r()" methods
56 struct SpacePoint {
57 SpacePoint(const xAOD::SpacePoint *sp) : m_x(sp->x()), m_y(sp->y()), m_z(sp->z()) {}
58 double x() const { return m_x; }
59 double y() const { return m_y; }
60 double z() const { return m_z; }
61 double r() const { return std::sqrt(m_x * m_x + m_y * m_y); }
62 private:
63 double m_x, m_y, m_z;
64 };
65
66 using VertexFinder = Acts::HoughVertexFinder<SpacePoint>;
67 VertexFinder::Config m_finderCfg;
68
69 SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey{this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot"};
70
71 UnsignedIntegerProperty m_minSPs{this, "minSPs", 100, "Minimum amount of spacepoints to attempt vertex finding"};
72
73 // workaround for a bug in ACTS - defVtxPosition should be (0,0,0), until Athena uses ACTS version that includes PR #5060
74 const bool m_useBeamSpot = false;
75 // BooleanProperty m_useBeamSpot{this, "useBeamSpot", false, "Use beam spot XY positions as the default vertex position"};
76
77 // Configuration variables
78 // For details check ACTS documentation
79 //
80 UnsignedIntegerProperty m_targetSPs{this, "targetSPs", 20000, "Ideal amount of spacepoints"};
81 DoubleProperty m_minAbsEta{this, "minAbsEta", 0.3, "Minimum range in |eta|"};
82 DoubleProperty m_maxAbsEta{this, "maxAbsEta", 4.0, "Maximum range in |eta|"};
83 UnsignedIntegerProperty m_minHits{this, "minHits", 4, "Minimum number of hits in Hough plane to consider the cell to contain a track"};
84 UnsignedIntegerProperty m_fillNeighbours{this, "fillNeighbours", 0, "Number of neighbouring bins in Hough plane to fill"};
85 // the two arrays below have to have the same size
86 DoubleArrayProperty m_absEtaRanges{this, "absEtaRanges", {2.0, 4.0}, "Upper threshold for eta ranges"};
87 DoubleArrayProperty m_absEtaFractions{this, "absEtaFractions", {0.4, 0.6}, "Amount of spacepoints in such eta ranges"};
88 // the three arrays below have to have the same size
89 DoubleArrayProperty m_rangeIterZ{this, "rangeIterZ", {200.0, 30.0, 16.0}, "Maximum vertex range to consider"};
90 UnsignedIntegerArrayProperty m_nBinsZIterZ{this, "nBinsZIterZ", {800, 180, 80}, "Number of bins in Z direction"};
91 UnsignedIntegerArrayProperty m_nBinsCotThetaIterZ{this, "nBinsCotThetaIterZ", {8000, 8000, 8000}, "Number of bins in cot(theta) direction"};
92 DoubleProperty m_binsCotThetaDecrease{this, "binsCotThetaDecrease", 1.35, "For every magnitude (in natural log) below targetSPs, the number of bins in cot(theta) will decrease by this factor"};
93 UnsignedIntegerProperty m_peakWidth{this, "peakWidth", 3, "Width of the peak when estimating vertex position"};
94 DoubleArrayProperty m_defVtxPosition{this, "defVtxPosition", {0.0, 0.0, 0.0}, "Default position of the vertex, might be overwritten by beamspot XY position"};
95};
96
97} // namespace ActsTrk
98
99#endif // ACTSVERTEXRECONSTRUCTION_HOUGHVTXFINDERTOOL_H
#define ATH_MSG_ERROR(x)
static Double_t sp
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
UnsignedIntegerProperty m_fillNeighbours
UnsignedIntegerProperty m_minSPs
Acts::HoughVertexFinder< SpacePoint > VertexFinder
std::unique_ptr< const Acts::Logger > m_logger
logging instance
virtual StatusCode initialize() override
DoubleArrayProperty m_defVtxPosition
DoubleArrayProperty m_absEtaRanges
UnsignedIntegerProperty m_targetSPs
virtual std::pair< xAOD::VertexContainer *, xAOD::VertexAuxContainer * > findVertex(const EventContext &, const TrackCollection *) const override
UnsignedIntegerProperty m_minHits
VertexFinder::Config m_finderCfg
UnsignedIntegerArrayProperty m_nBinsCotThetaIterZ
DoubleArrayProperty m_absEtaFractions
const Acts::Logger & logger() const
UnsignedIntegerArrayProperty m_nBinsZIterZ
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
UnsignedIntegerProperty m_peakWidth
virtual std::pair< xAOD::VertexContainer *, xAOD::VertexAuxContainer * > findVertex(const EventContext &, const xAOD::TrackParticleContainer *) const override
DoubleArrayProperty m_rangeIterZ
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
SpacePointContainer_v1 SpacePointContainer
Define the version of the space point container.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".