Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/externals/g4tools/include/tools/waxml/histos

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/waxml/histos (Version 11.3.0) and /externals/g4tools/include/tools/waxml/histos (Version 4.1.p1)


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef tools_waxml_histos                        
  5 #define tools_waxml_histos                        
  6                                                   
  7 #include "../histo/h1d"                           
  8 #include "../histo/h2d"                           
  9 #include "../histo/h3d"                           
 10 #include "../histo/p1d"                           
 11 #include "../histo/p2d"                           
 12                                                   
 13 #include "../sout"                                
 14 #include "../num2s"                               
 15 #include "../srep"                                
 16                                                   
 17 #include <sstream>                                
 18                                                   
 19 namespace tools {                                 
 20 namespace waxml {                                 
 21                                                   
 22   inline std::string soutd(std::ostringstream&    
 23     a_oss.str("");                                
 24     a_oss << a_value;                             
 25     std::string _s("\"");                         
 26     _s += a_oss.str();                            
 27     _s += "\"";                                   
 28     return _s;                                    
 29   }                                               
 30                                                   
 31   inline std::string bin_to_string(std::ostrin    
 32     if(a_index==histo::axis_UNDERFLOW_BIN) {      
 33       return "UNDERFLOW";                         
 34     } else if(a_index==histo::axis_OVERFLOW_BI    
 35       return "OVERFLOW";                          
 36     } else {                                      
 37       a_oss.str("");                              
 38       a_oss << a_index;                           
 39       return a_oss.str();                         
 40     }                                             
 41   }                                               
 42                                                   
 43   typedef std::map<std::string,std::string> an    
 44                                                   
 45   inline void write_annotations(                  
 46    const annotations_t& a_annotations             
 47   ,std::ostream& a_writer                         
 48   ,int aShift                                     
 49   ){                                              
 50     if(a_annotations.empty()) return;             
 51                                                   
 52     std::string spaces;                           
 53     for(int i=0;i<aShift;i++) spaces += " ";      
 54                                                   
 55     a_writer << spaces << "    <annotation>" <    
 56                                                   
 57     annotations_t::const_iterator it;             
 58     for(it=a_annotations.begin();it!=a_annotat    
 59       a_writer << spaces << "      <item"         
 60            << " key=" << sout(to_xml((*it).fir    
 61            << " value=" << sout(to_xml((*it).s    
 62            << "/>" << std::endl;                  
 63     }                                             
 64     a_writer << spaces << "    </annotation>"     
 65   }                                               
 66                                                   
 67   inline void write_axis(                         
 68    const histo::axis<double,unsigned int>& aAx    
 69   ,const std::string& aDirection                  
 70   ,std::ostream& a_writer                         
 71   ,std::ostringstream& a_oss                      
 72   ,int aShift                                     
 73   ){                                              
 74     typedef histo::axis<double,unsigned int>::    
 75                                                   
 76     std::string spaces;                           
 77     for(int i=0;i<aShift;i++) spaces += " ";      
 78                                                   
 79     if(aAxis.is_fixed_binning()) {                
 80       a_writer << spaces << "    <axis"           
 81            << " direction=" << sout(aDirection    
 82            << " numberOfBins=" << num_out<bn_t    
 83            << " min=" << soutd(a_oss,aAxis.low    
 84            << " max=" << soutd(a_oss,aAxis.upp    
 85            << "/>" << std::endl;                  
 86     } else {                                      
 87       a_writer << spaces << "    <axis"           
 88            << " direction=" << sout(aDirection    
 89            << " numberOfBins=" << num_out<bn_t    
 90            << " min=" << soutd(a_oss,aAxis.low    
 91            << " max=" << soutd(a_oss,aAxis.upp    
 92            << ">" << std::endl;                   
 93       bn_t number = aAxis.bins()-1;               
 94       for(bn_t index=0;index<number;index++) {    
 95         a_writer << spaces << "      <binBorde    
 96              << " value=" << soutd(a_oss,aAxis    
 97              << "/>" << std::endl;                
 98       }                                           
 99       a_writer << spaces << "    </axis>" << s    
100     }                                             
101   }                                               
102                                                   
103   inline void write_bin(                          
104    std::ostream& a_writer                         
105   ,std::ostringstream& a_oss                      
106   ,const histo::h1d& aObject                      
107   ,const std::string& aSpaces                     
108   ,int aIndex                                     
109   ){                                              
110     unsigned int entries = aObject.bin_entries    
111     if(entries) {                                 
112       a_writer << aSpaces << "      <bin1d"       
113            << " binNum=" << sout(bin_to_string    
114            << " entries=" << num_out<unsigned     
115            << " height=" << soutd(a_oss,aObjec    
116            << " error=" << soutd(a_oss,aObject    
117                                                   
118       double mean = aObject.bin_mean(aIndex);     
119       if(mean!=0) {                               
120         a_writer << " weightedMean=" << soutd(    
121       }                                           
122                                                   
123       double stddev = aObject.bin_rms(aIndex);    
124       if(stddev!=0) {                             
125         a_writer << " weightedRms=" << soutd(a    
126       }                                           
127                                                   
128       a_writer << "/>" << std::endl;              
129     }                                             
130   }                                               
131                                                   
132   inline void write_bin(                          
133    std::ostream& a_writer                         
134   ,std::ostringstream& a_oss                      
135   ,const histo::h2d& aObject                      
136   ,const std::string& aSpaces                     
137   ,int aIndexX                                    
138   ,int aIndexY                                    
139   ){                                              
140     unsigned int entries = aObject.bin_entries    
141     if(entries) {                                 
142       a_writer << aSpaces << "      <bin2d"       
143            << " binNumX=" << sout(bin_to_strin    
144            << " binNumY=" << sout(bin_to_strin    
145            << " entries=" << num_out<unsigned     
146            << " height=" << soutd(a_oss,aObjec    
147            << " error=" << soutd(a_oss,aObject    
148                                                   
149       double mean_x = aObject.bin_mean_x(aInde    
150       if(mean_x!=0) {                             
151         a_writer << " weightedMeanX=" << soutd    
152       }                                           
153       double mean_y = aObject.bin_mean_y(aInde    
154       if(mean_y!=0) {                             
155         a_writer << " weightedMeanY=" << soutd    
156       }                                           
157                                                   
158       double stddevX = aObject.bin_rms_x(aInde    
159       if(stddevX!=0) {                            
160         a_writer << " weightedRmsX=" << soutd(    
161       }                                           
162       double stddevY = aObject.bin_rms_y(aInde    
163       if(stddevY!=0) {                            
164         a_writer << " weightedRmsY=" << soutd(    
165       }                                           
166                                                   
167       a_writer << "/>" << std::endl;              
168     }                                             
169   }                                               
170                                                   
171   inline void write_bin(                          
172    std::ostream& a_writer                         
173   ,std::ostringstream& a_oss                      
174   ,const histo::h3d& aObject                      
175   ,const std::string& aSpaces                     
176   ,int aIndexX                                    
177   ,int aIndexY                                    
178   ,int aIndexZ                                    
179   ){                                              
180     unsigned int entries = aObject.bin_entries    
181     if(entries) {                                 
182       a_writer << aSpaces << "      <bin3d"       
183            << " binNumX=" << sout(bin_to_strin    
184            << " binNumY=" << sout(bin_to_strin    
185            << " binNumZ=" << sout(bin_to_strin    
186            << " entries=" << num_out<unsigned     
187            << " height=" << soutd(a_oss,aObjec    
188            << " error=" << soutd(a_oss,aObject    
189                                                   
190                                                   
191       double mean_x = aObject.bin_mean_x(aInde    
192       if(mean_x!=0) {                             
193         a_writer << " weightedMeanX=" << soutd    
194       }                                           
195       double mean_y = aObject.bin_mean_y(aInde    
196       if(mean_y!=0) {                             
197         a_writer << " weightedMeanY=" << soutd    
198       }                                           
199       double mean_z = aObject.bin_mean_z(aInde    
200       if(mean_y!=0) {                             
201         a_writer << " weightedMeanZ=" << soutd    
202       }                                           
203                                                   
204       double stddevX = aObject.bin_rms_x(aInde    
205       if(stddevX!=0) {                            
206         a_writer << " weightedRmsX=" << soutd(    
207       }                                           
208       double stddevY = aObject.bin_rms_y(aInde    
209       if(stddevY!=0) {                            
210         a_writer << " weightedRmsY=" << soutd(    
211       }                                           
212       double stddevZ = aObject.bin_rms_z(aInde    
213       if(stddevZ!=0) {                            
214         a_writer << " weightedRmsZ=" << soutd(    
215       }                                           
216                                                   
217       a_writer << "/>" << std::endl;              
218     }                                             
219   }                                               
220                                                   
221   inline void write_bin(                          
222    std::ostream& a_writer                         
223   ,std::ostringstream& a_oss                      
224   ,const histo::p1d& aObject                      
225   ,const std::string& aSpaces                     
226   ,int aIndex                                     
227   ){                                              
228     if(aObject.bin_entries(aIndex)) {             
229       a_writer << aSpaces << "      <bin1d"       
230            << " binNum=" << sout(bin_to_string    
231            << " entries=" << num_out<unsigned     
232            << " height=" << soutd(a_oss,aObjec    
233            << " error=" << soutd(a_oss,aObject    
234            << " weightedMean=" << soutd(a_oss,    
235                                                   
236       double stddev = aObject.bin_rms(aIndex);    
237       if(stddev!=0) {                             
238         a_writer << " weightedRms=" << soutd(a    
239       }                                           
240                                                   
241       a_writer << " rms=" << soutd(a_oss,aObje    
242       a_writer << "/>" << std::endl;              
243     }                                             
244   }                                               
245                                                   
246   inline void write_bin(                          
247    std::ostream& a_writer                         
248   ,std::ostringstream& a_oss                      
249   ,const histo::p2d& aObject                      
250   ,const std::string& aSpaces                     
251   ,int aIndexX                                    
252   ,int aIndexY                                    
253   ){                                              
254     if(aObject.bin_entries(aIndexX,aIndexY)) {    
255       a_writer << aSpaces << "      <bin2d"       
256            << " binNumX=" << sout(bin_to_strin    
257            << " binNumY=" << sout(bin_to_strin    
258            << " entries=" << num_out<unsigned     
259            << " height=" << soutd(a_oss,aObjec    
260            << " error=" << soutd(a_oss,aObject    
261            << " weightedMeanX=" << soutd(a_oss    
262            << " weightedMeanY=" << soutd(a_oss    
263                                                   
264       double stddevX = aObject.bin_rms_x(aInde    
265       if(stddevX!=0) {                            
266         a_writer << " weightedRmsX=" << soutd(    
267       }                                           
268       double stddevY = aObject.bin_rms_y(aInde    
269       if(stddevY!=0) {                            
270         a_writer << " weightedRmsY=" << soutd(    
271       }                                           
272                                                   
273       a_writer << " rms=" << soutd(a_oss,aObje    
274       a_writer << "/>" << std::endl;              
275     }                                             
276   }                                               
277                                                   
278   inline bool write(                              
279    std::ostream& a_writer                         
280   ,const histo::h1d& aObject                      
281   ,const std::string& aPath                       
282   ,const std::string& aName                       
283   ,int aShift = 0                                 
284   ){                                              
285     std::ostringstream ossd;                      
286     ossd.precision(25);                           
287                                                   
288     typedef histo::axis<double,unsigned int>::    
289                                                   
290     std::ostream& writer = a_writer;              
291                                                   
292     std::string spaces;                           
293     for(int i=0;i<aShift;i++) spaces += " ";      
294                                                   
295     // <histogram1d> :                            
296     writer << spaces << "  <histogram1d"          
297          << " path=" << sout(to_xml(aPath))       
298          << " name=" << sout(to_xml(aName))       
299          << " title=" << sout(to_xml(aObject.t    
300          << ">" << std::endl;                     
301                                                   
302     // <annotations> :                            
303     write_annotations(aObject.annotations(),wr    
304                                                   
305     // <axis> :                                   
306     write_axis(aObject.axis(),"x",writer,ossd,    
307                                                   
308     // <statistics> :                             
309     writer << spaces << "    <statistics"         
310            << " entries=" << num_out<unsigned     
311            << ">" << std::endl;                   
312     writer << spaces << "      <statistic"        
313          << " direction=" << sout("x")            
314          << " mean=" << soutd(ossd,aObject.mea    
315          << " rms=" << soutd(ossd,aObject.rms(    
316          << "/>" << std::endl;                    
317     writer << spaces << "    </statistics>" <<    
318                                                   
319     // bins :                                     
320     writer << spaces << "    <data1d>" << std:    
321                                                   
322     bn_t xbins = aObject.axis().bins();           
323     for(bn_t index=0;index<xbins;index++)         
324       write_bin(writer,ossd,aObject,spaces,ind    
325                                                   
326     write_bin(writer,ossd,aObject,spaces,histo    
327     write_bin(writer,ossd,aObject,spaces,histo    
328                                                   
329     writer << spaces << "    </data1d>" << std    
330     writer << spaces << "  </histogram1d>" <<     
331                                                   
332     return true;                                  
333   }                                               
334                                                   
335   inline bool write(                              
336    std::ostream& a_writer                         
337   ,const histo::h2d& aObject                      
338   ,const std::string& aPath                       
339   ,const std::string& aName                       
340   ,int aShift = 0                                 
341   ){                                              
342     std::ostringstream ossd;                      
343     ossd.precision(25);                           
344                                                   
345     typedef histo::axis<double,unsigned int>::    
346                                                   
347     std::ostream& writer = a_writer;              
348                                                   
349     std::string spaces;                           
350     for(int i=0;i<aShift;i++) spaces += " ";      
351                                                   
352     // <histogram2d> :                            
353     writer << spaces << "  <histogram2d"          
354          << " path=" << sout(to_xml(aPath))       
355          << " name=" << sout(to_xml(aName))       
356          << " title=" << sout(to_xml(aObject.t    
357          << ">" << std::endl;                     
358                                                   
359     // <annotations> :                            
360     write_annotations(aObject.annotations(),wr    
361                                                   
362     // <axis> :                                   
363     write_axis(aObject.axis_x(),"x",writer,oss    
364     write_axis(aObject.axis_y(),"y",writer,oss    
365                                                   
366     // <statistics> :                             
367     writer << spaces << "    <statistics"         
368          << " entries=" << num_out<unsigned in    
369          << ">" << std::endl;                     
370     writer << spaces << "      <statistic"        
371          << " direction=" << sout("x")            
372          << " mean=" << soutd(ossd,aObject.mea    
373          << " rms=" << soutd(ossd,aObject.rms_    
374          << "/>" << std::endl;                    
375     writer << spaces << "      <statistic"        
376          << " direction=" << sout("y")            
377          << " mean=" << soutd(ossd,aObject.mea    
378          << " rms=" << soutd(ossd,aObject.rms_    
379          << "/>" << std::endl;                    
380     writer << spaces << "    </statistics>" <<    
381                                                   
382     // bins :                                     
383     writer << spaces << "    <data2d>" << std:    
384                                                   
385     bn_t xbins = aObject.axis_x().bins();         
386     bn_t ybins = aObject.axis_y().bins();         
387     bn_t indexX,indexY;                           
388     for(indexX=0;indexX<xbins;indexX++) {         
389       for(indexY=0;indexY<ybins;indexY++) {       
390         write_bin(writer,ossd,aObject,spaces,i    
391       }                                           
392     }                                             
393                                                   
394     write_bin(writer,ossd,aObject,spaces,histo    
395     write_bin(writer,ossd,aObject,spaces,histo    
396     write_bin(writer,ossd,aObject,spaces,histo    
397     write_bin(writer,ossd,aObject,spaces,histo    
398                                                   
399     for(indexX=0;indexX<xbins;indexX++){          
400       write_bin(writer,ossd,aObject,spaces,ind    
401       write_bin(writer,ossd,aObject,spaces,ind    
402     }                                             
403                                                   
404     for(indexY=0;indexY<ybins;indexY++){          
405       write_bin(writer,ossd,aObject,spaces,his    
406       write_bin(writer,ossd,aObject,spaces,his    
407     }                                             
408                                                   
409     writer << spaces << "    </data2d>" << std    
410     writer << spaces << "  </histogram2d>" <<     
411                                                   
412     return true;                                  
413   }                                               
414                                                   
415   inline bool write(                              
416    std::ostream& a_writer                         
417   ,const histo::h3d& aObject                      
418   ,const std::string& aPath                       
419   ,const std::string& aName                       
420   ,int aShift = 0                                 
421   ){                                              
422     std::ostringstream ossd;                      
423     ossd.precision(25);                           
424                                                   
425     typedef histo::axis<double,unsigned int>::    
426     std::ostream& writer = a_writer;              
427                                                   
428     std::string spaces;                           
429     for(int i=0;i<aShift;i++) spaces += " ";      
430                                                   
431     // <histogram3d> :                            
432     writer << spaces << "  <histogram3d"          
433          << " path=" << sout(to_xml(aPath))       
434          << " name=" << sout(to_xml(aName))       
435          << " title=" << sout(to_xml(aObject.t    
436          << ">" << std::endl;                     
437                                                   
438     // <annotations> :                            
439     write_annotations(aObject.annotations(),wr    
440                                                   
441     // <axis> :                                   
442     write_axis(aObject.axis_x(),"x",writer,oss    
443     write_axis(aObject.axis_y(),"y",writer,oss    
444     write_axis(aObject.axis_z(),"z",writer,oss    
445                                                   
446     // <statistics> :                             
447     writer << spaces << "    <statistics"         
448          << " entries=" << num_out<unsigned in    
449          << ">" << std::endl;                     
450     writer << spaces << "      <statistic"        
451          << " direction=" << sout("x")            
452          << " mean=" << soutd(ossd,aObject.mea    
453          << " rms=" << soutd(ossd,aObject.rms_    
454          << "/>" << std::endl;                    
455     writer << spaces << "      <statistic"        
456          << " direction=" << sout("y")            
457          << " mean=" << soutd(ossd,aObject.mea    
458          << " rms=" << soutd(ossd,aObject.rms_    
459          << "/>" << std::endl;                    
460     writer << spaces << "      <statistic"        
461          << " direction=" << sout("z")            
462          << " mean=" << soutd(ossd,aObject.mea    
463          << " rms=" << soutd(ossd,aObject.rms_    
464          << "/>" << std::endl;                    
465     writer << spaces << "    </statistics>" <<    
466                                                   
467     // bins :                                     
468     writer << spaces << "    <data3d>" << std:    
469     bn_t xbins = aObject.axis_x().bins();         
470     bn_t ybins = aObject.axis_y().bins();         
471     bn_t zbins = aObject.axis_z().bins();         
472     bn_t indexX,indexY,indexZ;                    
473     for(indexX=0;indexX<xbins;indexX++) {         
474       for(indexY=0;indexY<ybins;indexY++) {       
475         for(indexZ=0;indexZ<zbins;indexZ++) {     
476           write_bin(writer,ossd,aObject,spaces    
477         }                                         
478       }                                           
479     }                                             
480                                                   
481     // Corners :                                  
482     write_bin(writer,ossd,aObject,spaces,         
483                       histo::axis_UNDERFLOW_BI    
484                       histo::axis_UNDERFLOW_BI    
485                       histo::axis_UNDERFLOW_BI    
486     write_bin(writer,ossd,aObject,spaces,         
487                       histo::axis_OVERFLOW_BIN    
488                       histo::axis_UNDERFLOW_BI    
489                       histo::axis_UNDERFLOW_BI    
490     write_bin(writer,ossd,aObject,spaces,         
491                       histo::axis_UNDERFLOW_BI    
492                       histo::axis_OVERFLOW_BIN    
493                       histo::axis_UNDERFLOW_BI    
494     write_bin(writer,ossd,aObject,spaces,         
495                       histo::axis_OVERFLOW_BIN    
496                       histo::axis_OVERFLOW_BIN    
497                       histo::axis_UNDERFLOW_BI    
498                                                   
499     write_bin(writer,ossd,aObject,spaces,         
500                       histo::axis_UNDERFLOW_BI    
501                       histo::axis_UNDERFLOW_BI    
502                       histo::axis_OVERFLOW_BIN    
503     write_bin(writer,ossd,aObject,spaces,         
504                       histo::axis_OVERFLOW_BIN    
505                       histo::axis_UNDERFLOW_BI    
506                       histo::axis_OVERFLOW_BIN    
507     write_bin(writer,ossd,aObject,spaces,         
508                       histo::axis_UNDERFLOW_BI    
509                       histo::axis_OVERFLOW_BIN    
510                       histo::axis_OVERFLOW_BIN    
511     write_bin(writer,ossd,aObject,spaces,         
512                       histo::axis_OVERFLOW_BIN    
513                       histo::axis_OVERFLOW_BIN    
514                       histo::axis_OVERFLOW_BIN    
515                                                   
516                                                   
517     // Edges :                                    
518     for(indexX=0;indexX<xbins;indexX++){          
519       write_bin(writer,ossd,aObject,spaces,       
520                         indexX,                   
521                         histo::axis_UNDERFLOW_    
522                         histo::axis_UNDERFLOW_    
523       write_bin(writer,ossd,aObject,spaces,       
524                         indexX,                   
525                         histo::axis_OVERFLOW_B    
526                         histo::axis_UNDERFLOW_    
527       write_bin(writer,ossd,aObject,spaces,       
528                         indexX,                   
529                         histo::axis_UNDERFLOW_    
530                         histo::axis_OVERFLOW_B    
531       write_bin(writer,ossd,aObject,spaces,       
532                         indexX,                   
533                         histo::axis_OVERFLOW_B    
534                         histo::axis_OVERFLOW_B    
535     }                                             
536                                                   
537     for(indexY=0;indexY<ybins;indexY++){          
538       write_bin(writer,ossd,aObject,spaces,       
539                         histo::axis_UNDERFLOW_    
540                         indexY,                   
541                         histo::axis_UNDERFLOW_    
542       write_bin(writer,ossd,aObject,spaces,       
543                         histo::axis_OVERFLOW_B    
544                         indexY,                   
545                         histo::axis_UNDERFLOW_    
546       write_bin(writer,ossd,aObject,spaces,       
547                         histo::axis_UNDERFLOW_    
548                         indexY,                   
549                         histo::axis_OVERFLOW_B    
550       write_bin(writer,ossd,aObject,spaces,       
551                         histo::axis_OVERFLOW_B    
552                         indexY,                   
553                         histo::axis_OVERFLOW_B    
554     }                                             
555                                                   
556     for(indexZ=0;indexZ<zbins;indexZ++){          
557       write_bin(writer,ossd,aObject,spaces,       
558                         histo::axis_UNDERFLOW_    
559                         histo::axis_UNDERFLOW_    
560                         indexZ);                  
561       write_bin(writer,ossd,aObject,spaces,       
562                         histo::axis_OVERFLOW_B    
563                         histo::axis_UNDERFLOW_    
564                         indexZ);                  
565       write_bin(writer,ossd,aObject,spaces,       
566                         histo::axis_UNDERFLOW_    
567                         histo::axis_OVERFLOW_B    
568                         indexZ);                  
569       write_bin(writer,ossd,aObject,spaces,       
570                         histo::axis_OVERFLOW_B    
571                         histo::axis_OVERFLOW_B    
572                         indexZ);                  
573     }                                             
574                                                   
575                                                   
576     // Faces :                                    
577     for(indexX=0;indexX<xbins;indexX++) {         
578       for(indexY=0;indexY<ybins;indexY++) {       
579         write_bin(writer,ossd,aObject,spaces,     
580                           indexX,indexY,histo:    
581         write_bin(writer,ossd,aObject,spaces,     
582                           indexX,indexY,histo:    
583       }                                           
584     }                                             
585     for(indexY=0;indexY<ybins;indexY++) {         
586       for(indexZ=0;indexZ<zbins;indexZ++) {       
587         write_bin(writer,ossd,aObject,spaces,     
588                           histo::axis_UNDERFLO    
589         write_bin(writer,ossd,aObject,spaces,     
590                           histo::axis_OVERFLOW    
591       }                                           
592     }                                             
593     for(indexX=0;indexX<xbins;indexX++) {         
594       for(indexZ=0;indexZ<zbins;indexZ++) {       
595         write_bin(writer,ossd,aObject,spaces,     
596                           indexX,histo::axis_U    
597         write_bin(writer,ossd,aObject,spaces,     
598                           indexX,histo::axis_O    
599       }                                           
600     }                                             
601                                                   
602     writer << spaces << "    </data3d>" << std    
603     writer << spaces << "  </histogram3d>" <<     
604                                                   
605     return true;                                  
606   }                                               
607                                                   
608   inline bool write(                              
609    std::ostream& a_writer                         
610   ,const histo::p1d& aObject                      
611   ,const std::string& aPath                       
612   ,const std::string& aName                       
613   ,int aShift = 0                                 
614   ){                                              
615     std::ostringstream ossd;                      
616     ossd.precision(25);                           
617                                                   
618     typedef histo::axis<double,unsigned int>::    
619     std::ostream& writer = a_writer;              
620                                                   
621     std::string spaces;                           
622     for(int i=0;i<aShift;i++) spaces += " ";      
623                                                   
624     // <profile1d> :                              
625     writer << spaces << "  <profile1d"            
626          << " path=" << sout(to_xml(aPath))       
627          << " name=" << sout(to_xml(aName))       
628          << " title=" << sout(to_xml(aObject.t    
629          << ">" << std::endl;                     
630                                                   
631     // <annotations> :                            
632     write_annotations(aObject.annotations(),wr    
633                                                   
634     // <axis> :                                   
635     write_axis(aObject.axis(),"x",writer,ossd,    
636                                                   
637     // <statistics> :                             
638     writer << spaces << "    <statistics"         
639      << " entries=" << num_out<unsigned int>(a    
640            << ">" << std::endl;                   
641     writer << spaces << "      <statistic"        
642          << " direction=" << sout("x")            
643          << " mean=" << soutd(ossd,aObject.mea    
644          << " rms=" << soutd(ossd,aObject.rms(    
645          << "/>" << std::endl;                    
646     writer << spaces << "    </statistics>" <<    
647                                                   
648     // bins :                                     
649     writer << spaces << "    <data1d>" << std:    
650     bn_t xbins = aObject.axis().bins();           
651     for(bn_t index=0;index<xbins;index++) {       
652       write_bin(writer,ossd,aObject,spaces,ind    
653     }                                             
654                                                   
655     write_bin(writer,ossd,aObject,spaces,histo    
656     write_bin(writer,ossd,aObject,spaces,histo    
657                                                   
658     writer << spaces << "    </data1d>" << std    
659     writer << spaces << "  </profile1d>" << st    
660                                                   
661     return true;                                  
662   }                                               
663                                                   
664   inline bool write(                              
665    std::ostream& a_writer                         
666   ,const histo::p2d& aObject                      
667   ,const std::string& aPath                       
668   ,const std::string& aName                       
669   ,int aShift = 0                                 
670   ){                                              
671     std::ostringstream ossd;                      
672     ossd.precision(25);                           
673                                                   
674     typedef histo::axis<double,unsigned int>::    
675     std::ostream& writer = a_writer;              
676                                                   
677     std::string spaces;                           
678     for(int i=0;i<aShift;i++) spaces += " ";      
679                                                   
680     // <profile2d> :                              
681     writer << spaces << "  <profile2d"            
682          << " path=" << sout(to_xml(aPath))       
683          << " name=" << sout(to_xml(aName))       
684          << " title=" << sout(to_xml(aObject.t    
685          << ">" << std::endl;                     
686                                                   
687     // <annotations> :                            
688     write_annotations(aObject.annotations(),wr    
689                                                   
690     // <axis> :                                   
691     write_axis(aObject.axis_x(),"x",writer,oss    
692     write_axis(aObject.axis_y(),"y",writer,oss    
693                                                   
694     // <statistics> :                             
695     writer << spaces << "    <statistics"         
696      << " entries=" << num_out<unsigned int>(a    
697            << ">" << std::endl;                   
698     writer << spaces << "      <statistic"        
699          << " direction=" << sout("x")            
700          << " mean=" << soutd(ossd,aObject.mea    
701          << " rms=" << soutd(ossd,aObject.rms_    
702          << "/>" << std::endl;                    
703     writer << spaces << "      <statistic"        
704          << " direction=" << sout("y")            
705          << " mean=" << soutd(ossd,aObject.mea    
706          << " rms=" << soutd(ossd,aObject.rms_    
707          << "/>" << std::endl;                    
708     writer << spaces << "    </statistics>" <<    
709                                                   
710     // bins :                                     
711     writer << spaces << "    <data2d>" << std:    
712    {bn_t xbins = aObject.axis_x().bins();         
713     bn_t ybins = aObject.axis_y().bins();         
714     for(bn_t indexX=0;indexX<xbins;indexX++) {    
715       for(bn_t indexY=0;indexY<ybins;indexY++)    
716         write_bin(writer,ossd,aObject,spaces,i    
717       }                                           
718     }}                                            
719                                                   
720     write_bin(writer,ossd,aObject,spaces,         
721                       histo::axis_UNDERFLOW_BI    
722     write_bin(writer,ossd,aObject,spaces,         
723                       histo::axis_OVERFLOW_BIN    
724     write_bin(writer,ossd,aObject,spaces,         
725                       histo::axis_UNDERFLOW_BI    
726     write_bin(writer,ossd,aObject,spaces,         
727                       histo::axis_OVERFLOW_BIN    
728                                                   
729     for(bn_t indexX=0;indexX<aObject.axis_x().    
730       write_bin(writer,ossd,aObject,spaces,ind    
731       write_bin(writer,ossd,aObject,spaces,ind    
732     }                                             
733                                                   
734     for(bn_t indexY=0;indexY<aObject.axis_y().    
735       write_bin(writer,ossd,aObject,spaces,his    
736       write_bin(writer,ossd,aObject,spaces,his    
737     }                                             
738                                                   
739     writer << spaces << "    </data2d>" << std    
740     writer << spaces << "  </profile2d>" << st    
741                                                   
742     return true;                                  
743   }                                               
744                                                   
745 }}                                                
746                                                   
747 #endif