ATLAS Offline Software
Loading...
Searching...
No Matches
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
15#endif // XAOD_STANDALONE
16
17namespace asg {
18
20 : m_pevm( pevm ), m_ptds( ptds ) {
21
22 }
23
25
26 if( ! m_pevm ) {
27 initialize().ignore();
28 }
29
30 return m_pevm;
31 }
32
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:
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 ) {
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
StatusCode initialize() const
Function initialising the object.
Definition SgEvent.cxx:44
xAOD::TStore * m_ptds
Pointer to the TStore that this object interacts with.
Definition SgEvent.h:107
xAOD::Event * m_pevm
Pointer to the Event that this object interacts with.
Definition SgEvent.h:105
xAOD::TStore * tds() const
Return the underlying transient data store.
Definition SgEvent.cxx:33
SgEvent(xAOD::Event *pevm=0, xAOD::TStore *ptds=0)
Constructor specifying concrete Event and TStore objects.
Definition SgEvent.cxx:19
xAOD::Event * event() const
Return the underlying event manager.
Definition SgEvent.cxx:24
Base class for the event (xAOD::TEvent and xAOD::REvent) classes.
Definition Event.h:60
static TVirtualEvent * event()
Access the currently active TVirtualEvent object.
static TStore * store()
Access the currently active TStore object.
A relatively simple transient store for objects created in analysis.
Definition TStore.h:45
Base interface for getting objects out of the input file.