22 std::string
n = branch_name+
".";
23 for(
int i=0,
m=n.length()-1;
i<
m; ++
i)
if ( !isalnum(n[
i]) ) n[i]=
'_';
25 TBranch* b = t ? t->GetBranch(n.c_str()) : 0;
26 if ( !b ) b = t ? t->GetBranch(branch_name.c_str()) : 0;
27 if ( b ) b->SetAutoDelete(kFALSE);
35 b->SetAddress(&prefs);
36 int nb = b->GetEntry(entry);
42 pair<const RootRef*,const ContainerSection*> ls =
c->
getMergeSection(cnt,entry);
44 if ( ls.first->dbase >= 0 ) {
48 msg <<
"Refs: LS [" << entry <<
"] -> "
49 << ls.first->dbase <<
"," << ls.first->container
50 <<
"," << ls.first->link
51 <<
"," << ls.first->entry
54 for(
size_t j=0,
n=refs.
refs.size(); j<
n; ++j) {
57 int db = r.
dbase + ls.first->dbase;
61 if ( r.
link ) r.
link += ls.first->link;
64 if ( k != ms.end() ) {
65 const auto& cs = (*k).second;
66 r.
entry = ( ls.first->entry >= 0 && ls.first->entry < (int)cs.size() )
67 ? cs[ls.first->entry].start + r.
entry : -1;
69 msg <<
"Add link [" << r.
entry
70 <<
"," << ls.first->entry
71 <<
"," << ls.first->container
74 <<
"] to -> " << rc <<
endmsg;
79 <<
"] Evt:" << entry <<
" Invalid link to " << rc <<
endmsg;
87 [&](
int&
i) { i += ls.first->link; } );
100 char* q = strchr(p,
'=');
103 c.emplace_back(p,++q);
111 TBranch* b = t->GetBranch(nam);
113 TLeaf*
l = b->GetLeaf(nam);
118 for(Long64_t
i=0,
n=b->GetEntries();
i<
n; ++
i) {
119 if ( b->GetEntry(
i)>0 ) {
120 char* p = (
char*)l->GetValuePointer();
121 msgSvc() <<
"Add Value[" << b->GetName() <<
"]:" << p <<
endmsg;
135 bool get(
const string& dsc, pair<string,ContainerSection>& e) {
136 if ( dsc !=
"[END-OF-SECTION]" ) {
137 size_t id1 = dsc.find(
"[CNT=");
138 size_t id2 = dsc.find(
"[START=");
139 size_t id3 = dsc.find(
"[LEN=");
140 if ( id1 != string::npos && id2 != string::npos && id3 != string::npos ) {
141 string cnt = dsc.substr(id1+5, id2-1-5);
142 int section_start = std::stoi(dsc.substr(id2+7,id3-id2-8));
143 int section_length = std::stoi(dsc.substr(id3+5,dsc.find(
"]",id3+5)-id3-5));
157 pair<string,ContainerSection> e;
165 for(
const auto&
i:tmp) {
167 msg <<
"Added Merge Section:" << e.first <<
endmsg;
168 ms[e.first].push_back(e.second);
169 if ( e.first ==
"Links" )
170 r.
link = e.second.start;
171 else if ( e.first ==
"Containers" )
173 else if ( e.first ==
"Databases" )
174 r.
dbase = e.second.start;
175 else if ( e.first ==
"Params" )
176 r.
svc = e.second.start;
178 else if (
i ==
"[END-OF-SECTION]" ) {
181 msg <<
"Link Section [" << r.
entry <<
"," << ls.size()
182 <<
"] -> D:" << r.
dbase
195 TTree* t = (TTree*)
c->
file()->Get(
"Sections");
217 string getParam(
const pair<string,string>& p) {
return p.first+
"="+p.second; }
221 string val, typ = nam;
223 TDirectory::TContext ctxt(
c->
file());
224 TBranch* b =
refs()->GetBranch(nam);
225 if ( !b ) b =
refs()->Branch(nam,0,(typ+
"/C").c_str());
227 for(i=b->GetEntries(), n=Long64_t(v.size()); i<
n; ++
i) {
228 val = (this->*pmf)(v[
size_t(i)]);
229 b->SetAddress((
char*)val.c_str());
Definition of the MsgStream class used to transmit messages.
const MergeSections & mergeSections() const
Access merged data section inventory.
const std::string & fid() const
Access file id.
TFile * file() const
Direct access to TFile structure.
const std::string & getDb(int which) const
Access database/file name from saved index.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
auto begin(reverse_wrapper< T > &w)
bool isActive() const
Accessor: is MsgStream active.
std::vector< int > links
The links of the link manager.
Persistent reference object containing all leafs and links corresponding to a Gaudi DataObject...
int dbase
Data members to define object location in the persistent world.
Persistent reference object.
auto end(reverse_wrapper< T > &w)
This class is used for returning status codes from appropriate routines.
std::pair< const RootRef *, const ContainerSection * > getMergeSection(const std::string &container, int entry) const
Access link section for single container and entry.
const std::string & getCont(int which) const
Access container name from saved index.
Concrete implementation of the IDataConnection interface to access ROOT files.
std::vector< RootRef > refs
The references corresponding to the next layer of items in the data store.
Helper functions to set/get the application return code.
TTree * getSection(const std::string §, bool create=false)
Access TTree section from section name. The section is created if required.