ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
Athena::xAODBranchAddress Class Reference

#include <xAODBranchAddress.h>

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

Public Member Functions

 xAODBranchAddress ()
 Default constructor: More...
 
 xAODBranchAddress (const xAODBranchAddress &rhs)
 Copy constructor: More...
 
xAODBranchAddressoperator= (const xAODBranchAddress &rhs)
 Assignment operator: More...
 
 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: More...
 
virtual ~xAODBranchAddress ()
 Destructor: More...
 
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  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 }

◆ 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:
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:1939
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
CLIDRegistry::CLIDToTypeinfo
static const std::type_info * CLIDToTypeinfo(CLID clid)
Translate between CLID and type_info.
Definition: CLIDRegistry.cxx:136
TRTCalib_cfilter.p2
p2
Definition: TRTCalib_cfilter.py:131
xAOD::xAODTEvent
Definition: xAODTEvent.h:23
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
Athena::xAODBranchAddress::tevent
xAOD::xAODTEvent * tevent()
Definition: xAODBranchAddress.cxx:86
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:29
Athena::xAODBranchAddress::m_ptr
void * m_ptr
Definition: xAODBranchAddress.h:65
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
xAOD::TEvent::setActive
void setActive() const
Set this event object as the currently active one.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:861