4 #ifndef tools_rroot_streamers
5 #define tools_rroot_streamers
21 #include "../histo/profile_data"
23 #include "../histo/h1d"
24 #include "../histo/h2d"
25 #include "../histo/h3d"
26 #include "../histo/p1d"
27 #include "../histo/p2d"
40 int fNdivisions = 510;
42 short fLabelColor = 1;
43 short fLabelFont = 62;
44 float fLabelOffset = 0.005F;
45 float fLabelSize = 0.04F;
46 float fTickLength = 0.03F;
47 float fTitleOffset = 1;
48 float fTitleSize = 0.04F;
49 short fTitleColor = 1;
50 short fTitleFont = 62;
57 if(!a_buffer.
read(fNdivisions))
return false;
58 if(!a_buffer.
read(fAxisColor))
return false;
59 if(!a_buffer.
read(fLabelColor))
return false;
60 if(!a_buffer.
read(fLabelFont))
return false;
61 if(!a_buffer.
read(fLabelOffset))
return false;
62 if(!a_buffer.
read(fLabelSize))
return false;
63 if(!a_buffer.
read(fTickLength))
return false;
64 if(!a_buffer.
read(fTitleOffset))
return false;
65 if(!a_buffer.
read(fTitleSize))
return false;
66 if(!a_buffer.
read(fTitleColor))
return false;
67 if(!a_buffer.
read(fTitleFont))
return false;
86 if(!a_buffer.
read(number))
return false;
88 if(!a_buffer.
read(min))
return false;
90 if(!a_buffer.
read(max))
return false;
92 std::vector<double> edges;
93 if(!Array_stream<double>(a_buffer,edges))
return false;
95 size_t edgen = edges.size();
99 std::vector<double> vedges;
100 for(
size_t index=0;index<edgen;index++) {
101 vedges.push_back(edges[index]);
107 if(!a_buffer.
read(First))
return false;
109 if(!a_buffer.
read(Last))
return false;
112 unsigned short dummy;
117 unsigned char TimeDisplay;
118 if(!a_buffer.
read(TimeDisplay))
return false;
121 std::string TimeFormat;
122 if(!a_buffer.
read(TimeFormat))
return false;
134 inline bool null_epsil(
double a_1,
double a_2,
double a_prec = -5) {
135 return (::log10(::fabs(a_1-a_2))<a_prec?
true:
false);
139 double& a_entries,
double& a_Sw,
double& a_Sw2,
double& a_Sxw,
double& a_Sx2w){
160 {
short color,style,width;
167 if(!a_buffer.
read(Ncells))
return false;
171 a_data.
m_axes[0].m_offset = 1;
193 if(!a_buffer.
read(barOffset))
return false;
196 if(!a_buffer.
read(barWidth))
return false;
198 if(!a_buffer.
read(a_entries))
return false;
200 if(!a_buffer.
read(a_Sw))
return false;
202 if(!a_buffer.
read(a_Sw2))
return false;
204 if(!a_buffer.
read(a_Sxw))
return false;
206 if(!a_buffer.
read(a_Sx2w))
return false;
209 if(!a_buffer.
read(max))
return false;
212 if(!a_buffer.
read(min))
return false;
215 if(!a_buffer.
read(NormFactor))
return false;
217 {std::vector<double> v;
218 if(!Array_stream<double>(a_buffer,v))
return false;}
220 std::vector<double> sumw2;
221 if(!Array_stream<double>(a_buffer,sumw2))
return false;
224 if(!a_buffer.
read(opt))
return false;
234 a_buffer.
out() <<
"tools::rroot::TH_read_1D :"
235 <<
" obj_list stream failed."
242 if(!a_buffer.
read(BufferSize))
return false;
245 if(!dummy_array_stream<double>(a_buffer,BufferSize))
return false;
259 (a_data.
m_axes[0].m_number_of_bins + 2) *
260 (a_data.
m_axes[1].m_number_of_bins + 2);
263 (a_data.
m_axes[0].m_number_of_bins + 2) *
264 (a_data.
m_axes[1].m_number_of_bins + 2) *
265 (a_data.
m_axes[2].m_number_of_bins + 2);
270 if(binn==sumw2.size()) {
271 for(
unsigned int index=0;index<binn;index++){
285 double& a_entries,
double& a_Sw,
double& a_Sw2,
286 double& a_Sxw,
double& a_Sx2w,
double& a_Syw,
double& a_Sy2w){
293 if(!
TH_read_1D(a_buffer,a_data,a_entries,a_Sw,a_Sw2,a_Sxw,a_Sx2w))
return false;
301 if(!a_buffer.
read(ScaleFactor))
return false;
302 if(!a_buffer.
read(a_Syw))
return false;
303 if(!a_buffer.
read(a_Sy2w))
return false;
306 if(!a_buffer.
read(Tsumwxy))
return false;
315 double& a_entries,
double& a_Sw,
double& a_Sw2,
316 double& a_Sxw,
double& a_Sx2w,
317 double& a_Syw,
double& a_Sy2w,
318 double& a_Szw,
double& a_Sz2w){
323 if(!
TH_read_1D(a_buffer,a_data,a_entries,a_Sw,a_Sw2,a_Sxw,a_Sx2w))
return false;
332 if(!a_buffer.
read(a_Syw))
return false;
333 if(!a_buffer.
read(a_Sy2w))
return false;
335 if(!a_buffer.
read(Tsumwxy))
return false;
337 if(!a_buffer.
read(a_Szw))
return false;
338 if(!a_buffer.
read(a_Sz2w))
return false;
340 if(!a_buffer.
read(Tsumwxz))
return false;
342 if(!a_buffer.
read(Tsumwyz))
return false;
373 if(!
TH_read_1D(a_buffer,data,fEntries,fSw,fSw2,fSxw,fSx2w))
return 0;
380 std::vector<float> bins;
381 if(!Array_stream<float>(a_buffer,bins))
return 0;
386 {
for(
unsigned int index=0;index<binn;index++){
387 data.
m_bin_Sw[index] = double(bins[index]);
391 {std::vector<double> empty;
427 if(!
TH_read_1D(a_buffer,data,fEntries,fSw,fSw2,fSxw,fSx2w))
return 0;
434 std::vector<double> bins;
435 if(!Array_stream<double>(a_buffer,bins))
return 0;
442 {std::vector<double> empty;
484 if(!
TH_read_2D(a_buffer,data,fEntries,fSw,fSw2,fSxw,fSx2w,fSyw,fSy2w))
return 0;
491 std::vector<float> bins;
492 if(!Array_stream<float>(a_buffer,bins))
return 0;
497 {
for(
unsigned int index=0;index<binn;index++){
498 data.
m_bin_Sw[index] = double(bins[index]);
502 {std::vector<double> empty;
546 if(!
TH_read_2D(a_buffer,data,fEntries,fSw,fSw2,fSxw,fSx2w,fSyw,fSy2w))
return 0;
553 std::vector<double> bins;
554 if(!Array_stream<double>(a_buffer,bins))
return 0;
561 {std::vector<double> empty;
605 if(!
TH_read_3D(a_buffer,data,fEntries,fSw,fSw2,fSxw,fSx2w,fSyw,fSy2w,fSzw,fSz2w))
return 0;
612 std::vector<double> bins;
613 if(!Array_stream<double>(a_buffer,bins))
return 0;
620 {std::vector<double> empty;
663 std::vector<double> bins;
664 if(!Array_stream<double>(a_buffer,bins))
return 0;
666 if(!a_buffer.
read(errorMode))
return 0;
668 if(!a_buffer.
read(ymin))
return 0;
670 if(!a_buffer.
read(ymax))
return 0;
674 if(!a_buffer.
read(sumwy))
return 0;
676 if(!a_buffer.
read(sumwy2))
return 0;
679 std::vector<double> bins_sumw2;
680 if(!Array_stream<double>(a_buffer,bins_sumw2))
return 0;
694 for(
unsigned int index=0;index<binn;index++){
697 double sw = bins[index];
732 std::vector<double> bins;
733 if(!Array_stream<double>(a_buffer,bins))
return 0;
735 if(!a_buffer.
read(errorMode))
return 0;
737 if(!a_buffer.
read(zmin))
return 0;
739 if(!a_buffer.
read(zmax))
return 0;
742 if(!a_buffer.
read(sumwz))
return 0;
744 if(!a_buffer.
read(sumwz2))
return 0;
747 std::vector<double> bins_sumw2;
748 if(!Array_stream<double>(a_buffer,bins_sumw2))
return 0;
761 for(
unsigned int index=0;index<binn;index++){
764 double sw = bins[index];
793 if(!a_buffer.
read(_date))
return false;
795 if(!a_buffer.
read(_date))
return false;
805 if(!a_buffer.
read(i))
return false;
809 if(!a_buffer.
read(i))
return false;
813 if(!a_buffer.
read(i))
return false;
821 a_buffer.
out() <<
"tools::rroot::TDirectory::stream :"
822 <<
" cannot read keys."
846 inline void dump(std::ostream& a_out,
848 const std::vector<key*>& a_keys,
850 unsigned int a_spaces = 0) {
853 {std::vector<key*>::const_iterator it;
854 for(it=a_keys.begin();it!=a_keys.end();++it) {
857 {
for(
unsigned int index=0;index<a_spaces;index++) a_out <<
" ";}
862 {std::vector<key*>::const_iterator it;
863 for(it=a_keys.begin();it!=a_keys.end();++it) {
868 {
for(
unsigned int index=0;index<a_spaces;index++) a_out <<
" ";}
869 a_out <<
"directory : " << label << std::endl;
871 if(!a_recursive)
continue;
877 a_out <<
"tools::rroot::dump :"
878 <<
" can't get directory data buffer."
884 a_out <<
"tools::rroot::dump :"
885 <<
" can't stream TDirectory."
888 const std::vector<key*>& keys = tdir.
keys();
889 dump(a_out,a_file,keys,a_recursive,a_spaces+1);