Go to the documentation of this file.
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 |";
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|";
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."
99 "| Title | # | Mean | RMS | Skewness | Kurtosis |";
102 const std::string s_histoFormatStatOnlyHeader =
"| # | Mean | RMS | Skewness | Kurtosis |";
106 "| # | Mean+-Error | RMS+-Error | Skewness+-Error | Kurtosis+-Error |";
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 =
"";
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/" );
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()
327 using namespace boost::io;
330 _fmt.exceptions( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) );
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 ) {}
static double nEff(const AIDA::IHistogram1D *histo)
get the effective entries (just for completeness)
static double rmsErr(const AIDA::IHistogram1D *histo)
get an error in the rms value
static double kurtosisErr(const AIDA::IHistogram1D *histo)
get the error in kurtosis for the histogram
static double underflowEntriesFracErr(const AIDA::IHistogram1D *histo)
the error on fraction of underflow entries (useful for shape comparison)
static double meanErr(const AIDA::IHistogram1D *histo)
get an error in the mean value
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
static double overflowEntriesFrac(const AIDA::IHistogram1D *histo)
the fraction of overflow entries (useful for shape comparison)
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
static double overflowIntegralFracErr(const AIDA::IHistogram1D *histo)
the error on fraction of overflow intergal
static double underflowIntegralFrac(const AIDA::IHistogram1D *histo)
the fraction of underflow integral (useful for shape comparison)
static double overflowEntriesFracErr(const AIDA::IHistogram1D *histo)
error on fraction of overflow entries (useful for shape comparison)
Table(const int ID=0)
constructor from enum
static double mean(const AIDA::IHistogram1D *histo)
get the mean value for the histogram (just for completeness)
static double rms(const AIDA::IHistogram1D *histo)
get the rms value for the histogram (just for completeness)
static double kurtosis(const AIDA::IHistogram1D *histo)
get the kurtosis for the histogram
static double sumBinHeightErr(const AIDA::IHistogram1D *histo)
get an error in the sum bin height ("in-range integral")
static double sumAllBinHeightErr(const AIDA::IHistogram1D *histo)
get an error in the sum of all bin height ("integral")
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
static double skewnessErr(const AIDA::IHistogram1D *histo)
get the error in skewness for the histogram
static double overflowIntegralFrac(const AIDA::IHistogram1D *histo)
the fraction of overflow intergal (useful for shape comparison)
static double skewness(const AIDA::IHistogram1D *histo)
get the skewness for the histogram
GAUDI_API std::string format(const AIDA::IHistogram1D *histo, const std::string &fmt)
Make the string representation of the histogram according to the specified format.
std::string toString(const AIDA::IHistogram1D *histo) const
make the string representation according to the default format
static double underflowIntegralFracErr(const AIDA::IHistogram1D *histo)
the error on fraction of underflow integral
static double underflowEntriesFrac(const AIDA::IHistogram1D *histo)
the fraction of underflow entries (useful for shape comparison)