| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

StatEntity.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_STATENTITY_H
2 #define GAUDIKERNEL_STATENTITY_H 1
3 // ============================================================================
4 // Include files
5 // ============================================================================
6 // STD & STL
7 // ============================================================================
8 #include <string>
9 #include <iostream>
10 // ============================================================================
11 // Gaudi
12 // ============================================================================
13 #include "GaudiKernel/Kernel.h"
14 // ============================================================================
64 class GAUDI_API StatEntity final
65 {
66 public:
67 // ==========================================================================
69 StatEntity () { reset() ; }
70 /* The full constructor from all important values:
71 * @attention it need to be coherent with
72 * the actual structure of the class
73 * and the format description
74 * @see StatEntity::format
75 * @param entries number of entries
76 * @param flag accumulated flag
77 * @param flag2 accumulated statistics: flag**2
78 * @param minFlag the minimum value for flag
79 * @param maxFlag the maximum value for flag
80 */
81 StatEntity ( const unsigned long entries ,
82 const double flag ,
83 const double flag2 ,
84 const double minFlag ,
85 const double maxFlag ) ;
87 ~StatEntity () = default;
88 // ==========================================================================
89 public: // the basic quantities
90 // ==========================================================================
92 const unsigned long& nEntries () const { return m_se_nEntries ; }
94 const double& sum () const { return m_se_accumulatedFlag ; }
96 const double& sum2 () const { return m_se_accumulatedFlag2 ; }
98 double mean () const ;
100 double rms () const ;
102 double meanErr () const ;
104 const double& min () const { return m_se_minimalFlag ; }
106 const double& max () const { return m_se_maximalFlag ; }
107 // ==========================================================================
108 public:
109 // ==========================================================================
142 double efficiency () const ;
179 double efficiencyErr () const ;
181 double eff () const { return efficiency () ; }
183 double effErr () const { return efficiencyErr () ; }
184 // ==========================================================================
185 public: // operators
186 // ==========================================================================
206 StatEntity& operator+= ( const double f )
207 {
208 addFlag ( f ) ;
209 return *this ;
210 }
228 StatEntity& operator++ () { return (*this)+= 1 ; }
247 StatEntity& operator++ (int) { return ++(*this) ; }
267 StatEntity& operator-= ( const double f )
268 {
269 addFlag ( -f ) ;
270 return *this ;
271 }
289 StatEntity& operator-- () { return (*this)-=1 ; }
307 StatEntity& operator-- (int) { return --(*this) ; }
325 StatEntity& operator= ( const double f )
326 {
327 // reset the statistics
328 reset() ;
329 // use the regular increment
330 return ((*this)+=f);
331 }
347 StatEntity& operator+= ( const StatEntity& other ) ;
348 // ==========================================================================
349 public:
350 // ==========================================================================
352 bool operator<( const StatEntity& se ) const ;
357 unsigned long add ( const double Flag ) ;
359 void reset () ;
361 void setnEntriesBeforeReset ( unsigned long nEntriesBeforeReset );
363 std::string toString () const;
367 std::ostream& print ( std::ostream& o = std::cout ) const ;
371 std::ostream& fillStream ( std::ostream& o ) const { return print ( o ) ; }
372 // ==========================================================================
373 public: // aliases (a'la ROOT)
374 // ==========================================================================
376 inline double Sum () const { return sum () ; } // get sum
378 inline double Mean () const { return mean () ; } // get mean
380 inline double MeanErr () const { return meanErr () ; } // get error in mean
382 inline double Rms () const { return rms () ; } // get rms
384 inline double RMS () const { return rms () ; } // get rms
386 inline double Eff () const { return eff () ; } // get efficiency
388 inline double Min () const { return min () ; } // get minimal value
390 inline double Max () const { return max () ; } // get maximal value
391 // ==========================================================================
392 public: // some legacy methods, to be removed ...
393 // ==========================================================================
395 inline double flag () const { return sum () ; }
397 inline double flag2 () const { return sum2 () ; }
399 inline double flagMean () const { return mean () ; }
401 inline double flagRMS () const { return rms () ; }
403 inline double flagMeanErr () const { return meanErr () ; }
405 inline double flagMin () const { return min () ; }
407 inline double flagMax () const { return max () ; }
412 inline unsigned long addFlag ( const double Flag ) { return add ( Flag ) ; }
413 // ==========================================================================
414 public:
415 // ==========================================================================
422 static const std::string& format () ;
429 static int size () ;
430 // ==========================================================================
431 private:
432 // ==========================================================================
434 unsigned long m_se_nEntries ;
436 double m_se_accumulatedFlag ;
437 double m_se_accumulatedFlag2 ;
438 double m_se_minimalFlag ;
439 double m_se_maximalFlag ;
440 // DR number of calls before reset
441 long m_se_nEntriesBeforeReset ;
442 // ==========================================================================
443 };
444 // ============================================================================
446 GAUDI_API StatEntity operator+( const StatEntity& entity , const double value ) ;
448 GAUDI_API StatEntity operator+( const double value , const StatEntity& entity ) ;
450 GAUDI_API StatEntity operator+( const StatEntity& entity , const StatEntity& value ) ;
452 GAUDI_API StatEntity operator-( const StatEntity& entity , const double value ) ;
454 GAUDI_API std::ostream& operator<<( std::ostream& stream , const StatEntity& entity ) ;
455 // ============================================================================
456 namespace Gaudi
457 {
458 // ==========================================================================
459 namespace Utils
460 {
461 // ========================================================================
511 GAUDI_API std::string formatAsTableRow
512 ( const StatEntity& counter ,
513 const bool flag ,
514 const std::string& format1 =
515 " |%|7d| |%|11.7g| |%|#11.5g| |%|#10.5g| |%|#10.5g| |%|#10.5g| |" ,
516 const std::string& format2 =
517 "*|%|7d| |%|11.5g| |(%|#9.7g| +- %|-#8.6g|)%%| ----- | ----- |" );
518 // ========================================================================
579 GAUDI_API std::string formatAsTableRow
580 ( const std::string& name ,
581 const StatEntity& counter ,
582 const bool flag = true ,
583 const std::string& format1 =
584 " %|-15.15s|%|17t||%|7d| |%|11.7g| |%|#11.5g| |%|#10.5g| |%|#10.5g| |%|#10.5g| |" ,
585 const std::string& format2 =
586 "*%|-15.15s|%|17t||%|7d| |%|11.5g| |(%|#9.7g| +- %|-#8.6g|)%%| ----- | ----- |" );
587 // ========================================================================
655 GAUDI_API std::string formatAsTableRow
656 ( const std::string& name ,
657 const std::string& group ,
658 const StatEntity& entity ,
659 const bool flag = true ,
660 const std::string& format1 =
661 " %|15.15s|%|-15.15s|%|32t||%|7d| |%|11.7g| |%|#11.5g| |%|#10.5g| |%|#10.5g| |%|#10.5g| |" ,
662 const std::string& format2 =
663 "*%|15.15s|%|-15.15s|%|32t||%|7d| |%|11.5g| |(%|#9.7g| +- %|-#8.6g|)%%| ----- | ----- |" ) ;
664 // ========================================================================
665 } // end of namespace Gaudi::Utils
666 // ==========================================================================
667 } // end of namespace Gaudi
668 // ============================================================================
669 // The END
670 // ============================================================================
671 #endif // GAUDIKERNEL_STATENTITY_H
672 // ============================================================================
StatEntity::effErr
double effErr() const
shortcut,
Definition: StatEntity.h:183
StatEntity::max
const double & max() const
maximal value
Definition: StatEntity.h:106
StatEntity::m_se_nEntries
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:434
Kernel.h
StatEntity::StatEntity
StatEntity()
the default constructor
Definition: StatEntity.h:69
StatEntity::Min
double Min() const
get minimal value
Definition: StatEntity.h:388
StatEntity::nEntries
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:92
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
StatEntity::Mean
double Mean() const
get mean
Definition: StatEntity.h:378
StatEntity::flagRMS
double flagRMS() const
r.m.s of flag
Definition: StatEntity.h:401
StatEntity::fillStream
std::ostream & fillStream(std::ostream &o) const
printout to std::ostream
Definition: StatEntity.h:371
sum
double sum(double x, double y, double z)
Definition: 3DoubleFuncTest.cpp:25
StatEntity::flagMin
double flagMin() const
minimal flag
Definition: StatEntity.h:405
StatEntity::m_se_minimalFlag
double m_se_minimalFlag
Definition: StatEntity.h:438
Gaudi::Utils::toString
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:371
StatEntity::flagMeanErr
double flagMeanErr() const
error in mean value of flag
Definition: StatEntity.h:403
StatEntity::m_se_nEntriesBeforeReset
long m_se_nEntriesBeforeReset
Definition: StatEntity.h:441
StatEntity::Max
double Max() const
get maximal value
Definition: StatEntity.h:390
StatEntity::sum2
const double & sum2() const
accumulated value**2
Definition: StatEntity.h:96
StatEntity::flagMax
double flagMax() const
maximal flag
Definition: StatEntity.h:407
Gaudi::Utils::formatAsTableRow
GAUDI_API std::string formatAsTableRow(const StatEntity &counter, const bool flag, const std::string &format1=" |%|7d| |%|11.7g| |%|#11.5g| |%|#10.5g| |%|#10.5g| |%|#10.5g| |", const std::string &format2="*|%|7d| |%|11.5g| |(%|#9.7g| +- %|-#8.6g|)%%| ----- | ----- |")
print the counter in a form of the table row
Definition: StatEntity.cpp:299
StatEntity::sum
const double & sum() const
accumulated value
Definition: StatEntity.h:94
std::string
STL class.
StatEntity::eff
double eff() const
shortcut,
Definition: StatEntity.h:181
GaudiPython.Persistency.add
def add(instance)
Definition: Persistency.py:32
StatEntity::MeanErr
double MeanErr() const
get error in mean
Definition: StatEntity.h:380
StatEntity::flagMean
double flagMean() const
mean value of flag
Definition: StatEntity.h:399
StatEntity::Eff
double Eff() const
get efficiency
Definition: StatEntity.h:386
StatEntity::m_se_accumulatedFlag
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:436
operator+
GAUDI_API StatEntity operator+(const StatEntity &entity, const double value)
external operator for addition of StatEntity and a number
Definition: StatEntity.cpp:244
StatEntity::min
const double & min() const
minimal value
Definition: StatEntity.h:104
dump_component_properties.value
list value
Definition: dump_component_properties.py:12
StatEntity::Sum
double Sum() const
get sum
Definition: StatEntity.h:376
StatEntity::addFlag
unsigned long addFlag(const double Flag)
add a flag
Definition: StatEntity.h:412
operator<
bool operator<(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:119
plotSpeedupsPyRoot.counter
int counter
Definition: plotSpeedupsPyRoot.py:141
operator<<
GAUDI_API std::ostream & operator<<(std::ostream &stream, const StatEntity &entity)
external printout operator to std::ostream
Definition: StatEntity.cpp:264
print
void print(string text)
Definition: mergesort.cpp:33
StatEntity::Rms
double Rms() const
get rms
Definition: StatEntity.h:382
StatEntity::RMS
double RMS() const
get rms
Definition: StatEntity.h:384
StatEntity
The basic counter used for Monitoring purposes.
Definition: StatEntity.h:64
StatEntity::m_se_maximalFlag
double m_se_maximalFlag
Definition: StatEntity.h:439
operator-
GAUDI_API StatEntity operator-(const StatEntity &entity, const double value)
external operator for subtraction of StatEntity and a number
Definition: StatEntity.cpp:254
StatEntity::flag2
double flag2() const
accumulated "flag squared"
Definition: StatEntity.h:397
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:107
std::ostream
STL class.
Gaudi
Helper functions to set/get the application return code.
Definition: __init__.py:1
StatEntity::flag
double flag() const
accumulated "flag"
Definition: StatEntity.h:395
StatEntity::m_se_accumulatedFlag2
double m_se_accumulatedFlag2
Definition: StatEntity.h:437