Geant4-11
Public Member Functions | Private Member Functions
G4ExceptionHandler Class Reference

#include <G4ExceptionHandler.hh>

Inheritance diagram for G4ExceptionHandler:
G4VExceptionHandler

Public Member Functions

 G4ExceptionHandler ()
 
 G4ExceptionHandler (const G4ExceptionHandler &)=delete
 
virtual G4bool Notify (const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
 
G4bool operator!= (const G4ExceptionHandler &right) const
 
G4bool operator!= (const G4VExceptionHandler &right) const
 
G4ExceptionHandleroperator= (const G4ExceptionHandler &)=delete
 
G4bool operator== (const G4ExceptionHandler &right) const
 
G4bool operator== (const G4VExceptionHandler &right) const
 
virtual ~G4ExceptionHandler ()
 

Private Member Functions

void DumpTrackInfo ()
 

Detailed Description

Definition at line 44 of file G4ExceptionHandler.hh.

Constructor & Destructor Documentation

◆ G4ExceptionHandler() [1/2]

G4ExceptionHandler::G4ExceptionHandler ( )

Definition at line 53 of file G4ExceptionHandler.cc.

53{}

◆ ~G4ExceptionHandler()

G4ExceptionHandler::~G4ExceptionHandler ( )
virtual

Definition at line 56 of file G4ExceptionHandler.cc.

56{}

◆ G4ExceptionHandler() [2/2]

G4ExceptionHandler::G4ExceptionHandler ( const G4ExceptionHandler )
delete

Member Function Documentation

◆ DumpTrackInfo()

void G4ExceptionHandler::DumpTrackInfo ( )
private

Definition at line 139 of file G4ExceptionHandler.cc.

140{
141 const G4Track *theTrack = nullptr;
142 const G4Step *theStep = nullptr;
143 if (G4StateManager::GetStateManager()->GetCurrentState() == G4State_EventProc)
144 {
148 theTrack = steppingMgr->GetfTrack();
149 theStep = steppingMgr->GetfStep();
150 }
151
152 if (theTrack == nullptr)
153 {
154 G4cerr << " **** Track information is not available at this moment"
155 << G4endl;
156 }
157 else
158 {
159 G4cerr << "G4Track (" << theTrack
160 << ") - track ID = " << theTrack->GetTrackID()
161 << ", parent ID = " << theTrack->GetParentID() << G4endl;
162 G4cerr << " Particle type : "
163 << theTrack->GetParticleDefinition()->GetParticleName();
164 if(theTrack->GetCreatorProcess())
165 {
166 G4cerr << " - creator process : "
167 << theTrack->GetCreatorProcess()->GetProcessName()
168 << ", creator model : " << theTrack->GetCreatorModelName()
169 << G4endl;
170 }
171 else
172 {
173 G4cerr << " - creator process : not available" << G4endl;
174 }
175 G4cerr << " Kinetic energy : "
176 << G4BestUnit(theTrack->GetKineticEnergy(), "Energy")
177 << " - Momentum direction : " << theTrack->GetMomentumDirection()
178 << G4endl;
179 }
180
181 if (theStep == nullptr)
182 {
183 G4cerr << " **** Step information is not available at this moment"
184 << G4endl;
185 }
186 else
187 {
188 G4cerr << " Step length : "
189 << G4BestUnit(theStep->GetStepLength(), "Length")
190 << " - total energy deposit : "
191 << G4BestUnit(theStep->GetTotalEnergyDeposit(), "Energy") << G4endl;
192 G4cerr << " Pre-step point : " << theStep->GetPreStepPoint()->GetPosition();
193 G4cerr << " - Physical volume : ";
194 if(theStep->GetPreStepPoint()->GetPhysicalVolume())
195 {
197 if(theStep->GetPreStepPoint()->GetMaterial())
198 {
199 G4cerr << " (" << theStep->GetPreStepPoint()->GetMaterial()->GetName()
200 << ")";
201 }
202 else
203 {
204 G4cerr << " (material not available)";
205 }
206 }
207 else
208 {
209 G4cerr << "not available";
210 }
211 G4cerr << G4endl;
212 if(theStep->GetPreStepPoint()->GetProcessDefinedStep())
213 {
214 G4cerr
215 << " - defined by : "
217 << " - step status : " << theStep->GetPreStepPoint()->GetStepStatus()
218 << G4endl;
219 }
220 else
221 {
222 G4cerr << " - defined by : not available" << G4endl;
223 }
224 G4cerr << " Post-step point : "
225 << theStep->GetPostStepPoint()->GetPosition();
226 G4cerr << " - Physical volume : ";
227 if(theStep->GetPostStepPoint()->GetPhysicalVolume())
228 {
230 if(theStep->GetPostStepPoint()->GetMaterial())
231 {
232 G4cerr << " (" << theStep->GetPostStepPoint()->GetMaterial()->GetName()
233 << ")";
234 }
235 else
236 {
237 G4cerr << " (material not available)";
238 }
239 }
240 else
241 {
242 G4cerr << "not available";
243 }
244 G4cerr << G4endl;
246 {
247 G4cerr << " - defined by : "
248 << theStep->GetPostStepPoint()
251 << " - step status : "
252 << theStep->GetPostStepPoint()->GetStepStatus() << G4endl;
253 }
254 else
255 {
256 G4cerr << " - defined by : not available" << G4endl;
257 }
258 G4cerr << " *** Note: Step information might not be properly updated."
259 << G4endl;
260 }
261}
@ G4State_EventProc
#define G4BestUnit(a, b)
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
const G4String & GetName() const
Definition: G4Material.hh:173
const G4String & GetParticleName() const
static G4RunManagerKernel * GetRunManagerKernel()
G4TrackingManager * GetTrackingManager() const
static G4StateManager * GetStateManager()
G4StepStatus GetStepStatus() const
const G4VProcess * GetProcessDefinedStep() const
G4Material * GetMaterial() const
const G4ThreeVector & GetPosition() const
G4VPhysicalVolume * GetPhysicalVolume() const
Definition: G4Step.hh:62
G4StepPoint * GetPreStepPoint() const
G4double GetStepLength() const
G4double GetTotalEnergyDeposit() const
G4StepPoint * GetPostStepPoint() const
G4int GetTrackID() const
const G4ParticleDefinition * GetParticleDefinition() const
const G4VProcess * GetCreatorProcess() const
const G4String GetCreatorModelName() const
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
G4int GetParentID() const
G4SteppingManager * GetSteppingManager() const
const G4String & GetName() const
const G4String & GetProcessName() const
Definition: G4VProcess.hh:382

References G4BestUnit, G4cerr, G4endl, G4State_EventProc, G4Track::GetCreatorModelName(), G4Track::GetCreatorProcess(), G4SteppingManager::GetfStep(), G4SteppingManager::GetfTrack(), G4Track::GetKineticEnergy(), G4StepPoint::GetMaterial(), G4Track::GetMomentumDirection(), G4VPhysicalVolume::GetName(), G4Material::GetName(), G4Track::GetParentID(), G4Track::GetParticleDefinition(), G4ParticleDefinition::GetParticleName(), G4StepPoint::GetPhysicalVolume(), G4StepPoint::GetPosition(), G4Step::GetPostStepPoint(), G4Step::GetPreStepPoint(), G4StepPoint::GetProcessDefinedStep(), G4VProcess::GetProcessName(), G4RunManagerKernel::GetRunManagerKernel(), G4StateManager::GetStateManager(), G4Step::GetStepLength(), G4TrackingManager::GetSteppingManager(), G4StepPoint::GetStepStatus(), G4Step::GetTotalEnergyDeposit(), G4Track::GetTrackID(), and G4RunManagerKernel::GetTrackingManager().

Referenced by Notify().

◆ Notify()

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

Implements G4VExceptionHandler.

Definition at line 71 of file G4ExceptionHandler.cc.

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

References G4RunManager::AbortEvent(), G4RunManager::AbortRun(), DumpTrackInfo(), EventMustBeAborted, FatalErrorInArgument, FatalException, G4cerr, G4cout, G4endl, G4State_EventProc, G4State_GeomClosed, G4StateManager::GetCurrentState(), G4RunManager::GetRunManager(), G4StateManager::GetStateManager(), and RunMustBeAborted.

◆ operator!=() [1/2]

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

Definition at line 65 of file G4ExceptionHandler.cc.

66{
67 return (this != &right);
68}

◆ operator!=() [2/2]

G4bool G4VExceptionHandler::operator!= ( const G4VExceptionHandler right) const
inherited

Definition at line 63 of file G4VExceptionHandler.cc.

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

◆ operator=()

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

◆ operator==() [1/2]

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

Definition at line 59 of file G4ExceptionHandler.cc.

60{
61 return (this == &right);
62}

◆ operator==() [2/2]

G4bool G4VExceptionHandler::operator== ( const G4VExceptionHandler right) const
inherited

Definition at line 58 of file G4VExceptionHandler.cc.

59{
60 return (this == &right);
61}

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