g4tools  5.4.0
histos
Go to the documentation of this file.
1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
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& a_oss,double a_value) {
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::ostringstream& a_oss,int a_index) {
32  if(a_index==histo::axis_UNDERFLOW_BIN) {
33  return "UNDERFLOW";
34  } else if(a_index==histo::axis_OVERFLOW_BIN) {
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> annotations_t;
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>" << std::endl;
56 
57  annotations_t::const_iterator it;
58  for(it=a_annotations.begin();it!=a_annotations.end();++it){
59  a_writer << spaces << " <item"
60  << " key=" << sout(to_xml((*it).first))
61  << " value=" << sout(to_xml((*it).second))
62  << "/>" << std::endl;
63  }
64  a_writer << spaces << " </annotation>" << std::endl;
65  }
66 
67  inline void write_axis(
69  ,const std::string& aDirection
70  ,std::ostream& a_writer
71  ,std::ostringstream& a_oss
72  ,int aShift
73  ){
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>(aAxis.bins())
83  << " min=" << soutd(a_oss,aAxis.lower_edge())
84  << " max=" << soutd(a_oss,aAxis.upper_edge())
85  << "/>" << std::endl;
86  } else {
87  a_writer << spaces << " <axis"
88  << " direction=" << sout(aDirection)
89  << " numberOfBins=" << num_out<bn_t>(aAxis.bins())
90  << " min=" << soutd(a_oss,aAxis.lower_edge())
91  << " max=" << soutd(a_oss,aAxis.upper_edge())
92  << ">" << std::endl;
93  bn_t number = aAxis.bins()-1;
94  for(bn_t index=0;index<number;index++) {
95  a_writer << spaces << " <binBorder"
96  << " value=" << soutd(a_oss,aAxis.bin_upper_edge(index))
97  << "/>" << std::endl;
98  }
99  a_writer << spaces << " </axis>" << std::endl;
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(aIndex);
111  if(entries) {
112  a_writer << aSpaces << " <bin1d"
113  << " binNum=" << sout(bin_to_string(a_oss,aIndex))
114  << " entries=" << num_out<unsigned int>(entries)
115  << " height=" << soutd(a_oss,aObject.bin_height(aIndex))
116  << " error=" << soutd(a_oss,aObject.bin_error(aIndex));
117 
118  double mean = aObject.bin_mean(aIndex);
119  if(mean!=0) {
120  a_writer << " weightedMean=" << soutd(a_oss,mean);
121  }
122 
123  double stddev = aObject.bin_rms(aIndex);
124  if(stddev!=0) {
125  a_writer << " weightedRms=" << soutd(a_oss,stddev);
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(aIndexX,aIndexY);
141  if(entries) {
142  a_writer << aSpaces << " <bin2d"
143  << " binNumX=" << sout(bin_to_string(a_oss,aIndexX))
144  << " binNumY=" << sout(bin_to_string(a_oss,aIndexY))
145  << " entries=" << num_out<unsigned int>(entries)
146  << " height=" << soutd(a_oss,aObject.bin_height(aIndexX,aIndexY))
147  << " error=" << soutd(a_oss,aObject.bin_error(aIndexX,aIndexY));
148 
149  double mean_x = aObject.bin_mean_x(aIndexX,aIndexY);
150  if(mean_x!=0) {
151  a_writer << " weightedMeanX=" << soutd(a_oss,mean_x);
152  }
153  double mean_y = aObject.bin_mean_y(aIndexX,aIndexY);
154  if(mean_y!=0) {
155  a_writer << " weightedMeanY=" << soutd(a_oss,mean_y);
156  }
157 
158  double stddevX = aObject.bin_rms_x(aIndexX,aIndexY);
159  if(stddevX!=0) {
160  a_writer << " weightedRmsX=" << soutd(a_oss,stddevX);
161  }
162  double stddevY = aObject.bin_rms_y(aIndexX,aIndexY);
163  if(stddevY!=0) {
164  a_writer << " weightedRmsY=" << soutd(a_oss,stddevY);
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(aIndexX,aIndexY,aIndexZ);
181  if(entries) {
182  a_writer << aSpaces << " <bin3d"
183  << " binNumX=" << sout(bin_to_string(a_oss,aIndexX))
184  << " binNumY=" << sout(bin_to_string(a_oss,aIndexY))
185  << " binNumZ=" << sout(bin_to_string(a_oss,aIndexZ))
186  << " entries=" << num_out<unsigned int>(entries)
187  << " height=" << soutd(a_oss,aObject.bin_height(aIndexX,aIndexY,aIndexZ))
188  << " error=" << soutd(a_oss,aObject.bin_error(aIndexX,aIndexY,aIndexZ));
189 
190 
191  double mean_x = aObject.bin_mean_x(aIndexX,aIndexY,aIndexZ);
192  if(mean_x!=0) {
193  a_writer << " weightedMeanX=" << soutd(a_oss,mean_x);
194  }
195  double mean_y = aObject.bin_mean_y(aIndexX,aIndexY,aIndexZ);
196  if(mean_y!=0) {
197  a_writer << " weightedMeanY=" << soutd(a_oss,mean_y);
198  }
199  double mean_z = aObject.bin_mean_z(aIndexX,aIndexY,aIndexZ);
200  if(mean_y!=0) {
201  a_writer << " weightedMeanZ=" << soutd(a_oss,mean_z);
202  }
203 
204  double stddevX = aObject.bin_rms_x(aIndexX,aIndexY,aIndexZ);
205  if(stddevX!=0) {
206  a_writer << " weightedRmsX=" << soutd(a_oss,stddevX);
207  }
208  double stddevY = aObject.bin_rms_y(aIndexX,aIndexY,aIndexZ);
209  if(stddevY!=0) {
210  a_writer << " weightedRmsY=" << soutd(a_oss,stddevY);
211  }
212  double stddevZ = aObject.bin_rms_z(aIndexX,aIndexY,aIndexZ);
213  if(stddevZ!=0) {
214  a_writer << " weightedRmsZ=" << soutd(a_oss,stddevZ);
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(a_oss,aIndex))
231  << " entries=" << num_out<unsigned int>(aObject.bin_entries(aIndex))
232  << " height=" << soutd(a_oss,aObject.bin_height(aIndex))
233  << " error=" << soutd(a_oss,aObject.bin_error(aIndex))
234  << " weightedMean=" << soutd(a_oss,aObject.bin_mean(aIndex));
235 
236  double stddev = aObject.bin_rms(aIndex);
237  if(stddev!=0) {
238  a_writer << " weightedRms=" << soutd(a_oss,stddev);
239  }
240 
241  a_writer << " rms=" << soutd(a_oss,aObject.bin_rms_value(aIndex));
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_string(a_oss,aIndexX))
257  << " binNumY=" << sout(bin_to_string(a_oss,aIndexY))
258  << " entries=" << num_out<unsigned int>(aObject.bin_entries(aIndexX,aIndexY))
259  << " height=" << soutd(a_oss,aObject.bin_height(aIndexX,aIndexY))
260  << " error=" << soutd(a_oss,aObject.bin_error(aIndexX,aIndexY))
261  << " weightedMeanX=" << soutd(a_oss,aObject.bin_mean_x(aIndexX,aIndexY))
262  << " weightedMeanY=" << soutd(a_oss,aObject.bin_mean_y(aIndexX,aIndexY));
263 
264  double stddevX = aObject.bin_rms_x(aIndexX,aIndexY);
265  if(stddevX!=0) {
266  a_writer << " weightedRmsX=" << soutd(a_oss,stddevX);
267  }
268  double stddevY = aObject.bin_rms_y(aIndexX,aIndexY);
269  if(stddevY!=0) {
270  a_writer << " weightedRmsY=" << soutd(a_oss,stddevY);
271  }
272 
273  a_writer << " rms=" << soutd(a_oss,aObject.bin_rms_value(aIndexX,aIndexY));
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 
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.title()))
300  << ">" << std::endl;
301 
302  // <annotations> :
303  write_annotations(aObject.annotations(),writer,aShift);
304 
305  // <axis> :
306  write_axis(aObject.axis(),"x",writer,ossd,aShift);
307 
308  // <statistics> :
309  writer << spaces << " <statistics"
310  << " entries=" << num_out<unsigned int>(aObject.entries())
311  << ">" << std::endl;
312  writer << spaces << " <statistic"
313  << " direction=" << sout("x")
314  << " mean=" << soutd(ossd,aObject.mean())
315  << " rms=" << soutd(ossd,aObject.rms())
316  << "/>" << std::endl;
317  writer << spaces << " </statistics>" << std::endl;
318 
319  // bins :
320  writer << spaces << " <data1d>" << std::endl;
321 
322  bn_t xbins = aObject.axis().bins();
323  for(bn_t index=0;index<xbins;index++)
324  write_bin(writer,ossd,aObject,spaces,index);
325 
326  write_bin(writer,ossd,aObject,spaces,histo::axis_UNDERFLOW_BIN);
327  write_bin(writer,ossd,aObject,spaces,histo::axis_OVERFLOW_BIN);
328 
329  writer << spaces << " </data1d>" << std::endl;
330  writer << spaces << " </histogram1d>" << std::endl;
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 
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.title()))
357  << ">" << std::endl;
358 
359  // <annotations> :
360  write_annotations(aObject.annotations(),writer,aShift);
361 
362  // <axis> :
363  write_axis(aObject.axis_x(),"x",writer,ossd,aShift);
364  write_axis(aObject.axis_y(),"y",writer,ossd,aShift);
365 
366  // <statistics> :
367  writer << spaces << " <statistics"
368  << " entries=" << num_out<unsigned int>(aObject.entries())
369  << ">" << std::endl;
370  writer << spaces << " <statistic"
371  << " direction=" << sout("x")
372  << " mean=" << soutd(ossd,aObject.mean_x())
373  << " rms=" << soutd(ossd,aObject.rms_x())
374  << "/>" << std::endl;
375  writer << spaces << " <statistic"
376  << " direction=" << sout("y")
377  << " mean=" << soutd(ossd,aObject.mean_y())
378  << " rms=" << soutd(ossd,aObject.rms_y())
379  << "/>" << std::endl;
380  writer << spaces << " </statistics>" << std::endl;
381 
382  // bins :
383  writer << spaces << " <data2d>" << std::endl;
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,indexX,indexY);
391  }
392  }
393 
398 
399  for(indexX=0;indexX<xbins;indexX++){
400  write_bin(writer,ossd,aObject,spaces,indexX,histo::axis_UNDERFLOW_BIN);
401  write_bin(writer,ossd,aObject,spaces,indexX,histo::axis_OVERFLOW_BIN);
402  }
403 
404  for(indexY=0;indexY<ybins;indexY++){
405  write_bin(writer,ossd,aObject,spaces,histo::axis_UNDERFLOW_BIN,indexY);
406  write_bin(writer,ossd,aObject,spaces,histo::axis_OVERFLOW_BIN,indexY);
407  }
408 
409  writer << spaces << " </data2d>" << std::endl;
410  writer << spaces << " </histogram2d>" << std::endl;
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 
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.title()))
436  << ">" << std::endl;
437 
438  // <annotations> :
439  write_annotations(aObject.annotations(),writer,aShift);
440 
441  // <axis> :
442  write_axis(aObject.axis_x(),"x",writer,ossd,aShift);
443  write_axis(aObject.axis_y(),"y",writer,ossd,aShift);
444  write_axis(aObject.axis_z(),"z",writer,ossd,aShift);
445 
446  // <statistics> :
447  writer << spaces << " <statistics"
448  << " entries=" << num_out<unsigned int>(aObject.entries())
449  << ">" << std::endl;
450  writer << spaces << " <statistic"
451  << " direction=" << sout("x")
452  << " mean=" << soutd(ossd,aObject.mean_x())
453  << " rms=" << soutd(ossd,aObject.rms_x())
454  << "/>" << std::endl;
455  writer << spaces << " <statistic"
456  << " direction=" << sout("y")
457  << " mean=" << soutd(ossd,aObject.mean_y())
458  << " rms=" << soutd(ossd,aObject.rms_y())
459  << "/>" << std::endl;
460  writer << spaces << " <statistic"
461  << " direction=" << sout("z")
462  << " mean=" << soutd(ossd,aObject.mean_z())
463  << " rms=" << soutd(ossd,aObject.rms_z())
464  << "/>" << std::endl;
465  writer << spaces << " </statistics>" << std::endl;
466 
467  // bins :
468  writer << spaces << " <data3d>" << std::endl;
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,indexX,indexY,indexZ);
477  }
478  }
479  }
480 
481  // Corners :
482  write_bin(writer,ossd,aObject,spaces,
486  write_bin(writer,ossd,aObject,spaces,
490  write_bin(writer,ossd,aObject,spaces,
494  write_bin(writer,ossd,aObject,spaces,
498 
499  write_bin(writer,ossd,aObject,spaces,
503  write_bin(writer,ossd,aObject,spaces,
507  write_bin(writer,ossd,aObject,spaces,
511  write_bin(writer,ossd,aObject,spaces,
515 
516 
517  // Edges :
518  for(indexX=0;indexX<xbins;indexX++){
519  write_bin(writer,ossd,aObject,spaces,
520  indexX,
523  write_bin(writer,ossd,aObject,spaces,
524  indexX,
527  write_bin(writer,ossd,aObject,spaces,
528  indexX,
531  write_bin(writer,ossd,aObject,spaces,
532  indexX,
535  }
536 
537  for(indexY=0;indexY<ybins;indexY++){
538  write_bin(writer,ossd,aObject,spaces,
540  indexY,
542  write_bin(writer,ossd,aObject,spaces,
544  indexY,
546  write_bin(writer,ossd,aObject,spaces,
548  indexY,
550  write_bin(writer,ossd,aObject,spaces,
552  indexY,
554  }
555 
556  for(indexZ=0;indexZ<zbins;indexZ++){
557  write_bin(writer,ossd,aObject,spaces,
560  indexZ);
561  write_bin(writer,ossd,aObject,spaces,
564  indexZ);
565  write_bin(writer,ossd,aObject,spaces,
568  indexZ);
569  write_bin(writer,ossd,aObject,spaces,
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::axis_UNDERFLOW_BIN);
581  write_bin(writer,ossd,aObject,spaces,
582  indexX,indexY,histo::axis_OVERFLOW_BIN);
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_UNDERFLOW_BIN,indexY,indexZ);
589  write_bin(writer,ossd,aObject,spaces,
590  histo::axis_OVERFLOW_BIN,indexY,indexZ);
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_UNDERFLOW_BIN,indexZ);
597  write_bin(writer,ossd,aObject,spaces,
598  indexX,histo::axis_OVERFLOW_BIN,indexZ);
599  }
600  }
601 
602  writer << spaces << " </data3d>" << std::endl;
603  writer << spaces << " </histogram3d>" << std::endl;
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 
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.title()))
629  << ">" << std::endl;
630 
631  // <annotations> :
632  write_annotations(aObject.annotations(),writer,aShift);
633 
634  // <axis> :
635  write_axis(aObject.axis(),"x",writer,ossd,aShift);
636 
637  // <statistics> :
638  writer << spaces << " <statistics"
639  << " entries=" << num_out<unsigned int>(aObject.entries())
640  << ">" << std::endl;
641  writer << spaces << " <statistic"
642  << " direction=" << sout("x")
643  << " mean=" << soutd(ossd,aObject.mean())
644  << " rms=" << soutd(ossd,aObject.rms())
645  << "/>" << std::endl;
646  writer << spaces << " </statistics>" << std::endl;
647 
648  // bins :
649  writer << spaces << " <data1d>" << std::endl;
650  bn_t xbins = aObject.axis().bins();
651  for(bn_t index=0;index<xbins;index++) {
652  write_bin(writer,ossd,aObject,spaces,index);
653  }
654 
655  write_bin(writer,ossd,aObject,spaces,histo::axis_UNDERFLOW_BIN);
656  write_bin(writer,ossd,aObject,spaces,histo::axis_OVERFLOW_BIN);
657 
658  writer << spaces << " </data1d>" << std::endl;
659  writer << spaces << " </profile1d>" << std::endl;
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 
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.title()))
685  << ">" << std::endl;
686 
687  // <annotations> :
688  write_annotations(aObject.annotations(),writer,aShift);
689 
690  // <axis> :
691  write_axis(aObject.axis_x(),"x",writer,ossd,aShift);
692  write_axis(aObject.axis_y(),"y",writer,ossd,aShift);
693 
694  // <statistics> :
695  writer << spaces << " <statistics"
696  << " entries=" << num_out<unsigned int>(aObject.entries())
697  << ">" << std::endl;
698  writer << spaces << " <statistic"
699  << " direction=" << sout("x")
700  << " mean=" << soutd(ossd,aObject.mean_x())
701  << " rms=" << soutd(ossd,aObject.rms_x())
702  << "/>" << std::endl;
703  writer << spaces << " <statistic"
704  << " direction=" << sout("y")
705  << " mean=" << soutd(ossd,aObject.mean_y())
706  << " rms=" << soutd(ossd,aObject.rms_y())
707  << "/>" << std::endl;
708  writer << spaces << " </statistics>" << std::endl;
709 
710  // bins :
711  writer << spaces << " <data2d>" << std::endl;
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,indexX,indexY);
717  }
718  }}
719 
720  write_bin(writer,ossd,aObject,spaces,
722  write_bin(writer,ossd,aObject,spaces,
724  write_bin(writer,ossd,aObject,spaces,
726  write_bin(writer,ossd,aObject,spaces,
728 
729  for(bn_t indexX=0;indexX<aObject.axis_x().bins();indexX++){
730  write_bin(writer,ossd,aObject,spaces,indexX,histo::axis_UNDERFLOW_BIN);
731  write_bin(writer,ossd,aObject,spaces,indexX,histo::axis_OVERFLOW_BIN);
732  }
733 
734  for(bn_t indexY=0;indexY<aObject.axis_y().bins();indexY++){
735  write_bin(writer,ossd,aObject,spaces,histo::axis_UNDERFLOW_BIN,indexY);
736  write_bin(writer,ossd,aObject,spaces,histo::axis_OVERFLOW_BIN,indexY);
737  }
738 
739  writer << spaces << " </data2d>" << std::endl;
740  writer << spaces << " </profile2d>" << std::endl;
741 
742  return true;
743  }
744 
745 }}
746 
747 #endif
tools::histo::p1d
Definition: p1d:12
tools::histo::b2::rms_x
TC rms_x() const
Definition: b2:37
tools::histo::h2::bin_error
virtual TH bin_error(int aI, int aJ) const
Definition: h2:24
tools::histo::b3::rms_x
TC rms_x() const
Definition: b3:52
tools::histo::h1d
Definition: h1d:14
tools::histo::axis_UNDERFLOW_BIN
@ axis_UNDERFLOW_BIN
Definition: axis:13
tools::histo::axis< double, unsigned int >
tools::histo::b2::bin_height
TH bin_height(int aI, int aJ) const
Definition: b2:95
tools::histo::b2::bin_rms_y
TC bin_rms_y(int aI, int aJ) const
Definition: b2:135
tools::histo::p2d
Definition: p2d:12
tools::histo::b3::bin_entries
TN bin_entries(int aI, int aJ, int aK) const
Definition: b3:71
tools::histo::b3::mean_x
TC mean_x() const
Definition: b3:37
tools::histo::b3::bin_mean_z
TC bin_mean_z(int aI, int aJ, int aK) const
Definition: b3:103
tools::histo::b2::mean_x
TC mean_x() const
Definition: b2:27
tools::histo::b3::bin_rms_y
TC bin_rms_y(int aI, int aJ, int aK) const
Definition: b3:122
tools::histo::axis::upper_edge
TC upper_edge() const
Definition: axis:27
tools::histo::h2d
Definition: h2d:12
tools::histo::b3::mean_z
TC mean_z() const
Definition: b3:47
tools::histo::b3::mean_y
TC mean_y() const
Definition: b3:42
tools::histo::b3::bin_rms_z
TC bin_rms_z(int aI, int aJ, int aK) const
Definition: b3:133
tools::histo::b2::mean_y
TC mean_y() const
Definition: b2:32
tools::histo::b3::rms_y
TC rms_y() const
Definition: b3:58
tools::histo::p2::bin_error
virtual TH bin_error(int aI, int aJ) const
Definition: p2:44
tools::histo::axis_OVERFLOW_BIN
@ axis_OVERFLOW_BIN
Definition: axis:13
tools::histo::p1::bin_error
virtual TH bin_error(int aI) const
Definition: p1:52
tools::histo::b3::axis_z
const axis_t & axis_z() const
Definition: b3:147
tools::histo::b1::bin_rms
TC bin_rms(int aI) const
Definition: b1:91
tools::waxml::bin_to_string
std::string bin_to_string(std::ostringstream &a_oss, int a_index)
Definition: histos:31
tools::to_xml
std::string to_xml(const std::string &a_string)
Definition: srep:68
tools::histo::p2::bin_rms_value
TV bin_rms_value(int aI, int aJ) const
Definition: p2:179
tools::histo::b3::bin_height
TH bin_height(int aI, int aJ, int aK) const
Definition: b3:77
tools::sout
Definition: sout:17
tools::waxml::write
bool write(std::ostream &a_writer, const histo::h1d &aObject, const std::string &aPath, const std::string &aName, int aShift=0)
Definition: histos:278
tools::histo::b1::axis
const axis_t & axis() const
Definition: b1:103
tools::histo::b3::axis_y
const axis_t & axis_y() const
Definition: b3:146
tools::histo::axis::bins
bn_t bins() const
Definition: axis:28
tools::histo::b3::bin_rms_x
TC bin_rms_x(int aI, int aJ, int aK) const
Definition: b3:111
tools::histo::axis::is_fixed_binning
bool is_fixed_binning() const
Definition: axis:25
tools::histo::h1::bin_error
virtual TH bin_error(int aI) const
Definition: h1:30
tools::histo::b1::rms
TC rms() const
Definition: b1:37
tools::histo::axis::bin_upper_edge
TC bin_upper_edge(int a_bin) const
Definition: axis:63
tools::histo::b2::axis_y
const axis_t & axis_y() const
Definition: b2:148
tools::histo::base_histo::annotations
const annotations_t & annotations() const
Definition: base_histo:443
tools::histo::b1::bin_height
TH bin_height(int aI) const
Definition: b1:75
tools::num_out
Definition: num2s:119
tools::waxml::annotations_t
std::map< std::string, std::string > annotations_t
Definition: histos:43
tools::histo::base_histo::title
const std::string & title() const
Definition: base_histo:87
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
tools::histo::axis::bn_t
unsigned int bn_t
Definition: axis:21
tools::histo::b2::bin_entries
TN bin_entries(int aI, int aJ) const
Definition: b2:57
tools::histo::b2::bin_mean_y
TC bin_mean_y(int aI, int aJ) const
Definition: b2:116
tools::histo::b1::bin_mean
TC bin_mean(int aI) const
Definition: b1:83
tools::histo::b3::rms_z
TC rms_z() const
Definition: b3:64
tools::waxml::write_axis
void write_axis(const histo::axis< double, unsigned int > &aAxis, const std::string &aDirection, std::ostream &a_writer, std::ostringstream &a_oss, int aShift)
Definition: histos:67
tools::histo::b3::bin_mean_x
TC bin_mean_x(int aI, int aJ, int aK) const
Definition: b3:87
tools::histo::h3d
Definition: h3d:12
tools::histo::b3::axis_x
const axis_t & axis_x() const
Definition: b3:145
tools::histo::p1::bin_rms_value
TV bin_rms_value(int aI) const
Definition: p1:242
tools::histo::b3::bin_mean_y
TC bin_mean_y(int aI, int aJ, int aK) const
Definition: b3:95
tools::image::writer
bool(* writer)(FILE *, unsigned char *, unsigned int, unsigned int)
Definition: image:201
tools::histo::b2::bin_mean_x
TC bin_mean_x(int aI, int aJ) const
Definition: b2:108
tools::waxml::soutd
std::string soutd(std::ostringstream &a_oss, double a_value)
Definition: histos:22
tools::waxml::write_annotations
void write_annotations(const annotations_t &a_annotations, std::ostream &a_writer, int aShift)
Definition: histos:45
tools::histo::base_histo::entries
TN entries() const
Definition: base_histo:92
tools::histo::b1::mean
TC mean() const
Definition: b1:30
tools::histo::h3::bin_error
virtual TH bin_error(int aI, int aJ, int aK) const
Definition: h3:24
tools::histo::axis::lower_edge
TC lower_edge() const
Definition: axis:26
tools::histo::b2::axis_x
const axis_t & axis_x() const
Definition: b2:147
tools::histo::b2::bin_rms_x
TC bin_rms_x(int aI, int aJ) const
Definition: b2:124
tools::histo::b1::bin_entries
TN bin_entries(int aI) const
Definition: b1:47
tools::histo::b2::rms_y
TC rms_y() const
Definition: b2:43
tools::waxml::write_bin
void write_bin(std::ostream &a_writer, std::ostringstream &a_oss, const histo::h1d &aObject, const std::string &aSpaces, int aIndex)
Definition: histos:103