ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Database
AthenaRoot
AthenaRootComps
src
xAODBranchAddress.cxx
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2026 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
#include "
xAODBranchAddress.h
"
13
#include "
xAODEvent.h
"
14
15
#include "
AthenaKernel/CLIDRegistry.h
"
16
#include "
CxxUtils/checker_macros.h
"
17
18
#include <typeinfo>
19
20
21
namespace
Athena
{
22
24
// Public methods:
26
27
// Constructors
29
31
xAODBranchAddress::xAODBranchAddress
() :
32
GenericAddress(),
33
m_ptr
()
34
{}
35
37
xAODBranchAddress::xAODBranchAddress
(
const
xAODBranchAddress
& rhs ) :
38
GenericAddress(rhs),
39
m_ptr
(rhs.
m_ptr
)
40
{}
41
43
xAODBranchAddress
&
44
xAODBranchAddress::operator=
(
const
xAODBranchAddress
& rhs )
45
{
46
if
(
this
!= &rhs) {
47
GenericAddress::operator=(rhs);
48
m_ptr
= rhs.
m_ptr
;
49
}
50
return
*
this
;
51
}
52
54
xAODBranchAddress::xAODBranchAddress
(
long
svc,
55
const
CLID
& clid,
56
const
std::string& p1,
57
const
std::string& p2,
58
unsigned
long
ip1,
59
unsigned
long
ip2) :
60
GenericAddress(svc, clid, p1, p2, ip1, ip2)
61
{
62
}
63
64
65
xAOD::Event
*
66
xAODBranchAddress::event
()
67
{
68
return
reinterpret_cast<
xAOD::Event
*
>
(
reinterpret_cast<
unsigned
long
*
>
(this->ipar()[0]));
69
}
70
71
void
72
xAODBranchAddress::setEventAddress
()
73
{
74
const
std::string& br_name = this->par()[1];
75
const
std::type_info* ti =
CLIDRegistry::CLIDToTypeinfo
(this->clID());
76
xAOD::Event
*
event
= this->
event
();
77
event
->setActive();
// ensure we are active event
78
79
// we use the ipar()[1] to flag if we retrieve main event info (0) or metadata (1) (see xAODEventSelector where it creates BranchAddress)
80
switch
( (this->ipar()[1]) ) {
81
case
0:
82
{
// reading event level info
83
static
constexpr
bool
SILENT =
false
;
84
static
constexpr
bool
METADATA =
false
;
85
void
* addr
ATLAS_THREAD_SAFE
=
const_cast<
void
*
>
(
xAOD::getInputObject
(*
event
, br_name, *ti, SILENT, METADATA));
86
m_ptr
= addr;
87
}
88
break
;
89
case
1:
90
{
// reading metadata
91
// FIXME: NEEED TO ACCESS METADATA
92
event
->setActive();
//ensure we are active event
93
static
constexpr
bool
SILENT =
false
;
94
static
constexpr
bool
METADATA =
true
;
95
void
* addr
ATLAS_THREAD_SAFE
=
const_cast<
void
*
>
(
xAOD::getInputObject
(*
event
, br_name, *ti, SILENT, METADATA));
96
m_ptr
= addr;
97
}
98
break
;
99
}
100
}
101
102
}
//> end namespace Athena
CLIDRegistry.h
a static registry of CLID->typeName entries.
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 or REvent.
Definition
xAODBranchAddress.h:29
Athena::xAODBranchAddress::operator=
xAODBranchAddress & operator=(const xAODBranchAddress &rhs)
Assignment operator:
Definition
xAODBranchAddress.cxx:44
Athena::xAODBranchAddress::event
xAOD::Event * event()
Definition
xAODBranchAddress.cxx:66
Athena::xAODBranchAddress::setEventAddress
void setEventAddress()
Definition
xAODBranchAddress.cxx:72
Athena::xAODBranchAddress::m_ptr
void * m_ptr
Definition
xAODBranchAddress.h:60
Athena::xAODBranchAddress::xAODBranchAddress
xAODBranchAddress()
Default constructor:
Definition
xAODBranchAddress.cxx:31
CLIDRegistry::CLIDToTypeinfo
static const std::type_info * CLIDToTypeinfo(CLID clid)
Translate between CLID and type_info.
Definition
CLIDRegistry.cxx:136
xAOD::Event
Base class for the event (xAOD::TEvent and xAOD::REvent) classes.
Definition
Event.h:61
Athena
Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc....
Definition
AthDsoUtils.h:10
xAOD::getInputObject
const void * getInputObject(xAOD::Event &event, const std::string &key, const std::type_info &ti, bool silent, bool metadata)
Retrieve an input object from an xAODTEvent or xAODREvent in a non-template way.
Definition
xAODEvent.h:51
xAODBranchAddress.h
xAODEvent.h
Generated on
for ATLAS Offline Software by
1.17.0