ATLAS Offline Software
Loading...
Searching...
No Matches
ColumnarToolXAOD.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7//
8// includes
9//
10
12
14#include <AsgTools/AsgTool.h>
15
16//
17// method implementations
18//
19
20namespace columnar
21{
24 : m_sharedData (std::make_shared<SharedData>(this))
25 {
26 }
27
28 ColumnarTool<ColumnarModeXAOD> ::
29 ColumnarTool (ColumnarTool<ColumnarModeXAOD>* val_parent)
30 {
31 if (val_parent)
32 {
33 m_sharedData = val_parent->m_sharedData;
34 if (auto *tool = dynamic_cast<asg::AsgTool*>(this))
35 m_sharedData->m_fulltools.insert (tool);
36 m_sharedData->m_subtools.insert(this);
37 } else
38 m_sharedData = std::make_shared<SharedData>(this);
39 }
40
41 ColumnarTool<ColumnarModeXAOD> ::
42 ~ColumnarTool ()
43 {
44 m_sharedData->m_subtools.erase(this);
45 if (auto *tool = dynamic_cast<asg::AsgTool*>(this))
46 m_sharedData->m_fulltools.erase (tool);
47 }
48
49 StatusCode ColumnarTool<ColumnarModeXAOD> ::
50 initializeColumns ()
51 {
52 for (auto& [key_weak, addMTDependency] : m_sharedData->m_keys)
53 {
54 if (auto key = key_weak.lock(); key && !key->key().empty())
55 {
56 // we don't have a message stream here, and the key should have
57 // already logged the error, so not logging anything here
58 if (key->initialize().isFailure())
59 return StatusCode::FAILURE;
60#ifndef XAOD_STANDALONE
61 if (addMTDependency)
62 {
63 for (auto* tool : m_sharedData->m_fulltools)
64 tool->addDependency (key->fullKey(), key->mode());
65 }
66#endif
67 }
68 }
69 m_sharedData->m_keys.clear();
70 return StatusCode::SUCCESS;
71 }
72
73 void ColumnarTool<ColumnarModeXAOD> ::
74 addSubtool (ColumnarTool<ColumnarModeXAOD>& subtool)
75 {
76 auto sharedData = subtool.m_sharedData;
77 for (auto* tool : sharedData->m_subtools)
78 tool->m_sharedData = m_sharedData;
79 m_sharedData->m_subtools.insert (sharedData->m_subtools.begin(), sharedData->m_subtools.end());
80 m_sharedData->m_fulltools.insert (sharedData->m_fulltools.begin(), sharedData->m_fulltools.end());
81 }
82
83 void ColumnarTool<ColumnarModeXAOD> ::
84 callEvents (ObjectRange<ContainerId::eventContext,ColumnarModeXAOD> /*events*/) const
85 {
86 throw std::runtime_error ("tool didn't implement callEvents");
87 }
88
89 void ColumnarTool<ColumnarModeXAOD> ::
90 internalAddKey (std::weak_ptr<SG::VarHandleKey> key, bool addMTDependency)
91 {
92 m_sharedData->m_keys.emplace_back (key, addMTDependency);
93 }
94
95 ColumnarTool<ColumnarModeXAOD>::SharedData ::
96 SharedData (ColumnarTool<ColumnarModeXAOD>* self)
97 : m_subtools ({self})
98 {
99 if (auto *tool = dynamic_cast<asg::AsgTool*>(self))
100 m_fulltools.insert (tool);
101 }
102}
A property holding a SG store/key/clid from which a VarHandle is made.
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
the base class for all columnar components