33 TBranch*
getBranch( std::string_view section, std::string_view branch_name )
override {
34 std::string n{ branch_name };
36 for (
int i = 0, m = n.length() - 1; i < m; ++i )
37 if ( !isalnum( n[i] ) ) n[i] =
'_';
38 TTree* t =
c->getSection( section );
39 TBranch* b = t ? t->GetBranch( n.c_str() ) :
nullptr;
40 if ( !b ) b = t ? t->GetBranch( std::string{ branch_name }.c_str() ) :
nullptr;
41 if ( b ) b->SetAutoDelete( kFALSE );
46 TBranch* b =
getBranch( section, std::string{ cnt } +
"#R" );
49 b->SetAddress( &prefs );
50 int nb = b->GetEntry( entry );
56 pair<const RootRef*, const ContainerSection*> ls =
c->getMergeSection( cnt, entry );
58 if ( ls.first->dbase >= 0 ) {
61 if ( msg.isActive() ) {
62 msg <<
"Refs: LS [" << entry <<
"] -> " << ls.first->dbase <<
"," << ls.first->container <<
","
63 << ls.first->link <<
"," << ls.first->entry <<
endmsg;
65 for (
size_t j = 0, n =
refs.refs.size(); j < n; ++j ) {
68 int db = r.
dbase + ls.first->dbase;
69 if (
c->getDb( db ) ==
c->fid() ) {
72 if ( r.
link ) r.
link += ls.first->link;
74 auto k = ms.find( rc );
75 if ( k != ms.end() ) {
76 const auto& cs = ( *k ).second;
77 r.
entry = ( ls.first->entry >= 0 && ls.first->entry < (int)cs.size() )
78 ? cs[ls.first->entry].start + r.
entry
80 if ( msg.isActive() ) {
81 msg <<
"Add link [" << r.
entry <<
"," << ls.first->entry <<
"," << ls.first->container <<
","
85 msg <<
MSG::WARNING <<
c->fid() <<
" [" <<
c->getDb( db ) <<
"] Evt:" << entry
86 <<
" Invalid link to " << rc <<
endmsg;
93 std::for_each( std::begin(
refs.links ), std::end(
refs.links ),
94 [&](
int& i ) { i += ls.first->link; } );
107 char* q = strchr( p,
'=' );
110 c.emplace_back( p, ++q );
116 template <
class C,
class F>
119 TBranch* b = t->GetBranch( nam );
121 TLeaf* l = b->GetLeaf( nam );
124 b->SetAddress( text );
126 for ( Long64_t i = 0, n = b->GetEntries(); i < n; ++i ) {
127 if ( b->GetEntry( i ) > 0 ) {
128 char* p = (
char*)l->GetValuePointer();
129 msgSvc() <<
"Add Value[" << b->GetName() <<
"]:" << p <<
endmsg;
130 ( this->*pmf )( v, p );
142 bool get(
const string& dsc, pair<string, ContainerSection>& e ) {
143 if ( dsc !=
"[END-OF-SECTION]" ) {
144 size_t id1 = dsc.find(
"[CNT=" );
145 size_t id2 = dsc.find(
"[START=" );
146 size_t id3 = dsc.find(
"[LEN=" );
147 if ( id1 != string::npos && id2 != string::npos && id3 != string::npos ) {
148 string cnt = dsc.substr( id1 + 5, id2 - 1 - 5 );
149 int section_start = std::stoi( dsc.substr( id2 + 7, id3 - id2 - 8 ) );
150 int section_length = std::stoi( dsc.substr( id3 + 5, dsc.find(
"]", id3 + 5 ) - id3 - 5 ) );
164 pair<string, ContainerSection> e;
172 for (
const auto& i : tmp ) {
174 msg <<
"Added Merge Section:" << e.first <<
endmsg;
175 ms[e.first].push_back( e.second );
176 if ( e.first ==
"Links" )
177 r.
link = e.second.start;
178 else if ( e.first ==
"Containers" )
180 else if ( e.first ==
"Databases" )
181 r.
dbase = e.second.start;
182 else if ( e.first ==
"Params" )
183 r.
svc = e.second.start;
184 }
else if ( i ==
"[END-OF-SECTION]" ) {
186 if ( msg.isActive() ) {
187 msg <<
"Link Section [" << r.
entry <<
"," << ls.size() <<
"] -> D:" << r.
dbase <<
" C:" << r.
container
197 TTree* t = (TTree*)
c->file()->Get(
"Sections" );
215 string getParam(
const pair<string, string>& p ) {
return p.first +
"=" + p.second; }
217 template <
class C,
class F>
220 string val, typ = nam;
222 TDirectory::TContext ctxt(
c->file() );
223 TBranch* b =
refs()->GetBranch( nam );
224 if ( !b ) b =
refs()->Branch( nam, 0, ( typ +
"/C" ).c_str() );
226 for ( i = b->GetEntries(), n = Long64_t( v.size() ); i < n; ++i ) {
227 val = ( this->*pmf )( v[
size_t( i )] );
228 b->SetAddress( (
char*)val.c_str() );
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Concrete implementation of the IDataConnection interface to access ROOT files.
Definition of the MsgStream class used to transmit messages.
This class is used for returning status codes from appropriate routines.
constexpr static const auto SUCCESS
constexpr static const auto FAILURE
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Persistent reference object containing all leafs and links corresponding to a Gaudi DataObject.
Persistent reference object.
int dbase
Data members to define object location in the persistent world.