Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/externals/g4tools/include/tools/wroot/streamers

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/g4tools/include/tools/wroot/streamers (Version 11.3.0) and /externals/g4tools/include/tools/wroot/streamers (Version 11.2.1)


  1 // Copyright (C) 2010, Guy Barrand. All rights      1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
  2 // See the file tools.license for terms.            2 // See the file tools.license for terms.
  3                                                     3 
  4 #ifndef tools_wroot_streamers                       4 #ifndef tools_wroot_streamers
  5 #define tools_wroot_streamers                       5 #define tools_wroot_streamers
  6                                                     6 
  7 #include "named"                                    7 #include "named"
  8 #include "directory"                                8 #include "directory"
  9 #include "file"                                     9 #include "file"
 10 #include "../vmanip" //convert                     10 #include "../vmanip" //convert
 11                                                    11 
 12 #include "../histo/h1d"                            12 #include "../histo/h1d"
 13 #include "../histo/h2d"                            13 #include "../histo/h2d"
 14 #include "../histo/h3d"                            14 #include "../histo/h3d"
 15 #include "../histo/p1d"                            15 #include "../histo/p1d"
 16 #include "../histo/p2d"                            16 #include "../histo/p2d"
 17                                                    17 
 18 #include "../histo/h1df"                           18 #include "../histo/h1df"
 19 #include "../histo/h2df"                           19 #include "../histo/h2df"
 20 #include "../histo/h3df"                           20 #include "../histo/h3df"
 21                                                    21 
 22 namespace tools {                                  22 namespace tools {
 23 namespace wroot {                                  23 namespace wroot {
 24                                                    24 
 25 typedef histo::histo_data<double,unsigned int,     25 typedef histo::histo_data<double,unsigned int,unsigned int,double> hd_data;
 26 typedef histo::histo_data<double,unsigned int,     26 typedef histo::histo_data<double,unsigned int,unsigned int,float> hf_data;
 27 typedef histo::profile_data<double,unsigned in     27 typedef histo::profile_data<double,unsigned int,unsigned int,double,double> pd_data;
 28                                                    28 
 29 inline bool AttAxis_stream(buffer& a_buffer) {     29 inline bool AttAxis_stream(buffer& a_buffer) {
 30   int fNdivisions = 510;   //Number of divisio     30   int fNdivisions = 510;   //Number of divisions(10000*n3 + 100*n2 + n1)
 31   short fAxisColor = 1;    //color of the line     31   short fAxisColor = 1;    //color of the line axis
 32   short fLabelColor = 1;   //color of labels       32   short fLabelColor = 1;   //color of labels
 33   short fLabelFont = 62;    //font for labels      33   short fLabelFont = 62;    //font for labels
 34   float fLabelOffset = 0.005F;  //offset of la     34   float fLabelOffset = 0.005F;  //offset of labels
 35   float fLabelSize = 0.04F;    //size of label     35   float fLabelSize = 0.04F;    //size of labels
 36   float fTickLength = 0.03F;   //length of tic     36   float fTickLength = 0.03F;   //length of tick marks
 37   float fTitleOffset = 1;  //offset of axis ti     37   float fTitleOffset = 1;  //offset of axis title
 38   float fTitleSize = 0.04F;    //size of axis      38   float fTitleSize = 0.04F;    //size of axis title
 39   short fTitleColor = 1;   //color of axis tit     39   short fTitleColor = 1;   //color of axis title
 40   short fTitleFont = 62;    //font for axis ti     40   short fTitleFont = 62;    //font for axis title
 41                                                    41 
 42   // Version 4 streaming (ROOT/v3-00-6).           42   // Version 4 streaming (ROOT/v3-00-6).
 43   unsigned int beg;                                43   unsigned int beg;
 44   if(!a_buffer.write_version(4,beg)) return fa     44   if(!a_buffer.write_version(4,beg)) return false;
 45                                                    45 
 46   if(!a_buffer.write(fNdivisions)) return fals     46   if(!a_buffer.write(fNdivisions)) return false;
 47   if(!a_buffer.write(fAxisColor)) return false     47   if(!a_buffer.write(fAxisColor)) return false;
 48   if(!a_buffer.write(fLabelColor)) return fals     48   if(!a_buffer.write(fLabelColor)) return false;
 49   if(!a_buffer.write(fLabelFont)) return false     49   if(!a_buffer.write(fLabelFont)) return false;
 50   if(!a_buffer.write(fLabelOffset)) return fal     50   if(!a_buffer.write(fLabelOffset)) return false;
 51   if(!a_buffer.write(fLabelSize)) return false     51   if(!a_buffer.write(fLabelSize)) return false;
 52   if(!a_buffer.write(fTickLength)) return fals     52   if(!a_buffer.write(fTickLength)) return false;
 53   if(!a_buffer.write(fTitleOffset)) return fal     53   if(!a_buffer.write(fTitleOffset)) return false;
 54   if(!a_buffer.write(fTitleSize)) return false     54   if(!a_buffer.write(fTitleSize)) return false;
 55   if(!a_buffer.write(fTitleColor)) return fals     55   if(!a_buffer.write(fTitleColor)) return false;
 56   if(!a_buffer.write(fTitleFont)) return false     56   if(!a_buffer.write(fTitleFont)) return false;
 57                                                    57 
 58   if(!a_buffer.set_byte_count(beg)) return fal     58   if(!a_buffer.set_byte_count(beg)) return false;
 59   return true;                                     59   return true;
 60 }                                                  60 }
 61                                                    61 
 62 inline bool axis_stream(buffer& a_buffer,          62 inline bool axis_stream(buffer& a_buffer,
 63                         const histo::axis<doub     63                         const histo::axis<double,unsigned int>& a_axis,
 64                         const std::string& a_n     64                         const std::string& a_name,
 65                         const std::string& a_t     65                         const std::string& a_title) {
 66     // Version 6 streaming (ROOT/v3-00-6).         66     // Version 6 streaming (ROOT/v3-00-6).
 67                                                    67 
 68     unsigned int beg;                              68     unsigned int beg;
 69     if(!a_buffer.write_version(6,beg)) return      69     if(!a_buffer.write_version(6,beg)) return false;
 70                                                    70 
 71     if(!Named_stream(a_buffer,a_name,a_title))     71     if(!Named_stream(a_buffer,a_name,a_title)) return false;
 72                                                    72 
 73     if(!AttAxis_stream(a_buffer)) return false     73     if(!AttAxis_stream(a_buffer)) return false;
 74                                                    74 
 75     if(!a_buffer.write(a_axis.bins())) return      75     if(!a_buffer.write(a_axis.bins())) return false;
 76     if(!a_buffer.write(a_axis.lower_edge())) r     76     if(!a_buffer.write(a_axis.lower_edge())) return false;
 77     if(!a_buffer.write(a_axis.upper_edge())) r     77     if(!a_buffer.write(a_axis.upper_edge())) return false;
 78                                                    78 
 79     // fXbins                                      79     // fXbins
 80     //if(a_axis.m_fixed) {                         80     //if(a_axis.m_fixed) {
 81     //  std::vector<double> v;                     81     //  std::vector<double> v;
 82     //  ArrayT<double> dummy(v);                   82     //  ArrayT<double> dummy(v);
 83     //  if(!dummy.stream(a_buffer)) return fal     83     //  if(!dummy.stream(a_buffer)) return false; //TArrayD
 84     //} else {                                     84     //} else {
 85       if(!a_buffer.write_array(a_axis.edges())     85       if(!a_buffer.write_array(a_axis.edges())) return false; //TArrayD
 86     //}                                            86     //}
 87                                                    87 
 88     if(!a_buffer.write((int)0)) return false;      88     if(!a_buffer.write((int)0)) return false; //fFirst
 89     if(!a_buffer.write((int)0)) return false;      89     if(!a_buffer.write((int)0)) return false; //fLast
 90                                                    90 
 91     //Bool_t                                       91     //Bool_t
 92     if(!a_buffer.write((unsigned char)0)) retu     92     if(!a_buffer.write((unsigned char)0)) return false;  //TimeDisplay
 93                                                    93 
 94     //TString                                      94     //TString
 95     if(!a_buffer.write(std::string())) return      95     if(!a_buffer.write(std::string())) return false; //TimeFormat
 96                                                    96 
 97     if(!a_buffer.set_byte_count(beg)) return f     97     if(!a_buffer.set_byte_count(beg)) return false;
 98                                                    98 
 99     return true;                                   99     return true;
100 }                                                 100 }
101                                                   101 
102 inline bool List_empty_stream(buffer& a_buffer    102 inline bool List_empty_stream(buffer& a_buffer) {
103   unsigned int beg;                               103   unsigned int beg;
104   if(!a_buffer.write_version(4,beg)) return fa    104   if(!a_buffer.write_version(4,beg)) return false;
105   if(!Object_stream(a_buffer)) return false;      105   if(!Object_stream(a_buffer)) return false;
106   std::string name;                               106   std::string name;
107   if(!a_buffer.write(name)) return false;         107   if(!a_buffer.write(name)) return false;
108   int nobjects = 0;                               108   int nobjects = 0;
109   if(!a_buffer.write(nobjects)) return false;     109   if(!a_buffer.write(nobjects)) return false;
110   if(!a_buffer.set_byte_count(beg)) return fal    110   if(!a_buffer.set_byte_count(beg)) return false;
111   return true;                                    111   return true;
112 }                                                 112 }
113                                                   113 
114 template <class HIST>                             114 template <class HIST>
115 inline std::string axis_title(const HIST& a_h,    115 inline std::string axis_title(const HIST& a_h,const std::string& a_key) {
116   typedef std::map<std::string,std::string> an    116   typedef std::map<std::string,std::string> annotations_t;
117   annotations_t::const_iterator it = a_h.annot    117   annotations_t::const_iterator it = a_h.annotations().find(a_key);
118   if(it==a_h.annotations().end()) return std::    118   if(it==a_h.annotations().end()) return std::string();
119   return (*it).second;                            119   return (*it).second;
120 }                                                 120 }
121                                                   121 
122 template <class HIST>                             122 template <class HIST>
123 inline bool TH_write_1D(buffer& a_buffer,         123 inline bool TH_write_1D(buffer& a_buffer,
124                         const HIST& a_h,          124                         const HIST& a_h,
125                         const std::string& a_n    125                         const std::string& a_name,
126                         const std::vector<doub    126                         const std::vector<double>& a_bin_Sw2) {
127                                                   127 
128     if(!a_buffer.write_version(3)) return fals    128     if(!a_buffer.write_version(3)) return false;
129                                                   129 
130     if(!Named_stream(a_buffer,a_name,a_h.title    130     if(!Named_stream(a_buffer,a_name,a_h.title())) return false;
131                                                   131 
132     if(!AttLine_stream(a_buffer)) return false    132     if(!AttLine_stream(a_buffer)) return false;
133     if(!AttFill_stream(a_buffer)) return false    133     if(!AttFill_stream(a_buffer)) return false;
134     if(!AttMarker_stream(a_buffer)) return fal    134     if(!AttMarker_stream(a_buffer)) return false;
135                                                   135 
136     if(!a_buffer.write((int)a_h.get_bins())) r    136     if(!a_buffer.write((int)a_h.get_bins())) return false;
137                                                   137 
138     //fXAxis,fYAxis,fZAxis                        138     //fXAxis,fYAxis,fZAxis
139     if(a_h.dimension()==3) {                      139     if(a_h.dimension()==3) {
140                                                   140 
141      {histo::axis<double,unsigned int> haxis(a    141      {histo::axis<double,unsigned int> haxis(a_h.get_axis(0));
142       if(!axis_stream(a_buffer,haxis,"xaxis",a    142       if(!axis_stream(a_buffer,haxis,"xaxis",axis_title(a_h,histo::key_axis_x_title()))) return false;}
143                                                   143 
144      {histo::axis<double,unsigned int> haxis(a    144      {histo::axis<double,unsigned int> haxis(a_h.get_axis(1));
145       if(!axis_stream(a_buffer,haxis,"yaxis",a    145       if(!axis_stream(a_buffer,haxis,"yaxis",axis_title(a_h,histo::key_axis_y_title()))) return false;}
146                                                   146 
147      {histo::axis<double,unsigned int> haxis(a    147      {histo::axis<double,unsigned int> haxis(a_h.get_axis(2));
148       if(!axis_stream(a_buffer,haxis,"zaxis",a    148       if(!axis_stream(a_buffer,haxis,"zaxis",axis_title(a_h,histo::key_axis_z_title()))) return false;}
149                                                   149 
150     } else if(a_h.dimension()==2) {               150     } else if(a_h.dimension()==2) {
151                                                   151 
152      {histo::axis<double,unsigned int> haxis(a    152      {histo::axis<double,unsigned int> haxis(a_h.get_axis(0));
153       if(!axis_stream(a_buffer,haxis,"xaxis",a    153       if(!axis_stream(a_buffer,haxis,"xaxis",axis_title(a_h,histo::key_axis_x_title()))) return false;}
154                                                   154 
155      {histo::axis<double,unsigned int> haxis(a    155      {histo::axis<double,unsigned int> haxis(a_h.get_axis(1));
156       if(!axis_stream(a_buffer,haxis,"yaxis",a    156       if(!axis_stream(a_buffer,haxis,"yaxis",axis_title(a_h,histo::key_axis_y_title()))) return false;}
157                                                   157 
158      {histo::axis<double,unsigned int> dummy;     158      {histo::axis<double,unsigned int> dummy;
159       dummy.configure(1,0,1);                     159       dummy.configure(1,0,1);
160       if(!axis_stream(a_buffer,dummy,"zaxis",a    160       if(!axis_stream(a_buffer,dummy,"zaxis",axis_title(a_h,histo::key_axis_z_title()))) return false;}
161                                                   161 
162     } else if(a_h.dimension()==1) {               162     } else if(a_h.dimension()==1) {
163                                                   163 
164      {histo::axis<double,unsigned int> haxis(a    164      {histo::axis<double,unsigned int> haxis(a_h.get_axis(0));
165       if(!axis_stream(a_buffer,haxis,"xaxis",a    165       if(!axis_stream(a_buffer,haxis,"xaxis",axis_title(a_h,histo::key_axis_x_title()))) return false;}
166                                                   166 
167      {histo::axis<double,unsigned int> dummy;     167      {histo::axis<double,unsigned int> dummy;
168       dummy.configure(1,0,1);                     168       dummy.configure(1,0,1);
169       if(!axis_stream(a_buffer,dummy,"yaxis",a    169       if(!axis_stream(a_buffer,dummy,"yaxis",axis_title(a_h,histo::key_axis_y_title()))) return false;}
170                                                   170 
171      {histo::axis<double,unsigned int> dummy;     171      {histo::axis<double,unsigned int> dummy;
172       dummy.configure(1,0,1);                     172       dummy.configure(1,0,1);
173       if(!axis_stream(a_buffer,dummy,"zaxis",a    173       if(!axis_stream(a_buffer,dummy,"zaxis",axis_title(a_h,histo::key_axis_z_title()))) return false;}
174                                                   174 
175     } else {                                      175     } else {
176       return false;                               176       return false;
177     }                                             177     }
178                                                   178 
179     if(!a_buffer.write((short)(1000 * 0.25)))     179     if(!a_buffer.write((short)(1000 * 0.25))) return false; //fBarOffset
180     if(!a_buffer.write((short)(1000 * 0.5))) r    180     if(!a_buffer.write((short)(1000 * 0.5))) return false; //fBarWidth
181                                                   181 
182     if(!a_buffer.write((double)a_h.all_entries    182     if(!a_buffer.write((double)a_h.all_entries())) return false;
183     if(!a_buffer.write((double)a_h.get_in_rang    183     if(!a_buffer.write((double)a_h.get_in_range_Sw())) return false;  //enforce double in case h1df
184     if(!a_buffer.write((double)a_h.get_in_rang    184     if(!a_buffer.write((double)a_h.get_in_range_Sw2())) return false; //idem
185                                                   185 
186    {double value;                                 186    {double value;
187     a_h.get_ith_axis_Sxw(0,value);                187     a_h.get_ith_axis_Sxw(0,value);
188     if(!a_buffer.write(value)) return false;}     188     if(!a_buffer.write(value)) return false;}
189                                                   189 
190    {double value;                                 190    {double value;
191     a_h.get_ith_axis_Sx2w(0,value);               191     a_h.get_ith_axis_Sx2w(0,value);
192     if(!a_buffer.write(value)) return false;}     192     if(!a_buffer.write(value)) return false;}
193                                                   193 
194     if(!a_buffer.write((double)-1111)) return     194     if(!a_buffer.write((double)-1111)) return false; //fMaximum
195     if(!a_buffer.write((double)-1111)) return     195     if(!a_buffer.write((double)-1111)) return false; //fMinimum
196     if(!a_buffer.write((double)0)) return fals    196     if(!a_buffer.write((double)0)) return false; //NormFactor
197                                                   197 
198     if(!a_buffer.write_array(std::vector<doubl    198     if(!a_buffer.write_array(std::vector<double>())) return false; //fContour TArrayD
199                                                   199 
200     if(!a_buffer.write_array(a_bin_Sw2)) retur    200     if(!a_buffer.write_array(a_bin_Sw2)) return false; //fSumw2 TArrayD
201                                                   201 
202     // store annotation on fOption                202     // store annotation on fOption
203     // but try to fool CERN-ROOT in order that    203     // but try to fool CERN-ROOT in order that it does not
204     // understand fOption as.. CERN-ROOT optio    204     // understand fOption as.. CERN-ROOT options !
205    //{std::string opt = " "+fAnnotation;          205    //{std::string opt = " "+fAnnotation;
206    // opt[0] = 0; //awfull trick                  206    // opt[0] = 0; //awfull trick
207    // if(!a_buffer.write(opt)) return false;}     207    // if(!a_buffer.write(opt)) return false;} //TString fOption
208    {std::string opt;                              208    {std::string opt;
209     if(!a_buffer.write(opt)) return false;} //    209     if(!a_buffer.write(opt)) return false;} //TString fOption
210                                                   210 
211     if(!List_empty_stream(a_buffer)) return fa    211     if(!List_empty_stream(a_buffer)) return false; //*TList fFunctions
212                                                   212 
213     return true;                                  213     return true;
214 }                                                 214 }
215                                                   215 
216 template <class HIST>                             216 template <class HIST>
217 inline bool TH_write_2D(buffer& a_buffer,         217 inline bool TH_write_2D(buffer& a_buffer,
218                         const HIST& a_h,          218                         const HIST& a_h,
219                         const std::string& a_n    219                         const std::string& a_name,
220                         const std::vector<doub    220                         const std::vector<double>& a_bin_Sw2) {
221   if(!a_buffer.write_version(3)) return false;    221   if(!a_buffer.write_version(3)) return false;
222   if(!TH_write_1D(a_buffer,a_h,a_name,a_bin_Sw    222   if(!TH_write_1D(a_buffer,a_h,a_name,a_bin_Sw2)) return false;
223   if(!a_buffer.write((double)1)) return false;    223   if(!a_buffer.write((double)1)) return false; //ScaleFactor
224                                                   224 
225  {double value;                                   225  {double value;
226   a_h.get_ith_axis_Sxw(1,value);                  226   a_h.get_ith_axis_Sxw(1,value);
227   if(!a_buffer.write(value)) return false;}       227   if(!a_buffer.write(value)) return false;}
228                                                   228 
229  {double value;                                   229  {double value;
230   a_h.get_ith_axis_Sx2w(1,value);                 230   a_h.get_ith_axis_Sx2w(1,value);
231   if(!a_buffer.write(value)) return false;}       231   if(!a_buffer.write(value)) return false;}
232                                                   232 
233   if(!a_buffer.write((double)a_h.Sxyw())) retu    233   if(!a_buffer.write((double)a_h.Sxyw())) return false; //Tsumwxy
234                                                   234 
235   return true;                                    235   return true;
236 }                                                 236 }
237                                                   237 
238 template <class HIST>                             238 template <class HIST>
239 inline bool TH_write_3D(buffer& a_buffer,         239 inline bool TH_write_3D(buffer& a_buffer,
240                         const HIST& a_h,          240                         const HIST& a_h,
241                         const std::string& a_n    241                         const std::string& a_name,
242                         const std::vector<doub    242                         const std::vector<double>& a_bin_Sw2) {
243   if(!a_buffer.write_version(4)) return false;    243   if(!a_buffer.write_version(4)) return false;
244   if(!TH_write_1D(a_buffer,a_h,a_name,a_bin_Sw    244   if(!TH_write_1D(a_buffer,a_h,a_name,a_bin_Sw2)) return false;
245   if(!Att3D_stream(a_buffer)) return false;       245   if(!Att3D_stream(a_buffer)) return false;
246                                                   246 
247  {double value;                                   247  {double value;
248   a_h.get_ith_axis_Sxw(1,value);                  248   a_h.get_ith_axis_Sxw(1,value);
249   if(!a_buffer.write(value)) return false;}       249   if(!a_buffer.write(value)) return false;}    //Tsumwy : Total Sum of weight*Y
250  {double value;                                   250  {double value;
251   a_h.get_ith_axis_Sx2w(1,value);                 251   a_h.get_ith_axis_Sx2w(1,value);
252   if(!a_buffer.write(value)) return false;}       252   if(!a_buffer.write(value)) return false;}    //Tsumwy2 : Total Sum of weight*Y*Y
253   if(!a_buffer.write((double)a_h.Sxyw())) retu    253   if(!a_buffer.write((double)a_h.Sxyw())) return false; //Tsumwxy : Total Sum of weight*X*Y
254                                                   254 
255  {double value;                                   255  {double value;
256   a_h.get_ith_axis_Sxw(2,value);                  256   a_h.get_ith_axis_Sxw(2,value);
257   if(!a_buffer.write(value)) return false;}       257   if(!a_buffer.write(value)) return false;}    //Tsumwz : Total Sum of weight*Z
258  {double value;                                   258  {double value;
259   a_h.get_ith_axis_Sx2w(2,value);                 259   a_h.get_ith_axis_Sx2w(2,value);
260   if(!a_buffer.write(value)) return false;}       260   if(!a_buffer.write(value)) return false;}    //Tsumwz2 : Total Sum of weight*Z*Z
261   if(!a_buffer.write((double)a_h.Szxw())) retu    261   if(!a_buffer.write((double)a_h.Szxw())) return false; //Tsumwxz : Total Sum of weight*X*Z
262   if(!a_buffer.write((double)a_h.Syzw())) retu    262   if(!a_buffer.write((double)a_h.Syzw())) return false; //Tsumwyz : Total Sum of weight*Y*Z
263                                                   263 
264   return true;                                    264   return true;
265 }                                                 265 }
266                                                   266 
267 inline bool TH1F_stream(buffer& a_buffer,const    267 inline bool TH1F_stream(buffer& a_buffer,const histo::h1df& a_h,const std::string& a_name) {
268   if(!a_buffer.write_version(1)) return false;    268   if(!a_buffer.write_version(1)) return false;
269   std::vector<double> bins_sum_w2d;               269   std::vector<double> bins_sum_w2d;
270   convert<float,double>(a_h.bins_sum_w2(),bins    270   convert<float,double>(a_h.bins_sum_w2(),bins_sum_w2d);
271   if(!TH_write_1D(a_buffer,a_h,a_name,bins_sum    271   if(!TH_write_1D(a_buffer,a_h,a_name,bins_sum_w2d)) return false;
272   if(!a_buffer.write_array(a_h.bins_sum_w()))     272   if(!a_buffer.write_array(a_h.bins_sum_w())) return false;
273   return true;                                    273   return true;
274 }                                                 274 }
275                                                   275 
276 inline bool TH1F_stream(buffer& a_buffer,const    276 inline bool TH1F_stream(buffer& a_buffer,const histo::h1d& a_h,const std::string& a_name) {
277   if(!a_buffer.write_version(1)) return false;    277   if(!a_buffer.write_version(1)) return false;
278   if(!TH_write_1D(a_buffer,a_h,a_name,a_h.bins    278   if(!TH_write_1D(a_buffer,a_h,a_name,a_h.bins_sum_w2())) return false;
279   std::vector<float> bins_sum_wf;                 279   std::vector<float> bins_sum_wf;
280   convert<double,float>(a_h.bins_sum_w(),bins_    280   convert<double,float>(a_h.bins_sum_w(),bins_sum_wf);
281   if(!a_buffer.write_array(bins_sum_wf)) retur    281   if(!a_buffer.write_array(bins_sum_wf)) return false;
282   return true;                                    282   return true;
283 }                                                 283 }
284                                                   284 
285 inline bool TH1D_stream(buffer& a_buffer,const    285 inline bool TH1D_stream(buffer& a_buffer,const histo::h1d& a_h,const std::string& a_name) {
286   if(!a_buffer.write_version(1)) return false;    286   if(!a_buffer.write_version(1)) return false;
287   if(!TH_write_1D(a_buffer,a_h,a_name,a_h.bins    287   if(!TH_write_1D(a_buffer,a_h,a_name,a_h.bins_sum_w2())) return false;
288   if(!a_buffer.write_array(a_h.bins_sum_w()))     288   if(!a_buffer.write_array(a_h.bins_sum_w())) return false; //fArray TArrayD
289   return true;                                    289   return true;
290 }                                                 290 }
291                                                   291 
292 inline bool TH2F_stream(buffer& a_buffer,const    292 inline bool TH2F_stream(buffer& a_buffer,const histo::h2d& a_h,const std::string& a_name){
293   if(!a_buffer.write_version(3)) return false;    293   if(!a_buffer.write_version(3)) return false;
294   if(!TH_write_2D(a_buffer,a_h,a_name,a_h.bins    294   if(!TH_write_2D(a_buffer,a_h,a_name,a_h.bins_sum_w2())) return false;
295   std::vector<float> bins_sum_wf;                 295   std::vector<float> bins_sum_wf;
296   convert<double,float>(a_h.bins_sum_w(),bins_    296   convert<double,float>(a_h.bins_sum_w(),bins_sum_wf);
297   if(!a_buffer.write_array(bins_sum_wf)) retur    297   if(!a_buffer.write_array(bins_sum_wf)) return false; //fArray TArrayF
298   return true;                                    298   return true;
299 }                                                 299 }
300                                                   300 
301 inline bool TH2F_stream(buffer& a_buffer,const    301 inline bool TH2F_stream(buffer& a_buffer,const histo::h2df& a_h,const std::string& a_name){
302   if(!a_buffer.write_version(3)) return false;    302   if(!a_buffer.write_version(3)) return false;
303   std::vector<double> bins_sum_w2d;               303   std::vector<double> bins_sum_w2d;
304   convert<float,double>(a_h.bins_sum_w2(),bins    304   convert<float,double>(a_h.bins_sum_w2(),bins_sum_w2d);
305   if(!TH_write_2D(a_buffer,a_h,a_name,bins_sum    305   if(!TH_write_2D(a_buffer,a_h,a_name,bins_sum_w2d)) return false;
306   if(!a_buffer.write_array(a_h.bins_sum_w()))     306   if(!a_buffer.write_array(a_h.bins_sum_w())) return false;
307   return true;                                    307   return true;
308 }                                                 308 }
309                                                   309 
310 inline bool TH2D_stream(buffer& a_buffer,const    310 inline bool TH2D_stream(buffer& a_buffer,const histo::h2d& a_h,const std::string& a_name){
311   if(!a_buffer.write_version(3)) return false;    311   if(!a_buffer.write_version(3)) return false;
312   if(!TH_write_2D(a_buffer,a_h,a_name,a_h.bins    312   if(!TH_write_2D(a_buffer,a_h,a_name,a_h.bins_sum_w2())) return false;
313   if(!a_buffer.write_array(a_h.bins_sum_w()))     313   if(!a_buffer.write_array(a_h.bins_sum_w())) return false; //fArray TArrayD
314   return true;                                    314   return true;
315 }                                                 315 }
316                                                   316 
317 inline bool TH3F_stream(buffer& a_buffer,const    317 inline bool TH3F_stream(buffer& a_buffer,const histo::h3d& a_h,const std::string& a_name){
318   if(!a_buffer.write_version(3)) return false;    318   if(!a_buffer.write_version(3)) return false;
319   if(!TH_write_3D(a_buffer,a_h,a_name,a_h.bins    319   if(!TH_write_3D(a_buffer,a_h,a_name,a_h.bins_sum_w2())) return false;
320   std::vector<float> bins_sum_wf;                 320   std::vector<float> bins_sum_wf;
321   convert<double,float>(a_h.bins_sum_w(),bins_    321   convert<double,float>(a_h.bins_sum_w(),bins_sum_wf);
322   if(!a_buffer.write_array(bins_sum_wf)) retur    322   if(!a_buffer.write_array(bins_sum_wf)) return false; //fArray TArrayF
323   return true;                                    323   return true;
324 }                                                 324 }
325                                                   325 
326 inline bool TH3F_stream(buffer& a_buffer,const    326 inline bool TH3F_stream(buffer& a_buffer,const histo::h3df& a_h,const std::string& a_name){
327   if(!a_buffer.write_version(3)) return false;    327   if(!a_buffer.write_version(3)) return false;
328   std::vector<double> bins_sum_w2d;               328   std::vector<double> bins_sum_w2d;
329   convert<float,double>(a_h.bins_sum_w2(),bins    329   convert<float,double>(a_h.bins_sum_w2(),bins_sum_w2d);
330   if(!TH_write_3D(a_buffer,a_h,a_name,bins_sum    330   if(!TH_write_3D(a_buffer,a_h,a_name,bins_sum_w2d)) return false;
331   if(!a_buffer.write_array(a_h.bins_sum_w()))     331   if(!a_buffer.write_array(a_h.bins_sum_w())) return false; //fArray TArrayF
332   return true;                                    332   return true;
333 }                                                 333 }
334                                                   334 
335 inline bool TH3D_stream(buffer& a_buffer,const    335 inline bool TH3D_stream(buffer& a_buffer,const histo::h3d& a_h,const std::string& a_name){
336   if(!a_buffer.write_version(3)) return false;    336   if(!a_buffer.write_version(3)) return false;
337   if(!TH_write_3D(a_buffer,a_h,a_name,a_h.bins    337   if(!TH_write_3D(a_buffer,a_h,a_name,a_h.bins_sum_w2())) return false;
338   if(!a_buffer.write_array(a_h.bins_sum_w()))     338   if(!a_buffer.write_array(a_h.bins_sum_w())) return false; //fArray TArrayD
339   return true;                                    339   return true;
340 }                                                 340 }
341                                                   341 
342 inline bool TProfile_stream(buffer& a_buffer,c    342 inline bool TProfile_stream(buffer& a_buffer,const histo::p1d& a_p,const std::string& a_name){
343   if(!a_buffer.write_version(4)) return false;    343   if(!a_buffer.write_version(4)) return false;
344                                                   344 
345   //WARNING : the mapping histo::p1d / TProfil    345   //WARNING : the mapping histo::p1d / TProfile is not obvious.
346   //p1d::m_bin_Svw  <---> TProfile::fArray        346   //p1d::m_bin_Svw  <---> TProfile::fArray
347   //p1d::m_bin_Sv2w <---> TProfile::fSumw2        347   //p1d::m_bin_Sv2w <---> TProfile::fSumw2
348   //p1d::m_bin_Sw   <---> TProfile::fBinEntrie    348   //p1d::m_bin_Sw   <---> TProfile::fBinEntries
349                                                   349 
350   // TH1D_stream(a_buffer,h,a_name) :             350   // TH1D_stream(a_buffer,h,a_name) :
351   //if(!a_buffer.write_version(1)) return fals    351   //if(!a_buffer.write_version(1)) return false;
352   //if(!TH_write_1D(a_buffer,a_h,a_name,a_h.bi    352   //if(!TH_write_1D(a_buffer,a_h,a_name,a_h.bins_sum_w2())) return false; //fSumw2 TArrayD
353   //if(!a_buffer.write_array(a_h.bins_sum_w())    353   //if(!a_buffer.write_array(a_h.bins_sum_w())) return false; //fArray TArrayD
354   // but for profile :                            354   // but for profile :
355   if(!a_buffer.write_version(1)) return false;    355   if(!a_buffer.write_version(1)) return false;
356   if(!TH_write_1D(a_buffer,a_p,a_name,a_p.bins    356   if(!TH_write_1D(a_buffer,a_p,a_name,a_p.bins_sum_v2w())) return false; //fSumw2 TArrayD
357   if(!a_buffer.write_array(a_p.bins_sum_vw()))    357   if(!a_buffer.write_array(a_p.bins_sum_vw())) return false; //fArray TArrayD
358                                                   358 
359   //TProfile specific :                           359   //TProfile specific :
360   if(!a_buffer.write_array(a_p.bins_sum_w()))     360   if(!a_buffer.write_array(a_p.bins_sum_w())) return false; //fBinEntries TArrayD
361                                                   361 
362   int errorMode = 0;                              362   int errorMode = 0;
363   if(!a_buffer.write(errorMode)) return false;    363   if(!a_buffer.write(errorMode)) return false;
364   if(!a_buffer.write(a_p.min_v())) return fals    364   if(!a_buffer.write(a_p.min_v())) return false;
365   if(!a_buffer.write(a_p.max_v())) return fals    365   if(!a_buffer.write(a_p.max_v())) return false;
366                                                   366 
367   // version 4 :                                  367   // version 4 :
368   if(!a_buffer.write(a_p.get_Svw())) return fa    368   if(!a_buffer.write(a_p.get_Svw())) return false;              //Double_t fTsumwy;  //Total Sum of weight*Y
369   if(!a_buffer.write(a_p.get_Sv2w())) return f    369   if(!a_buffer.write(a_p.get_Sv2w())) return false;             //Double_t fTsumwy2; //Total Sum of weight*Y*Y
370                                                   370 
371   return true;                                    371   return true;
372 }                                                 372 }
373                                                   373 
374 inline bool TProfile2D_stream(buffer& a_buffer    374 inline bool TProfile2D_stream(buffer& a_buffer,const histo::p2d& a_p,const std::string& a_name){
375   if(!a_buffer.write_version(5)) return false;    375   if(!a_buffer.write_version(5)) return false;
376                                                   376 
377   //WARNING : the mapping histo::p2d / TProfil    377   //WARNING : the mapping histo::p2d / TProfile2D is not obvious.
378   //p2d::m_bin_Svw  <---> TProfile2D::fArray      378   //p2d::m_bin_Svw  <---> TProfile2D::fArray
379   //p2d::m_bin_Sv2w <---> TProfile2D::fSumw2      379   //p2d::m_bin_Sv2w <---> TProfile2D::fSumw2
380   //p2d::m_bin_Sw   <---> TProfile2D::fBinEntr    380   //p2d::m_bin_Sw   <---> TProfile2D::fBinEntries
381                                                   381 
382   // TH2D_stream(a_buffer,h,a_name) :             382   // TH2D_stream(a_buffer,h,a_name) :
383   //if(!a_buffer.write_version(3)) return fals    383   //if(!a_buffer.write_version(3)) return false;
384   //if(!TH_write_2D(a_buffer,a_h,a_name,a_h.bi    384   //if(!TH_write_2D(a_buffer,a_h,a_name,a_h.bins_sum_w2())) return false; //fSumw2 TArrayD
385   //if(!a_buffer.write_array(a_h.bins_sum_w())    385   //if(!a_buffer.write_array(a_h.bins_sum_w())) return false; //fArray TArrayD
386   // for profile :                                386   // for profile :
387   if(!a_buffer.write_version(3)) return false;    387   if(!a_buffer.write_version(3)) return false;
388   if(!TH_write_2D(a_buffer,a_p,a_name,a_p.bins    388   if(!TH_write_2D(a_buffer,a_p,a_name,a_p.bins_sum_v2w())) return false; //fSumw2 TArrayD
389   if(!a_buffer.write_array(a_p.bins_sum_vw()))    389   if(!a_buffer.write_array(a_p.bins_sum_vw())) return false; //fArray TArrayD
390                                                   390 
391   //TProfile2D specific :                         391   //TProfile2D specific :
392   if(!a_buffer.write_array(a_p.bins_sum_w()))     392   if(!a_buffer.write_array(a_p.bins_sum_w())) return false; //fBinEntries TArrayD
393                                                   393 
394   int errorMode = 0;                              394   int errorMode = 0;
395   if(!a_buffer.write(errorMode)) return false;    395   if(!a_buffer.write(errorMode)) return false;    //fErrorMode
396   if(!a_buffer.write(a_p.min_v())) return fals    396   if(!a_buffer.write(a_p.min_v())) return false; //fZmin
397   if(!a_buffer.write(a_p.max_v())) return fals    397   if(!a_buffer.write(a_p.max_v())) return false; //fZmax
398                                                   398 
399   // version 5 :                                  399   // version 5 :
400   if(!a_buffer.write(a_p.get_Svw())) return fa    400   if(!a_buffer.write(a_p.get_Svw())) return false;              //Double_t fTsumwz;  //Total Sum of weight*Z
401   if(!a_buffer.write(a_p.get_Sv2w())) return f    401   if(!a_buffer.write(a_p.get_Sv2w())) return false;             //Double_t fTsumwz2; //Total Sum of weight*Z*Z
402                                                   402 
403   return true;                                    403   return true;
404 }                                                 404 }
405                                                   405 
406 }}                                                406 }}
407                                                   407 
408 #endif                                            408 #endif