ATLAS Offline Software
Database
AthenaRoot
AthenaRootComps
src
xAODBranchAddress.cxx
Go to the documentation of this file.
1
3
/*
4
Copyright (C) 2002-2022 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
void
* addr
ATLAS_THREAD_SAFE
=
const_cast<
void
*
>
(
tevent
->
getInputObject
(br_name, *ti));
119
m_ptr
= addr;
120
}
121
break
;
122
case
1:
123
{
//reading metadata
124
//FIXME: NEEED TO ACCESS METADATA
125
//std::cout << "xAODBranchAddress::setTEventAddress metadata " << br_name << std::endl;
126
tevent
->
setActive
();
//ensure we are active tevent
127
void
* addr
ATLAS_THREAD_SAFE
=
const_cast<
void
*
>
(
tevent
->
getInputObject
(br_name, *ti,
false
,
true
));
128
m_ptr
= addr;
129
}
130
break
;
131
}
132
133
//std::cout << "xAODBranchAddress::setTEventAddress m_ptr=" << m_ptr << std::endl;
134
135
136
}
137
139
// Protected methods:
141
142
}
//> end namespace Athena
Athena::xAODBranchAddress
Definition:
xAODBranchAddress.h:31
xAOD::xAODTEvent::getInputObject
const void * getInputObject(SG::sgkey_t key, const std::type_info &ti, bool silent=false) override
Function for retrieving an input object in a non-template way.
Definition:
Control/xAODRootAccess/Root/TEvent.cxx:1938
CLIDRegistry::CLIDToTypeinfo
static const std::type_info * CLIDToTypeinfo(CLID clid)
Translate between CLID and type_info.
Definition:
CLIDRegistry.cxx:136
Athena::xAODBranchAddress::setTEventAddress
void setTEventAddress()
Definition:
xAODBranchAddress.cxx:93
Athena::xAODBranchAddress::~xAODBranchAddress
virtual ~xAODBranchAddress()
Destructor:
Definition:
xAODBranchAddress.cxx:78
Athena
Some weak symbol referencing magic...
Definition:
AthLegacySequence.h:21
TEvent.h
xAODTEvent.h
xAOD::xAODTEvent
Definition:
xAODTEvent.h:23
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition:
AthROOTErrorHandlerSvc.cxx:10
Athena::xAODBranchAddress::tevent
xAOD::xAODTEvent * tevent()
Definition:
xAODBranchAddress.cxx:86
CLID
uint32_t CLID
The Class ID type.
Definition:
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
xAODBranchAddress.h
createCoolChannelIdFile.par
par
Definition:
createCoolChannelIdFile.py:29
Athena::xAODBranchAddress::operator=
xAODBranchAddress & operator=(const xAODBranchAddress &rhs)
Assignment operator:
Definition:
xAODBranchAddress.cxx:54
Athena::xAODBranchAddress::xAODBranchAddress
xAODBranchAddress()
Default constructor:
Definition:
xAODBranchAddress.cxx:41
CLIDRegistry.h
a static registry of CLID->typeName entries. NOT for general use. Use ClassIDSvc instead.
Athena::xAODBranchAddress::m_ptr
void * m_ptr
Definition:
xAODBranchAddress.h:65
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition:
checker_macros.h:211
checker_macros.h
Define macros for attributes used to control the static checker.
xAOD::TEvent::setActive
void setActive() const
Set this event object as the currently active one.
Definition:
Control/xAODRootAccess/Root/TEvent.cxx:860
Generated on Tue Jul 2 2024 21:32:50 for ATLAS Offline Software by
1.8.18