22 #include <AIDA/IAxis.h>
23 #include <AIDA/IHistogram1D.h>
24 #include <AIDA/IProfile1D.h>
38 #include <boost/algorithm/string/erase.hpp>
39 #include <boost/format.hpp>
52 const std::string s_histoFormatStat =
"| %2$-45.45s | %3$=7d |%8$11.5g | %10$-11.5g|%12$11.5g |%14$11.5g |";
55 const std::string s_histoFormatStatOnly =
"| %3$=7d |%8$11.5g | %10$-11.5g|%12$11.5g |%14$11.5g |";
58 const std::string s_histoFormatStat1 =
59 "| %3$=7d |%8$9.3g+-%9$-9.3g|%10$9.3g+-%11$-9.3g|%12$9.3g+-%13$-9.3g|%14$9.3g+-%15$-9.3g|";
64 const std::string s_histoFormatShapeOnly =
"|%8$11.5g |%10$11.5g |%12$11.5g |%14$11.5g |%19$11.5g/%21$-11.5g|";
70 const std::string s_histoFormatShape =
"|%8$9.3g+-%9$-9.3g|%10$9.3g+-%11$-9.3g|%12$9.3g+-%13$-9.3g|%14$9.3g+-%15$-9."
71 "3g|%19$9.3g+-%20$-9.3g|%21$9.3g+-%22$-9.3g|";
74 const std::string s_histoFormatLineTitle =
75 " %2$-45.45s mean/sigma/skew/kurtosis = %8$10.4g/%10$10.4g/%12$10.4g/%14$10.4g";
78 const std::string s_histoFormatLineOnly =
" mean/sigma/skew/kurtosis = %8$10.4g/%10$10.4g/%12$10.4g/%14$10.4g";
81 const std::string s_histoFormatOld =
" %2$-45.45s Ents/All=%7$5s/%3$5s<X>/sX=%8$.5g/%10$-.5g";
84 const std::string s_histoFormatPathTitle =
"| %1$-45.45s | %2$-45.45s | ";
87 const std::string s_histoFormatFull =
"| %1$-45.45s | %2$-45.45s | %3$=7d |%4$5d/%5$-5d|%6$9.3g | "
88 "%7$-9.3g|%8$9.3g+-%9$-9.3g|%10$9.3g+-%11$-9.3g|%12$9.3g+-%13$-9.3g|%14$9.3g+-%"
91 const std::string s_histoFormatFullStat =
"| %3$=7d |%4$5d/%5$-5d|%6$9.3g | "
92 "%7$-9.3g|%8$9.3g+-%9$-9.3g|%10$9.3g+-%11$-9.3g|%12$9.3g+-%13$-9.3g|%14$9."
98 const std::string s_histoFormatStatHeader =
99 "| Title | # | Mean | RMS | Skewness | Kurtosis |";
102 const std::string s_histoFormatStatOnlyHeader =
"| # | Mean | RMS | Skewness | Kurtosis |";
105 const std::string s_histoFormatStat1Header =
106 "| # | Mean+-Error | RMS+-Error | Skewness+-Error | Kurtosis+-Error |";
109 const std::string s_histoFormatShapeOnlyHeader =
110 "| Mean | RMS | Skewness | Kurtosis | Underflow%/Overflow% |";
113 const std::string s_histoFormatShapeHeader =
"| Mean | RMS | Skewness | "
114 "Kurtosis | Underflow [%] | Overflow [%] |";
117 const std::string s_histoFormatLineTitleHeader =
" Title ";
120 const std::string s_histoFormatLineOnlyHeader =
"";
123 const std::string s_histoFormatOldHeader =
"";
126 const std::string s_histoFormatPathTitleHeader =
127 "| Path in Histogram Data Store | Title | ";
130 const std::string s_histoFormatFullHeader =
"| Path in Histogram Data Store | Title | "
131 "# |Udflw/Ovflw| nEff | Sum | Mean+-Error | "
132 "RMS+-Error | Skewness+-Error | Kurtosis+-Error |";
135 const std::string s_histoFormatFullStatHeader =
"| # |Udflw/Ovflw| nEff | Sum | Mean+-Error | "
136 " RMS+-Error | Skewness+-Error | Kurtosis+-Error |";
139 template <
typename HISTO>
140 decltype(
auto ) _title( const HISTO*
h ) {
144 auto htitle =
h->title();
145 boost::erase_all( htitle,
"|" );
156 return s_histoFormatOld;
158 return s_histoFormatFull;
160 return s_histoFormatFullStat;
162 return s_histoFormatStat;
164 return s_histoFormatStatOnly;
166 return s_histoFormatStat1;
168 return s_histoFormatShapeOnly;
170 return s_histoFormatShape;
172 return s_histoFormatLineTitle;
174 return s_histoFormatLineOnly;
176 return s_histoFormatPathTitle;
181 return s_histoFormatStat;
189 return s_histoFormatOldHeader;
191 return s_histoFormatFullHeader;
193 return s_histoFormatFullStatHeader;
195 return s_histoFormatStatHeader;
197 return s_histoFormatStat1Header;
199 return s_histoFormatStatOnlyHeader;
201 return s_histoFormatShapeOnlyHeader;
203 return s_histoFormatShapeHeader;
205 return s_histoFormatLineTitleHeader;
207 return s_histoFormatLineOnlyHeader;
209 return s_histoFormatPathTitleHeader;
213 return s_histoFormatStatHeader;
219 if ( !aida ) {
return ""; }
220 const auto object =
dynamic_cast<const DataObject*
>( aida );
221 if ( !
object ) {
return ""; }
222 const auto registry =
object->registry();
224 const auto _path =
registry->identifier();
225 const auto n = _path.find(
"/stat/" );
226 return ( 0 ==
n ? std::string( _path, 6 ) : _path );
234 if ( !histo ) {
return "<NULL>"; }
236 using namespace boost::io;
239 _fmt.exceptions( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) );
241 _fmt % (
"\"" +
path( histo ) +
"\"" )
242 % (
"\"" + _title( histo ) +
"\"" )
243 % histo->allEntries()
244 % histo->binEntries( AIDA::IAxis::UNDERFLOW_BIN )
245 % histo->binEntries( AIDA::IAxis::OVERFLOW_BIN )
247 % histo->sumBinHeights()
257 % histo->sumAllBinHeights()
280 if ( !histo ) {
return "<NULL>"; }
282 using namespace boost::io;
285 _fmt.exceptions( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) );
287 _fmt % (
"\"" +
path( histo ) +
"\"" )
288 % (
"\"" + _title( histo ) +
"\"" )
289 % histo->allEntries()
290 % histo->binEntries( AIDA::IAxis::UNDERFLOW_BIN )
291 % histo->binEntries( AIDA::IAxis::OVERFLOW_BIN )
293 % histo->sumBinHeights()
303 % histo->sumAllBinHeights()
326 const std::string& fmt1,
const std::string& fmt2 ) {
327 using namespace boost::io;
330 _fmt.exceptions( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) );
343 const std::string& fmt2 ) {
344 using namespace boost::io;
347 _fmt.exceptions( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) );
358 using namespace boost::io;
361 _fmt.exceptions( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) );
372 : m_header(
Gaudi::Utils::Histos::Formats::
header( ID ) )
374 , m_format(
Gaudi::Utils::Histos::Formats::
format( ID ) ) {}
377 : m_header(
header ), m_footer( footer ), m_format(
format ) {}
390 const std::string&
fmt )
const {
407 const std::string&
fmt )
const {