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

A simple class to do the retrieve from TEvent. 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:
xAODBranchAddressoperator= (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 ()
 Destructor:
xAOD::xAODTEventtevent ()
void setTEventAddress ()

Public Attributes

void * m_ptr

Detailed Description

A simple class to do the retrieve from TEvent.

Definition at line 29 of file xAODBranchAddress.h.

Constructor & Destructor Documentation

◆ xAODBranchAddress() [1/3]

Athena::xAODBranchAddress::xAODBranchAddress ( )

Default constructor:

Definition at line 41 of file xAODBranchAddress.cxx.

41 :
42 GenericAddress(),
43 m_ptr ()
44{}

◆ xAODBranchAddress() [2/3]

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

Copy constructor:

Definition at line 47 of file xAODBranchAddress.cxx.

47 :
48 GenericAddress(rhs),
49 m_ptr (rhs.m_ptr)
50{}

◆ 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 64 of file xAODBranchAddress.cxx.

69 :
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}

◆ ~xAODBranchAddress()

Athena::xAODBranchAddress::~xAODBranchAddress ( )
virtual

Destructor:

Definition at line 78 of file xAODBranchAddress.cxx.

79{
80 // std::cerr << "::RBA::~RBA... (this=" << this << ") br=["
81 // << this->par()[1] << "]\n";
82}

Member Function Documentation

◆ operator=()

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

Assignment operator:

Definition at line 54 of file xAODBranchAddress.cxx.

55{
56 if (this != &rhs) {
57 GenericAddress::operator=(rhs);
58 m_ptr = rhs.m_ptr;
59 }
60 return *this;
61}

◆ setTEventAddress()

void Athena::xAODBranchAddress::setTEventAddress ( )

Definition at line 93 of file xAODBranchAddress.cxx.

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

◆ tevent()

xAOD::xAODTEvent * Athena::xAODBranchAddress::tevent ( )

Definition at line 86 of file xAODBranchAddress.cxx.

87{
88 //std::cout << "xAODBranchAddress::tevent ..." << std::endl;
89 return reinterpret_cast<xAOD::xAODTEvent*>(reinterpret_cast<unsigned long*>(this->ipar()[0]));
90}

Member Data Documentation

◆ m_ptr

void* Athena::xAODBranchAddress::m_ptr

Definition at line 65 of file xAODBranchAddress.h.


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