ATLAS Offline Software
Loading...
Searching...
No Matches
Database
AthenaRoot
AthenaRootComps
src
xAODBranchAddress.cxx
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
// xAODBranchAddress.cxx
8
// Implementation file for class Athena::xAODBranchAddress
9
// Author: Johannes ELmsheuser, Will Buttinger
11
12
// AthenaRootComps includes
13
#include "
xAODBranchAddress.h
"
14
#include "
xAODTEvent.h
"
15
16
// fwk includes
17
#include "GaudiKernel/System.h"
18
#include "
AthenaKernel/CLIDRegistry.h
"
19
#include "
CxxUtils/checker_macros.h
"
20
21
// ROOT includes
22
#include "TBranch.h"
23
#include "TTree.h"
24
#include "TLeaf.h"
25
26
#include "
xAODRootAccess/TEvent.h
"
27
#include "TClass.h"
28
#include <typeinfo>
29
30
31
namespace
Athena
{
32
34
// Public methods:
36
37
// Constructors
39
41
xAODBranchAddress::xAODBranchAddress
() :
42
GenericAddress(),
43
m_ptr
()
44
{}
45
47
xAODBranchAddress::xAODBranchAddress
(
const
xAODBranchAddress
& rhs ) :
48
GenericAddress(rhs),
49
m_ptr
(rhs.
m_ptr
)
50
{}
51
53
xAODBranchAddress
&
54
xAODBranchAddress::operator=
(
const
xAODBranchAddress
& rhs )
55
{
56
if
(
this
!= &rhs) {
57
GenericAddress::operator=(rhs);
58
m_ptr
= rhs.
m_ptr
;
59
}
60
return
*
this
;
61
}
62
64
xAODBranchAddress::xAODBranchAddress
(
long
svc,
65
const
CLID
& clid,
66
const
std::string& p1,
67
const
std::string& p2,
68
unsigned
long
ip1,
69
unsigned
long
ip2) :
70
GenericAddress(svc, clid, p1, p2, ip1, ip2),
71
m_ptr
(0)
//the actual data object that is retrieved
72
{
73
// std::cerr << "::RBA::+RBA... (this=" << this << ") br=["
74
// << this->par()[1] << "]\n";
75
}
76
78
xAODBranchAddress::~xAODBranchAddress
()
79
{
80
// std::cerr << "::RBA::~RBA... (this=" << this << ") br=["
81
// << this->par()[1] << "]\n";
82
}
83
84
85
xAOD::xAODTEvent
*
86
xAODBranchAddress::tevent
()
87
{
88
//std::cout << "xAODBranchAddress::tevent ..." << std::endl;
89
return
reinterpret_cast<
xAOD::xAODTEvent
*
>
(
reinterpret_cast<
unsigned
long
*
>
(this->ipar()[0]));
90
}
91
92
void
93
xAODBranchAddress::setTEventAddress
()
94
{
95
96
//std::cout << "xAODBranchAddress::setTEvent ..." << std::endl;
97
98
99
100
const
std::string& br_name = this->par()[1];
101
xAOD::xAODTEvent
*
tevent
= this->
tevent
();
102
//xAOD::TEvent* tevent = this->tevent();
103
//std::cout << "xAODBranchAddress::setTEventAddress br_name=" << br_name << std::endl;
104
//std::cout << "xAODBranchAddress::setTEventAddress tevent=" << tevent << " entries = " << tevent->getEntries() << std::endl;
105
//std::cout << "xAODBranchAddress::setTEventAddress tlID()=" << this->clID() << std::endl;
106
107
const
std::type_info* ti =
CLIDRegistry::CLIDToTypeinfo
(this->clID());
108
//std::cout << "xAODBranchAddress::setTEventAddress ti=" << ti << std::endl;
109
110
// void* addr = *(char**)&tevent;
111
112
113
//we use the ipar()[1] to flag if we retrieve main event info (0) or metadata (1) (see xAODEventSelector where it creates BranchAddress)
114
switch
( (this->ipar()[1]) ) {
115
case
0:
116
{
//reading event level info
117
tevent
->setActive();
//ensure we are active tevent
118
static
constexpr
bool
SILENT =
false
;
119
static
constexpr
bool
METADATA =
false
;
120
void
* addr
ATLAS_THREAD_SAFE
=
const_cast<
void
*
>
(
tevent
->getInputObject(br_name, *ti, SILENT, METADATA));
121
m_ptr
= addr;
122
}
123
break
;
124
case
1:
125
{
//reading metadata
126
//FIXME: NEEED TO ACCESS METADATA
127
//std::cout << "xAODBranchAddress::setTEventAddress metadata " << br_name << std::endl;
128
tevent
->setActive();
//ensure we are active tevent
129
static
constexpr
bool
SILENT =
false
;
130
static
constexpr
bool
METADATA =
true
;
131
void
* addr
ATLAS_THREAD_SAFE
=
const_cast<
void
*
>
(
tevent
->getInputObject(br_name, *ti, SILENT, METADATA));
132
m_ptr
= addr;
133
}
134
break
;
135
}
136
137
//std::cout << "xAODBranchAddress::setTEventAddress m_ptr=" << m_ptr << std::endl;
138
139
140
}
141
143
// Protected methods:
145
146
}
//> end namespace Athena
CLIDRegistry.h
a static registry of CLID->typeName entries.
TEvent.h
CLID
uint32_t CLID
The Class ID type.
Definition
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
checker_macros.h
Define macros for attributes used to control the static checker.
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition
checker_macros.h:211
Athena::xAODBranchAddress
A simple class to do the retrieve from TEvent.
Definition
xAODBranchAddress.h:31
Athena::xAODBranchAddress::operator=
xAODBranchAddress & operator=(const xAODBranchAddress &rhs)
Assignment operator:
Definition
xAODBranchAddress.cxx:54
Athena::xAODBranchAddress::~xAODBranchAddress
virtual ~xAODBranchAddress()
Destructor:
Definition
xAODBranchAddress.cxx:78
Athena::xAODBranchAddress::m_ptr
void * m_ptr
Definition
xAODBranchAddress.h:65
Athena::xAODBranchAddress::tevent
xAOD::xAODTEvent * tevent()
Definition
xAODBranchAddress.cxx:86
Athena::xAODBranchAddress::setTEventAddress
void setTEventAddress()
Definition
xAODBranchAddress.cxx:93
Athena::xAODBranchAddress::xAODBranchAddress
xAODBranchAddress()
Default constructor:
Definition
xAODBranchAddress.cxx:41
CLIDRegistry::CLIDToTypeinfo
static const std::type_info * CLIDToTypeinfo(CLID clid)
Translate between CLID and type_info.
Definition
CLIDRegistry.cxx:136
xAOD::xAODTEvent
Definition
xAODTEvent.h:23
Athena
Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc....
Definition
AthLegacySequence.h:21
xAODBranchAddress.h
xAODTEvent.h
Generated on
for ATLAS Offline Software by
1.14.0