Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
8 # include "xAODRootAccess/TEvent.h"
9 #endif // XAOD_STANDALONE
10 
11 // Local include(s):
12 #include "AsgTools/SgTEventMeta.h"
13 
14 namespace 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 
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
xAOD::TVirtualEvent
Base interface for getting objects out of the input file.
Definition: TVirtualEvent.h:32
asg
Definition: DataHandleTestTool.h:28
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
asg::SgTEventMeta::StoreType
StoreType
Type of the store that this object implements.
Definition: SgTEventMeta.h:49
xAOD::TActiveEvent::event
static TVirtualEvent * event()
Access the currently active TVirtualEvent object.
Definition: TActiveEvent.cxx:16
m_type
TokenType m_type
the type
Definition: TProperty.cxx:44
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
asg::SgTEventMeta::initialize
StatusCode initialize() const
Function initialising the object.
Definition: SgTEventMeta.cxx:46
asg::SgTEventMeta::SgTEventMeta
SgTEventMeta(StoreType type, xAOD::TEvent *event=0)
Constructor with a type and an optional TEvent pointer.
Definition: SgTEventMeta.cxx:16
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TEvent.h
SgTEventMeta.h
asg::SgTEventMeta::operator=
SgTEventMeta & operator=(SgTEventMeta &&other) noexcept
Move assignment operator.
Definition: SgTEventMeta.cxx:26
TActiveEvent.h
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
asg::SgTEventMeta
Wrapper class providing StoreGate-like access to metadata in ROOT.
Definition: SgTEventMeta.h:45
asg::SgTEventMeta::m_event
std::atomic< xAOD::TEvent * > m_event
Pointer to the xAOD::TEvent object in use.
Definition: SgTEventMeta.h:110
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:85