CMS 3D CMS Logo

ExceptionHandler.h
Go to the documentation of this file.
1 // ------------------------------------------------------------
2 //
3 // Author: V.Ivanchenko - 01.11.2017 - old code re-written
4 //
5 // ------------------------------------------------------------
6 //
7 // Class description:
8 //
9 // Catch Geant4 exception and throw CMS exception allowing
10 // correctly abort problematic run or notify about a problem
11 // ------------------------------------------------------------
12 
13 #ifndef SimG4Core_Application_ExceptionHandler_H
14 #define SimG4Core_Application_ExceptionHandler_H
15 
16 #include "G4VExceptionHandler.hh"
17 #include "G4ExceptionSeverity.hh"
18 
19 class ExceptionHandler : public G4VExceptionHandler {
20 public:
21  explicit ExceptionHandler(double th, bool tr);
22  ~ExceptionHandler() override;
23 
24  int operator==(const ExceptionHandler &right) const { return (this == &right); }
25  int operator!=(const ExceptionHandler &right) const { return (this != &right); }
26 
27  bool Notify(const char *exceptionOrigin,
28  const char *exceptionCode,
29  G4ExceptionSeverity severity,
30  const char *description) override;
31 
32  ExceptionHandler(const ExceptionHandler &) = delete;
33  ExceptionHandler &operator=(const ExceptionHandler &right) = delete;
34 
35 private:
36  double m_eth;
37  int m_number{0};
38  bool m_trace;
39 };
40 
41 #endif
ExceptionHandler & operator=(const ExceptionHandler &right)=delete
~ExceptionHandler() override
int operator==(const ExceptionHandler &right) const
bool Notify(const char *exceptionOrigin, const char *exceptionCode, G4ExceptionSeverity severity, const char *description) override
int operator!=(const ExceptionHandler &right) const
ExceptionHandler(double th, bool tr)