ATLAS Offline Software
Loading...
Searching...
No Matches
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):
10
11// FrameWork include(s):
12#include "AthLinks/ElementLink.h"
15
16// EDM include(s):
18
19namespace DerivationFramework {
20
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
56 if (!vtxCont.isValid()) {
57 ATH_MSG_ERROR("Unable to retrieve xAOD::VertexContainer!");
58 return StatusCode::FAILURE;
59 }
60
61 // Open our event info
63 if (!evtInfo.isValid()) {
64 ATH_MSG_ERROR("Unable to retrieve xAOD::EventInfo!");
65 return StatusCode::FAILURE;
66 }
67
68 // Instantiate our WriteDecorHandle
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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
Handle class for reading from StoreGate.
Handle class for adding a decoration to an object.
ToolHandle< InDet::IInDetHardScatterSelectionTool > m_vtxSelectTool
ToolHandle for the IInDetHardScatterSelectionTool.
virtual StatusCode addBranches(const EventContext &ctx) const override final
Function decorating the inputs.
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey
xAOD::EventInfo ReadHandleKey
SG::ReadHandleKey< xAOD::VertexContainer > m_vtxContKey
ReadHandleKey for the input vertices.
SG::WriteDecorHandleKey< xAOD::EventInfo > m_evtDecoKey
WriteDecorHandleKey for the output hardscatter decoration (applied to xAOD::EventInfo)
virtual StatusCode initialize() override final
Function initialising the tool.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type get() const
Dereference the pointer, but don't cache anything.
Handle class for adding a decoration to an object.
THE reconstruction tool.