Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4Timer.cc File Reference
#include "G4Timer.hh"
#include "G4ios.hh"
#include "G4ExceptionSeverity.hh"
Include dependency graph for G4Timer.cc:

Go to the source code of this file.

Functions

void G4Exception (const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
 
std::ostream & operator<< (std::ostream &os, const G4Timer &t)
 

Function Documentation

void G4Exception ( const char *  originOfException,
const char *  exceptionCode,
G4ExceptionSeverity  severity,
const char *  comments 
)

Definition at line 41 of file G4Exception.cc.

45 {
46  G4VExceptionHandler* exceptionHandler
48  G4bool toBeAborted = true;
49  if(exceptionHandler)
50  {
51  toBeAborted = exceptionHandler
52  ->Notify(originOfException,exceptionCode,severity,description);
53  }
54  else
55  {
56  static const G4String es_banner
57  = "\n-------- EEEE ------- G4Exception-START -------- EEEE -------\n";
58  static const G4String ee_banner
59  = "\n-------- EEEE -------- G4Exception-END --------- EEEE -------\n";
60  static const G4String ws_banner
61  = "\n-------- WWWW ------- G4Exception-START -------- WWWW -------\n";
62  static const G4String we_banner
63  = "\n-------- WWWW -------- G4Exception-END --------- WWWW -------\n";
64  std::ostringstream message;
65  message << "\n*** ExceptionHandler is not defined ***\n"
66  << "*** G4Exception : " << exceptionCode << G4endl
67  << " issued by : " << originOfException << G4endl
68  << description << G4endl;
69  switch(severity)
70  {
71  case FatalException:
72  G4cerr << es_banner << message.str() << "*** Fatal Exception ***"
73  << ee_banner << G4endl;
74  break;
76  G4cerr << es_banner << message.str() << "*** Fatal Error In Argument ***"
77  << ee_banner << G4endl;
78  break;
79  case RunMustBeAborted:
80  G4cerr << es_banner << message.str() << "*** Run Must Be Aborted ***"
81  << ee_banner << G4endl;
82  break;
83  case EventMustBeAborted:
84  G4cerr << es_banner << message.str() << "*** Event Must Be Aborted ***"
85  << ee_banner << G4endl;
86  break;
87  default:
88  G4cout << ws_banner << message.str()
89  << "*** This is just a warning message. ***"
90  << we_banner << G4endl;
91  toBeAborted = false;
92  break;
93  }
94  }
95  if(toBeAborted)
96  {
98  {
99  G4cerr << G4endl << "*** G4Exception: Aborting execution ***" << G4endl;
100  abort();
101  }
102  else
103  {
104  G4cerr << G4endl << "*** G4Exception: Abortion suppressed ***"
105  << G4endl << "*** No guarantee for further execution ***" << G4endl;
106  }
107  }
108 }
virtual G4bool Notify(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)=0
G4VExceptionHandler * GetExceptionHandler() const
static G4StateManager * GetStateManager()
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

std::ostream& operator<< ( std::ostream &  os,
const G4Timer t 
)

Definition at line 87 of file G4Timer.cc.

88 {
89  if (t.IsValid())
90  {
91  os << "User=" << t.GetUserElapsed()
92  << "s Real=" << t.GetRealElapsed()
93  << "s Sys=" << t.GetSystemElapsed() << "s";
94  }
95  else
96  {
97  os << "User=****s Real=****s Sys=****s";
98  }
99  return os;
100 }
G4double GetSystemElapsed() const
Definition: G4Timer.cc:119
G4bool IsValid() const
G4double GetUserElapsed() const
Definition: G4Timer.cc:130
G4double GetRealElapsed() const
Definition: G4Timer.cc:107

Here is the call graph for this function: