CMS 3D CMS Logo

ExceptionHandler Class Reference

#include <SimG4Core/Application/interface/ExceptionHandler.h>

List of all members.

Public Member Functions

 ExceptionHandler ()
 ExceptionHandler (RunManager *rm)
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.

00015    : fRunManager(rm)
00016 { 
00017 //    override = false; 
00018 //    verbose = 0; 
00019 }

ExceptionHandler::ExceptionHandler (  )  [inline]

Definition at line 13 of file ExceptionHandler.h.

00013 {} ;

ExceptionHandler::~ExceptionHandler (  )  [virtual]

Definition at line 21 of file ExceptionHandler.cc.

00021 {}

ExceptionHandler::ExceptionHandler ( const ExceptionHandler  )  [inline, private]

Definition at line 20 of file ExceptionHandler.h.

00020 : 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(), GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and fRunManager.

00025 {
00026     cout << endl;
00027     cout << "*** G4Exception : " << exceptionCode << " issued by " << exceptionOrigin << endl;
00028     cout << "    " << description << endl;
00029     bool abortionForCoreDump = false;
00030     G4ApplicationState aps = G4StateManager::GetStateManager()->GetCurrentState();
00031     switch(severity)
00032     {
00033     case FatalException:
00034         if ( aps==G4State_EventProc && exceptionOrigin==string("G4HadronicProcess") )
00035         {
00036         cout << "*** Fatal exception *** (will be fixed in v4.8.3) ***" << endl;
00037         throw SimG4Exception( "SimG4CoreApplication: Bug in G4HadronicProcess will be fixed in G4.8.3" ) ;
00038         }
00039         else
00040         {
00041         cout << "*** Fatal exception *** core dump ***" << endl;
00042         abortionForCoreDump = true;
00043         }
00044 /*
00045         cout << "*** Fatal exception *** core dump ***" << endl;
00046         abortionForCoreDump = true;
00047 */
00048         break;
00049     case FatalErrorInArgument:
00050         cout << "*** Fatal error in argument *** core dump ***" << endl;
00051         abortionForCoreDump = true;
00052         break;
00053     case RunMustBeAborted:
00054         if(aps==G4State_GeomClosed || aps==G4State_EventProc)
00055         {
00056             cout << "*** Run must be aborted " << endl;
00057             fRunManager->abortRun(false);
00058             //RunManager::instance()->abortRun(false) ;
00059         }
00060         abortionForCoreDump = false;
00061         break;
00062     case EventMustBeAborted:
00063         if(aps==G4State_EventProc)
00064         {
00065             cout << "*** Event must be aborted " << endl;
00066             // if (override && exceptionCode == string("StuckTrack"))
00067 /*
00068             if (exceptionCode == string("StuckTrack"))
00069             {
00070                 //if (verbose > 1) cout << "*** overriden by user " << endl;
00071                 G4Track * t = G4EventManager::GetEventManager()->GetTrackingManager()->GetTrack();
00072                 //if (verbose > 1) 
00073                     cout << " ERROR - G4Navigator::ComputeStep() " << endl 
00074                          << " Track " << t->GetTrackID() << " stuck " 
00075                          << " in volume " << t->GetVolume()->GetName()
00076                          << " at point " << t->GetPosition()/mm << " mm "<< endl
00077                          << " with direction: " << t->GetMomentumDirection()
00078                          << " and distance to out " 
00079                          << (t->GetVolume()->GetLogicalVolume()->GetSolid())
00080                         ->DistanceToOut(t->GetPosition())/mm << " mm " << endl;
00081                 //if (verbose > 1) 
00082                     cout << " Particle " << t->GetDynamicParticle()->GetDefinition()->GetParticleName()
00083                          << " from parent ID " << t->GetParentID() << endl
00084                          << " with " << t->GetKineticEnergy()/MeV << " MeV kinetic energy " 
00085                          << " created in " << t->GetLogicalVolumeAtVertex()->GetName() << endl;
00086                 cout << " *** StuckTrack: track status set to fStopButAlive " << endl;
00087                 t->SetTrackStatus(fStopButAlive);
00088             }
00089             else
00090 */
00091                 //fRunManager->abortEvent();
00092                 //RunManager::instance()->abortEvent() ;
00093                 throw SimG4Exception( "SimG4CoreApplication: G4Navigator:StuckTrack detected" ) ;
00094         }
00095         abortionForCoreDump = false;
00096         break;
00097     default:
00098         cout << "*** This is just a warning message " << endl;
00099         abortionForCoreDump = false;
00100         break;
00101     }
00102     cout << endl;
00103     return abortionForCoreDump;
00104 }

int ExceptionHandler::operator!= ( const ExceptionHandler right  )  const [inline]

Definition at line 16 of file ExceptionHandler.h.

00016 { return (this != &right); }

ExceptionHandler& ExceptionHandler::operator= ( const ExceptionHandler right  )  [inline, private]

Definition at line 21 of file ExceptionHandler.h.

00021 { return *this; }

int ExceptionHandler::operator== ( const ExceptionHandler right  )  const [inline]

Definition at line 15 of file ExceptionHandler.h.

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


Member Data Documentation

RunManager* ExceptionHandler::fRunManager [private]

Definition at line 22 of file ExceptionHandler.h.

Referenced by Notify().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:20:32 2009 for CMSSW by  doxygen 1.5.4