ATLAS Offline Software
Tracking
TrkVertexFitter
TrkVertexWeightCalculators
src
DecorateVertexScoreAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrkVertexWeightCalculators/DecorateVertexScoreAlg.h
"
6
7
#include "
AsgDataHandles/WriteDecorHandle.h
"
8
#include "
xAODTracking/Vertex.h
"
9
#include "
xAODTracking/VertexContainer.h
"
10
11
DecorateVertexScoreAlg::DecorateVertexScoreAlg
(
const
std::string&
name
,
12
ISvcLocator* svcLoc)
13
:
EL
::AnaAlgorithm(
name
, svcLoc) {}
14
15
StatusCode
DecorateVertexScoreAlg::initialize
() {
16
ATH_CHECK
(
m_vertexContainer_key
.initialize());
17
ATH_CHECK
(
m_vertexScoreDecor_key
.initialize());
18
ATH_CHECK
(
m_vertexWeightCalculator
.retrieve());
19
return
StatusCode::SUCCESS;
20
}
21
22
StatusCode
DecorateVertexScoreAlg::execute
() {
23
SG::ReadHandle<xAOD::VertexContainer>
vertices{
m_vertexContainer_key
};
24
if
(!vertices.isValid()) {
25
ATH_MSG_ERROR
(
m_vertexContainer_key
.key() <<
" not found"
);
26
return
StatusCode::FAILURE;
27
}
28
29
auto
vertexScoreDecor = SG::makeHandle<float>(
m_vertexScoreDecor_key
);
30
31
ATH_MSG_DEBUG
(
"Decorating "
<< vertices->size() <<
" vertices with scores"
);
32
for
(
const
auto
*
vertex
: *vertices) {
33
const
float
score
=
m_vertexWeightCalculator
->estimateSignalCompatibility(*
vertex
);
34
vertexScoreDecor(*
vertex
) =
score
;
35
ATH_MSG_DEBUG
(
"Decorated vertex with score: "
<<
score
);
36
}
37
return
StatusCode::SUCCESS;
38
}
DecorateVertexScoreAlg::m_vertexWeightCalculator
ToolHandle< Trk::IVertexWeightCalculator > m_vertexWeightCalculator
Definition:
DecorateVertexScoreAlg.h:41
SG::ReadHandle
Definition:
StoreGate/StoreGate/ReadHandle.h:70
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition:
AthMsgStreamMacros.h:33
DecorateVertexScoreAlg::initialize
virtual StatusCode initialize() override
Definition:
DecorateVertexScoreAlg.cxx:15
DecorateVertexScoreAlg.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition:
AthMsgStreamMacros.h:29
DecorateVertexScoreAlg::m_vertexScoreDecor_key
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_vertexScoreDecor_key
Definition:
DecorateVertexScoreAlg.h:37
ATH_CHECK
#define ATH_CHECK
Definition:
AthCheckMacros.h:40
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition:
AlgorithmWorkerData.h:24
DecorateVertexScoreAlg::DecorateVertexScoreAlg
DecorateVertexScoreAlg(const std::string &name, ISvcLocator *svcLoc=nullptr)
Definition:
DecorateVertexScoreAlg.cxx:11
Vertex.h
WriteDecorHandle.h
Handle class for adding a decoration to an object.
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:228
DecorateVertexScoreAlg::execute
StatusCode execute() override
Definition:
DecorateVertexScoreAlg.cxx:22
xAOD::score
@ score
Definition:
TrackingPrimitives.h:513
Trk::vertex
@ vertex
Definition:
MeasurementType.h:21
VertexContainer.h
DecorateVertexScoreAlg::m_vertexContainer_key
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainer_key
Definition:
DecorateVertexScoreAlg.h:34
Generated on Sun Dec 22 2024 21:09:19 for ATLAS Offline Software by
1.8.18