ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthToolSupport
AsgTools
Root
SgEvent.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
// System include(s):
6
#include <iostream>
7
8
// Local include(s):
9
#include "
AsgTools/SgEvent.h
"
10
11
// RootCore include(s):
12
#ifdef XAOD_STANDALONE
13
# include "
xAODRootAccessInterfaces/TActiveEvent.h
"
14
# include "
xAODRootAccess/TActiveStore.h
"
15
#endif
// XAOD_STANDALONE
16
17
namespace
asg
{
18
19
SgEvent::SgEvent
(
xAOD::Event
* pevm,
xAOD::TStore
* ptds )
20
:
m_pevm
( pevm ),
m_ptds
( ptds ) {
21
22
}
23
24
xAOD::Event
*
SgEvent::event
()
const
{
25
26
if
( !
m_pevm
) {
27
initialize
().ignore();
28
}
29
30
return
m_pevm
;
31
}
32
33
xAOD::TStore
*
SgEvent::tds
()
const
{
34
35
// I'm checking the value of m_pevm on purpose. Since m_ptds may be
36
// missing under normal circumstances as well.
37
if
( !
m_pevm
) {
38
initialize
().ignore();
39
}
40
41
return
m_ptds
;
42
}
43
44
StatusCode
SgEvent::initialize
()
const
{
45
46
// Return right away if we already have a pointer to both stores:
47
if
(
m_pevm
&&
m_ptds
) {
48
return
StatusCode::SUCCESS;
49
}
50
51
// Look for a pointer to the active event if necessary:
52
if
( !
m_pevm
) {
53
// Check if there's an active event:
54
xAOD::TVirtualEvent
*
event
=
xAOD::TActiveEvent::event
();
55
if
( !
event
) {
56
std::cout << 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_pevm
=
dynamic_cast<
xAOD::Event
*
>
(
event
);
63
if
( !
m_pevm
) {
64
std::cout << ERROR_SRC <<
"The active event is not of type "
65
<<
"xAOD::Event?!?"
<< std::endl;
66
return
StatusCode::FAILURE;
67
}
68
}
69
70
// Look for a pointer to the active store if necessary:
71
if
( !
m_ptds
) {
72
m_ptds
=
xAOD::TActiveStore::store
();
73
if
( !
m_ptds
) {
74
std::cout <<
"asg::SgEvent WARNING "
75
<<
"No xAOD::TStore object is available"
<< std::endl;
76
}
77
}
78
79
// Return gracefully:
80
return
StatusCode::SUCCESS;
81
}
82
83
}
// namespace asg
SgEvent.h
TActiveEvent.h
TActiveStore.h
asg::SgEvent::initialize
StatusCode initialize() const
Function initialising the object.
Definition
SgEvent.cxx:44
asg::SgEvent::m_ptds
xAOD::TStore * m_ptds
Pointer to the TStore that this object interacts with.
Definition
SgEvent.h:107
asg::SgEvent::m_pevm
xAOD::Event * m_pevm
Pointer to the Event that this object interacts with.
Definition
SgEvent.h:105
asg::SgEvent::tds
xAOD::TStore * tds() const
Return the underlying transient data store.
Definition
SgEvent.cxx:33
asg::SgEvent::SgEvent
SgEvent(xAOD::Event *pevm=0, xAOD::TStore *ptds=0)
Constructor specifying concrete Event and TStore objects.
Definition
SgEvent.cxx:19
asg::SgEvent::event
xAOD::Event * event() const
Return the underlying event manager.
Definition
SgEvent.cxx:24
xAOD::Event
Base class for the event (xAOD::TEvent and xAOD::REvent) classes.
Definition
Event.h:61
xAOD::TActiveEvent::event
static TVirtualEvent * event()
Access the currently active TVirtualEvent object.
Definition
TActiveEvent.cxx:16
xAOD::TActiveStore::store
static TStore * store()
Access the currently active TStore object.
Definition
TActiveStore.cxx:16
xAOD::TStore
A relatively simple transient store for objects created in analysis.
Definition
TStore.h:45
xAOD::TVirtualEvent
Base interface for getting objects out of the input file.
Definition
TVirtualEvent.h:26
asg
Definition
DataHandleTestTool.h:28
Generated on
for ATLAS Offline Software by
1.17.0