#include <G4TrialsCounter.hh>
Public Member Functions | |
G4TrialsCounter (const G4String &nameStats, const G4String &description, G4bool printOnExit=false) | |
~G4TrialsCounter () | |
void | AccumulateCounts (G4int noTrials) |
void | ClearCounts () |
G4int | ReturnTotals (G4int &calls, G4int &maxTrials, G4int &numMaxT) |
void | PrintStatistics () |
Definition at line 46 of file G4TrialsCounter.hh.
G4TrialsCounter::G4TrialsCounter | ( | const G4String & | nameStats, | |
const G4String & | description, | |||
G4bool | printOnExit = false | |||
) |
Definition at line 39 of file G4TrialsCounter.cc.
References ClearCounts().
00042 : fName(nameStats), fDescription(description), 00043 fStatsVerbose(printOnExit), fPrinted(false) 00044 { 00045 ClearCounts(); 00046 }
G4TrialsCounter::~G4TrialsCounter | ( | ) |
Definition at line 48 of file G4TrialsCounter.cc.
References PrintStatistics().
00049 { 00050 if( (fStatsVerbose) && (!fPrinted) ) { PrintStatistics(); } 00051 }
void G4TrialsCounter::AccumulateCounts | ( | G4int | noTrials | ) | [inline] |
Definition at line 35 of file G4TrialsCounter.icc.
00036 { 00037 fTotalNoTrials += noTrials; 00038 fNumberCalls++; 00039 00040 if( noTrials >= fmaxTrials ){ 00041 if (noTrials > fmaxTrials ) { 00042 fmaxTrials=noTrials; 00043 fNoTimesMaxTrials=1; 00044 } else { 00045 fNoTimesMaxTrials++; 00046 } 00047 } 00048 fPrinted= false; // New statistics 00049 }
void G4TrialsCounter::ClearCounts | ( | ) |
Definition at line 68 of file G4TrialsCounter.cc.
Referenced by G4TrialsCounter().
00069 { 00070 fTotalNoTrials= 0; 00071 fNumberCalls = 0; 00072 fmaxTrials = 0; // Maximum --> so only unsigned ints expected 00073 fNoTimesMaxTrials=0; 00074 }
void G4TrialsCounter::PrintStatistics | ( | ) |
Definition at line 54 of file G4TrialsCounter.cc.
References G4cout, and G4endl.
Referenced by ~G4TrialsCounter().
00055 { 00056 // Print Statistics 00057 G4cout << "G4TrialsCounter::PrintStatistics()" << G4endl 00058 << "Report of counts for " << fDescription << " : " << G4endl; 00059 G4cout << "Stats for '" << fName << "' > " 00060 << " No-trials= " << fTotalNoTrials 00061 << " No-calls= " << fNumberCalls 00062 << " Max-trial= " << fmaxTrials 00063 << " no-max= " << fNoTimesMaxTrials 00064 << G4endl; 00065 fPrinted= true; 00066 }
Definition at line 77 of file G4TrialsCounter.cc.
00078 { 00079 calls = fNumberCalls; 00080 maxTrials= fmaxTrials; 00081 numMaxT = fNoTimesMaxTrials; 00082 00083 return fTotalNoTrials; 00084 }