Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:30:13

0001 // ------------------------------------------------------------
0002 //
0003 // Author: V.Ivanchenko - 01.11.2017 - old code re-written
0004 //
0005 // ------------------------------------------------------------
0006 //
0007 // Class description:
0008 //
0009 // Catch Geant4 exception and throw CMS exception allowing
0010 // correctly abort problematic run or notify about a problem
0011 // ------------------------------------------------------------
0012 
0013 #ifndef SimG4Core_Application_ExceptionHandler_H
0014 #define SimG4Core_Application_ExceptionHandler_H
0015 
0016 #include "G4VExceptionHandler.hh"
0017 #include "G4ExceptionSeverity.hh"
0018 
0019 class ExceptionHandler : public G4VExceptionHandler {
0020 public:
0021   explicit ExceptionHandler(double th, bool tr);
0022   ~ExceptionHandler() override;
0023 
0024   int operator==(const ExceptionHandler &right) const { return (this == &right); }
0025   int operator!=(const ExceptionHandler &right) const { return (this != &right); }
0026 
0027   bool Notify(const char *exceptionOrigin,
0028               const char *exceptionCode,
0029               G4ExceptionSeverity severity,
0030               const char *description) override;
0031 
0032   ExceptionHandler(const ExceptionHandler &) = delete;
0033   ExceptionHandler &operator=(const ExceptionHandler &right) = delete;
0034 
0035 private:
0036   double m_eth;
0037   int m_number{0};
0038   bool m_trace;
0039 };
0040 
0041 #endif