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...
 
ServiceHandle< IClassIDSvc > m_classIDSvc {"ClassIDSvc", "PyDataHeader"}
 class ID service More...
 

Detailed Description

A wrapper for DataHeader.

Author
Tadashi Maeno

Definition at line 25 of file PyDataHeader.h.

Constructor & Destructor Documentation

◆ PyDataHeader()

PyDataHeader::PyDataHeader ( )
inline

Definition at line 28 of file PyDataHeader.h.

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

◆ ~PyDataHeader()

virtual PyDataHeader::~PyDataHeader ( )
inlinevirtual

Definition at line 61 of file PyDataHeader.h.

61 {}

Member Function Documentation

◆ getKey()

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

get key of Nth element

Definition at line 97 of file PyDataHeader.h.

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

◆ getName()

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

get class name of Nth element

Definition at line 67 of file PyDataHeader.h.

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

◆ size()

int PyDataHeader::size ( )
inline

get number of elements

Definition at line 64 of file PyDataHeader.h.

64 { return m_DataHeaderElementV.size(); }

Member Data Documentation

◆ m_classIDSvc

ServiceHandle<IClassIDSvc> PyDataHeader::m_classIDSvc {"ClassIDSvc", "PyDataHeader"}
private

class ID service

Definition at line 110 of file PyDataHeader.h.

◆ m_DataHeaderElementV

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

cash for DataHeaderElements

Definition at line 107 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:396
PyPoolBrowser.dh
dh
Definition: PyPoolBrowser.py:102
PyDataHeader::size
int size()
get number of elements
Definition: PyDataHeader.h:64
PyDataHeader::m_DataHeaderElementV
std::vector< const DataHeaderElement * > m_DataHeaderElementV
cash for DataHeaderElements
Definition: PyDataHeader.h:107
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
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:221
DeMoScan.index
string index
Definition: DeMoScan.py:364
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
PyDataHeader::m_classIDSvc
ServiceHandle< IClassIDSvc > m_classIDSvc
class ID service
Definition: PyDataHeader.h:110
SG::ConstIterator
Definition: SGIterator.h:163