ATLAS Offline Software
Loading...
Searching...
No Matches
ColumnarToolXAOD.icc
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 Nils Krumnack
6
7
8#include <AsgMessaging/StatusCode.h>
9#include <AsgTools/AsgTool.h>
10#include <ColumnarCore/ContainerId.h>
11#include <ColumnarCore/ObjectRange.h>
12
13namespace SG
14{
15 class VarHandleKey;
16}
17
18namespace asg
19{
20 class AsgTool;
21}
22
23namespace columnar
24{
25 template<> class ColumnarTool<ColumnarModeXAOD>
26 {
27 /// Common Public Members
28 /// =====================
29 public:
30
31 static constexpr bool singleEvent = true;
32
33 ColumnarTool ();
34 explicit ColumnarTool (ColumnarTool<ColumnarModeXAOD>* val_parent);
35 ColumnarTool (const ColumnarTool<ColumnarModeXAOD>&) = delete;
36 ColumnarTool& operator = (const ColumnarTool<ColumnarModeXAOD>&) = delete;
37 virtual ~ColumnarTool ();
38
39
40 /// @brief initialize the columns/column handles
41 ///
42 /// This should be called at the end of initialize after all data handles
43 /// have been declared.
44 StatusCode initializeColumns ();
45
46
47 /// @brief add the given sub-tool
48 void addSubtool (ColumnarTool<ColumnarModeXAOD>& subtool);
49
50
51 /// @brief call the tool for the given event range
52 virtual void callEvents (ObjectRange<ContainerId::eventContext,ColumnarModeXAOD> events) const;
53
54
55
56 /// Mode-Specific Public Members
57 /// ============================
58 public:
59
60 auto& eventStore () const noexcept {
61#ifdef XAOD_STANDALONE
62 return m_sharedData->m_event;
63#else
64 return *m_sharedData->m_evtStore;
65#endif
66 }
67
68 void internalAddKey (std::weak_ptr<SG::VarHandleKey> key, bool addMTDependency);
69
70
71
72 /// Private Members
73 /// ===============
74 private:
75
76 struct SharedData final
77 {
78#ifdef XAOD_STANDALONE
79 mutable asg::SgTEvent m_event;
80#else
81 using StoreGateSvc_t = ServiceHandle<StoreGateSvc>;
82 /// Pointer to StoreGate (event store by default)
83 StoreGateSvc_t m_evtStore {"StoreGateSvc/StoreGateSvc", "ColumnarToolXAOD"};
84#endif
85 std::vector<std::pair<std::weak_ptr<SG::VarHandleKey>,bool>> m_keys;
86 std::unordered_set<ColumnarTool<ColumnarModeXAOD>*> m_subtools;
87 std::unordered_set<asg::AsgTool*> m_fulltools;
88 SharedData (ColumnarTool<ColumnarModeXAOD>* self);
89 };
90 std::shared_ptr<SharedData> m_sharedData;
91 };
92}