CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
ExceptionHandler Class Reference

#include <ExceptionHandler.h>

Inheritance diagram for ExceptionHandler:

Public Member Functions

 ExceptionHandler (RunManager *rm)
 
 ExceptionHandler (RunManagerMT *rm)
 
 ExceptionHandler ()
 
virtual bool Notify (const char *exceptionOrigin, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
 
int operator!= (const ExceptionHandler &right) const
 
int operator== (const ExceptionHandler &right) const
 
virtual ~ExceptionHandler ()
 

Private Member Functions

 ExceptionHandler (const ExceptionHandler &)
 
ExceptionHandleroperator= (const ExceptionHandler &right)
 

Private Attributes

RunManagerfRunManager
 
RunManagerMTfRunManagerMT
 

Detailed Description

Definition at line 10 of file ExceptionHandler.h.

Constructor & Destructor Documentation

ExceptionHandler::ExceptionHandler ( RunManager rm)

Definition at line 15 of file ExceptionHandler.cc.

16  : fRunManager(rm),fRunManagerMT(0)
17 {}
RunManager * fRunManager
RunManagerMT * fRunManagerMT
ExceptionHandler::ExceptionHandler ( RunManagerMT rm)

Definition at line 19 of file ExceptionHandler.cc.

20  : fRunManager(0),fRunManagerMT(rm)
21 {}
RunManager * fRunManager
RunManagerMT * fRunManagerMT
ExceptionHandler::ExceptionHandler ( )
inline

Definition at line 15 of file ExceptionHandler.h.

15 {} ;
ExceptionHandler::~ExceptionHandler ( )
virtual

Definition at line 23 of file ExceptionHandler.cc.

23 {}
ExceptionHandler::ExceptionHandler ( const ExceptionHandler )
inlineprivate

Definition at line 22 of file ExceptionHandler.h.

22 : G4VExceptionHandler() {}

Member Function Documentation

bool ExceptionHandler::Notify ( const char *  exceptionOrigin,
const char *  exceptionCode,
G4ExceptionSeverity  severity,
const char *  description 
)
virtual

Definition at line 25 of file ExceptionHandler.cc.

References RunManager::abortRun(), RunManagerMT::abortRun(), gather_cfg::cout, fRunManager, and fRunManagerMT.

29 {
30  cout << endl;
31  cout << "*** G4Exception : " << exceptionCode << " issued by " << exceptionOrigin << endl;
32  cout << " " << description << endl;
33  bool abortionForCoreDump = false;
34  G4ApplicationState aps = G4StateManager::GetStateManager()->GetCurrentState();
35  switch(severity)
36  {
37  case FatalException:
38  if ( aps==G4State_EventProc && exceptionOrigin==string("G4HadronicProcess") )
39  {
40  cout << "*** Fatal exception *** " << endl;
41  throw SimG4Exception( "SimG4CoreApplication: Bug in G4HadronicProcess" ) ;
42  }
43  else
44  {
45  cout << "*** Fatal exception *** core dump ***" << endl;
46  abortionForCoreDump = true;
47  }
48 /*
49  cout << "*** Fatal exception *** core dump ***" << endl;
50  abortionForCoreDump = true;
51 */
52  break;
53  case FatalErrorInArgument:
54  cout << "*** Fatal error in argument *** core dump ***" << endl;
55  abortionForCoreDump = true;
56  break;
57  case RunMustBeAborted:
58  if(aps==G4State_GeomClosed || aps==G4State_EventProc)
59  {
60  cout << "*** Run must be aborted " << endl;
61  if(fRunManager) { fRunManager->abortRun(false); }
62  if(fRunManagerMT) { fRunManagerMT->abortRun(false); }
63  }
64  abortionForCoreDump = false;
65  break;
66  case EventMustBeAborted:
67  if(aps==G4State_EventProc)
68  {
69  cout << "*** Event must be aborted " << endl;
70  // if (override && exceptionCode == string("StuckTrack"))
71 /*
72  if (exceptionCode == string("StuckTrack"))
73  {
74  //if (verbose > 1) cout << "*** overriden by user " << endl;
75  G4Track * t = G4EventManager::GetEventManager()->GetTrackingManager()->GetTrack();
76  //if (verbose > 1)
77  cout << " ERROR - G4Navigator::ComputeStep() " << endl
78  << " Track " << t->GetTrackID() << " stuck "
79  << " in volume " << t->GetVolume()->GetName()
80  << " at point " << t->GetPosition()/mm << " mm "<< endl
81  << " with direction: " << t->GetMomentumDirection()
82  << " and distance to out "
83  << (t->GetVolume()->GetLogicalVolume()->GetSolid())
84  ->DistanceToOut(t->GetPosition())/mm << " mm " << endl;
85  //if (verbose > 1)
86  cout << " Particle " << t->GetDynamicParticle()->GetDefinition()->GetParticleName()
87  << " from parent ID " << t->GetParentID() << endl
88  << " with " << t->GetKineticEnergy()/MeV << " MeV kinetic energy "
89  << " created in " << t->GetLogicalVolumeAtVertex()->GetName() << endl;
90  cout << " *** StuckTrack: track status set to fStopButAlive " << endl;
91  t->SetTrackStatus(fStopButAlive);
92  }
93  else
94 */
95  //fRunManager->abortEvent();
96  //RunManager::instance()->abortEvent() ;
97  throw SimG4Exception( "SimG4CoreApplication: G4Navigator:StuckTrack detected" ) ;
98  }
99  abortionForCoreDump = false;
100  break;
101  default:
102  cout << "*** This is just a warning message " << endl;
103  abortionForCoreDump = false;
104  break;
105  }
106  cout << endl;
107  return abortionForCoreDump;
108 }
void abortRun(bool softAbort=false)
Definition: RunManager.cc:497
void abortRun(bool softAbort=false)
Definition: RunManagerMT.h:78
tuple description
Definition: idDealer.py:66
RunManager * fRunManager
RunManagerMT * fRunManagerMT
tuple cout
Definition: gather_cfg.py:145
int ExceptionHandler::operator!= ( const ExceptionHandler right) const
inline

Definition at line 18 of file ExceptionHandler.h.

18 { return (this != &right); }
ExceptionHandler& ExceptionHandler::operator= ( const ExceptionHandler right)
inlineprivate

Definition at line 23 of file ExceptionHandler.h.

23 { return *this; }
int ExceptionHandler::operator== ( const ExceptionHandler right) const
inline

Definition at line 17 of file ExceptionHandler.h.

17 { return (this == &right); }

Member Data Documentation

RunManager* ExceptionHandler::fRunManager
private

Definition at line 24 of file ExceptionHandler.h.

Referenced by Notify().

RunManagerMT* ExceptionHandler::fRunManagerMT
private

Definition at line 25 of file ExceptionHandler.h.

Referenced by Notify().