ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
DerivationFramework
DerivationFrameworkInDet
src
HardScatterVertexDecorator.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// Author: Matthew Basso (matthew.joseph.basso@cern.ch)
6
// A very simple tool for decorating vertices as hardscatter or not-hardscatter
7
8
// Local include(s):
9
#include "
DerivationFrameworkInDet/HardScatterVertexDecorator.h
"
10
11
// FrameWork include(s):
12
#include "AthLinks/ElementLink.h"
13
#include "
StoreGate/ReadHandle.h
"
14
#include "
StoreGate/WriteDecorHandle.h
"
15
16
// EDM include(s):
17
#include "
xAODTracking/VertexContainer.h
"
18
19
namespace
DerivationFramework
{
20
21
StatusCode
HardScatterVertexDecorator::initialize
()
22
{
23
// Print configuration
24
ATH_MSG_DEBUG
(
"Initializing "
<< name() <<
"..."
);
25
ATH_MSG_DEBUG
(
"Using VertexContainerName: "
<<
m_vtxContKey
);
26
ATH_MSG_DEBUG
(
"Using HardScatterSelectionTool: "
<<
m_vtxSelectTool
);
27
28
if
(
m_vtxContKey
.empty()) {
29
ATH_MSG_ERROR
(
"No xAOD::VertexContainer provided!"
);
30
return
StatusCode::FAILURE;
31
}
32
33
if
(
m_vtxSelectTool
.empty()) {
34
ATH_MSG_ERROR
(
"No InDet::IInDetHardScatterSelectionTool provided!"
);
35
return
StatusCode::FAILURE;
36
}
37
38
// Initialize our vertex and event info container reads
39
ATH_CHECK
(
m_vtxContKey
.initialize());
40
ATH_CHECK
(
m_evtInfoKey
.initialize());
41
42
// Instantiate and initialize our event info decorator write
43
ATH_CHECK
(
m_evtDecoKey
.initialize());
44
// Fetch our InDet::IInDetHardScatterSelectionTool
45
ATH_CHECK
(
m_vtxSelectTool
.retrieve());
46
return
StatusCode::SUCCESS;
47
}
48
49
StatusCode
HardScatterVertexDecorator::addBranches
(
const
EventContext& ctx)
const
50
{
51
ATH_MSG_DEBUG
(
"In addBranches(...) for "
<< name() <<
"..."
);
52
53
54
// Open our vertex container
55
SG::ReadHandle<xAOD::VertexContainer>
vtxCont(
m_vtxContKey
, ctx);
56
if
(!vtxCont.
isValid
()) {
57
ATH_MSG_ERROR
(
"Unable to retrieve xAOD::VertexContainer!"
);
58
return
StatusCode::FAILURE;
59
}
60
61
// Open our event info
62
SG::ReadHandle<xAOD::EventInfo>
evtInfo(
m_evtInfoKey
, ctx);
63
if
(!evtInfo.
isValid
()) {
64
ATH_MSG_ERROR
(
"Unable to retrieve xAOD::EventInfo!"
);
65
return
StatusCode::FAILURE;
66
}
67
68
// Instantiate our WriteDecorHandle
69
SG::WriteDecorHandle<xAOD::EventInfo, ElementLink<xAOD::VertexContainer>
> evtDeco(
m_evtDecoKey
, ctx);
70
71
// Decorate our event info
72
evtDeco(*evtInfo) =
m_vtxSelectTool
->getHardScatterLink(vtxCont.
get
());
73
74
return
StatusCode::SUCCESS;
75
}
76
77
}
// end: namespace DerivationFramework
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
HardScatterVertexDecorator.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteDecorHandle.h
Handle class for adding a decoration to an object.
VertexContainer.h
DerivationFramework::HardScatterVertexDecorator::m_vtxSelectTool
ToolHandle< InDet::IInDetHardScatterSelectionTool > m_vtxSelectTool
ToolHandle for the IInDetHardScatterSelectionTool.
Definition
HardScatterVertexDecorator.h:63
DerivationFramework::HardScatterVertexDecorator::addBranches
virtual StatusCode addBranches(const EventContext &ctx) const override final
Function decorating the inputs.
Definition
HardScatterVertexDecorator.cxx:49
DerivationFramework::HardScatterVertexDecorator::m_evtInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey
xAOD::EventInfo ReadHandleKey
Definition
HardScatterVertexDecorator.h:67
DerivationFramework::HardScatterVertexDecorator::m_vtxContKey
SG::ReadHandleKey< xAOD::VertexContainer > m_vtxContKey
ReadHandleKey for the input vertices.
Definition
HardScatterVertexDecorator.h:59
DerivationFramework::HardScatterVertexDecorator::m_evtDecoKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_evtDecoKey
WriteDecorHandleKey for the output hardscatter decoration (applied to xAOD::EventInfo).
Definition
HardScatterVertexDecorator.h:70
DerivationFramework::HardScatterVertexDecorator::initialize
virtual StatusCode initialize() override final
Function initialising the tool.
Definition
HardScatterVertexDecorator.cxx:21
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::ReadHandle::get
const_pointer_type get() const
Dereference the pointer, but don't cache anything.
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition
StoreGate/StoreGate/WriteDecorHandle.h:100
DerivationFramework
THE reconstruction tool.
Definition
CascadeTools.h:16
Generated on
for ATLAS Offline Software by
1.17.0