ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
POOLRootAccess
POOLRootAccess
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef POOLROOTACCESS_TEVENT_H
6
#define POOLROOTACCESS_TEVENT_H
7
8
#include "
StoreGate/StoreGateSvc.h
"
9
10
#include "GaudiKernel/Bootstrap.h"
11
12
#include "GaudiKernel/IIncidentSvc.h"
13
#include "Gaudi/Interfaces/IOptionsSvc.h"
14
#include "
AthenaKernel/IEvtSelectorSeek.h
"
15
#include "
AthenaKernel/IEventSeek.h
"
16
17
#include "GaudiKernel/IAppMgrUI.h"
18
19
//include the CLIDs of simple types so that we don't need to do this ourselves from ROOT prompt
20
//when reading in kTreeAccess
21
#include "
SGTools/BuiltinsClids.h
"
22
#include "
SGTools/StlVectorClids.h
"
23
#include "
SGTools/StlMapClids.h
"
24
25
class
TFile;
26
class
TChain;
27
class
IEventProcessor;
28
29
//Bootstraps the minimal gaudi environment + a few extra defaults (see basic.opts)
30
namespace
Gaudi
{
31
IAppMgrUI*
Init
();
32
}
33
34
namespace
POOL
{
35
37
IAppMgrUI*
Init
(
const
char
* options =
"POOLRootAccess/basic.opts"
);
38
39
40
class
TEvent
{
41
public
:
42
enum
EReadMode
{
43
kTreeAccess
= -2,
//read the TTree directly
44
kPOOLAccess
= -1,
//cannot be used in the same session as the other access modes
45
kBranchAccess
= 0,
46
kClassAccess
= 1,
47
kAthenaAccess
= 2,
48
kUndefinedAccess
= 3
49
};
50
51
static
IAppMgrUI*
Init
(
const
char
* options =
"POOLRootAccess/basic.opts"
) {
return
POOL::Init
(options); }
52
53
54
TEvent
(
const
std::string& name =
"StoreGateSvc"
);
55
TEvent
(
EReadMode
mode,
const
std::string& name =
"StoreGateSvc"
);
56
57
~TEvent
();
58
59
ServiceHandle<IEventSeek>
&
evtLoop
() {
return
m_evtLoop
; }
60
ServiceHandle<StoreGateSvc>
&
evtStore
() {
return
m_evtStore
; }
61
ServiceHandle<StoreGateSvc>
&
inputMetaStore
() {
return
m_inputMetaStore
; }
62
63
template
<
typename
T>
void
setEvtSelProperty
(
const
char
* name,
const
T& val ) {
64
if
constexpr
(std::is_convertible_v<T, std::string>) {
65
// Gaudi::Utils::toString adds extra quotes, don't do this for strings:
66
m_joSvc
->set(
m_evtSelect
.name() +
"."
+ name, std::string(val));
67
}
68
else
{
69
m_joSvc
->set(
m_evtSelect
.name() +
"."
+ name, Gaudi::Utils::toString(val));
70
}
71
}
72
73
//forward retrieve calls to the evtStore
74
template
<
typename
T> StatusCode
retrieve
(
const
T*& obj ) {
75
return
evtStore
()->retrieve( obj );
76
}
77
78
template
<
typename
T> StatusCode
retrieve
( T*& obj ) {
79
return
evtStore
()->retrieve( obj );
80
}
81
82
template
<
typename
T> StatusCode
retrieve
(
const
T*& obj ,
const
std::string& key ){
83
return
evtStore
()->retrieve( obj, key );
84
}
85
template
<
typename
T> StatusCode
retrieve
( T*& obj ,
const
std::string& key ){
86
return
evtStore
()->retrieve( obj, key );
87
}
88
89
//forward calls to metadata store
90
template
<
typename
T> StatusCode
retrieveMetaInput
(
const
T*& obj,
const
std::string& key ) {
91
return
inputMetaStore
()->retrieve( obj, key );
92
}
93
94
int
getEntry
(
long
entry );
//return -1 if failure. otherwise 0
95
long
getEntries
();
96
97
StatusCode
readFrom
( TFile*
file
);
98
StatusCode
readFrom
(
const
char
*
file
);
//also takes a comma-separated list and can take wild cards
99
StatusCode
readFrom
( TChain*
files
);
//multi-file input
100
102
void
setActive
();
103
104
106
PyObject
*
retrieve
(
PyObject
* tp,
PyObject
* pykey );
107
PyObject
*
get_item
(
PyObject
* pykey );
//typess retrieve, which is slower than retrieve above
108
PyObject
*
contains
(
PyObject
* tp,
PyObject
* pykey );
109
PyObject
*
retrieveMetaInput
(
PyObject
* tp,
PyObject
* pykey);
110
PyObject
*
record
(
PyObject
* obj,
PyObject
* pykey,
bool
allowMods =
true
,
bool
resetOnly =
true
,
bool
noHist =
false
);
111
112
private
:
113
long
m_curEntry
= -1;
//if this becomes >=0 then the TEvent is considered 'initialized'
114
long
m_size
= -1;
//cache of the event size, filled on first call to getEntries
115
116
IEventProcessor*
m_evtProcessor
;
117
118
// HAVE_LISTENERS means that there are listeners for the ClearStore
119
// incident; NO_LISTENERS means that there aren't any.
120
// UNCHECKED means that we haven't checked yet.
121
enum
ListenerState
{
UNCHECKED
,
HAVE_LISTENERS
,
NO_LISTENERS
};
122
std::atomic<ListenerState>
m_listenerState
{
UNCHECKED
};
123
124
ServiceHandle<IIncidentSvc>
m_incSvc
;
125
ServiceHandle<Gaudi::Interfaces::IOptionsSvc>
m_joSvc
;
126
127
ServiceHandle<IEventSeek>
m_evtLoop
;
//the AthenaEventLoopMgr
128
ServiceHandle<IEvtSelectorSeek>
m_evtSelect
;
//the EventSelectorAthenaPool
129
ServiceHandle<StoreGateSvc>
m_evtStore
;
//the storegate
130
131
ServiceHandle<StoreGateSvc>
m_inputMetaStore
;
//input metadata storegate
132
133
};
134
135
}
136
137
138
#endif
BuiltinsClids.h
IEventSeek.h
Abstract interface for seeking within an event stream.
IEvtSelectorSeek.h
Extension to IEvtSelector to allow for seeking.
PyObject
_object PyObject
Definition
IPyComponent.h:27
StlMapClids.h
StlVectorClids.h
StoreGateSvc.h
POOL::TEvent::m_curEntry
long m_curEntry
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:113
POOL::TEvent::readFrom
StatusCode readFrom(TFile *file)
Definition
PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:135
POOL::TEvent::TEvent
TEvent(const std::string &name="StoreGateSvc")
Definition
PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:46
POOL::TEvent::m_size
long m_size
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:114
POOL::TEvent::contains
PyObject * contains(PyObject *tp, PyObject *pykey)
Definition
PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:227
POOL::TEvent::getEntry
int getEntry(long entry)
Definition
PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:187
POOL::TEvent::m_evtSelect
ServiceHandle< IEvtSelectorSeek > m_evtSelect
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:128
POOL::TEvent::record
PyObject * record(PyObject *obj, PyObject *pykey, bool allowMods=true, bool resetOnly=true, bool noHist=false)
Definition
PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:234
POOL::TEvent::Init
static IAppMgrUI * Init(const char *options="POOLRootAccess/basic.opts")
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:51
POOL::TEvent::retrieve
StatusCode retrieve(const T *&obj)
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:74
POOL::TEvent::m_joSvc
ServiceHandle< Gaudi::Interfaces::IOptionsSvc > m_joSvc
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:125
POOL::TEvent::m_inputMetaStore
ServiceHandle< StoreGateSvc > m_inputMetaStore
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:131
POOL::TEvent::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:60
POOL::TEvent::get_item
PyObject * get_item(PyObject *pykey)
Definition
PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:224
POOL::TEvent::retrieveMetaInput
StatusCode retrieveMetaInput(const T *&obj, const std::string &key)
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:90
POOL::TEvent::retrieve
StatusCode retrieve(T *&obj, const std::string &key)
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:85
POOL::TEvent::setActive
void setActive()
ensure we are the active store, for the purpose of element links etc
Definition
PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:122
POOL::TEvent::m_evtStore
ServiceHandle< StoreGateSvc > m_evtStore
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:129
POOL::TEvent::m_evtLoop
ServiceHandle< IEventSeek > m_evtLoop
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:127
POOL::TEvent::inputMetaStore
ServiceHandle< StoreGateSvc > & inputMetaStore()
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:61
POOL::TEvent::EReadMode
EReadMode
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:42
POOL::TEvent::kPOOLAccess
@ kPOOLAccess
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:44
POOL::TEvent::kTreeAccess
@ kTreeAccess
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:43
POOL::TEvent::kBranchAccess
@ kBranchAccess
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:45
POOL::TEvent::kAthenaAccess
@ kAthenaAccess
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:47
POOL::TEvent::kUndefinedAccess
@ kUndefinedAccess
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:48
POOL::TEvent::kClassAccess
@ kClassAccess
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:46
POOL::TEvent::m_listenerState
std::atomic< ListenerState > m_listenerState
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:122
POOL::TEvent::ListenerState
ListenerState
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:121
POOL::TEvent::UNCHECKED
@ UNCHECKED
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:121
POOL::TEvent::NO_LISTENERS
@ NO_LISTENERS
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:121
POOL::TEvent::HAVE_LISTENERS
@ HAVE_LISTENERS
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:121
POOL::TEvent::retrieve
StatusCode retrieve(T *&obj)
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:78
POOL::TEvent::~TEvent
~TEvent()
Definition
PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:33
POOL::TEvent::getEntries
long getEntries()
Definition
PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:126
POOL::TEvent::m_evtProcessor
IEventProcessor * m_evtProcessor
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:116
POOL::TEvent::m_incSvc
ServiceHandle< IIncidentSvc > m_incSvc
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:124
POOL::TEvent::setEvtSelProperty
void setEvtSelProperty(const char *name, const T &val)
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:63
POOL::TEvent::evtLoop
ServiceHandle< IEventSeek > & evtLoop()
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:59
POOL::TEvent::retrieve
StatusCode retrieve(const T *&obj, const std::string &key)
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:82
ServiceHandle
Definition
ClusterMakerTool.h:36
files
std::vector< std::string > files
file names and file pointers
Definition
hcg.cxx:52
Gaudi
=============================================================================
Definition
CaloGPUClusterAndCellDataMonitorOptions.h:273
Gaudi::Init
IAppMgrUI * Init()
Definition
PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:22
POOL
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:34
POOL::Init
IAppMgrUI * Init(const char *options="POOLRootAccess/basic.opts")
Bootstraps (creates and configures) the Gaudi Application with the provided options file.
Definition
PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:29
file
TFile * file
Definition
tile_monitor.h:29
Generated on
for ATLAS Offline Software by
1.17.0