15 # pragma clang diagnostic push 16 # pragma clang diagnostic ignored "-Wkeyword-macro" 18 #define class class GAUDI_API 20 # pragma clang diagnostic pop 22 #include "AIDA/IAxis.h" 23 #include "AIDA/IHistogram1D.h" 24 #include "AIDA/IProfile1D.h" 39 #include "boost/algorithm/string/erase.hpp" 40 #include "boost/format.hpp" 53 const std::string s_histoFormatStat =
"| %2$-45.45s | %3$=7d |%8$11.5g | %10$-11.5g|%12$11.5g |%14$11.5g |";
56 const std::string s_histoFormatStatOnly =
"| %3$=7d |%8$11.5g | %10$-11.5g|%12$11.5g |%14$11.5g |";
60 "| %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|";
65 const std::string s_histoFormatShapeOnly =
"|%8$11.5g |%10$11.5g |%12$11.5g |%14$11.5g |%19$11.5g/%21$-11.5g|";
71 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." 72 "3g|%19$9.3g+-%20$-9.3g|%21$9.3g+-%22$-9.3g|";
76 " %2$-45.45s mean/sigma/skew/kurtosis = %8$10.4g/%10$10.4g/%12$10.4g/%14$10.4g";
79 const std::string s_histoFormatLineOnly =
" mean/sigma/skew/kurtosis = %8$10.4g/%10$10.4g/%12$10.4g/%14$10.4g";
82 const std::string s_histoFormatOld =
" %2$-45.45s Ents/All=%7$5s/%3$5s<X>/sX=%8$.5g/%10$-.5g";
85 const std::string s_histoFormatPathTitle =
"| %1$-45.45s | %2$-45.45s | ";
88 const std::string s_histoFormatFull =
"| %1$-45.45s | %2$-45.45s | %3$=7d |%4$5d/%5$-5d|%6$9.3g | " 89 "%7$-9.3g|%8$9.3g+-%9$-9.3g|%10$9.3g+-%11$-9.3g|%12$9.3g+-%13$-9.3g|%14$9.3g+-%" 92 const std::string s_histoFormatFullStat =
"| %3$=7d |%4$5d/%5$-5d|%6$9.3g | " 93 "%7$-9.3g|%8$9.3g+-%9$-9.3g|%10$9.3g+-%11$-9.3g|%12$9.3g+-%13$-9.3g|%14$9." 100 "| Title | # | Mean | RMS | Skewness | Kurtosis |";
103 const std::string s_histoFormatStatOnlyHeader =
"| # | Mean | RMS | Skewness | Kurtosis |";
107 "| # | Mean+-Error | RMS+-Error | Skewness+-Error | Kurtosis+-Error |";
111 "| Mean | RMS | Skewness | Kurtosis | Underflow%/Overflow% |";
114 const std::string s_histoFormatShapeHeader =
"| Mean | RMS | Skewness | " 115 "Kurtosis | Underflow [%] | Overflow [%] |";
118 const std::string s_histoFormatLineTitleHeader =
" Title ";
121 const std::string s_histoFormatLineOnlyHeader =
"";
128 "| Path in Histogram Data Store | Title | ";
131 const std::string s_histoFormatFullHeader =
"| Path in Histogram Data Store | Title | " 132 "# |Udflw/Ovflw| nEff | Sum | Mean+-Error | " 133 "RMS+-Error | Skewness+-Error | Kurtosis+-Error |";
136 const std::string s_histoFormatFullStatHeader =
"| # |Udflw/Ovflw| nEff | Sum | Mean+-Error | " 137 " RMS+-Error | Skewness+-Error | Kurtosis+-Error |";
140 template <
typename HISTO>
141 decltype(
auto ) _title(
const HISTO* h ) {
146 boost::erase_all(
htitle,
"|" );
157 return s_histoFormatOld;
159 return s_histoFormatFull;
161 return s_histoFormatFullStat;
163 return s_histoFormatStat;
165 return s_histoFormatStatOnly;
167 return s_histoFormatStat1;
169 return s_histoFormatShapeOnly;
171 return s_histoFormatShape;
173 return s_histoFormatLineTitle;
175 return s_histoFormatLineOnly;
177 return s_histoFormatPathTitle;
182 return s_histoFormatStat;
190 return s_histoFormatOldHeader;
192 return s_histoFormatFullHeader;
194 return s_histoFormatFullStatHeader;
196 return s_histoFormatStatHeader;
198 return s_histoFormatStat1Header;
200 return s_histoFormatStatOnlyHeader;
202 return s_histoFormatShapeOnlyHeader;
204 return s_histoFormatShapeHeader;
206 return s_histoFormatLineTitleHeader;
208 return s_histoFormatLineOnlyHeader;
210 return s_histoFormatPathTitleHeader;
214 return s_histoFormatStatHeader;
220 if ( !aida ) {
return ""; }
221 const auto object =
dynamic_cast<const DataObject*
>( aida );
222 if ( !
object ) {
return ""; }
223 const auto registry =
object->registry();
225 const auto _path =
registry->identifier();
226 const auto n = _path.find(
"/stat/" );
235 if ( !histo ) {
return "<NULL>"; }
237 using namespace boost::io;
240 _fmt.exceptions( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) );
242 _fmt % (
"\"" +
path( histo ) +
"\"" )
243 % (
"\"" + _title( histo ) +
"\"" )
244 % histo->allEntries()
245 % histo->binEntries( AIDA::IAxis::UNDERFLOW_BIN )
246 % histo->binEntries( AIDA::IAxis::OVERFLOW_BIN )
248 % histo->sumBinHeights()
258 % histo->sumAllBinHeights()
281 if ( !histo ) {
return "<NULL>"; }
283 using namespace boost::io;
286 _fmt.exceptions( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) );
288 _fmt % (
"\"" +
path( histo ) +
"\"" )
289 % (
"\"" + _title( histo ) +
"\"" )
290 % histo->allEntries()
291 % histo->binEntries( AIDA::IAxis::UNDERFLOW_BIN )
292 % histo->binEntries( AIDA::IAxis::OVERFLOW_BIN )
294 % histo->sumBinHeights()
304 % histo->sumAllBinHeights()
328 using namespace boost::io;
331 _fmt.exceptions( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) );
345 using namespace boost::io;
348 _fmt.exceptions( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) );
359 using namespace boost::io;
362 _fmt.exceptions( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) );
helper namespace to collect useful definitions, types, constants and functions, related to manipulati...
static double underflowIntegralFracErr(const AIDA::IHistogram1D *histo)
the error on fraction of underflow integral
static double overflowIntegralFracErr(const AIDA::IHistogram1D *histo)
the error on fraction of overflow intergal
GAUDI_API std::string htitle(const AIDA::IBaseHistogram *histo, const std::string &title="")
get the title
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
static double underflowEntriesFrac(const AIDA::IHistogram1D *histo)
the fraction of underflow entries (useful for shape comparison)
std::string m_header
the table header
static double rmsErr(const AIDA::IHistogram1D *histo)
get an error in the rms value
Table(const int ID=0)
constructor from enum
Small wrapper class for easy manipulation with generic counters and IStatSvc interface.
static double underflowIntegralFrac(const AIDA::IHistogram1D *histo)
the fraction of underflow integral (useful for shape comparison)
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.
static double meanErr(const AIDA::IHistogram1D *histo)
get an error in the mean value
static double overflowIntegralFrac(const AIDA::IHistogram1D *histo)
the fraction of overflow intergal (useful for shape comparison)
const std::string & header() const
the table header
static double rms(const AIDA::IHistogram1D *histo)
get the rms value for the histogram (just for completeness)
const std::string & format() const
the format
static double overflowEntriesFrac(const AIDA::IHistogram1D *histo)
the fraction of overflow entries (useful for shape comparison)
std::string m_footer
the table footer
static double sumBinHeightErr(const AIDA::IHistogram1D *histo)
get an error in the sum bin height ("in-range integral")
static double overflowEntriesFracErr(const AIDA::IHistogram1D *histo)
error on fraction of overflow entries (useful for shape comparison)
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
static double sumAllBinHeightErr(const AIDA::IHistogram1D *histo)
get an error in the sum of all bin height ("integral")
static double kurtosisErr(const AIDA::IHistogram1D *histo)
get the error in kurtosis for the histogram
static double mean(const AIDA::IHistogram1D *histo)
get the mean value for the histogram (just for completeness)
static double skewnessErr(const AIDA::IHistogram1D *histo)
get the error in skewness for the histogram
static double underflowEntriesFracErr(const AIDA::IHistogram1D *histo)
the error on fraction of underflow entries (useful for shape comparison)
static double kurtosis(const AIDA::IHistogram1D *histo)
get the kurtosis for the histogram
A DataObject is the base class of any identifiable object on any data store.
static double nEff(const AIDA::IHistogram1D *histo)
get the effective entries (just for completeness)
Helper functions to set/get the application return code.
std::string m_format
the defautl format
static double skewness(const AIDA::IHistogram1D *histo)
get the skewness for the histogram
std::string toString(const AIDA::IHistogram1D *histo) const
make the string representation according to the default format
const std::string & footer() const
the table footer