ATLAS Offline Software
Loading...
Searching...
No Matches
SgEventMeta.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5// xAOD include(s):
6#ifdef XAOD_STANDALONE
9#endif // XAOD_STANDALONE
10
11// Local include(s):
13
14namespace asg {
15
17 : m_type( type ) {
18 m_event.store(event);
19 }
20
22 : m_type(other.m_type) {
23 m_event.store(other.m_event.load());
24 }
25
27 if (this != &other) {
28 m_type = other.m_type;
29 m_event.store(other.m_event.load());
30 }
31 return *this;
32 }
33
35 m_event.store(event);
36 return *this;
37 }
38
46 StatusCode SgEventMeta::initialize() const {
47
48 // Return right away if we already have a non-null pointer:
49 if (m_event && m_event.load()) {
50 return StatusCode::SUCCESS;
51 }
52
53 // Check if there's an active event:
55 if( ! event ) {
56 std::cout << META_ERROR_SRC << "Couldn't find an active event in "
57 << "the job" << std::endl;
58 return StatusCode::FAILURE;
59 }
60
61 // This should actually be a Event:
62 m_event.store(dynamic_cast< xAOD::Event* >( event ));
63 if( !m_event || !m_event.load() ) {
64 std::cout << META_ERROR_SRC << "The active event is not of type "
65 << "xAOD::Event?!?" << std::endl;
66 return StatusCode::FAILURE;
67 }
68
69 // We succeeded:
70 return StatusCode::SUCCESS;
71 }
72
73} // namespace asg
std::atomic< xAOD::Event * > m_event
Pointer to the xAOD::Event object in use.
SgEventMeta & operator=(SgEventMeta &&other) noexcept
Move assignment operator.
StatusCode initialize() const
Function initialising the object.
SgEventMeta(StoreType type, xAOD::Event *event=0)
Constructor with a type and an optional Event pointer.
StoreType
Type of the store that this object implements.
Definition SgEventMeta.h:49
StoreType m_type
Type of this store.
Base class for the event (xAOD::TEvent and xAOD::REvent) classes.
Definition Event.h:60
static TVirtualEvent * event()
Access the currently active TVirtualEvent object.
Base interface for getting objects out of the input file.