ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
Acts
ActsVertexReconstruction
src
HoughVtxFinderTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
ActsVertexReconstruction/HoughVtxFinderTool.h
"
6
7
#include <vector>
8
9
10
StatusCode
ActsTrk::HoughVtxFinderTool::initialize
() {
11
ATH_MSG_DEBUG
(
"Initializing ActsTrk::HoughVtxFinderTool"
);
12
13
ATH_CHECK
(
m_beamSpotKey
.initialize(
m_useBeamSpot
));
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
}
49
50
std::pair<std::unique_ptr<xAOD::VertexContainer>, std::unique_ptr<xAOD::VertexAuxContainer>>
51
ActsTrk::HoughVtxFinderTool::findVertex
(
const
EventContext &ctx,
52
const
xAOD::SpacePointContainer
&spacePointContainer)
const
{
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
Acts::SpacePointContainer spacePoints(Acts::SpacePointColumns::X |
87
Acts::SpacePointColumns::Y |
88
Acts::SpacePointColumns::Z);
89
spacePoints.reserve(spacePointContainer.
size
(), 0);
90
for
(
const
auto
sp
: spacePointContainer) {
91
auto
newSp = spacePoints.createSpacePoint();
92
newSp.x() =
sp
->x();
93
newSp.y() =
sp
->y();
94
newSp.z() =
sp
->z();
95
}
96
97
ATH_MSG_DEBUG
(
"Number of input space points: "
<< spacePoints.size());
98
auto
vtx = vertexFinder->find(spacePoints);
99
100
if
(vtx.ok()) {
101
ATH_MSG_DEBUG
(
"Vertex position: "
<< (*vtx)[0] <<
", "
<< (*vtx)[1] <<
", "
<< (*vtx)[2]);
102
auto
xAODVertex = theVertexContainer->push_back(std::make_unique<xAOD::Vertex>());
103
xAODVertex->setPosition(*vtx);
104
xAODVertex->setVertexType(
xAOD::VxType::PriVtx
);
105
}
else
{
106
ATH_MSG_DEBUG
(
"Vertex finding failed"
);
107
}
108
109
return
std::make_pair(std::move(theVertexContainer), std::move(theVertexAuxContainer));
110
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
HoughVtxFinderTool.h
sp
static Double_t sp
Definition
LArPhysWaveHECTool.cxx:37
makeActsAthenaLogger
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger(IMessageSvc *svc, const std::string &name, int level, std::optional< std::string > parent_name)
Definition
Logger.cxx:64
ActsTrk::HoughVtxFinderTool::m_fillNeighbours
UnsignedIntegerProperty m_fillNeighbours
Definition
HoughVtxFinderTool.h:71
ActsTrk::HoughVtxFinderTool::m_minSPs
UnsignedIntegerProperty m_minSPs
Definition
HoughVtxFinderTool.h:61
ActsTrk::HoughVtxFinderTool::m_logger
std::unique_ptr< const Acts::Logger > m_logger
logging instance
Definition
HoughVtxFinderTool.h:53
ActsTrk::HoughVtxFinderTool::m_maxAbsEta
DoubleProperty m_maxAbsEta
Definition
HoughVtxFinderTool.h:69
ActsTrk::HoughVtxFinderTool::initialize
virtual StatusCode initialize() override
Definition
HoughVtxFinderTool.cxx:10
ActsTrk::HoughVtxFinderTool::m_defVtxPosition
DoubleArrayProperty m_defVtxPosition
Definition
HoughVtxFinderTool.h:81
ActsTrk::HoughVtxFinderTool::m_absEtaRanges
DoubleArrayProperty m_absEtaRanges
Definition
HoughVtxFinderTool.h:73
ActsTrk::HoughVtxFinderTool::m_targetSPs
UnsignedIntegerProperty m_targetSPs
Definition
HoughVtxFinderTool.h:67
ActsTrk::HoughVtxFinderTool::findVertex
virtual std::pair< xAOD::VertexContainer *, xAOD::VertexAuxContainer * > findVertex(const EventContext &, const TrackCollection *) const override
Definition
HoughVtxFinderTool.h:37
ActsTrk::HoughVtxFinderTool::m_minHits
UnsignedIntegerProperty m_minHits
Definition
HoughVtxFinderTool.h:70
ActsTrk::HoughVtxFinderTool::m_finderCfg
VertexFinder::Config m_finderCfg
Definition
HoughVtxFinderTool.h:57
ActsTrk::HoughVtxFinderTool::m_minAbsEta
DoubleProperty m_minAbsEta
Definition
HoughVtxFinderTool.h:68
ActsTrk::HoughVtxFinderTool::m_nBinsCotThetaIterZ
UnsignedIntegerArrayProperty m_nBinsCotThetaIterZ
Definition
HoughVtxFinderTool.h:78
ActsTrk::HoughVtxFinderTool::m_absEtaFractions
DoubleArrayProperty m_absEtaFractions
Definition
HoughVtxFinderTool.h:74
ActsTrk::HoughVtxFinderTool::m_nBinsZIterZ
UnsignedIntegerArrayProperty m_nBinsZIterZ
Definition
HoughVtxFinderTool.h:77
ActsTrk::HoughVtxFinderTool::m_binsCotThetaDecrease
DoubleProperty m_binsCotThetaDecrease
Definition
HoughVtxFinderTool.h:79
ActsTrk::HoughVtxFinderTool::m_beamSpotKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Definition
HoughVtxFinderTool.h:59
ActsTrk::HoughVtxFinderTool::m_peakWidth
UnsignedIntegerProperty m_peakWidth
Definition
HoughVtxFinderTool.h:80
ActsTrk::HoughVtxFinderTool::m_useBeamSpot
BooleanProperty m_useBeamSpot
Definition
HoughVtxFinderTool.h:62
ActsTrk::HoughVtxFinderTool::m_rangeIterZ
DoubleArrayProperty m_rangeIterZ
Definition
HoughVtxFinderTool.h:76
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
Trk::RecVertex
Trk::RecVertex inherits from Trk::Vertex.
Definition
RecVertex.h:44
Trk::Vertex::position
const Amg::Vector3D & position() const
return position of vertex
Definition
Vertex.cxx:63
logger
static Root::TMsgLogger logger("iLumiCalc")
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition
TrackingPrimitives.h:590
xAOD::SpacePointContainer
SpacePointContainer_v1 SpacePointContainer
Define the version of the space point container.
Definition
Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/SpacePointContainer.h:14
Generated on
for ATLAS Offline Software by
1.17.0