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-2026 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}
27class EventContext;
28
39template< typename STORABLE >
41
42public:
45
47 typedef std::string ID_type;
49 typedef uint32_t sgkey_t;
50
52 typedef const STORABLE& BaseConstReference;
54 typedef const STORABLE* BaseConstPointer;
55
57 typedef size_t index_type;
58
60 typedef typename STORABLE::value_type value_type;
62 typedef typename STORABLE::const_iterator const_iterator;
63
72
74
77
82
85 xAOD::TVirtualEvent* event = 0 );
88 xAOD::TVirtualEvent* event = 0 );
89
94 xAOD::TVirtualEvent* event = 0 );
99 xAOD::TVirtualEvent* event = 0 );
100
103 xAOD::TVirtualEvent* event = 0 );
106 xAOD::TVirtualEvent* event = 0 );
107
109 ElementLink( const ElementLink& parent );
110
114 const EventContext& ctx );
116 const EventContext& ctx );
118 const EventContext& ctx );
120 const EventContext& ctx );
122 const EventContext& ctx );
124 const EventContext& ctx );
125
127
130
133
138
140 bool setElement( ElementType element );
143
146 xAOD::TVirtualEvent* event = 0 );
149 xAOD::TVirtualEvent* event = 0 );
151 void reset();
152
154
157
162
164 index_type index() const { return persIndex(); }
165
167 const ID_type& dataID() const;
169 sgkey_t key() const { return persKey(); }
170
172 bool operator==( const ElementLink& rhs ) const;
174 bool operator!=( const ElementLink& rhs ) const;
175
178
180 ElementConstPointer operator->() const { return cptr(); }
182 operator ElementConstPointer () const { return cptr(); }
185
187 bool isValid() const;
189 bool operator!() const { return ! isValid(); }
190
194 bool hasCachedElement() const { return m_elementCached; }
195
197
199 xAOD::TVirtualEvent* source() const { return m_event; }
200
202 bool toPersistent() { return true; }
203
204private:
206 virtual bool toTransient();
210 void findIndex();
211
217 mutable bool m_elementCached;
220
222 typedef typename
224
225}; // class ElementLink
226
227template <typename STORABLE>
229 const ElementLink<STORABLE> &rhs);
230
231template <typename STORABLE>
233 const ElementLink<STORABLE> &rhs);
234
235/*
236 * The following piece of code declares all members of the ElementLink
237 * class as transient.
238 */
239namespace ROOT { namespace Meta { namespace Selection {
240template< typename STORABLE >
241class ElementLink : public SelectNoInstance
242{
243
244public:
247
249 ROOT::Meta::Selection::MemberAttributes< kTransient > m_container;
250 ROOT::Meta::Selection::MemberAttributes< kTransient > m_element;
251 ROOT::Meta::Selection::MemberAttributes< kTransient > m_elementCached;
252 ROOT::Meta::Selection::MemberAttributes< kTransient > m_event;
253
254};
255}}} // ROOT namespace
256
257// Include the implementation:
258#ifndef __GCCXML__
259# include "ElementLink.icc"
260#endif // __GCCXML__
261
262#endif // ATHLINKS_ELEMENTLINK_H
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
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.
ElementLinkBase(const ElementLinkBase &)=default
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:312
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