ATLAS Offline Software
Loading...
Searching...
No Matches
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
17
18#include <typeinfo>
19
20
21namespace Athena {
22
24// Public methods:
26
27// Constructors
29
32 GenericAddress(),
33 m_ptr ()
34{}
35
38 GenericAddress(rhs),
39 m_ptr (rhs.m_ptr)
40{}
41
45{
46 if (this != &rhs) {
47 GenericAddress::operator=(rhs);
48 m_ptr = rhs.m_ptr;
49 }
50 return *this;
51}
52
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
67{
68 return reinterpret_cast<xAOD::Event*>(reinterpret_cast<unsigned long*>(this->ipar()[0]));
69}
70
71void
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
a static registry of CLID->typeName entries.
uint32_t CLID
The Class ID type.
Define macros for attributes used to control the static checker.
#define ATLAS_THREAD_SAFE
A simple class to do the retrieve from TEvent or REvent.
xAODBranchAddress & operator=(const xAODBranchAddress &rhs)
Assignment operator:
xAODBranchAddress()
Default constructor:
static const std::type_info * CLIDToTypeinfo(CLID clid)
Translate between CLID and type_info.
Base class for the event (xAOD::TEvent and xAOD::REvent) classes.
Definition Event.h:61
Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc....
Definition AthDsoUtils.h:10
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