13 #include "GaudiKernel/Kernel.h"
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/IHistogram1D.h"
23 #include "AIDA/IAxis.h"
28 #include "GaudiKernel/DataObject.h"
29 #include "GaudiKernel/IRegistry.h"
33 #include "GaudiUtils/HistoStats.h"
34 #include "GaudiUtils/HistoTableFormat.h"
38 #include "boost/format.hpp"
52 const std::string s_histoFormatStat =
53 "| %2$-45.45s | %3$=7d |%8$11.5g | %10$-11.5g|%12$11.5g |%14$11.5g |" ;
56 const std::string s_histoFormatStatOnly =
57 "| %3$=7d |%8$11.5g | %10$-11.5g|%12$11.5g |%14$11.5g |" ;
60 const std::string s_histoFormatStat1 =
61 "| %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|" ;
66 const std::string s_histoFormatShapeOnly =
67 "|%8$11.5g |%10$11.5g |%12$11.5g |%14$11.5g |%19$11.5g/%21$-11.5g|" ;
73 const std::string s_histoFormatShape =
74 "|%8$9.3g+-%9$-9.3g|%10$9.3g+-%11$-9.3g|%12$9.3g+-%13$-9.3g|%14$9.3g+-%15$-9.3g|%19$9.3g+-%20$-9.3g|%21$9.3g+-%22$-9.3g|" ;
77 const std::string s_histoFormatLineTitle =
78 " %2$-45.45s mean/sigma/skew/kurtosis = %8$10.4g/%10$10.4g/%12$10.4g/%14$10.4g" ;
81 const std::string s_histoFormatLineOnly =
82 " mean/sigma/skew/kurtosis = %8$10.4g/%10$10.4g/%12$10.4g/%14$10.4g" ;
85 const std::string s_histoFormatOld =
86 " %2$-45.45s Ents/All=%7$5s/%3$5s<X>/sX=%8$.5g/%10$-.5g" ;
89 const std::string s_histoFormatPathTitle =
"| %1$-45.45s | %2$-45.45s | " ;
92 const std::string s_histoFormatFull =
93 "| %1$-45.45s | %2$-45.45s | %3$=7d |%4$5d/%5$-5d|%6$9.3g | %7$-9.3g|%8$9.3g+-%9$-9.3g|%10$9.3g+-%11$-9.3g|%12$9.3g+-%13$-9.3g|%14$9.3g+-%15$-9.3g|" ;
95 const std::string s_histoFormatFullStat =
96 "| %3$=7d |%4$5d/%5$-5d|%6$9.3g | %7$-9.3g|%8$9.3g+-%9$-9.3g|%10$9.3g+-%11$-9.3g|%12$9.3g+-%13$-9.3g|%14$9.3g+-%15$-9.3g|" ;
101 const std::string s_histoFormatStatHeader =
102 "| Title | # | Mean | RMS | Skewness | Kurtosis |" ;
105 const std::string s_histoFormatStatOnlyHeader =
106 "| # | Mean | RMS | Skewness | Kurtosis |" ;
109 const std::string s_histoFormatStat1Header =
110 "| # | Mean+-Error | RMS+-Error | Skewness+-Error | Kurtosis+-Error |" ;
113 const std::string s_histoFormatShapeOnlyHeader =
114 "| Mean | RMS | Skewness | Kurtosis | Underflow%/Overflow% |" ;
117 const std::string s_histoFormatShapeHeader =
118 "| Mean | RMS | Skewness | Kurtosis | Underflow [%] | Overflow [%] |" ;
121 const std::string s_histoFormatLineTitleHeader =
" Title " ;
124 const std::string s_histoFormatLineOnlyHeader =
"" ;
127 const std::string s_histoFormatOldHeader =
"" ;
130 const std::string s_histoFormatPathTitleHeader =
131 "| Path in Histogram Data Store | Title | ";
134 const std::string s_histoFormatFullHeader =
135 "| Path in Histogram Data Store | Title | # |Udflw/Ovflw| nEff | Sum | Mean+-Error | RMS+-Error | Skewness+-Error | Kurtosis+-Error |" ;
138 const std::string s_histoFormatFullStatHeader =
139 "| # |Udflw/Ovflw| nEff | Sum | Mean+-Error | RMS+-Error | Skewness+-Error | Kurtosis+-Error |" ;
149 case Old :
return s_histoFormatOld ;
150 case Full :
return s_histoFormatFull ;
151 case FullStat :
return s_histoFormatFullStat ;
152 case Stat :
return s_histoFormatStat ;
153 case StatOnly :
return s_histoFormatStatOnly ;
154 case Stat1 :
return s_histoFormatStat1 ;
155 case ShapeOnly :
return s_histoFormatShapeOnly ;
156 case Shape :
return s_histoFormatShape ;
157 case LineTitle :
return s_histoFormatLineTitle ;
158 case LineOnly :
return s_histoFormatLineOnly ;
159 case PathTitle :
return s_histoFormatPathTitle ;
163 return s_histoFormatStat ;
172 case Old :
return s_histoFormatOldHeader ;
173 case Full :
return s_histoFormatFullHeader ;
174 case FullStat :
return s_histoFormatFullStatHeader ;
175 case Stat :
return s_histoFormatStatHeader ;
176 case Stat1 :
return s_histoFormatStat1Header ;
177 case StatOnly :
return s_histoFormatStatOnlyHeader ;
178 case ShapeOnly :
return s_histoFormatShapeOnlyHeader ;
179 case Shape :
return s_histoFormatShapeHeader ;
180 case LineTitle :
return s_histoFormatLineTitleHeader ;
181 case LineOnly :
return s_histoFormatLineOnlyHeader ;
182 case PathTitle :
return s_histoFormatPathTitleHeader ;
186 return s_histoFormatStatHeader ;
193 if ( 0 == aida ) {
return "" ; }
195 if ( 0 ==
object ) {
return "" ; }
197 if ( 0 == registry ) {
return "" ; }
199 std::string::size_type
n = _path.find(
"/stat/") ;
200 if ( 0 == n ) {
return std::string(_path,6) ; }
209 (
const AIDA::IHistogram1D* histo ,
210 const std::string& fmt )
212 if ( 0 == histo ) {
return "<NULL>" ; }
214 using namespace boost::io ;
217 _fmt.exceptions ( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) ) ;
220 % (
"\"" +
path ( histo ) +
"\"" )
221 % (
"\"" + histo -> title () +
"\"" )
222 % histo -> allEntries ()
223 % histo -> binEntries ( AIDA::IAxis::UNDERFLOW_BIN )
224 % histo -> binEntries ( AIDA::IAxis::OVERFLOW_BIN )
225 % histo -> equivalentBinEntries ()
226 % histo -> sumBinHeights ()
236 % histo -> sumAllBinHeights ()
258 (
const AIDA::IHistogram1D* histo ,
259 const std::string& ID ,
260 const std::string& fmt1 ,
261 const std::string& fmt2 )
263 using namespace boost::io ;
266 _fmt.exceptions ( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) ) ;
270 %
format ( histo , fmt2 ) ;
278 (
const std::string& val1 ,
279 const std::string& val2 ,
280 const std::string& fmt )
282 using namespace boost::io ;
285 _fmt.exceptions ( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) ) ;
304 const std::string&
header ,
305 const std::string& footer )
306 : m_header ( header )
307 , m_footer ( footer )
308 , m_format ( format )
314 (
const AIDA::IHistogram1D* histo )
const
322 (
const AIDA::IHistogram1D* histo ,
323 const std::string& ID ,
324 const std::string& fmt )
const
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
static double underflowEntriesFrac(const AIDA::IHistogram1D *histo)
the fraction of underflow entries (useful for shape comparison)
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&ICounterSvc interface...
static double underflowIntegralFrac(const AIDA::IHistogram1D *histo)
the fraction of underflow integral (useful for shape comparison)
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)
GAUDI_API std::string format(const AIDA::IHistogram1D *histo, const std::string &fmt)
Make the string representation of the historgam according to the specified format.
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)
The IRegistry represents the entry door to the environment any data object residing in a transient da...
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)
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 skewnessErr(const AIDA::IHistogram1D *histo)
get the error in skewness for the histogram
virtual const id_type & identifier() const =0
Full identifier (or key)
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
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
A DataObject is the base class of any identifiable object on any data store.
Helper functions to set/get the application return code.
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