Go to the documentation of this file.
31 TBranch*
getBranch( std::string_view section, std::string_view branch_name )
override {
34 for (
int i = 0,
m =
n.length() - 1; i <
m; ++i )
35 if ( !isalnum(
n[i] ) )
n[i] =
'_';
37 TBranch* b =
t ?
t->GetBranch(
n.c_str() ) :
nullptr;
39 if ( b ) b->SetAutoDelete( kFALSE );
47 b->SetAddress( &prefs );
48 int nb = b->GetEntry( entry );
54 pair<const RootRef*, const ContainerSection*> ls =
c->
getMergeSection( cnt, entry );
56 if ( ls.first->dbase >= 0 ) {
59 if (
msg.isActive() ) {
60 msg <<
"Refs: LS [" << entry <<
"] -> " << ls.first->dbase <<
"," << ls.first->container <<
","
61 << ls.first->link <<
"," << ls.first->entry <<
endmsg;
63 for (
size_t j = 0,
n =
refs.refs.size();
j <
n; ++
j ) {
66 int db = r.
dbase + ls.first->dbase;
70 if ( r.
link ) r.
link += ls.first->link;
72 auto k =
ms.find(
rc );
73 if ( k !=
ms.end() ) {
74 const auto& cs = ( *k ).second;
75 r.
entry = ( ls.first->entry >= 0 && ls.first->entry < (int)cs.size() )
76 ? cs[ls.first->entry].start + r.
entry
78 if (
msg.isActive() ) {
79 msg <<
"Add link [" << r.
entry <<
"," << ls.first->entry <<
"," << ls.first->container <<
","
84 <<
" Invalid link to " <<
rc <<
endmsg;
92 [&](
int& i ) { i += ls.first->link; } );
105 char* q = strchr( p,
'=' );
108 c.emplace_back( p, ++q );
114 template <
class C,
class F>
117 TBranch* b =
t->GetBranch( nam );
119 TLeaf*
l = b->GetLeaf( nam );
122 b->SetAddress( text );
124 for ( Long64_t i = 0,
n = b->GetEntries(); i <
n; ++i ) {
125 if ( b->GetEntry( i ) > 0 ) {
126 char* p = (
char*)
l->GetValuePointer();
127 msgSvc() <<
"Add Value[" << b->GetName() <<
"]:" << p <<
endmsg;
128 ( this->*pmf )(
v, p );
140 bool get(
const string& dsc, pair<string, ContainerSection>& e ) {
141 if ( dsc !=
"[END-OF-SECTION]" ) {
142 size_t id1 = dsc.find(
"[CNT=" );
143 size_t id2 = dsc.find(
"[START=" );
144 size_t id3 = dsc.find(
"[LEN=" );
145 if ( id1 != string::npos && id2 != string::npos && id3 != string::npos ) {
146 string cnt = dsc.substr( id1 + 5, id2 - 1 - 5 );
147 int section_start =
std::stoi( dsc.substr( id2 + 7, id3 - id2 - 8 ) );
148 int section_length =
std::stoi( dsc.substr( id3 + 5, dsc.find(
"]", id3 + 5 ) - id3 - 5 ) );
162 pair<string, ContainerSection> e;
170 for (
const auto& i : tmp ) {
172 msg <<
"Added Merge Section:" << e.first <<
endmsg;
173 ms[e.first].push_back( e.second );
174 if ( e.first ==
"Links" )
175 r.
link = e.second.start;
176 else if ( e.first ==
"Containers" )
178 else if ( e.first ==
"Databases" )
179 r.
dbase = e.second.start;
180 else if ( e.first ==
"Params" )
181 r.
svc = e.second.start;
182 }
else if ( i ==
"[END-OF-SECTION]" ) {
184 if (
msg.isActive() ) {
195 TTree*
t = (TTree*)
c->
file()->Get(
"Sections" );
213 string getParam(
const pair<string, string>& p ) {
return p.first +
"=" + p.second; }
215 template <
class C,
class F>
218 string val, typ = nam;
220 TDirectory::TContext ctxt(
c->
file() );
221 TBranch* b =
refs()->GetBranch( nam );
222 if ( !b ) b =
refs()->Branch( nam, 0, ( typ +
"/C" ).c_str() );
224 for ( i = b->GetEntries(),
n = Long64_t(
v.size() ); i <
n; ++i ) {
225 val = ( this->*pmf )(
v[
size_t( i )] );
226 b->SetAddress( (
char*)val.c_str() );
int dbase
Data members to define object location in the persistent world.
const std::string & getDb(int which) const
Access database/file name from saved index.
const std::string & getCont(int which) const
Access container name from saved index.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
TFile * file() const
Direct access to TFile structure.
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
constexpr static const auto SUCCESS
TTree * getSection(std::string_view sect, bool create=false)
Access TTree section from section name. The section is created if required.
const MergeSections & mergeSections() const
Access merged data section inventory.
std::pair< const RootRef *, const ContainerSection * > getMergeSection(std::string_view container, int entry) const
Access link section for single container and entry.
const std::string & fid() const
Access file id.
constexpr static const auto FAILURE