Go to the documentation of this file.
4 #ifndef tools_rroot_rall
5 #define tools_rroot_rall
12 #define TOOLS_RROOT_NOT_OSC
14 #ifndef TOOLS_RROOT_NOT_OSC
24 std::ostream& out = a_dir.
file().
out();
34 out <<
"tools::rroot::find_dir :"
35 <<
" key " << a_name <<
" not a TDirectory."
42 out <<
"tools::rroot::find_dir :"
43 <<
" can't get directory data buffer."
51 out <<
"tools::rroot::find_dir :"
52 <<
" can't stream TDirectory."
60 if(a_path.empty())
return 0;
61 std::vector<std::string> ws;
62 words(a_path,
"/",
false,ws);
64 for(
unsigned int index=0;index<ws.size();index++) {
67 if(index==(ws.size()-1))
return _dir;
68 if(index)
delete cur_dir;
78 a_out <<
"tools::rroot::read_key : can't get data buffer of " << a_key.
object_name() <<
"." << std::endl;
89 std::string name,title;
91 a_out <<
"tools::rroot::read_key : TNamed streaming failed" << std::endl;
94 a_out <<
"Named : name = " <<
sout(name) <<
", title = " <<
sout(title) << std::endl;
101 a_out <<
"tools::rroot::read_key : TH1F streaming failed" << std::endl;
103 if(a_dump) h->
hprint(a_out);
110 a_out <<
"tools::rroot::read_key :"
111 <<
" TH1D streaming failed"
114 if(a_dump) h->
hprint(a_out);
121 a_out <<
"tools::rroot::read_key :"
122 <<
" TH2F streaming failed"
125 if(a_dump) h->
hprint(a_out);
132 a_out <<
"tools::rroot::read_key :"
133 <<
" TH2D streaming failed"
136 if(a_dump) h->
hprint(a_out);
143 a_out <<
"tools::rroot::read_key :"
144 <<
" TH3D streaming failed"
147 if(a_dump) h->
hprint(a_out);
154 a_out <<
"tools::rroot::read_key :"
155 <<
" TProfile streaming failed"
158 if(a_dump) p->
hprint(a_out);
165 a_out <<
"tools::rroot::read_key :"
166 <<
" TProfile2D streaming failed"
169 if(a_dump) p->
hprint(a_out);
178 a_out <<
"tools::rroot::read_key :"
179 <<
" TTree streaming failed"
202 a_out <<
" show failed for entry " << i
206 {
for(
uint64 i=mx<int64>(5,entries-5);i<entries;i++){
208 a_out <<
" show failed for entry " << i
216 #ifndef TOOLS_RROOT_NOT_OSC
221 a_out <<
"tools::rroot::read_key :"
225 if(a_dump) h.
hprint(a_out);
232 a_out <<
"tools::rroot::read_key :"
236 if(a_dump) h.
hprint(a_out);
243 a_out <<
"tools::rroot::read_key :"
247 if(a_dump) h.
hprint(a_out);
254 a_out <<
"tools::rroot::read_key :"
258 if(a_dump) h.
hprint(a_out);
265 a_out <<
"tools::rroot::read_key :"
269 if(a_dump) h.
hprint(a_out);
278 a_out <<
"tools::rroot::read_key : read_THistogram() failed." << std::endl;
281 if(a_dump) _h1d->hprint(a_out);
284 if(a_dump) _h2d->hprint(a_out);
287 if(a_dump) _p1d->hprint(a_out);
290 if(a_dump) _p2d->hprint(a_out);
293 a_out <<
"tools::rroot::read_key : can't convert THistogram dat to h1d,h2d,p1d or p2d." << std::endl;
302 a_out <<
"tools::rroot::read_key :"
303 <<
" dont't know how to read key with object class "
312 a_annotations.clear();
313 std::ostream& out = a_key.
out();
315 if(a_warn) out <<
"tools::rroot::key_to_annotations : key not a TNamed." << std::endl;
321 out <<
"tools::rroot::key_to_annotations : can't get data buffer of " << a_key.
object_name() <<
"." << std::endl;
325 std::string histo_name;
328 std::vector<std::string> ws;
329 words(sas,
"\n",
true,ws);
330 size_t wordn = ws.size();
331 if(2*(wordn/2)!=wordn) {
332 out <<
"tools::rroot::key_to_annotations : wordn should be even in " <<
sout(sas) <<
"." << std::endl;
335 std::vector<std::string>::const_iterator it;
336 for(it=ws.begin();it!=ws.end();) {
337 const std::string&
key = *it;it++;
338 const std::string&
value = *it;it++;
345 std::ostream& out = a_key.
out();
347 if(a_warn) out <<
"tools::rroot::key_to_h1d : key not a TH1D and not a TH1F." << std::endl;
353 out <<
"tools::rroot::key_to_h1d : can't get data buffer of " << a_key.
object_name() <<
"." << std::endl;
365 std::ostream& out = a_key.
out();
367 if(a_warn) out <<
"tools::rroot::key_to_h2d : key not a TH2D and not a TH2F." << std::endl;
373 out <<
"tools::rroot::key_to_h2d : can't get data buffer of " << a_key.
object_name() <<
"." << std::endl;
385 std::ostream& out = a_key.
out();
387 out <<
"tools::rroot::key_to_h3d :"
388 <<
" key not a TH3D."
395 out <<
"tools::rroot::key_to_h3d :"
396 <<
" can't get data buffer of " << a_key.
object_name() <<
"."
405 std::ostream& out = a_key.
out();
407 out <<
"tools::rroot::key_to_p1d :"
408 <<
" key not a TProfile."
415 out <<
"tools::rroot::key_to_p1d :"
416 <<
" can't get data buffer of " << a_key.
object_name() <<
"."
425 std::ostream& out = a_key.
out();
427 out <<
"tools::rroot::key_to_p2d :"
428 <<
" key not a TProfile2D."
435 out <<
"tools::rroot::key_to_p2d :"
436 <<
" can't get data buffer of " << a_key.
object_name() <<
"."
445 std::ostream& out = a_key.
out();
447 if(a_warn) out <<
"tools::rroot::key_to_tree : key not a TTree." << std::endl;
453 out <<
"tools::rroot::key_to_tree : can't get data buffer of " << a_key.
object_name() <<
"." << std::endl;
458 tree* _tree =
new tree(a_file,a_fac);
460 out <<
"tools::rroot::key_to_tree : TTree streaming failed" << std::endl;
467 inline void read(std::ostream& a_out,
469 const std::vector<key*>& a_keys,
473 unsigned int a_spaces) {
475 {std::vector<key*>::const_iterator it;
476 for(it=a_keys.begin();it!=a_keys.end();++it) {
480 {
for(
unsigned int index=0;index<a_spaces;index++) a_out <<
" ";}
482 a_out <<
"object : " <<
sout(label)
487 if(!
read_key(a_out,a_file,k,a_dump))
return;
491 {std::vector<key*>::const_iterator it;
492 for(it=a_keys.begin();it!=a_keys.end();++it) {
497 {
for(
unsigned int index=0;index<a_spaces;index++) a_out <<
" ";}
499 a_out <<
"directory : " << label << std::endl;
502 if(!a_recursive)
continue;
508 <<
" can't get directory data buffer."
515 <<
" can't stream TDirectory."
518 const std::vector<key*>& keys = dir.
keys();
519 read(a_out,a_file,keys,a_recursive,a_ls,a_dump,a_spaces+1);