ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
PyDataHeader Class Reference

A wrapper for DataHeader. More...

#include <PyDataHeader.h>

Collaboration diagram for PyDataHeader:

Public Member Functions

 PyDataHeader ()
 
virtual ~PyDataHeader ()
 
int size ()
 get number of elements More...
 
std::string getName (int index)
 get class name of Nth element More...
 
std::string getKey (int index)
 get key of Nth element More...
 

Private Attributes

std::vector< const DataHeaderElement * > m_DataHeaderElementV
 cash for DataHeaderElements More...
 
IClassIDSvc * m_classIDSvc
 class ID service More...
 

Detailed Description

A wrapper for DataHeader.

Author
Tadashi Maeno

Definition at line 23 of file PyDataHeader.h.

Constructor & Destructor Documentation

◆ PyDataHeader()

PyDataHeader::PyDataHeader ( )
inline

Definition at line 26 of file PyDataHeader.h.

27  {
28  MsgStream log(Athena::getMessageSvc(), "PyDataHeader");
29 
30  // get StoreGate
31  StoreGateSvc *pSvc = 0;
32  StatusCode sc = Gaudi::svcLocator()->service("StoreGateSvc", pSvc);
33  if (sc.isFailure())
34  log << MSG::ERROR << "could not get StoreGateSvc" << endmsg;
35  else
36  {
37  // retrieve DataHeader
40  sc = pSvc->retrieve(beg,ending);
41  if (sc.isFailure() || beg==ending)
42  log << MSG::ERROR << "could not get DataHeader" << endmsg;
43  else
44  {
45  // cache DataHeaderElement
46  for (; beg != ending; ++beg)
47  {
48  const DataHeader &dh = *beg;
49  std::vector<DataHeaderElement>::const_iterator it = dh.begin();
50  for (; it != dh.end(); ++it)
51  m_DataHeaderElementV.push_back(&*it);
52  }
53  }
54  }
55 
56  m_classIDSvc = 0;
57  sc = Gaudi::svcLocator()->service("ClassIDSvc", m_classIDSvc);
58  if (sc.isFailure())
59  log << MSG::ERROR << "could not get ClassIDSvc" << endmsg;
60  }

◆ ~PyDataHeader()

virtual PyDataHeader::~PyDataHeader ( )
inlinevirtual

Definition at line 62 of file PyDataHeader.h.

62 {}

Member Function Documentation

◆ getKey()

std::string PyDataHeader::getKey ( int  index)
inline

get key of Nth element

Definition at line 98 of file PyDataHeader.h.

99  {
100  if (index >= size()) return "";
102  it += index;
103  return (*it)->getKey();
104  }

◆ getName()

std::string PyDataHeader::getName ( int  index)
inline

get class name of Nth element

Definition at line 68 of file PyDataHeader.h.

69  {
70  if (index >= size()) return "";
72  it += index;
73 
74  // look for non-symlink name
75  std::string name="";
76  for (CLID clid : (*it)->getClassIDs())
77  {
78  // convert CLID to class name
79  std::string localName;
80  StatusCode sc = m_classIDSvc->getTypeNameOfID (clid, localName);
81  if (sc.isFailure())
82  {
83  MsgStream log(Athena::getMessageSvc(), "PyDataHeader");
84  log << MSG::ERROR << "could not get TypeName for " << clid << endmsg;
85  return "";
86  }
87  // select non-symlink
88  if ((name == "") ||
89  ((localName != "ParticleBaseContainer") &&
90  (localName != "IParticleContainer") &&
91  (localName != "INavigable4MomentumCollection")))
92  name = localName;
93  }
94  return name;
95  }

◆ size()

int PyDataHeader::size ( )
inline

get number of elements

Definition at line 65 of file PyDataHeader.h.

65 { return m_DataHeaderElementV.size(); }

Member Data Documentation

◆ m_classIDSvc

IClassIDSvc* PyDataHeader::m_classIDSvc
private

class ID service

Definition at line 111 of file PyDataHeader.h.

◆ m_DataHeaderElementV

std::vector<const DataHeaderElement *> PyDataHeader::m_DataHeaderElementV
private

cash for DataHeaderElements

Definition at line 108 of file PyDataHeader.h.


The documentation for this class was generated from the following file:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
index
Definition: index.py:1
skel.it
it
Definition: skel.GENtoEVGEN.py:423
PyPoolBrowser.dh
dh
Definition: PyPoolBrowser.py:102
PyDataHeader::size
int size()
get number of elements
Definition: PyDataHeader.h:65
PyDataHeader::m_DataHeaderElementV
std::vector< const DataHeaderElement * > m_DataHeaderElementV
cash for DataHeaderElements
Definition: PyDataHeader.h:108
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
StoreGateSvc::retrieve
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
PyDataHeader::m_classIDSvc
IClassIDSvc * m_classIDSvc
class ID service
Definition: PyDataHeader.h:111
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
DataHeader
This class provides the layout for summary information stored for data written to POOL.
Definition: DataHeader.h:124
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
WriteBchToCool.beg
beg
Definition: WriteBchToCool.py:69
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
DeMoScan.index
string index
Definition: DeMoScan.py:362
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
SG::ConstIterator
Definition: SGIterator.h:163