| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

StatEntity.h

Go to the documentation of this file.
00001 // $Id: StatEntity.h,v 1.7 2007/08/06 08:39:40 marcocle Exp $ 
00002 // ============================================================================
00003 // CVS tag $Name: GAUDI_v20r4-pre $, version $Revision: 1.7 $
00004 // ============================================================================
00005 #ifndef   GAUDIKERNEL_STATENTITY_H
00006 #define   GAUDIKERNEL_STATENTITY_H 1 
00007 // ============================================================================
00008 // Include files 
00009 // ============================================================================
00010 // STD & STL 
00011 // ============================================================================
00012 #include <string>
00013 #include <iostream>
00014 // ============================================================================
00065 class StatEntity
00066 {
00067 public:
00069   StatEntity  () { reset() ; }
00070   /* The full contructor from all important values:
00071    * @attention it need to be coherent with 
00072    *            the actual structure of the class 
00073    *            and the format description
00074    *  @see StatEntity::format
00075    *  @param entries number of entries 
00076    *  @param flag  accumulated flag 
00077    *  @param flag2 accumulated statistics: flag**2
00078    *  @param minFlag the minimun value for flag
00079    *  @param maxFlag the maximum value for flag
00080    */
00081   StatEntity ( const unsigned long entries , 
00082                const double        flag    ,
00083                const double        flag2   ,
00084                const double        minFlag , 
00085                const double        maxFlag ) ;              
00087   ~StatEntity () {}
00089 public:
00096   static const std::string& format () ;
00103   static int                size  () ;
00104 public:
00106   unsigned long nEntries           () const { return m_se_nEntries         ; }
00107   // "flag" statistics:
00109   double   flag               () const { return m_se_accumulatedFlag  ; }
00111   double   flag2              () const { return m_se_accumulatedFlag2 ; }
00113   double   flagMean           () const ; 
00115   double   flagRMS            () const ;
00117   double   flagMeanErr        () const ;
00119   double   flagMin            () const { return m_se_minimalFlag      ; }
00121   double   flagMax            () const { return m_se_maximalFlag      ; }
00154   double efficiency () const ;
00191   double efficiencyErr () const ;  
00193   double eff           () const { return efficiency    () ; }
00195   double effErr        () const { return efficiencyErr () ; }
00215   StatEntity& operator+= ( const double f ) 
00216   {
00217     addFlag ( f ) ; 
00218     return *this ;
00219   }
00237   StatEntity& operator++ ()    { return   (*this)+= 1  ; }
00256   StatEntity& operator++ (int) { return ++(*this)      ; }
00276   StatEntity& operator-= ( const double   f ) 
00277   {
00278     addFlag ( -f ) ;
00279     return *this ; 
00280   }
00298   StatEntity& operator-- () { return (*this)-=1  ; }
00316   StatEntity& operator-- (int) { return --(*this) ; }
00334   StatEntity& operator= ( const double   f ) 
00335   {
00336     // reset the statistics 
00337     reset() ;            
00338     // use the regular inrement
00339     return ((*this)+=f); 
00340   }
00356   StatEntity& operator+= ( const StatEntity& other ) ;   
00357 public:
00359   bool operator<( const StatEntity& se ) const ;
00364   unsigned long addFlag ( const double Flag    ) ;
00366   void reset() ;
00368   void setnEntriesBeforeReset ( unsigned long nEntriesBeforeReset );  
00370   std::string   toString () const;
00374   std::ostream& print      ( std::ostream& o = std::cout ) const ;
00378   std::ostream& fillStream ( std::ostream& o ) const { return print ( o ) ; }
00379 private:
00381   unsigned long                m_se_nEntries          ; 
00383   double                       m_se_accumulatedFlag   ; 
00384   double                       m_se_accumulatedFlag2  ;
00385   double                       m_se_minimalFlag       ;
00386   double                       m_se_maximalFlag       ;  
00387   // DR number of calls before reset
00388   long                         m_se_nEntriesBeforeReset ; 
00389 };
00390 // ============================================================================
00392 StatEntity operator+( const StatEntity& entity , const double      value  ) ;
00394 StatEntity operator+( const double      value  , const StatEntity& entity ) ;
00396 StatEntity operator+( const StatEntity& entity , const StatEntity& value  ) ;
00398 StatEntity operator-( const StatEntity& entity , const double      value  ) ;
00400 std::ostream& operator<<( std::ostream& stream , const StatEntity& entity ) ;
00401 // ============================================================================
00402 namespace Gaudi
00403 {
00404   namespace Utils
00405   {
00406     // ========================================================================
00456     std::string formatAsTableRow 
00457     ( const StatEntity&  counter , 
00458       const bool         flag    , 
00459       const std::string& format1 = 
00460       " |%|7d| |%|11.7g| |%|#11.5g| |%|#10.5g| |%|#10.5g| |%|#10.5g| |"        ,
00461       const std::string& format2 = 
00462       "*|%|7d| |%|11.5g| |(%|#9.7g| +- %|-#8.6g|)%%|   -----   |   -----   |" );
00463     // ========================================================================
00524     std::string formatAsTableRow 
00525     ( const std::string& name           ,
00526       const StatEntity&  counter        , 
00527       const bool         flag    = true , 
00528       const std::string& format1 = 
00529       " %|-15.15s|%|17t||%|7d| |%|11.7g| |%|#11.5g| |%|#10.5g| |%|#10.5g| |%|#10.5g| |"       ,
00530       const std::string& format2 = 
00531       "*%|-15.15s|%|17t||%|7d| |%|11.5g| |(%|#9.7g| +- %|-#8.6g|)%%|   -----   |   -----   |" );
00532     // ========================================================================
00600     std::string formatAsTableRow 
00601     ( const std::string& name           ,
00602       const std::string& group          ,
00603       const StatEntity&  entity         ,
00604       const bool         flag    = true , 
00605       const std::string& format1 = 
00606       " %|15.15s|%|-15.15s|%|32t||%|7d| |%|11.7g| |%|#11.5g| |%|#10.5g| |%|#10.5g| |%|#10.5g| |"         ,
00607       const std::string& format2 = 
00608       "*%|15.15s|%|-15.15s|%|32t||%|7d| |%|11.5g| |(%|#9.7g| +- %|-#8.6g|)%%|    -----    |   -----   |" ) ;   
00609     // ========================================================================
00610   } // end of namespace Gaudi::Utils
00611 } // end of namespace Gaudi 
00612 // ============================================================================
00613 // The END 
00614 // ============================================================================
00615 #endif // GAUDIKERNEL_STATENTITY_H
00616 // ============================================================================
00617 
00618 
00619 
00620 
00621 
00622 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 19:56:58 2011 for GaudiKernel by doxygen 1.4.7