| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Private Attributes | List of all members
Gaudi::PoolTool Class Reference

`#include <src/PoolTool.h>`

Inheritance diagram for Gaudi::PoolTool:
[legend]
Collaboration diagram for Gaudi::PoolTool:
[legend]

## Public Member Functions
| PoolTool (RootDataConnection *con)
| Standard constructor. More...
string | _treeName (string t)
| Convert TES object identifier to ROOT tree name. More...
RootRef | poolRef (size_t i) const override
| Internal overload to facilitate the access to POOL files. More...
int | loadRefs (CSTR, CSTR cnt, unsigned long entry, RootObjectRefs &refs) override
| Load references object from file. More...
TBranch * | getBranch (CSTR, CSTR branch_name) override
| Access data branch by name: Get existing branch in read only mode. More...
StatusCode | saveRefs () override
| Save references section when closing data file (NOT SUPPORTED) More...
StatusCode | readRefs () override
| Internal helper to read reference tables ##Params and ##Links. More...
Public Member Functions inherited from Gaudi::RootDataConnection::Tool
TTree * | refs () const
StringVec & | dbs () const
StringVec & | conts () const
StringVec & | links () const
ParamMap & | params () const
MsgStream & | msgSvc () const
const std::string & | name () const
Sections & | sections () const
LinkSections & | linkSections () const
MergeSections & | mergeSections () const
virtual | ~Tool ()=default
| Default destructor. More...
virtual TBranch * | getBranch (const std::string &section, const std::string &n)=0
| Access data branch by name: Get existing branch in read only mode. More...
virtual int | loadRefs (const std::string &section, const std::string &cnt, unsigned long entry, RootObjectRefs &refs)=0
| Load references object. More...

## Private Attributes
std::vector< Gaudi::RootRef > | m_poolLinks
| Image of the POOL ##Links table. More...

## Additional Inherited Members
Protected Types inherited from Gaudi::RootDataConnection::Tool
typedef RootDataConnection::StringVec | StringVec
typedef RootDataConnection::ParamMap | ParamMap
typedef RootDataConnection::Sections | Sections
typedef RootDataConnection::MergeSections | MergeSections
typedef RootDataConnection::LinkSections | LinkSections
typedef RootDataConnection::ContainerSection | ContainerSection
typedef RootDataConnection::ContainerSections | ContainerSections
Protected Attributes inherited from Gaudi::RootDataConnection::Tool
RootDataConnection * | c
| Pointer to containing data connection object. More...

## Detailed Description

Definition at line 18 of file PoolTool.h.

## Constructor & Destructor Documentation

Gaudi::PoolTool::PoolTool | ( | RootDataConnection * | con | ) |
| inline

Standard constructor.

Definition at line 25 of file PoolTool.h.

25 { c = con; }
Gaudi::RootDataConnection::Tool::c
RootDataConnection * c
Pointer to containing data connection object.
Definition: RootDataConnection.h:207

## Member Function Documentation

string Gaudi::PoolTool::_treeName | ( | string | t | ) |
| inline

Convert TES object identifier to ROOT tree name.

Definition at line 28 of file PoolTool.h.

29 {
30 std::replace( std::begin( t ), std::end( t ), '/', '_' );
31 return t;
32 }
std::end
T end(T...args)
std::replace
T replace(T...args)
std::begin
T begin(T...args)

TBranch* Gaudi::PoolTool::getBranch | ( | CSTR | ,
|  | CSTR | branch_name
| ) |  |
| inline override

Access data branch by name: Get existing branch in read only mode.

Definition at line 90 of file PoolTool.h.

91 {
92 TTree* t = sections()[branch_name];
93 if ( t ) {
94 return (TBranch*)t->GetListOfBranches()->At( 0 );
95 }
96 string tname = _treeName( branch_name );
97 t = (TTree*)c->file()->Get( tname.c_str() ); // c->getSection(tname);
98 if ( t ) {
99 TBranch* b = (TBranch*)t->GetListOfBranches()->At( 0 );
100 if ( b ) {
101 sections()[branch_name] = t;
102 return b;
103 }
104 msgSvc() << MSG::ERROR << "Failed to access POOL branch:" << branch_name << " [" << tname << "]" << endmsg;
105 t->Print();
106 }
107 return nullptr;
108 }
Gaudi::RootDataConnection::file
TFile * file() const
Direct access to TFile structure.
Definition: RootDataConnection.h:249
Gaudi::RootDataConnection::Tool::sections
Sections & sections() const
Definition: RootDataConnection.h:217
Gaudi::RootDataConnection::Tool::msgSvc
MsgStream & msgSvc() const
Definition: RootDataConnection.h:215
Gaudi::PoolTool::_treeName
string _treeName(string t)
Convert TES object identifier to ROOT tree name.
Definition: PoolTool.h:28
MSG::ERROR
Definition: IMessageSvc.h:16
Gaudi::RootDataConnection::Tool::c
RootDataConnection * c
Pointer to containing data connection object.
Definition: RootDataConnection.h:207
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209

int Gaudi::PoolTool::loadRefs | ( | CSTR | ,
|  | CSTR | cnt,
|  | unsigned long | entry,
|  | RootObjectRefs & | refs
| ) |  |
| inline override

Load references object from file.

Definition at line 37 of file PoolTool.h.

38 {
39 TTree* t = sections()[cnt];
40 if ( !t ) {
41 t = (TTree*)c->file()->Get( _treeName( cnt ).c_str() );
42 }
43 if ( t ) {
44 TBranch* b1 = t->GetBranch( "Links" );
45 TBranch* b2 = t->GetBranch( "Refs" );
46 MsgStream& msg = msgSvc();
47 if ( b1 && b2 ) {
48 LinkManager lm, *plm = &lm;
49 PoolDbLinkManager mgr, *pmgr = &mgr;
50 b1->SetAutoDelete( kFALSE );
51 b2->SetAutoDelete( kFALSE );
52 b1->SetAddress( &plm );
53 b2->SetAddress( &pmgr );
54 int nb1 = b1->GetEvent( entry );
55 int nb2 = b2->GetEvent( entry );
56 if ( nb1 > 1 && nb2 > 1 ) {
57 size_t ref_size = mgr.references().size();
58 refs.refs.resize( ref_size );
59 msg << MSG::VERBOSE;
60 for ( size_t j = 0; j < ref_size; ++j ) {
61 const pair<int, int>& oid = mgr.references()[j]->m_oid;
62 string loc = mgr.links()[j].substr( 1 );
63 RootRef& r = refs.refs[j];
64 if ( oid.first >= 0 ) {
65 r = m_poolLinks[oid.first];
66 r.entry = oid.second;
67 r.link = c->makeLink( loc );
68 msg << "Add leaf:" << oid.first << "->" << loc << " from " << c->getDb( r.dbase ) << "#"
69 << c->getCont( r.container ) << " Link:" << c->getLink( r.link ) << " CLID:" << hex << r.clid
70 << " Typ:" << hex << int( r.svc ) << " Ent:" << dec << r.entry << endl;
71 }
72 }
73 for ( int i = 0, n = lm.size(); i < n; ++i ) {
74 LinkManager::Link* lnk = lm.link( i );
75 int link_id = c->makeLink( lnk->path() );
76 msg << "Add Link:" << lnk->path() << endl;
77 refs.links.push_back( link_id );
78 }
79 return nb1 + nb2;
80 }
81 }
82 msg << MSG::ERROR << "Failed to access POOL Ref/Link branches:" << cnt << " [" << _treeName( cnt ) << "]"
83 << endmsg;
84 t->Print();
85 }
86 return -1;
87 }
LinkManager::Link::path
const std::string & path() const
Access to path of object.
Definition: LinkManager.h:66
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Gaudi::RootDataConnection::file
TFile * file() const
Direct access to TFile structure.
Definition: RootDataConnection.h:249
Gaudi::RootDataConnection::getDb
const std::string & getDb(int which) const
Access database/file name from saved index.
Definition: RootDataConnection.cpp:450
PoolDbLinkManager::references
std::vector< pool::Token * > & references()
Access to token array.
Definition: PoolClasses.h:117
Gaudi::PoolTool::m_poolLinks
std::vector< Gaudi::RootRef > m_poolLinks
Image of the POOL ##Links table.
Definition: PoolTool.h:21
std::endl
T endl(T...args)
MSG::dec
MsgStream & dec(MsgStream &log)
Definition: MsgStream.h:299
Gaudi::RootDataConnection::getLink
const std::string & getLink(int which) const
Access link name from saved index.
Definition: RootDataConnection.h:336
MSG::hex
MsgStream & hex(MsgStream &log)
Definition: MsgStream.h:304
MSG::VERBOSE
Definition: IMessageSvc.h:16
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
PoolDbLinkManager::links
std::vector< std::string > & links()
Access to link array.
Definition: PoolClasses.h:119
Gaudi::RootDataConnection::Tool::sections
Sections & sections() const
Definition: RootDataConnection.h:217
PoolDbLinkManager
Description: PoolDbLinkManager class implementation definition.
Definition: PoolClasses.h:100
LinkManager::link
Link * link(long id)
Retrieve symbolic link identified by ID.
Definition: LinkManager.cpp:31
Gaudi::RootDataConnection::Tool::msgSvc
MsgStream & msgSvc() const
Definition: RootDataConnection.h:215
Gaudi::RootDataConnection::getCont
const std::string & getCont(int which) const
Access container name from saved index.
Definition: RootDataConnection.h:330
std::vector::size
T size(T...args)
Gaudi::RootDataConnection::makeLink
int makeLink(const std::string &p)
Convert path string to path index.
Definition: RootDataConnection.cpp:441
Gaudi::RootDataConnection::Tool::refs
TTree * refs() const
Definition: RootDataConnection.h:210
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:8
Gaudi::PoolTool::_treeName
string _treeName(string t)
Convert TES object identifier to ROOT tree name.
Definition: PoolTool.h:28
MSG::ERROR
Definition: IMessageSvc.h:16
Gaudi::RootDataConnection::Tool::c
RootDataConnection * c
Pointer to containing data connection object.
Definition: RootDataConnection.h:207
LinkManager::Link
Embedded class defining a symbolic link Note: No copy constructor; bitwise copy (done by the compiler...
Definition: LinkManager.h:32
LinkManager
A LinkManager is the object aggregated into a DataObject, which is responsible for the handling of no...
Definition: LinkManager.h:21
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
LinkManager::size
long size() const
Retrieve number of link present.
Definition: LinkManager.h:105

RootRef Gaudi::PoolTool::poolRef | ( | size_t |  | ) | const
| inline override virtual

Internal overload to facilitate the access to POOL files.

Reimplemented from Gaudi::RootDataConnection::Tool.

Definition at line 34 of file PoolTool.h.

34 { return m_poolLinks[i]; }
Gaudi::PoolTool::m_poolLinks
std::vector< Gaudi::RootRef > m_poolLinks
Image of the POOL ##Links table.
Definition: PoolTool.h:21

StatusCode Gaudi::PoolTool::readRefs | ( |  | ) |
| inline override virtual

Internal helper to read reference tables ##Params and ##Links.

Implements Gaudi::RootDataConnection::Tool.

Definition at line 114 of file PoolTool.h.

115 {
116 int i;
117 char text[2048];
118 msgSvc() << MSG::VERBOSE;
119
120 // First read ##Params
121 TTree* t = (TTree*)c->file()->Get( "##Params" );
122 if ( !t ) return StatusCode::FAILURE;
123 TBranch* b = t->GetBranch( "db_string" );
124 if ( !b ) return StatusCode::FAILURE;
125 for ( i = 0, b->SetAddress( text ); i < b->GetEntries(); ++i ) {
126 b->GetEvent( i );
127 char* id1 = strstr( text, "[NAME=" );
128 char* id2 = strstr( text, "[VALUE=" );
129 if ( id1 && id2 ) {
130 id1 += 6;
131 id2 += 7;
132 char* id11 = strstr( id1, "]" );
133 char* id22 = strstr( id2, "]" );
134 if ( id11 && id22 ) {
135 *id11 = 0;
136 *id22 = 0;
137 params().emplace_back( id1, id2 );
138 msgSvc() << "Param:" << id1 << "=" << id2 << "." << endmsg;
139 }
140 }
141 }
142
143 // Read ##Links
144 t = (TTree*)c->file()->Get( "##Links" );
145 if ( !t ) return StatusCode::FAILURE;
146 b = t->GetBranch( "db_string" );
147 if ( !b ) return StatusCode::FAILURE;
148 m_poolLinks.resize( (size_t)b->GetEntries() + 2 ); // Take into account the ##Links and ##Shapes entry of POOL!
149 for ( i = 0, b->SetAddress( text ); i < b->GetEntries(); ++i ) {
150 b->GetEvent( i );
151 std::string db, container;
152 int clid = 1, technology = 0, ipar[2] = {-1, -1};
153 for ( char* p1 = (char*)text; p1; p1 = ::strchr( ++p1, '[' ) ) {
154 char* p2 = ::strchr( p1, '=' );
155 char* p3 = ::strchr( p1, ']' );
156 if ( p2 && p3 ) {
157 if (::strncmp( "[DB=", p1, 4 ) == 0 ) {
158 *p3 = 0;
159 db = p1 + 4;
160 } else if (::strncmp( "[CNT=", p1, 5 ) == 0 ) {
161 *p3 = 0;
162 container = p1 + 5;
163 } else if (::strncmp( "[OID=", p1, 5 ) == 0 ) {
164 *p3 = 0;
165 ::sscanf( p1 + 5, "%08X,%08X", (unsigned int*)&ipar[0], (unsigned int*)&ipar[1] );
166 } else if (::strncmp( "[CLID=", p1, 6 ) == 0 ) {
167 *p3 = 0;
168 ::sscanf( p1 + 6, "%08X", (unsigned int*)&clid );
169 } else if (::strncmp( "[TECH=", p1, 6 ) == 0 ) {
170 *p3 = 0;
171 ::sscanf( p1 + 6, "%08X", (unsigned int*)&technology );
172 } else {
173 *p3 = *p2 = 0;
174 }
175 *p3 = ']';
176 *p2 = '=';
177 }
178 }
179 c->makeRef( "", clid, technology, db, container, -1, m_poolLinks[i + 2] );
180 RootRef& r = m_poolLinks[i];
181 msgSvc() << "Add link[" << i << "]:" << db << container << " [" << r.dbase << "," << r.container << "] "
182 << " tech:" << hex << setw( 8 ) << r.svc << " CLID:" << setw( 8 ) << r.clid << dec << endmsg;
183 }
184 return StatusCode::SUCCESS;
185 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
StatusCode::FAILURE
Definition: StatusCode.h:31
Gaudi::RootDataConnection::file
TFile * file() const
Direct access to TFile structure.
Definition: RootDataConnection.h:249
Gaudi::PoolTool::m_poolLinks
std::vector< Gaudi::RootRef > m_poolLinks
Image of the POOL ##Links table.
Definition: PoolTool.h:21
MSG::dec
MsgStream & dec(MsgStream &log)
Definition: MsgStream.h:299
MSG::hex
MsgStream & hex(MsgStream &log)
Definition: MsgStream.h:304
MSG::VERBOSE
Definition: IMessageSvc.h:16
std::setw
T setw(T...args)
std::vector::resize
T resize(T...args)
std::string
STL class.
Gaudi::RootDataConnection::Tool::params
ParamMap & params() const
Definition: RootDataConnection.h:214
HiveAlgSequencer.p2
p2
Definition: HiveAlgSequencer.py:23
Gaudi::RootDataConnection::makeRef
void makeRef(IRegistry *pA, RootRef &ref)
Create reference object from registry entry.
Definition: RootDataConnection.cpp:605
Gaudi::RootDataConnection::Tool::msgSvc
MsgStream & msgSvc() const
Definition: RootDataConnection.h:215
std::strncmp
T strncmp(T...args)
HiveAlgSequencer.p1
p1
Definition: HiveAlgSequencer.py:22
Gaudi::RootDataConnection::Tool::c
RootDataConnection * c
Pointer to containing data connection object.
Definition: RootDataConnection.h:207
std::strstr
T strstr(T...args)
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
std::vector::emplace_back
T emplace_back(T...args)

StatusCode Gaudi::PoolTool::saveRefs | ( |  | ) |
| inline override virtual

Save references section when closing data file (NOT SUPPORTED)

Implements Gaudi::RootDataConnection::Tool.

Definition at line 111 of file PoolTool.h.

111 { return StatusCode::FAILURE; }
StatusCode::FAILURE
Definition: StatusCode.h:31

## Member Data Documentation

std::vector<Gaudi::RootRef> Gaudi::PoolTool::m_poolLinks
| private

Image of the POOL ##Links table.

Definition at line 21 of file PoolTool.h.

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

- RootCnv/src/PoolTool.h