ATLAS Offline Software
Loading...
Searching...
No Matches
Athena::xAODBranchAddress Class Reference

A simple class to do the retrieve from TEvent or REvent. More...

#include <xAODBranchAddress.h>

Inheritance diagram for Athena::xAODBranchAddress:
Collaboration diagram for Athena::xAODBranchAddress:

Public Member Functions

 xAODBranchAddress ()
 Default constructor:
 xAODBranchAddress (const xAODBranchAddress &rhs)
 Copy constructor:
xAODBranchAddress & operator= (const xAODBranchAddress &rhs)
 Assignment operator:
 xAODBranchAddress (long svc, const CLID &clid, const std::string &p1="", const std::string &p2="", unsigned long ip1=0, unsigned long ip2=0)
 Constructor with parameters:
virtual ~xAODBranchAddress ()=default
 Destructor:
xAOD::Event * event ()
void setEventAddress ()

Public Attributes

void * m_ptr = nullptr

Detailed Description

A simple class to do the retrieve from TEvent or REvent.

Definition at line 27 of file xAODBranchAddress.h.

Constructor & Destructor Documentation

◆ xAODBranchAddress() [1/3]

Athena::xAODBranchAddress::xAODBranchAddress ( )

Default constructor:

Definition at line 31 of file xAODBranchAddress.cxx.

31 :
32 GenericAddress(),
33 m_ptr ()
34{}

◆ xAODBranchAddress() [2/3]

Athena::xAODBranchAddress::xAODBranchAddress ( const xAODBranchAddress & rhs)

Copy constructor:

Definition at line 37 of file xAODBranchAddress.cxx.

37 :
38 GenericAddress(rhs),
39 m_ptr (rhs.m_ptr)
40{}

◆ xAODBranchAddress() [3/3]

Athena::xAODBranchAddress::xAODBranchAddress ( long svc,
const CLID & clid,
const std::string & p1 = "",
const std::string & p2 = "",
unsigned long ip1 = 0,
unsigned long ip2 = 0 )

Constructor with parameters:

Definition at line 54 of file xAODBranchAddress.cxx.

59 :
60 GenericAddress(svc, clid, p1, p2, ip1, ip2)
61{
62}

◆ ~xAODBranchAddress()

virtual Athena::xAODBranchAddress::~xAODBranchAddress ( )
virtualdefault

Destructor:

Member Function Documentation

◆ event()

xAOD::Event * Athena::xAODBranchAddress::event ( )

Definition at line 66 of file xAODBranchAddress.cxx.

67{
68 return reinterpret_cast<xAOD::Event*>(reinterpret_cast<unsigned long*>(this->ipar()[0]));
69}

◆ operator=()

xAODBranchAddress & Athena::xAODBranchAddress::operator= ( const xAODBranchAddress & rhs)

Assignment operator:

Definition at line 44 of file xAODBranchAddress.cxx.

45{
46 if (this != &rhs) {
47 GenericAddress::operator=(rhs);
48 m_ptr = rhs.m_ptr;
49 }
50 return *this;
51}

◆ setEventAddress()

void Athena::xAODBranchAddress::setEventAddress ( )

Definition at line 72 of file xAODBranchAddress.cxx.

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}
#define ATLAS_THREAD_SAFE
static const std::type_info * CLIDToTypeinfo(CLID clid)
Translate between CLID and type_info.
@ SILENT
don't print anything and return success
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

Member Data Documentation

◆ m_ptr

void* Athena::xAODBranchAddress::m_ptr = nullptr

Definition at line 60 of file xAODBranchAddress.h.


The documentation for this class was generated from the following files: