Gaudi Framework, version v23r6
Home
Generated: Wed Jan 30 2013
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
GaudiKernel
GaudiKernel
StatEntity.h
Go to the documentation of this file.
1
// $Id: StatEntity.h,v 1.7 2007/08/06 08:39:40 marcocle Exp $
2
// ============================================================================
3
// CVS tag $Name: $, version $Revision: 1.7 $
4
// ============================================================================
5
#ifndef GAUDIKERNEL_STATENTITY_H
6
#define GAUDIKERNEL_STATENTITY_H 1
7
// ============================================================================
8
// Include files
9
// ============================================================================
10
// STD & STL
11
// ============================================================================
12
#include <
string
>
13
#include <
iostream
>
14
// ============================================================================
15
// Gaudi
16
// ============================================================================
17
#include "
GaudiKernel/Kernel.h
"
18
// ============================================================================
68
class
GAUDI_API
StatEntity
69
{
70
public
:
71
// ==========================================================================
73
StatEntity
() { reset() ; }
74
/* The full constructor from all important values:
75
* @attention it need to be coherent with
76
* the actual structure of the class
77
* and the format description
78
* @see StatEntity::format
79
* @param entries number of entries
80
* @param flag accumulated flag
81
* @param flag2 accumulated statistics: flag**2
82
* @param minFlag the minimum value for flag
83
* @param maxFlag the maximum value for flag
84
*/
85
StatEntity
(
const
unsigned
long
entries ,
86
const
double
flag ,
87
const
double
flag2 ,
88
const
double
minFlag ,
89
const
double
maxFlag ) ;
91
~StatEntity
() {}
92
// ==========================================================================
93
public
:
// the basic quantities
94
// ==========================================================================
96
const
unsigned
long
&
nEntries
()
const
{
return
m_se_nEntries ; }
98
const
double
&
sum
()
const
{
return
m_se_accumulatedFlag ; }
100
const
double
&
sum2
()
const
{
return
m_se_accumulatedFlag2 ; }
102
double
mean ()
const
;
104
double
rms ()
const
;
106
double
meanErr ()
const
;
108
const
double
&
min
()
const
{
return
m_se_minimalFlag ; }
110
const
double
&
max
()
const
{
return
m_se_maximalFlag ; }
111
// ==========================================================================
112
public
:
113
// ==========================================================================
146
double
efficiency ()
const
;
183
double
efficiencyErr ()
const
;
185
double
eff
()
const
{
return
efficiency () ; }
187
double
effErr
()
const
{
return
efficiencyErr () ; }
188
// ==========================================================================
189
public
:
// operators
190
// ==========================================================================
210
StatEntity
& operator+= (
const
double
f )
211
{
212
addFlag ( f ) ;
213
return
*this ;
214
}
232
StatEntity
& operator++ () {
return
(*
this
)+= 1 ; }
251
StatEntity
& operator++ (
int
) {
return
++(*this) ; }
271
StatEntity
& operator-= (
const
double
f )
272
{
273
addFlag ( -f ) ;
274
return
*this ;
275
}
293
StatEntity
& operator-- () {
return
(*
this
)-=1 ; }
311
StatEntity
& operator-- (
int
) {
return
--(*this) ; }
329
StatEntity
& operator= (
const
double
f )
330
{
331
// reset the statistics
332
reset() ;
333
// use the regular increment
334
return
((*
this
)+=f);
335
}
351
StatEntity
& operator+= (
const
StatEntity
& other ) ;
352
// ==========================================================================
353
public
:
354
// ==========================================================================
356
bool
operator<
(
const
StatEntity
& se )
const
;
361
unsigned
long
add
(
const
double
Flag ) ;
363
void
reset () ;
365
void
setnEntriesBeforeReset (
unsigned
long
nEntriesBeforeReset );
367
std::string
toString
()
const
;
371
std::ostream
& print (
std::ostream
& o =
std::cout
)
const
;
375
std::ostream
&
fillStream
(
std::ostream
& o )
const
{
return
print ( o ) ; }
376
// ==========================================================================
377
public
:
// aliases (a'la ROOT)
378
// ==========================================================================
380
inline
double
Sum
()
const
{
return
sum
() ; }
// get sum
382
inline
double
Mean
()
const
{
return
mean () ; }
// get mean
384
inline
double
MeanErr
()
const
{
return
meanErr () ; }
// get error in mean
386
inline
double
Rms
()
const
{
return
rms () ; }
// get rms
388
inline
double
RMS
()
const
{
return
rms () ; }
// get rms
390
inline
double
Eff
()
const
{
return
eff () ; }
// get efficiency
392
inline
double
Min
()
const
{
return
min
() ; }
// get minimal value
394
inline
double
Max
()
const
{
return
max
() ; }
// get maximal value
395
// ==========================================================================
396
public
:
// some legacy methods, to be removed ...
397
// ==========================================================================
399
inline
double
flag
()
const
{
return
sum
() ; }
401
inline
double
flag2
()
const
{
return
sum2 () ; }
403
inline
double
flagMean
()
const
{
return
mean () ; }
405
inline
double
flagRMS
()
const
{
return
rms () ; }
407
inline
double
flagMeanErr
()
const
{
return
meanErr () ; }
409
inline
double
flagMin
()
const
{
return
min
() ; }
411
inline
double
flagMax
()
const
{
return
max
() ; }
416
inline
unsigned
long
addFlag
(
const
double
Flag ) {
return
add
( Flag ) ; }
417
// ==========================================================================
418
public
:
419
// ==========================================================================
426
static
const
std::string
&
format
() ;
433
static
int
size () ;
434
// ==========================================================================
435
private
:
436
// ==========================================================================
438
unsigned
long
m_se_nEntries
;
440
double
m_se_accumulatedFlag
;
441
double
m_se_accumulatedFlag2
;
442
double
m_se_minimalFlag
;
443
double
m_se_maximalFlag
;
444
// DR number of calls before reset
445
long
m_se_nEntriesBeforeReset
;
446
// ==========================================================================
447
};
448
// ============================================================================
450
GAUDI_API
StatEntity
operator+
(
const
StatEntity
& entity ,
const
double
value ) ;
452
GAUDI_API
StatEntity
operator+
(
const
double
value ,
const
StatEntity
& entity ) ;
454
GAUDI_API
StatEntity
operator+
(
const
StatEntity
& entity ,
const
StatEntity
& value ) ;
456
GAUDI_API
StatEntity
operator-
(
const
StatEntity
& entity ,
const
double
value ) ;
458
GAUDI_API
std::ostream
&
operator<<
(
std::ostream
& stream ,
const
StatEntity
& entity ) ;
459
// ============================================================================
460
namespace
Gaudi
461
{
462
// ==========================================================================
463
namespace
Utils
464
{
465
// ========================================================================
515
GAUDI_API
std::string
formatAsTableRow
516
(
const
StatEntity
& counter ,
517
const
bool
flag ,
518
const
std::string
& format1 =
519
" |%|7d| |%|11.7g| |%|#11.5g| |%|#10.5g| |%|#10.5g| |%|#10.5g| |"
,
520
const
std::string
& format2 =
521
"*|%|7d| |%|11.5g| |(%|#9.7g| +- %|-#8.6g|)%%| ----- | ----- |"
);
522
// ========================================================================
583
GAUDI_API
std::string
formatAsTableRow
584
(
const
std::string
& name ,
585
const
StatEntity
& counter ,
586
const
bool
flag =
true
,
587
const
std::string
& format1 =
588
" %|-15.15s|%|17t||%|7d| |%|11.7g| |%|#11.5g| |%|#10.5g| |%|#10.5g| |%|#10.5g| |"
,
589
const
std::string
& format2 =
590
"*%|-15.15s|%|17t||%|7d| |%|11.5g| |(%|#9.7g| +- %|-#8.6g|)%%| ----- | ----- |"
);
591
// ========================================================================
659
GAUDI_API
std::string
formatAsTableRow
660
(
const
std::string
& name ,
661
const
std::string
& group ,
662
const
StatEntity
& entity ,
663
const
bool
flag =
true
,
664
const
std::string
& format1 =
665
" %|15.15s|%|-15.15s|%|32t||%|7d| |%|11.7g| |%|#11.5g| |%|#10.5g| |%|#10.5g| |%|#10.5g| |"
,
666
const
std::string
& format2 =
667
"*%|15.15s|%|-15.15s|%|32t||%|7d| |%|11.5g| |(%|#9.7g| +- %|-#8.6g|)%%| ----- | ----- |"
) ;
668
// ========================================================================
669
}
// end of namespace Gaudi::Utils
670
// ==========================================================================
671
}
// end of namespace Gaudi
672
// ============================================================================
673
// The END
674
// ============================================================================
675
#endif // GAUDIKERNEL_STATENTITY_H
676
// ============================================================================
677
678
679
680
681
682
Generated at Wed Jan 30 2013 17:13:40 for Gaudi Framework, version v23r6 by
Doxygen
version 1.8.2 written by
Dimitri van Heesch
, © 1997-2004