ATLAS Offline Software
Loading...
Searching...
No Matches
A/AthLinks/ElementLink.h
Go to the documentation of this file.
1// Dear emacs, this is -*- c++ -*-
2/*
3 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4 */
5#ifndef ATHLINKS_ELEMENTLINK_H
6#define ATHLINKS_ELEMENTLINK_H
7
8// System include(s):
9extern "C" {
10# include <stdint.h>
11}
12#include <string>
13#include <RootMetaSelection.h>
14
15// Local include(s):
16#include "AthLinks/ElementLinkBase.h"
18
19// Forward declaration(s):
20namespace ROOT { namespace Meta { namespace Selection {
21 template< typename STORABLE >
22 class ElementLink;
23}}}
24namespace xAOD {
25 class TVirtualEvent;
26}
27
38template< typename STORABLE >
39class ElementLink : public ElementLinkBase {
40
41public:
44
46 typedef std::string ID_type;
48 typedef uint32_t sgkey_t;
49
51 typedef const STORABLE& BaseConstReference;
53 typedef const STORABLE* BaseConstPointer;
54
56 typedef size_t index_type;
57
59 typedef typename STORABLE::value_type value_type;
61 typedef typename STORABLE::const_iterator const_iterator;
62
71
73
76
81
84 xAOD::TVirtualEvent* event = 0 );
87 xAOD::TVirtualEvent* event = 0 );
88
93 xAOD::TVirtualEvent* event = 0 );
98 xAOD::TVirtualEvent* event = 0 );
99
102 xAOD::TVirtualEvent* event = 0 );
105 xAOD::TVirtualEvent* event = 0 );
106
108 ElementLink( const ElementLink& parent );
109
111
114
117
122
124 bool setElement( ElementType element );
127
130 xAOD::TVirtualEvent* event = 0 );
133 xAOD::TVirtualEvent* event = 0 );
135 void reset();
136
138
141
146
148 index_type index() const { return persIndex(); }
149
151 const ID_type& dataID() const;
153 sgkey_t key() const { return persKey(); }
154
156 bool operator==( const ElementLink& rhs ) const;
158 bool operator!=( const ElementLink& rhs ) const;
159
162
164 ElementConstPointer operator->() const { return cptr(); }
166 operator ElementConstPointer () const { return cptr(); }
169
171 bool isValid() const;
173 bool operator!() const { return ! isValid(); }
174
178 bool hasCachedElement() const { return m_elementCached; }
179
181
183 xAOD::TVirtualEvent* source() const { return m_event; }
184
186 bool toPersistent() { return true; }
187
188private:
190 virtual bool toTransient();
194 void findIndex();
195
201 mutable bool m_elementCached;
204
206 typedef typename
208
209}; // class ElementLink
210
211template <typename STORABLE>
213 const ElementLink<STORABLE> &rhs);
214
215template <typename STORABLE>
217 const ElementLink<STORABLE> &rhs);
218
219/*
220 * The following piece of code declares all members of the ElementLink
221 * class as transient.
222 */
223namespace ROOT { namespace Meta { namespace Selection {
224template< typename STORABLE >
225class ElementLink : public SelectNoInstance
226{
227
228public:
231
233 ROOT::Meta::Selection::MemberAttributes< kTransient > m_container;
234 ROOT::Meta::Selection::MemberAttributes< kTransient > m_element;
235 ROOT::Meta::Selection::MemberAttributes< kTransient > m_elementCached;
236 ROOT::Meta::Selection::MemberAttributes< kTransient > m_event;
237
238};
239}}} // ROOT namespace
240
241// Include the implementation:
242#ifndef __GCCXML__
243# include "ElementLink.icc"
244#endif // __GCCXML__
245
246#endif // ATHLINKS_ELEMENTLINK_H
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
Base class for ElementLinks to vectors of pointers.
stored_index_type persIndex() const
Return the index of the link.
sgkey_t persKey() const
Return the SG key that we reference, as a hash.
Base interface for getting objects out of the input file.
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition hcg.cxx:310
Selection rules: declare transient members.
Definition DataVector.h:581
Definition index.py:1
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
T type
Type of the elements in the container.
Definition TypeTools.h:19
const T * const_pointer
Constant pointer to an element in the container.
Definition TypeTools.h:23
const T & const_reference
Constant reference to an element in the container.
Definition TypeTools.h:21