5 #define GAUDIKERNEL_STATENTITY_CPP 1
23 #include "boost/format.hpp"
24 #include "boost/static_assert.hpp"
25 #include "boost/algorithm/string/case_conv.hpp"
31 #pragma warning(disable:1572)
35 #pragma warning(disable:2259)
48 (
const unsigned long entries ,
51 const double minFlag ,
52 const double maxFlag )
53 : m_se_nEntries ( entries )
54 , m_se_accumulatedFlag ( flag )
55 , m_se_accumulatedFlag2 ( flag2 )
56 , m_se_minimalFlag ( minFlag )
57 , m_se_maximalFlag ( maxFlag )
58 , m_se_nEntriesBeforeReset ( -1 )
66 BOOST_STATIC_ASSERT(((
sizeof(
unsigned long)==4)||(
sizeof(
unsigned long)==8)));
68 BOOST_STATIC_ASSERT((
sizeof(
double)==8)) ;
71 ( ( 8 ==
sizeof(
unsigned long) ) ?
"X:1;" :
"L:1;" ) +
std::string(
"D:4") ;
79 static const int s_size =
sizeof(
unsigned long) + 4 *
sizeof(
double) ;
97 if ( 0 >=
nEntries() ) {
return 0 ; }
99 const long double f2 = f1 /
nEntries () ;
101 const long double f4 = f3 /
nEntries () ;
102 const long double result = f4 - f2 * f2 ;
103 return ( 0 > result ) ? 0 : ::sqrtl ( result ) ;
110 if ( 0 >=
nEntries () ) {
return 0 ; }
112 const long double f2 = f1 /
nEntries () ;
114 const long double f4 = f3 /
nEntries () ;
115 const long double result = f4 - f2 * f2 ;
116 if ( 0 > result ) {
return 0 ; }
118 return ::sqrtl ( result /
nEntries () ) ;
126 const long double fMin =
min () ;
127 if ( 0 != fMin && 1 != fMin ) {
return -1 ; }
128 const long double fMax =
max () ;
129 if ( 0 != fMax && 1 != fMax ) {
return -1 ; }
139 long double n1 =
sum () ;
141 if ( 0 == n1 ) { n1 = 1 ; }
142 const long double n3 =
nEntries () ;
143 long double n2 = n3 -
flag () ;
145 if ( 1 > fabsl( n2 ) ) { n2 = 1 ; }
147 return ::sqrtl( n1 * n2 / n3 ) / n3 ;
167 if ( &se ==
this ) {
return false ; }
170 sum () < se.
sum () ) {
return true ; }
173 min () < se.
min () ) {
return true ; }
177 max () < se.
max () ) {
return true ; }
182 sum2 () < se.
sum2 () ) {
return true ; }
201 if ( s_min1 < Flag || -s_min1 > Flag )
240 boost::format fmt2 (
" Mean=%|#10.4g| +- %|-#10.5g| Min/Max=%|#10.4g|/%|-#10.4g|" ) ;
248 {
StatEntity aux ( entity ) ;
return aux+=value ; }
253 {
return entity + value ; }
258 {
StatEntity aux ( entity ) ;
return aux-=value ; }
263 {
StatEntity aux ( entity ) ;
return aux+=value ; }
268 {
return entity.
print ( stream ) ; }
282 const std::string lower = boost::algorithm::to_lower_copy( name ) ;
307 using namespace boost::io ;
308 if ( flag && 0 <= counter.
eff() && 0 <= counter.
effErr() )
311 fmt.exceptions ( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) ) ;
315 % ( counter.
eff () * 100 )
316 % ( counter.
effErr () * 100 ) ;
320 fmt.exceptions ( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) ) ;
347 using namespace boost::io ;
348 if ( flag && effCounter ( name ) && 0 <= counter.
eff() && 0 <= counter.
effErr() )
351 fmt.exceptions ( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) ) ;
353 % (
"\"" + name +
"\"" )
356 % ( counter.
eff () * 100 )
357 % ( counter.
effErr () * 100 ) ;
361 fmt.exceptions ( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) ) ;
363 % (
"\"" + name +
"\"" )
391 using namespace boost::io ;
392 if ( flag && ( effCounter ( name ) || effCounter ( group ) )
393 && 0 <= counter.
eff() && 0 <= counter.
effErr() )
396 fmt.exceptions ( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) ) ;
398 % (
"\"" + name +
":" )
399 % (
":" + group +
"\"" )
402 % ( counter.
eff () * 100 )
403 % ( counter.
effErr () * 100 ) ;
407 fmt.exceptions ( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) ) ;
409 % (
"\"" + name +
":" )
410 % (
":" + group +
"\"" )