13 #include "GaudiKernel/Kernel.h"
14 #define class class GAUDI_API
15 #include "AIDA/IHistogram1D.h"
16 #include "AIDA/IAxis.h"
21 #include "GaudiKernel/DataObject.h"
22 #include "GaudiKernel/IRegistry.h"
26 #include "GaudiUtils/HistoStats.h"
27 #include "GaudiUtils/HistoTableFormat.h"
31 #include "boost/format.hpp"
45 const std::string s_histoFormatStat =
46 "| %2$-45.45s | %3$=7d |%8$11.5g | %10$-11.5g|%12$11.5g |%14$11.5g |" ;
49 const std::string s_histoFormatStatOnly =
50 "| %3$=7d |%8$11.5g | %10$-11.5g|%12$11.5g |%14$11.5g |" ;
53 const std::string s_histoFormatStat1 =
54 "| %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|" ;
59 const std::string s_histoFormatShapeOnly =
60 "|%8$11.5g |%10$11.5g |%12$11.5g |%14$11.5g |%19$11.5g/%21$-11.5g|" ;
66 const std::string s_histoFormatShape =
67 "|%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|" ;
70 const std::string s_histoFormatLineTitle =
71 " %2$-45.45s mean/sigma/skew/kurtosis = %8$10.4g/%10$10.4g/%12$10.4g/%14$10.4g" ;
74 const std::string s_histoFormatLineOnly =
75 " mean/sigma/skew/kurtosis = %8$10.4g/%10$10.4g/%12$10.4g/%14$10.4g" ;
78 const std::string s_histoFormatOld =
79 " %2$-45.45s Ents/All=%7$5s/%3$5s<X>/sX=%8$.5g/%10$-.5g" ;
82 const std::string s_histoFormatPathTitle =
"| %1$-45.45s | %2$-45.45s | " ;
85 const std::string s_histoFormatFull =
86 "| %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|" ;
88 const std::string s_histoFormatFullStat =
89 "| %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|" ;
94 const std::string s_histoFormatStatHeader =
95 "| Title | # | Mean | RMS | Skewness | Kurtosis |" ;
98 const std::string s_histoFormatStatOnlyHeader =
99 "| # | Mean | RMS | Skewness | Kurtosis |" ;
102 const std::string s_histoFormatStat1Header =
103 "| # | Mean+-Error | RMS+-Error | Skewness+-Error | Kurtosis+-Error |" ;
106 const std::string s_histoFormatShapeOnlyHeader =
107 "| Mean | RMS | Skewness | Kurtosis | Underflow%/Overflow% |" ;
110 const std::string s_histoFormatShapeHeader =
111 "| Mean | RMS | Skewness | Kurtosis | Underflow [%] | Overflow [%] |" ;
114 const std::string s_histoFormatLineTitleHeader =
" Title " ;
117 const std::string s_histoFormatLineOnlyHeader =
"" ;
120 const std::string s_histoFormatOldHeader =
"" ;
123 const std::string s_histoFormatPathTitleHeader =
124 "| Path in Histogram Data Store | Title | ";
127 const std::string s_histoFormatFullHeader =
128 "| Path in Histogram Data Store | Title | # |Udflw/Ovflw| nEff | Sum | Mean+-Error | RMS+-Error | Skewness+-Error | Kurtosis+-Error |" ;
131 const std::string s_histoFormatFullStatHeader =
132 "| # |Udflw/Ovflw| nEff | Sum | Mean+-Error | RMS+-Error | Skewness+-Error | Kurtosis+-Error |" ;
142 case Old :
return s_histoFormatOld ;
143 case Full :
return s_histoFormatFull ;
144 case FullStat :
return s_histoFormatFullStat ;
145 case Stat :
return s_histoFormatStat ;
146 case StatOnly :
return s_histoFormatStatOnly ;
147 case Stat1 :
return s_histoFormatStat1 ;
148 case ShapeOnly :
return s_histoFormatShapeOnly ;
149 case Shape :
return s_histoFormatShape ;
150 case LineTitle :
return s_histoFormatLineTitle ;
151 case LineOnly :
return s_histoFormatLineOnly ;
152 case PathTitle :
return s_histoFormatPathTitle ;
156 return s_histoFormatStat ;
165 case Old :
return s_histoFormatOldHeader ;
166 case Full :
return s_histoFormatFullHeader ;
167 case FullStat :
return s_histoFormatFullStatHeader ;
168 case Stat :
return s_histoFormatStatHeader ;
169 case Stat1 :
return s_histoFormatStat1Header ;
170 case StatOnly :
return s_histoFormatStatOnlyHeader ;
171 case ShapeOnly :
return s_histoFormatShapeOnlyHeader ;
172 case Shape :
return s_histoFormatShapeHeader ;
173 case LineTitle :
return s_histoFormatLineTitleHeader ;
174 case LineOnly :
return s_histoFormatLineOnlyHeader ;
175 case PathTitle :
return s_histoFormatPathTitleHeader ;
179 return s_histoFormatStatHeader ;
186 if ( 0 == aida ) {
return "" ; }
188 if ( 0 ==
object ) {
return "" ; }
190 if ( 0 == registry ) {
return "" ; }
192 std::string::size_type
n = _path.find(
"/stat/") ;
193 if ( 0 == n ) {
return std::string(_path,6) ; }
202 (
const AIDA::IHistogram1D* histo ,
203 const std::string& fmt )
205 if ( 0 == histo ) {
return "<NULL>" ; }
207 using namespace boost::io ;
210 _fmt.exceptions ( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) ) ;
213 % (
"\"" +
path ( histo ) +
"\"" )
214 % (
"\"" + histo -> title () +
"\"" )
215 % histo -> allEntries ()
216 % histo -> binEntries ( AIDA::IAxis::UNDERFLOW_BIN )
217 % histo -> binEntries ( AIDA::IAxis::OVERFLOW_BIN )
218 % histo -> equivalentBinEntries ()
219 % histo -> sumBinHeights ()
229 % histo -> sumAllBinHeights ()
251 (
const AIDA::IHistogram1D* histo ,
252 const std::string& ID ,
253 const std::string& fmt1 ,
254 const std::string& fmt2 )
256 using namespace boost::io ;
259 _fmt.exceptions ( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) ) ;
263 %
format ( histo , fmt2 ) ;
271 (
const std::string& val1 ,
272 const std::string& val2 ,
273 const std::string& fmt )
275 using namespace boost::io ;
278 _fmt.exceptions ( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) ) ;
297 const std::string&
header ,
298 const std::string& footer )
299 : m_header ( header )
300 , m_footer ( footer )
301 , m_format ( format )
307 (
const AIDA::IHistogram1D* histo )
const
315 (
const AIDA::IHistogram1D* histo ,
316 const std::string& ID ,
317 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.
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.
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
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