g4tools  5.4.0
Classes | Typedefs | Functions
tools::waxml Namespace Reference

Classes

class  ntuple
 

Typedefs

typedef std::map< std::string, std::string > annotations_t
 

Functions

void begin (std::ostream &a_writer)
 
void end (std::ostream &a_writer)
 
std::string soutd (std::ostringstream &a_oss, double a_value)
 
std::string bin_to_string (std::ostringstream &a_oss, int a_index)
 
void write_annotations (const annotations_t &a_annotations, std::ostream &a_writer, int aShift)
 
void write_axis (const histo::axis< double, unsigned int > &aAxis, const std::string &aDirection, std::ostream &a_writer, std::ostringstream &a_oss, int aShift)
 
void write_bin (std::ostream &a_writer, std::ostringstream &a_oss, const histo::h1d &aObject, const std::string &aSpaces, int aIndex)
 
void write_bin (std::ostream &a_writer, std::ostringstream &a_oss, const histo::h2d &aObject, const std::string &aSpaces, int aIndexX, int aIndexY)
 
void write_bin (std::ostream &a_writer, std::ostringstream &a_oss, const histo::h3d &aObject, const std::string &aSpaces, int aIndexX, int aIndexY, int aIndexZ)
 
void write_bin (std::ostream &a_writer, std::ostringstream &a_oss, const histo::p1d &aObject, const std::string &aSpaces, int aIndex)
 
void write_bin (std::ostream &a_writer, std::ostringstream &a_oss, const histo::p2d &aObject, const std::string &aSpaces, int aIndexX, int aIndexY)
 
bool write (std::ostream &a_writer, const histo::h1d &aObject, const std::string &aPath, const std::string &aName, int aShift=0)
 
bool write (std::ostream &a_writer, const histo::h2d &aObject, const std::string &aPath, const std::string &aName, int aShift=0)
 
bool write (std::ostream &a_writer, const histo::h3d &aObject, const std::string &aPath, const std::string &aName, int aShift=0)
 
bool write (std::ostream &a_writer, const histo::p1d &aObject, const std::string &aPath, const std::string &aName, int aShift=0)
 
bool write (std::ostream &a_writer, const histo::p2d &aObject, const std::string &aPath, const std::string &aName, int aShift=0)
 

Typedef Documentation

◆ annotations_t

typedef std::map<std::string,std::string> tools::waxml::annotations_t

Definition at line 43 of file histos.

Function Documentation

◆ begin()

void tools::waxml::begin ( std::ostream &  a_writer)
inline

Definition at line 15 of file begend.

15  {
16  // Header :
17  a_writer << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
18  a_writer << "<!DOCTYPE aida SYSTEM"
19  << " \"http://aida.freehep.org/schemas/3.2.1/aida.dtd\">"
20  << std::endl;
21 
22  std::string sAIDA_VERSION("3.2.1");
23 
24  a_writer << "<aida version=" << sout(sAIDA_VERSION) << ">"
25  << std::endl;
26  a_writer << " <implementation package=" << sout("tools")
27  << " version=" << sout(TOOLS_VERSION) << "/>"
28  << std::endl;
29  }

◆ bin_to_string()

std::string tools::waxml::bin_to_string ( std::ostringstream &  a_oss,
int  a_index 
)
inline

Definition at line 31 of file histos.

31  {
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  }

◆ end()

void tools::waxml::end ( std::ostream &  a_writer)
inline

Definition at line 31 of file begend.

31  {
32  a_writer << "</aida>" << std::endl;
33  }

◆ soutd()

std::string tools::waxml::soutd ( std::ostringstream &  a_oss,
double  a_value 
)
inline

Definition at line 22 of file histos.

22  {
23  a_oss.str("");
24  a_oss << a_value;
25  std::string s("\"");
26  s += a_oss.str();
27  s += "\"";
28  return s;
29  }

◆ write() [1/5]

bool tools::waxml::write ( std::ostream &  a_writer,
const histo::h1d aObject,
const std::string &  aPath,
const std::string &  aName,
int  aShift = 0 
)
inline

Definition at line 278 of file histos.

284  {
285  std::ostringstream ossd;
286  ossd.precision(25);
287 
288  typedef histo::axis<double,unsigned int>::bn_t bn_t;
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  }

◆ write() [2/5]

bool tools::waxml::write ( std::ostream &  a_writer,
const histo::h2d aObject,
const std::string &  aPath,
const std::string &  aName,
int  aShift = 0 
)
inline

Definition at line 335 of file histos.

341  {
342  std::ostringstream ossd;
343  ossd.precision(25);
344 
345  typedef histo::axis<double,unsigned int>::bn_t bn_t;
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  }

◆ write() [3/5]

bool tools::waxml::write ( std::ostream &  a_writer,
const histo::h3d aObject,
const std::string &  aPath,
const std::string &  aName,
int  aShift = 0 
)
inline

Definition at line 415 of file histos.

421  {
422  std::ostringstream ossd;
423  ossd.precision(25);
424 
425  typedef histo::axis<double,unsigned int>::bn_t bn_t;
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  }

◆ write() [4/5]

bool tools::waxml::write ( std::ostream &  a_writer,
const histo::p1d aObject,
const std::string &  aPath,
const std::string &  aName,
int  aShift = 0 
)
inline

Definition at line 608 of file histos.

614  {
615  std::ostringstream ossd;
616  ossd.precision(25);
617 
618  typedef histo::axis<double,unsigned int>::bn_t bn_t;
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  }

◆ write() [5/5]

bool tools::waxml::write ( std::ostream &  a_writer,
const histo::p2d aObject,
const std::string &  aPath,
const std::string &  aName,
int  aShift = 0 
)
inline

Definition at line 664 of file histos.

670  {
671  std::ostringstream ossd;
672  ossd.precision(25);
673 
674  typedef histo::axis<double,unsigned int>::bn_t bn_t;
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  }

◆ write_annotations()

void tools::waxml::write_annotations ( const annotations_t a_annotations,
std::ostream &  a_writer,
int  aShift 
)
inline

Definition at line 45 of file histos.

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  }

◆ write_axis()

void tools::waxml::write_axis ( const histo::axis< double, unsigned int > &  aAxis,
const std::string &  aDirection,
std::ostream &  a_writer,
std::ostringstream &  a_oss,
int  aShift 
)
inline

Definition at line 67 of file histos.

73  {
74  typedef histo::axis<double,unsigned int>::bn_t bn_t;
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  }

◆ write_bin() [1/5]

void tools::waxml::write_bin ( std::ostream &  a_writer,
std::ostringstream &  a_oss,
const histo::h1d aObject,
const std::string &  aSpaces,
int  aIndex 
)
inline

Definition at line 103 of file histos.

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  }

◆ write_bin() [2/5]

void tools::waxml::write_bin ( std::ostream &  a_writer,
std::ostringstream &  a_oss,
const histo::h2d aObject,
const std::string &  aSpaces,
int  aIndexX,
int  aIndexY 
)
inline

Definition at line 132 of file histos.

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  }

◆ write_bin() [3/5]

void tools::waxml::write_bin ( std::ostream &  a_writer,
std::ostringstream &  a_oss,
const histo::h3d aObject,
const std::string &  aSpaces,
int  aIndexX,
int  aIndexY,
int  aIndexZ 
)
inline

Definition at line 171 of file histos.

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  }

◆ write_bin() [4/5]

void tools::waxml::write_bin ( std::ostream &  a_writer,
std::ostringstream &  a_oss,
const histo::p1d aObject,
const std::string &  aSpaces,
int  aIndex 
)
inline

Definition at line 221 of file histos.

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  }

◆ write_bin() [5/5]

void tools::waxml::write_bin ( std::ostream &  a_writer,
std::ostringstream &  a_oss,
const histo::p2d aObject,
const std::string &  aSpaces,
int  aIndexX,
int  aIndexY 
)
inline

Definition at line 246 of file histos.

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  }
tools::histo::axis_UNDERFLOW_BIN
@ axis_UNDERFLOW_BIN
Definition: axis:13
tools::histo::axis_OVERFLOW_BIN
@ axis_OVERFLOW_BIN
Definition: axis:13
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::waxml::write_bin
void write_bin(std::ostream &a_writer, std::ostringstream &a_oss, const histo::p2d &aObject, const std::string &aSpaces, int aIndexX, int aIndexY)
Definition: histos:246
TOOLS_VERSION
#define TOOLS_VERSION
Definition: version:10
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::image::writer
bool(* writer)(FILE *, unsigned char *, unsigned int, unsigned int)
Definition: image:201
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