ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
VKalVrt
GNNVertexFitter
src
GNNVertexFitterAlg.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 "
GNNVertexFitterAlg.h
"
6
#include "
xAODJet/JetContainer.h
"
7
#include "
xAODTracking/VertexAuxContainer.h
"
8
#include "
xAODTracking/VertexContainer.h
"
9
10
namespace
Rec
{
11
12
GNNVertexFitterAlg::GNNVertexFitterAlg
(
const
std::string &name, ISvcLocator *pSvcLocator)
13
:
AthReentrantAlgorithm
(name, pSvcLocator),
m_VtxTool
(
"Rec::GNNVertexFitterTool/VtxTool"
, this) {
14
declareProperty
(
"VtxTool"
,
m_VtxTool
,
"The GNN Vtxing Tool"
);
15
}
16
17
StatusCode
GNNVertexFitterAlg::initialize
() {
18
19
// Retrieving the tool
20
ATH_CHECK
(
m_VtxTool
.retrieve());
21
22
// Initializing Keys
23
ATH_CHECK
(
m_inJetsKey
.initialize());
24
ATH_CHECK
(
m_outVertexKey
.initialize());
25
ATH_CHECK
(
m_pvContainerKey
.initialize());
26
27
return
StatusCode::SUCCESS;
28
}
29
30
StatusCode
GNNVertexFitterAlg::execute
(
const
EventContext &ctx)
const
{
31
32
ATH_MSG_DEBUG
(
"In GNNVertexFitterAlg::execute()"
);
33
34
// Extract Jets
35
SG::ReadHandle<xAOD::JetContainer>
inJetContainer(
m_inJetsKey
, ctx);
36
if
(!inJetContainer.
isValid
()) {
37
ATH_MSG_WARNING
(
"No xAOD::JetContainer named "
<<
m_inJetsKey
.key() <<
" found in StoreGate"
);
38
return
StatusCode::FAILURE;
39
}
40
41
// Write new GNN Vertice Container
42
SG::WriteHandle<xAOD::VertexContainer>
outVertexContainer(
m_outVertexKey
, ctx);
43
if
(outVertexContainer.
record
(std::make_unique<xAOD::VertexContainer>(), std::make_unique<xAOD::VertexAuxContainer>())
44
.isFailure()) {
45
ATH_MSG_ERROR
(
"Storegate record of VertexContainer failed."
);
46
return
StatusCode::FAILURE;
47
}
48
49
const
xAOD::Vertex
*pv =
nullptr
;
50
//-- Extract Primary Vertices
51
SG::ReadHandle<xAOD::VertexContainer>
pv_cont(
m_pvContainerKey
, ctx);
52
if
(!pv_cont.
isValid
()) {
53
ATH_MSG_ERROR
(
"No Primary Vertices container found in TDS"
);
54
return
StatusCode::FAILURE;
55
}
else
{
56
//-- Extract PV itself
57
for
(
auto
v : *pv_cont) {
58
if
(v->vertexType() ==
xAOD::VxType::PriVtx
) {
59
pv = v;
60
break
;
61
}
62
}
63
}
64
if
(!pv) pv = pv_cont->front();
65
66
// Perform a Vertex fit
67
ATH_CHECK
(
m_VtxTool
->fitAllVertices(inJetContainer.
ptr
(), outVertexContainer.
ptr
(), *pv, ctx));
68
69
return
StatusCode::SUCCESS;
70
}
71
72
StatusCode
GNNVertexFitterAlg::finalize
() {
73
ATH_MSG_DEBUG
(
"GNNVertexFitter::finalize()"
);
74
return
StatusCode::SUCCESS;
75
}
76
77
}
// namespace Rec
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_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
GNNVertexFitterAlg.h
JetContainer.h
VertexAuxContainer.h
VertexContainer.h
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
Rec::GNNVertexFitterAlg::initialize
StatusCode initialize() override
Definition
GNNVertexFitterAlg.cxx:17
Rec::GNNVertexFitterAlg::m_inJetsKey
SG::ReadHandleKey< xAOD::JetContainer > m_inJetsKey
Definition
GNNVertexFitterAlg.h:26
Rec::GNNVertexFitterAlg::GNNVertexFitterAlg
GNNVertexFitterAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
GNNVertexFitterAlg.cxx:12
Rec::GNNVertexFitterAlg::finalize
StatusCode finalize() override
Definition
GNNVertexFitterAlg.cxx:72
Rec::GNNVertexFitterAlg::m_outVertexKey
SG::WriteHandleKey< xAOD::VertexContainer > m_outVertexKey
Definition
GNNVertexFitterAlg.h:28
Rec::GNNVertexFitterAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition
GNNVertexFitterAlg.cxx:30
Rec::GNNVertexFitterAlg::m_VtxTool
ToolHandle< Rec::GNNVertexFitterTool > m_VtxTool
Definition
GNNVertexFitterAlg.h:24
Rec::GNNVertexFitterAlg::m_pvContainerKey
SG::ReadHandleKey< xAOD::VertexContainer > m_pvContainerKey
Definition
GNNVertexFitterAlg.h:32
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::ptr
const_pointer_type ptr()
Dereference the pointer.
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
Rec
namespace for combined reconstruction tools and interfaces
Definition
FakeTrackBuilder.h:10
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition
TrackingPrimitives.h:590
xAOD::Vertex
Vertex_v1 Vertex
Define the latest version of the vertex class.
Definition
Event/xAOD/xAODTracking/xAODTracking/Vertex.h:16
Generated on
for ATLAS Offline Software by
1.17.0