Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ExceptionHandler Class Reference

#include <G4ExceptionHandler.hh>

Inheritance diagram for G4ExceptionHandler:

Public Member Functions

 G4ExceptionHandler ()
 ~G4ExceptionHandler () override
G4bool operator== (const G4ExceptionHandler &right) const
G4bool operator!= (const G4ExceptionHandler &right) const
 G4ExceptionHandler (const G4ExceptionHandler &)=delete
G4ExceptionHandleroperator= (const G4ExceptionHandler &)=delete
G4bool Notify (const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description) override
void SetMaxTotalWarning (G4int mx)
void SetMaxWarning (const char *errCode, G4int mx)
Public Member Functions inherited from G4VExceptionHandler
 G4VExceptionHandler ()
virtual ~G4VExceptionHandler ()=default
G4bool operator== (const G4VExceptionHandler &right) const
G4bool operator!= (const G4VExceptionHandler &right) const

Detailed Description

Definition at line 47 of file G4ExceptionHandler.hh.

Constructor & Destructor Documentation

◆ G4ExceptionHandler() [1/2]

G4ExceptionHandler::G4ExceptionHandler ( )

Definition at line 54 of file G4ExceptionHandler.cc.

55{ messenger = new G4ExceptionHandlerMessenger(this); }

Referenced by G4ExceptionHandler(), operator!=(), operator=(), and operator==().

◆ ~G4ExceptionHandler()

G4ExceptionHandler::~G4ExceptionHandler ( )
override

Definition at line 58 of file G4ExceptionHandler.cc.

59{ delete messenger; }

◆ G4ExceptionHandler() [2/2]

G4ExceptionHandler::G4ExceptionHandler ( const G4ExceptionHandler & )
delete

Member Function Documentation

◆ Notify()

G4bool G4ExceptionHandler::Notify ( const char * originOfException,
const char * exceptionCode,
G4ExceptionSeverity severity,
const char * description )
overridevirtual

Implements G4VExceptionHandler.

Definition at line 74 of file G4ExceptionHandler.cc.

76{
77 static const G4String es_banner =
78 "\n-------- EEEE ------- G4Exception-START -------- EEEE -------\n";
79 static const G4String ee_banner =
80 "\n-------- EEEE -------- G4Exception-END --------- EEEE -------\n";
81 static const G4String ws_banner =
82 "\n-------- WWWW ------- G4Exception-START -------- WWWW -------\n";
83 static const G4String we_banner =
84 "\n-------- WWWW -------- G4Exception-END --------- WWWW -------\n";
85 std::ostringstream message;
86 message << "*** G4Exception : " << exceptionCode << G4endl
87 << " issued by : " << originOfException << G4endl << description << G4endl;
88 G4bool abortionForCoreDump = false;
90 switch (severity) {
91 case FatalException:
92 G4cerr << es_banner << message.str() << "*** Fatal Exception *** core dump ***" << G4endl;
93 DumpTrackInfo();
94 G4cerr << ee_banner << G4endl;
95 abortionForCoreDump = true;
96 break;
98 G4cerr << es_banner << message.str() << "*** Fatal Error In Argument *** core dump ***"
99 << G4endl;
100 DumpTrackInfo();
101 G4cerr << ee_banner << G4endl;
102 abortionForCoreDump = true;
103 break;
104 case RunMustBeAborted:
105 if (aps == G4State_GeomClosed || aps == G4State_EventProc) {
106 G4cerr << es_banner << message.str() << "*** Run Must Be Aborted ***" << G4endl;
107 DumpTrackInfo();
108 G4cerr << ee_banner << G4endl;
110 }
111 abortionForCoreDump = false;
112 break;
114 if (aps == G4State_EventProc) {
115 G4cerr << es_banner << message.str() << "*** Event Must Be Aborted ***" << G4endl;
116 DumpTrackInfo();
117 G4cerr << ee_banner << G4endl;
119 }
120 abortionForCoreDump = false;
121 break;
122 case JustWarning:
123 if(IfPrint(exceptionCode))
124 {
125 std::ostringstream wmessage;
126 wmessage << "*** G4Exception : " << exceptionCode << G4endl
127 << " issued by : " << originOfException << G4endl << description << G4endl;
128 G4cout << ws_banner << wmessage.str() << "*** This is just a warning message. ***" << we_banner
129 << G4endl;
130 }
131 abortionForCoreDump = false;
132 break;
133 default:
134 abortionForCoreDump = false;
135 break;
136 }
137 return abortionForCoreDump;
138}
G4ApplicationState
@ G4State_EventProc
@ G4State_GeomClosed
@ JustWarning
@ FatalException
@ FatalErrorInArgument
@ RunMustBeAborted
@ EventMustBeAborted
bool G4bool
Definition G4Types.hh:86
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
virtual void AbortRun(G4bool softAbort=false)
static G4RunManager * GetRunManager()
virtual void AbortEvent()
const G4ApplicationState & GetCurrentState() const
static G4StateManager * GetStateManager()

◆ operator!=()

G4bool G4ExceptionHandler::operator!= ( const G4ExceptionHandler & right) const

Definition at line 68 of file G4ExceptionHandler.cc.

69{
70 return (this != &right);
71}

◆ operator=()

G4ExceptionHandler & G4ExceptionHandler::operator= ( const G4ExceptionHandler & )
delete

◆ operator==()

G4bool G4ExceptionHandler::operator== ( const G4ExceptionHandler & right) const

Definition at line 62 of file G4ExceptionHandler.cc.

63{
64 return (this == &right);
65}

◆ SetMaxTotalWarning()

void G4ExceptionHandler::SetMaxTotalWarning ( G4int mx)
inline

Definition at line 65 of file G4ExceptionHandler.hh.

66 { fTotalWarnCount = mx; }

◆ SetMaxWarning()

void G4ExceptionHandler::SetMaxWarning ( const char * errCode,
G4int mx )
inline

Definition at line 67 of file G4ExceptionHandler.hh.

68 { fWarnCount[errCode] = mx; }

The documentation for this class was generated from the following files: