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 ()
 
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
 

Detailed Description

Definition at line 9 of file ExceptionHandler.h.

Constructor & Destructor Documentation

ExceptionHandler::ExceptionHandler ( RunManager rm)

Definition at line 14 of file ExceptionHandler.cc.

15  : fRunManager(rm)
16 {
17 // override = false;
18 // verbose = 0;
19 }
RunManager * fRunManager
ExceptionHandler::ExceptionHandler ( )
inline

Definition at line 13 of file ExceptionHandler.h.

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

Definition at line 21 of file ExceptionHandler.cc.

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

Definition at line 20 of file ExceptionHandler.h.

20 : G4VExceptionHandler() {}

Member Function Documentation

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

Definition at line 23 of file ExceptionHandler.cc.

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

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

Definition at line 16 of file ExceptionHandler.h.

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

Definition at line 21 of file ExceptionHandler.h.

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

Definition at line 15 of file ExceptionHandler.h.

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

Member Data Documentation

RunManager* ExceptionHandler::fRunManager
private

Definition at line 22 of file ExceptionHandler.h.

Referenced by Notify().