Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4TrialsCounter.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4TrialsCounter
0027 //
0028 // Class description:
0029 //
0030 // Keeps statistics of the number of trials, including the Maximum
0031 // and how many times it was reached.
0032 
0033 // Author: John Apostolakis (CERN), 08.12.2006   
0034 // -------------------------------------------------------------------
0035 #ifndef G4TRIALS_COUNTER_HH
0036 #define G4TRIALS_COUNTER_HH
0037 
0038 #include "G4Types.hh"
0039 #include "G4String.hh"
0040 
0041 /**
0042  * @brief G4TrialsCounter is a class to keep statistics of the number of
0043  * trials, including the maximum and how many times it was reached.
0044  */
0045 
0046 class G4TrialsCounter
0047 {
0048   public:
0049 
0050     /**
0051      * Constructor for G4TrialsCounter.
0052      *  @param[in] nameStats Identifier.
0053      *  @param[in] description Description text.
0054      *  @param[in] printOnExit Flag for enabling additional verbosity on exit.
0055      */
0056     G4TrialsCounter( const G4String& nameStats,
0057                      const G4String& description,
0058                      G4bool printOnExit = false ); 
0059 
0060     /**
0061      * Destructor.
0062      */
0063     ~G4TrialsCounter();
0064 
0065     /**
0066      * Adds this number to stats.
0067      */
0068     inline void AccumulateCounts( G4int noTrials ); 
0069 
0070     /**
0071      * Resets all counts.
0072      */
0073     void ClearCounts(); 
0074 
0075     /**
0076      * Returns number of count/trials, calls, max & no-max.
0077      */
0078     G4int ReturnTotals( G4int& calls, G4int& maxTrials, G4int& numMaxT ) ; 
0079 
0080     /**
0081      * Prints out statistics.
0082      */
0083     void PrintStatistics(); 
0084 
0085   private:
0086 
0087     /** Counts sum of trials. */
0088     G4int fTotalNoTrials = 0;
0089 
0090     /** Total number of calls to accumulate. */
0091     G4int fNumberCalls = 0;
0092 
0093     /** Max value of trials. */
0094     G4int fmaxTrials = 0;
0095 
0096     /** How many times maximum is reached. */
0097     G4int fNoTimesMaxTrials = 0;
0098 
0099     /** Identifies stats, and is printed. */
0100     G4String fName;
0101 
0102     /** Explanation of stats. */
0103     G4String fDescription;
0104 
0105     /** If verbose and not printed, print on destruction. */
0106     G4bool fStatsVerbose = false;
0107 
0108     /** Flag, to avoid reprinting on destruction. */
0109     G4bool fPrinted = false;
0110 }; 
0111 
0112 #include "G4TrialsCounter.icc"
0113 
0114 #endif