Go to the documentation of this file.00001
00002
00003
00004
00005 #ifndef GAUDIKERNEL_STATENTITY_H
00006 #define GAUDIKERNEL_STATENTITY_H 1
00007
00008
00009
00010
00011
00012 #include <string>
00013 #include <iostream>
00014
00015
00016
00017 #include "GaudiKernel/Kernel.h"
00018
00068 class GAUDI_API StatEntity
00069 {
00070 public:
00071
00073 StatEntity () { reset() ; }
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 StatEntity ( const unsigned long entries ,
00086 const double flag ,
00087 const double flag2 ,
00088 const double minFlag ,
00089 const double maxFlag ) ;
00091 ~StatEntity () {}
00092
00093 public:
00094
00096 const unsigned long& nEntries () const { return m_se_nEntries ; }
00098 const double& sum () const { return m_se_accumulatedFlag ; }
00100 const double& sum2 () const { return m_se_accumulatedFlag2 ; }
00102 double mean () const ;
00104 double rms () const ;
00106 double meanErr () const ;
00108 const double& min () const { return m_se_minimalFlag ; }
00110 const double& max () const { return m_se_maximalFlag ; }
00111
00112 public:
00113
00146 double efficiency () const ;
00183 double efficiencyErr () const ;
00185 double eff () const { return efficiency () ; }
00187 double effErr () const { return efficiencyErr () ; }
00188
00189 public:
00190
00210 StatEntity& operator+= ( const double f )
00211 {
00212 addFlag ( f ) ;
00213 return *this ;
00214 }
00232 StatEntity& operator++ () { return (*this)+= 1 ; }
00251 StatEntity& operator++ (int) { return ++(*this) ; }
00271 StatEntity& operator-= ( const double f )
00272 {
00273 addFlag ( -f ) ;
00274 return *this ;
00275 }
00293 StatEntity& operator-- () { return (*this)-=1 ; }
00311 StatEntity& operator-- (int) { return --(*this) ; }
00329 StatEntity& operator= ( const double f )
00330 {
00331
00332 reset() ;
00333
00334 return ((*this)+=f);
00335 }
00351 StatEntity& operator+= ( const StatEntity& other ) ;
00352
00353 public:
00354
00356 bool operator<( const StatEntity& se ) const ;
00361 unsigned long add ( const double Flag ) ;
00363 void reset () ;
00365 void setnEntriesBeforeReset ( unsigned long nEntriesBeforeReset );
00367 std::string toString () const;
00371 std::ostream& print ( std::ostream& o = std::cout ) const ;
00375 std::ostream& fillStream ( std::ostream& o ) const { return print ( o ) ; }
00376
00377 public:
00378
00380 inline double Sum () const { return sum () ; }
00382 inline double Mean () const { return mean () ; }
00384 inline double MeanErr () const { return meanErr () ; }
00386 inline double Rms () const { return rms () ; }
00388 inline double RMS () const { return rms () ; }
00390 inline double Eff () const { return eff () ; }
00392 inline double Min () const { return min () ; }
00394 inline double Max () const { return max () ; }
00395
00396 public:
00397
00399 inline double flag () const { return sum () ; }
00401 inline double flag2 () const { return sum2 () ; }
00403 inline double flagMean () const { return mean () ; }
00405 inline double flagRMS () const { return rms () ; }
00407 inline double flagMeanErr () const { return meanErr () ; }
00409 inline double flagMin () const { return min () ; }
00411 inline double flagMax () const { return max () ; }
00416 inline unsigned long addFlag ( const double Flag ) { return add ( Flag ) ; }
00417
00418 public:
00419
00426 static const std::string& format () ;
00433 static int size () ;
00434
00435 private:
00436
00438 unsigned long m_se_nEntries ;
00440 double m_se_accumulatedFlag ;
00441 double m_se_accumulatedFlag2 ;
00442 double m_se_minimalFlag ;
00443 double m_se_maximalFlag ;
00444
00445 long m_se_nEntriesBeforeReset ;
00446
00447 };
00448
00450 GAUDI_API StatEntity operator+( const StatEntity& entity , const double value ) ;
00452 GAUDI_API StatEntity operator+( const double value , const StatEntity& entity ) ;
00454 GAUDI_API StatEntity operator+( const StatEntity& entity , const StatEntity& value ) ;
00456 GAUDI_API StatEntity operator-( const StatEntity& entity , const double value ) ;
00458 GAUDI_API std::ostream& operator<<( std::ostream& stream , const StatEntity& entity ) ;
00459
00460 namespace Gaudi
00461 {
00462
00463 namespace Utils
00464 {
00465
00515 GAUDI_API std::string formatAsTableRow
00516 ( const StatEntity& counter ,
00517 const bool flag ,
00518 const std::string& format1 =
00519 " |%|7d| |%|11.7g| |%|#11.5g| |%|#10.5g| |%|#10.5g| |%|#10.5g| |" ,
00520 const std::string& format2 =
00521 "*|%|7d| |%|11.5g| |(%|#9.7g| +- %|-#8.6g|)%%| ----- | ----- |" );
00522
00583 GAUDI_API std::string formatAsTableRow
00584 ( const std::string& name ,
00585 const StatEntity& counter ,
00586 const bool flag = true ,
00587 const std::string& format1 =
00588 " %|-15.15s|%|17t||%|7d| |%|11.7g| |%|#11.5g| |%|#10.5g| |%|#10.5g| |%|#10.5g| |" ,
00589 const std::string& format2 =
00590 "*%|-15.15s|%|17t||%|7d| |%|11.5g| |(%|#9.7g| +- %|-#8.6g|)%%| ----- | ----- |" );
00591
00659 GAUDI_API std::string formatAsTableRow
00660 ( const std::string& name ,
00661 const std::string& group ,
00662 const StatEntity& entity ,
00663 const bool flag = true ,
00664 const std::string& format1 =
00665 " %|15.15s|%|-15.15s|%|32t||%|7d| |%|11.7g| |%|#11.5g| |%|#10.5g| |%|#10.5g| |%|#10.5g| |" ,
00666 const std::string& format2 =
00667 "*%|15.15s|%|-15.15s|%|32t||%|7d| |%|11.5g| |(%|#9.7g| +- %|-#8.6g|)%%| ----- | ----- |" ) ;
00668
00669 }
00670
00671 }
00672
00673
00674
00675 #endif // GAUDIKERNEL_STATENTITY_H
00676
00677
00678
00679
00680
00681
00682