ATLAS Offline Software
Loading...
Searching...
No Matches
ActsTrk::HoughVtxFinderTool Class Reference

#include <HoughVtxFinderTool.h>

Inheritance diagram for ActsTrk::HoughVtxFinderTool:
Collaboration diagram for ActsTrk::HoughVtxFinderTool:

Classes

struct  SpacePoint

Public Member Functions

virtual StatusCode initialize () override
virtual std::pair< xAOD::VertexContainer *, xAOD::VertexAuxContainer * > findVertex (const EventContext &, const TrackCollection *) const override
virtual std::pair< xAOD::VertexContainer *, xAOD::VertexAuxContainer * > findVertex (const EventContext &, const xAOD::TrackParticleContainer *) const override
std::pair< std::unique_ptr< xAOD::VertexContainer >, std::unique_ptr< xAOD::VertexAuxContainer > > findVertex (const EventContext &ctx, const xAOD::SpacePointContainer &spacePointContainer) const

Private Types

using VertexFinder = Acts::HoughVertexFinder<SpacePoint>

Private Member Functions

const Acts::Logger & logger () const

Private Attributes

std::unique_ptr< const Acts::Logger > m_logger {nullptr}
 logging instance
VertexFinder::Config m_finderCfg
SG::ReadCondHandleKey< InDet::BeamSpotDatam_beamSpotKey {this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot"}
UnsignedIntegerProperty m_minSPs {this, "minSPs", 100, "Minimum amount of spacepoints to attempt vertex finding"}
const bool m_useBeamSpot = false
UnsignedIntegerProperty m_targetSPs {this, "targetSPs", 20000, "Ideal amount of spacepoints"}
DoubleProperty m_minAbsEta {this, "minAbsEta", 0.3, "Minimum range in |eta|"}
DoubleProperty m_maxAbsEta {this, "maxAbsEta", 4.0, "Maximum range in |eta|"}
UnsignedIntegerProperty m_minHits {this, "minHits", 4, "Minimum number of hits in Hough plane to consider the cell to contain a track"}
UnsignedIntegerProperty m_fillNeighbours {this, "fillNeighbours", 0, "Number of neighbouring bins in Hough plane to fill"}
DoubleArrayProperty m_absEtaRanges {this, "absEtaRanges", {2.0, 4.0}, "Upper threshold for eta ranges"}
DoubleArrayProperty m_absEtaFractions {this, "absEtaFractions", {0.4, 0.6}, "Amount of spacepoints in such eta ranges"}
DoubleArrayProperty m_rangeIterZ {this, "rangeIterZ", {200.0, 30.0, 16.0}, "Maximum vertex range to consider"}
UnsignedIntegerArrayProperty m_nBinsZIterZ {this, "nBinsZIterZ", {800, 180, 80}, "Number of bins in Z direction"}
UnsignedIntegerArrayProperty m_nBinsCotThetaIterZ {this, "nBinsCotThetaIterZ", {8000, 8000, 8000}, "Number of bins in cot(theta) direction"}
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"}
UnsignedIntegerProperty m_peakWidth {this, "peakWidth", 3, "Width of the peak when estimating vertex position"}
DoubleArrayProperty m_defVtxPosition {this, "defVtxPosition", {0.0, 0.0, 0.0}, "Default position of the vertex, might be overwritten by beamspot XY position"}

Detailed Description

Definition at line 28 of file HoughVtxFinderTool.h.

Member Typedef Documentation

◆ VertexFinder

using ActsTrk::HoughVtxFinderTool::VertexFinder = Acts::HoughVertexFinder<SpacePoint>
private

Definition at line 66 of file HoughVtxFinderTool.h.

Member Function Documentation

◆ findVertex() [1/3]

virtual std::pair< xAOD::VertexContainer *, xAOD::VertexAuxContainer * > ActsTrk::HoughVtxFinderTool::findVertex ( const EventContext & ,
const TrackCollection *  ) const
inlineoverridevirtual

Definition at line 36 of file HoughVtxFinderTool.h.

36 {
37 ATH_MSG_ERROR("Can't call HoughVtxFinderTool::findVertex(ctx, trackTES)");
38 return std::make_pair(nullptr, nullptr);
39 }
#define ATH_MSG_ERROR(x)

◆ findVertex() [2/3]

virtual std::pair< xAOD::VertexContainer *, xAOD::VertexAuxContainer * > ActsTrk::HoughVtxFinderTool::findVertex ( const EventContext & ,
const xAOD::TrackParticleContainer *  ) const
inlineoverridevirtual

Definition at line 41 of file HoughVtxFinderTool.h.

41 {
42 ATH_MSG_ERROR("Can't call HoughVtxFinderTool::findVertex(ctx, trackParticles)");
43 return std::make_pair(nullptr, nullptr);
44 }

◆ findVertex() [3/3]

std::pair< std::unique_ptr< xAOD::VertexContainer >, std::unique_ptr< xAOD::VertexAuxContainer > > ActsTrk::HoughVtxFinderTool::findVertex ( const EventContext & ctx,
const xAOD::SpacePointContainer & spacePointContainer ) const

Definition at line 51 of file HoughVtxFinderTool.cxx.

52 {
53 // vertex finder configuration depending on the beamspot
54 auto finderCfgBS = m_finderCfg;
55
56 if (m_useBeamSpot) {
57 // beamspot XY position for the default XY position of the vertex
58 SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle{m_beamSpotKey, ctx};
59 const Trk::RecVertex &beamposition(beamSpotHandle->beamVtx());
60
61 finderCfgBS.defVtxPosition[0] = beamposition.position().x();
62 finderCfgBS.defVtxPosition[1] = beamposition.position().y();
63 // default Z position is kept the same
64
65 ATH_MSG_DEBUG("beamspot position: " << beamposition.position().x() << ", " << beamposition.position().y() << ", "
66 << beamposition.position().z());
67 }
68
69 // the output vertex containers
70 auto theVertexContainer = std::make_unique<xAOD::VertexContainer>();
71 auto theVertexAuxContainer = std::make_unique<xAOD::VertexAuxContainer>();
72 theVertexContainer->setStore(theVertexAuxContainer.get());
73
74 if (spacePointContainer.size() < m_minSPs) {
75 ATH_MSG_DEBUG("Not enough space points for vertex finding; " << spacePointContainer.size() << " < " << m_minSPs);
76 // do not attempt vertex finding
77 return std::make_pair(std::move(theVertexContainer), std::move(theVertexAuxContainer));
78 }
79
80 auto vertexFinder = std::make_unique<VertexFinder>(finderCfgBS, logger().cloneWithSuffix("Finder"));
81
82 ATH_MSG_DEBUG("default vertex position: " << vertexFinder->config().defVtxPosition[0] << ", "
83 << vertexFinder->config().defVtxPosition[1] << ", "
84 << vertexFinder->config().defVtxPosition[2]);
85
86 std::vector<SpacePoint> spacePointVector;
87 spacePointVector.reserve(spacePointContainer.size());
88 for (const auto sp : spacePointContainer) {
89 spacePointVector.emplace_back(sp);
90 }
91
92 ATH_MSG_DEBUG("Number of input space points: " << spacePointVector.size());
93 auto vtx = vertexFinder->find(spacePointVector);
94
95 if (vtx.ok()) {
96 ATH_MSG_DEBUG("Vertex position: " << (*vtx)[0] << ", " << (*vtx)[1] << ", " << (*vtx)[2]);
97 auto xAODVertex = theVertexContainer->push_back(std::make_unique<xAOD::Vertex>());
98 xAODVertex->setPosition(*vtx);
99 xAODVertex->setVertexType(xAOD::VxType::PriVtx);
100 } else {
101 ATH_MSG_DEBUG("Vertex finding failed");
102 }
103
104 return std::make_pair(std::move(theVertexContainer), std::move(theVertexAuxContainer));
105}
#define ATH_MSG_DEBUG(x)
static Double_t sp
UnsignedIntegerProperty m_minSPs
VertexFinder::Config m_finderCfg
const Acts::Logger & logger() const
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
size_type size() const noexcept
Returns the number of elements in the collection.
@ PriVtx
Primary vertex.

◆ initialize()

StatusCode ActsTrk::HoughVtxFinderTool::initialize ( )
overridevirtual

Definition at line 10 of file HoughVtxFinderTool.cxx.

10 {
11 ATH_MSG_DEBUG("Initializing ActsTrk::HoughVtxFinderTool");
12
14
15 // logger
16 m_logger = makeActsAthenaLogger(this, "Acts");
17
18 // check if vector sizes are compatible
19 if (m_absEtaRanges.size() != m_absEtaFractions.size()) {
20 ATH_MSG_ERROR("m_absEtaRanges.size() != m_absEtaFractions.size(), "
21 << m_absEtaRanges.size() << " != " << m_absEtaFractions.size());
22 return StatusCode::FAILURE;
23 }
24 if (m_rangeIterZ.size() != m_nBinsZIterZ.size() || m_rangeIterZ.size() != m_nBinsCotThetaIterZ.size()) {
25 ATH_MSG_ERROR("sizes of m_rangeIterZ, m_nBinsZIterZ.size(), and m_nBinsCotThetaIterZ.size() are not equal, "
26 << m_rangeIterZ.size() << ", " << m_nBinsZIterZ.size() << ", " << m_nBinsCotThetaIterZ.size());
27 return StatusCode::FAILURE;
28 }
29
30 // vertex finder configuration
31 m_finderCfg.targetSPs = m_targetSPs;
32 m_finderCfg.minAbsEta = m_minAbsEta;
33 m_finderCfg.maxAbsEta = m_maxAbsEta;
34 m_finderCfg.minHits = m_minHits;
35 m_finderCfg.fillNeighbours = m_fillNeighbours;
36 m_finderCfg.absEtaRanges = m_absEtaRanges;
37 m_finderCfg.absEtaFractions = m_absEtaFractions;
38 m_finderCfg.rangeIterZ = m_rangeIterZ;
39 m_finderCfg.nBinsZIterZ = m_nBinsZIterZ;
40 m_finderCfg.nBinsCotThetaIterZ = m_nBinsCotThetaIterZ;
41 m_finderCfg.binsCotThetaDecrease = m_binsCotThetaDecrease;
42 m_finderCfg.peakWidth = m_peakWidth;
43 Acts::Vector3 defVtxPos{m_defVtxPosition[0], m_defVtxPosition[1], m_defVtxPosition[2]};
44 m_finderCfg.defVtxPosition = defVtxPos;
45
46 ATH_MSG_DEBUG("Successfully initialized ActsTrk::HoughVtxFinderTool");
47 return StatusCode::SUCCESS;
48}
#define ATH_CHECK
Evaluate an expression and check for errors.
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger(IMessageSvc *svc, const std::string &name, int level, std::optional< std::string > parent_name)
UnsignedIntegerProperty m_fillNeighbours
std::unique_ptr< const Acts::Logger > m_logger
logging instance
DoubleArrayProperty m_defVtxPosition
DoubleArrayProperty m_absEtaRanges
UnsignedIntegerProperty m_targetSPs
UnsignedIntegerProperty m_minHits
UnsignedIntegerArrayProperty m_nBinsCotThetaIterZ
DoubleArrayProperty m_absEtaFractions
UnsignedIntegerArrayProperty m_nBinsZIterZ
UnsignedIntegerProperty m_peakWidth
DoubleArrayProperty m_rangeIterZ

◆ logger()

const Acts::Logger & ActsTrk::HoughVtxFinderTool::logger ( ) const
inlineprivate

Definition at line 53 of file HoughVtxFinderTool.h.

53{ return *m_logger; }

Member Data Documentation

◆ m_absEtaFractions

DoubleArrayProperty ActsTrk::HoughVtxFinderTool::m_absEtaFractions {this, "absEtaFractions", {0.4, 0.6}, "Amount of spacepoints in such eta ranges"}
private

Definition at line 87 of file HoughVtxFinderTool.h.

87{this, "absEtaFractions", {0.4, 0.6}, "Amount of spacepoints in such eta ranges"};

◆ m_absEtaRanges

DoubleArrayProperty ActsTrk::HoughVtxFinderTool::m_absEtaRanges {this, "absEtaRanges", {2.0, 4.0}, "Upper threshold for eta ranges"}
private

Definition at line 86 of file HoughVtxFinderTool.h.

86{this, "absEtaRanges", {2.0, 4.0}, "Upper threshold for eta ranges"};

◆ m_beamSpotKey

SG::ReadCondHandleKey<InDet::BeamSpotData> ActsTrk::HoughVtxFinderTool::m_beamSpotKey {this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot"}
private

Definition at line 69 of file HoughVtxFinderTool.h.

69{this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot"};

◆ m_binsCotThetaDecrease

DoubleProperty ActsTrk::HoughVtxFinderTool::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"}
private

Definition at line 92 of file HoughVtxFinderTool.h.

92{this, "binsCotThetaDecrease", 1.35, "For every magnitude (in natural log) below targetSPs, the number of bins in cot(theta) will decrease by this factor"};

◆ m_defVtxPosition

DoubleArrayProperty ActsTrk::HoughVtxFinderTool::m_defVtxPosition {this, "defVtxPosition", {0.0, 0.0, 0.0}, "Default position of the vertex, might be overwritten by beamspot XY position"}
private

Definition at line 94 of file HoughVtxFinderTool.h.

94{this, "defVtxPosition", {0.0, 0.0, 0.0}, "Default position of the vertex, might be overwritten by beamspot XY position"};

◆ m_fillNeighbours

UnsignedIntegerProperty ActsTrk::HoughVtxFinderTool::m_fillNeighbours {this, "fillNeighbours", 0, "Number of neighbouring bins in Hough plane to fill"}
private

Definition at line 84 of file HoughVtxFinderTool.h.

84{this, "fillNeighbours", 0, "Number of neighbouring bins in Hough plane to fill"};

◆ m_finderCfg

VertexFinder::Config ActsTrk::HoughVtxFinderTool::m_finderCfg
private

Definition at line 67 of file HoughVtxFinderTool.h.

◆ m_logger

std::unique_ptr<const Acts::Logger> ActsTrk::HoughVtxFinderTool::m_logger {nullptr}
private

logging instance

Definition at line 52 of file HoughVtxFinderTool.h.

52{nullptr};

◆ m_maxAbsEta

DoubleProperty ActsTrk::HoughVtxFinderTool::m_maxAbsEta {this, "maxAbsEta", 4.0, "Maximum range in |eta|"}
private

Definition at line 82 of file HoughVtxFinderTool.h.

82{this, "maxAbsEta", 4.0, "Maximum range in |eta|"};

◆ m_minAbsEta

DoubleProperty ActsTrk::HoughVtxFinderTool::m_minAbsEta {this, "minAbsEta", 0.3, "Minimum range in |eta|"}
private

Definition at line 81 of file HoughVtxFinderTool.h.

81{this, "minAbsEta", 0.3, "Minimum range in |eta|"};

◆ m_minHits

UnsignedIntegerProperty ActsTrk::HoughVtxFinderTool::m_minHits {this, "minHits", 4, "Minimum number of hits in Hough plane to consider the cell to contain a track"}
private

Definition at line 83 of file HoughVtxFinderTool.h.

83{this, "minHits", 4, "Minimum number of hits in Hough plane to consider the cell to contain a track"};

◆ m_minSPs

UnsignedIntegerProperty ActsTrk::HoughVtxFinderTool::m_minSPs {this, "minSPs", 100, "Minimum amount of spacepoints to attempt vertex finding"}
private

Definition at line 71 of file HoughVtxFinderTool.h.

71{this, "minSPs", 100, "Minimum amount of spacepoints to attempt vertex finding"};

◆ m_nBinsCotThetaIterZ

UnsignedIntegerArrayProperty ActsTrk::HoughVtxFinderTool::m_nBinsCotThetaIterZ {this, "nBinsCotThetaIterZ", {8000, 8000, 8000}, "Number of bins in cot(theta) direction"}
private

Definition at line 91 of file HoughVtxFinderTool.h.

91{this, "nBinsCotThetaIterZ", {8000, 8000, 8000}, "Number of bins in cot(theta) direction"};

◆ m_nBinsZIterZ

UnsignedIntegerArrayProperty ActsTrk::HoughVtxFinderTool::m_nBinsZIterZ {this, "nBinsZIterZ", {800, 180, 80}, "Number of bins in Z direction"}
private

Definition at line 90 of file HoughVtxFinderTool.h.

90{this, "nBinsZIterZ", {800, 180, 80}, "Number of bins in Z direction"};

◆ m_peakWidth

UnsignedIntegerProperty ActsTrk::HoughVtxFinderTool::m_peakWidth {this, "peakWidth", 3, "Width of the peak when estimating vertex position"}
private

Definition at line 93 of file HoughVtxFinderTool.h.

93{this, "peakWidth", 3, "Width of the peak when estimating vertex position"};

◆ m_rangeIterZ

DoubleArrayProperty ActsTrk::HoughVtxFinderTool::m_rangeIterZ {this, "rangeIterZ", {200.0, 30.0, 16.0}, "Maximum vertex range to consider"}
private

Definition at line 89 of file HoughVtxFinderTool.h.

89{this, "rangeIterZ", {200.0, 30.0, 16.0}, "Maximum vertex range to consider"};

◆ m_targetSPs

UnsignedIntegerProperty ActsTrk::HoughVtxFinderTool::m_targetSPs {this, "targetSPs", 20000, "Ideal amount of spacepoints"}
private

Definition at line 80 of file HoughVtxFinderTool.h.

80{this, "targetSPs", 20000, "Ideal amount of spacepoints"};

◆ m_useBeamSpot

const bool ActsTrk::HoughVtxFinderTool::m_useBeamSpot = false
private

Definition at line 74 of file HoughVtxFinderTool.h.


The documentation for this class was generated from the following files: