ATLAS Offline Software
Loading...
Searching...
No Matches
SgTEventMeta.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 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 SgTEventMeta::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_SOURCE << "Couldn't find an active event in "
57 << "the job" << std::endl;
58 return StatusCode::FAILURE;
59 }
60
61 // This should actually be a TEvent:
62 m_event.store(dynamic_cast< xAOD::TEvent* >( event ));
63 if( !m_event || !m_event.load() ) {
64 std::cout << META_ERROR_SOURCE << "The active event is not of type "
65 << "xAOD::TEvent?!?" << std::endl;
66 return StatusCode::FAILURE;
67 }
68
69 // We succeeded:
70 return StatusCode::SUCCESS;
71 }
72
73} // namespace asg
SgTEventMeta & operator=(SgTEventMeta &&other) noexcept
Move assignment operator.
StoreType
Type of the store that this object implements.
StatusCode initialize() const
Function initialising the object.
StoreType m_type
Type of this store.
SgTEventMeta(StoreType type, xAOD::TEvent *event=0)
Constructor with a type and an optional TEvent pointer.
std::atomic< xAOD::TEvent * > m_event
Pointer to the xAOD::TEvent object in use.
static TVirtualEvent * event()
Access the currently active TVirtualEvent object.
Tool for accessing xAOD files outside of Athena.
Base interface for getting objects out of the input file.